[llvm] 5888c15 - [RISCV] Simplify some code in RISCVInstrInfo::verifyInstruction. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 14 17:07:47 PDT 2022
Author: Craig Topper
Date: 2022-09-14T17:07:21-07:00
New Revision: 5888c157a74b052f227b19d15dbb913cc0232f57
URL: https://github.com/llvm/llvm-project/commit/5888c157a74b052f227b19d15dbb913cc0232f57
DIFF: https://github.com/llvm/llvm-project/commit/5888c157a74b052f227b19d15dbb913cc0232f57.diff
LOG: [RISCV] Simplify some code in RISCVInstrInfo::verifyInstruction. NFCI
This code was written as if it lived in the MC layer instead of
the CodeGen layer. We get the MCInstrDesc directly from MachineInstr.
And we can use RISCVSubtarget::is64Bit instead of going to the
Triple.
Differential Revision: https://reviews.llvm.org/D133905
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 795dc04587a1..a98bd5acf896 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1127,8 +1127,7 @@ RISCVInstrInfo::isCopyInstrImpl(const MachineInstr &MI) const {
bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
StringRef &ErrInfo) const {
- const MCInstrInfo *MCII = STI.getInstrInfo();
- MCInstrDesc const &Desc = MCII->get(MI.getOpcode());
+ MCInstrDesc const &Desc = MI.getDesc();
for (auto &OI : enumerate(Desc.operands())) {
unsigned OpType = OI.value().OperandType;
@@ -1195,17 +1194,14 @@ bool RISCVInstrInfo::verifyInstruction(const MachineInstr &MI,
Ok = isShiftedInt<7, 5>(Imm);
break;
case RISCVOp::OPERAND_UIMMLOG2XLEN:
- Ok = STI.getTargetTriple().isArch64Bit() ? isUInt<6>(Imm)
- : isUInt<5>(Imm);
+ Ok = STI.is64Bit() ? isUInt<6>(Imm) : isUInt<5>(Imm);
break;
case RISCVOp::OPERAND_UIMMLOG2XLEN_NONZERO:
- Ok = STI.getTargetTriple().isArch64Bit() ? isUInt<6>(Imm)
- : isUInt<5>(Imm);
+ Ok = STI.is64Bit() ? isUInt<6>(Imm) : isUInt<5>(Imm);
Ok = Ok && Imm != 0;
break;
case RISCVOp::OPERAND_UIMM_SHFL:
- Ok = STI.getTargetTriple().isArch64Bit() ? isUInt<5>(Imm)
- : isUInt<4>(Imm);
+ Ok = STI.is64Bit() ? isUInt<5>(Imm) : isUInt<4>(Imm);
break;
case RISCVOp::OPERAND_RVKRNUM:
Ok = Imm >= 0 && Imm <= 10;
More information about the llvm-commits
mailing list