[PATCH] D40965: [CodeGen] Move printing MO_Immediate operands to MachineOperand::print

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 13:04:20 PST 2017


MatzeB accepted this revision.
MatzeB added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: lib/CodeGen/MIRPrinter.cpp:857-869
+  case MachineOperand::MO_Register:
+  case MachineOperand::MO_Immediate: {
     unsigned TiedOperandIdx = 0;
-    if (ShouldPrintRegisterTies && Op.isTied() && !Op.isDef())
+    if (ShouldPrintRegisterTies && Op.isReg() && Op.isTied() && !Op.isDef())
       TiedOperandIdx = Op.getParent()->findTiedOperandIdx(OpIdx);
     const TargetIntrinsicInfo *TII = MI.getMF()->getTarget().getIntrinsicInfo();
+    if (Op.isImm() && MI.isOperandSubregIdx(OpIdx))
----------------
I guess this could be:
```
case MachineOperand::MO_Immediate:
  if (MI.isOperandSubregIdx(OpIdx)) {
    printSubReg();
    break;
   }
   LLVM_FALLTHROUGH;
case MachineOperand::MO_Register:
   //...


```


https://reviews.llvm.org/D40965





More information about the llvm-commits mailing list