Skip to content

Commit bbda21b

Browse files
toppercHoney Goyal
authored andcommitted
[RISCV] Make RISCVInstrInfo::verifyInstruction stricter for immediate-only operands (llvm#170736)
Most of the immediate operands can only be an immediate, but we were allowing any non-register operand. Split the immediate-only from the immediate or non-register operands. The non-register cases could be made even stricter, but I'll leave that as a TODO.
1 parent d593d58 commit bbda21b

File tree

4 files changed

+228
-186
lines changed

4 files changed

+228
-186
lines changed

llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ enum OperandType : unsigned {
393393
OPERAND_UIMM14_LSB00,
394394
OPERAND_UIMM16,
395395
OPERAND_UIMM16_NONZERO,
396-
OPERAND_UIMM20,
397396
OPERAND_UIMMLOG2XLEN,
398397
OPERAND_UIMMLOG2XLEN_NONZERO,
399398
OPERAND_UIMM32,
@@ -412,13 +411,11 @@ enum OperandType : unsigned {
412411
OPERAND_SIMM10_LSB0000_NONZERO,
413412
OPERAND_SIMM10_UNSIGNED,
414413
OPERAND_SIMM11,
415-
OPERAND_SIMM12,
416414
OPERAND_SIMM12_LSB00000,
417415
OPERAND_SIMM16,
418416
OPERAND_SIMM16_NONZERO,
419417
OPERAND_SIMM20_LI,
420418
OPERAND_SIMM26,
421-
OPERAND_BARE_SIMM32,
422419
OPERAND_CLUI_IMM,
423420
OPERAND_VTYPEI10,
424421
OPERAND_VTYPEI11,
@@ -447,6 +444,15 @@ enum OperandType : unsigned {
447444
// Vtype operand for XSfmm extension.
448445
OPERAND_XSFMM_VTYPE,
449446
OPERAND_LAST_RISCV_IMM = OPERAND_XSFMM_VTYPE,
447+
448+
OPERAND_UIMM20_LUI,
449+
OPERAND_UIMM20_AUIPC,
450+
451+
// Simm12 or constant pool, global, basicblock, etc.
452+
OPERAND_SIMM12_LO,
453+
454+
OPERAND_BARE_SIMM32,
455+
450456
// Operand is either a register or uimm5, this is used by V extension pseudo
451457
// instructions to represent a value that be passed as AVL to either vsetvli
452458
// or vsetivli.

0 commit comments

Comments
 (0)