[llvm] [RISCV] Use OperandType from MCInstrDesc in RISCVInstrInfo::createMIROperandComment. NFCI (PR #119637)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 21:13:20 PST 2024
================
@@ -3188,29 +3188,28 @@ std::string RISCVInstrInfo::createMIROperandComment(
if (!Op.isImm())
return std::string();
+ const MCInstrDesc &Desc = MI.getDesc();
+ if (OpIdx >= Desc.getNumOperands())
+ return std::string();
+
std::string Comment;
raw_string_ostream OS(Comment);
- uint64_t TSFlags = MI.getDesc().TSFlags;
+ const MCOperandInfo &OpInfo = Desc.operands()[OpIdx];
// Print the full VType operand of vsetvli/vsetivli instructions, and the SEW
// operand of vector codegen pseudos.
- if ((MI.getOpcode() == RISCV::VSETVLI || MI.getOpcode() == RISCV::VSETIVLI ||
- MI.getOpcode() == RISCV::PseudoVSETVLI ||
- MI.getOpcode() == RISCV::PseudoVSETIVLI ||
- MI.getOpcode() == RISCV::PseudoVSETVLIX0) &&
- OpIdx == 2) {
- unsigned Imm = MI.getOperand(OpIdx).getImm();
+ if (OpInfo.OperandType == RISCVOp::OPERAND_VTYPEI10 ||
----------------
topperc wrote:
In hindsight, I should have converted this to a switch
https://github.com/llvm/llvm-project/pull/119637
More information about the llvm-commits
mailing list