[PATCH] D133953: [RISCV] Verify VL operand on instructions if present
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 13:07:06 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG32cfafddb1c5: [RISCV] Verify VL operand on instructions if present (authored by reames).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133953/new/
https://reviews.llvm.org/D133953
Files:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Index: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1216,6 +1216,21 @@
}
const uint64_t TSFlags = Desc.TSFlags;
+ if (RISCVII::hasVLOp(TSFlags)) {
+ const MachineOperand &Op = MI.getOperand(RISCVII::getVLOpNum(Desc));
+ if (!Op.isImm() && !Op.isReg()) {
+ ErrInfo = "Invalid operand type for VL operand";
+ return false;
+ }
+ if (Op.isReg() && Op.getReg() != RISCV::NoRegister) {
+ const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
+ auto *RC = MRI.getRegClass(Op.getReg());
+ if (!RISCV::GPRRegClass.hasSubClassEq(RC)) {
+ ErrInfo = "Invalid register class for VL operand";
+ return false;
+ }
+ }
+ }
if (RISCVII::hasSEWOp(TSFlags)) {
unsigned OpIdx = RISCVII::getSEWOpNum(Desc);
uint64_t Log2SEW = MI.getOperand(OpIdx).getImm();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133953.460489.patch
Type: text/x-patch
Size: 1000 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220915/c2fab61e/attachment.bin>
More information about the llvm-commits
mailing list