[llvm] [RISCV] Add OPERAND_AVL to RISCVInstrInfo::verifyInstruction. (PR #170770)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 15:10:53 PST 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/170770
None
>From 937c8d64646bdb74e91b0612780c37d4d3ce5e8e Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 4 Dec 2025 15:09:53 -0800
Subject: [PATCH] [RISCV] Add OPERAND_AVL to RISCVInstrInfo::verifyInstruction.
---
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index a5f680c35124b..e878558f73b2c 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -3076,6 +3076,18 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
ErrInfo = "Invalid immediate";
return false;
}
+ } else if (OpType == RISCVOp::OPERAND_AVL) {
+ if (MO.isImm()) {
+ int64_t Imm = MO.getImm();
+ // VLMAX is represented as -1.
+ if (!isUInt<5>(Imm) && Imm != -1) {
+ ErrInfo = "Invalid immediate";
+ return false;
+ }
+ } else if (!MO.isReg()) {
+ ErrInfo = "Expected a register or immediate operand.";
+ return false;
+ }
}
}
More information about the llvm-commits
mailing list