[PATCH] D40836: [CodeGen] Unify printing API for MachineOperand between MIR and debug

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 20:28:21 PST 2017


MatzeB added a comment.

Looks good, but I assume this is incomplete and cannot be pushed like this?



================
Comment at: lib/CodeGen/MachineInstr.cpp:1245
+  SmallBitVector PrintedTypes(8);
+  bool ShouldPrintRegisterTies = hasComplexRegisterTies();
+  auto getTiedOperandIdx = [&](unsigned OpIdx) {
----------------
I think in case of MachineInstr::print()  (at least by default) we should print all register ties on machine operands. Not sure what your plans with this flag are anyway as it's not really used by MachineOperand::print yet?


================
Comment at: lib/CodeGen/MachineOperand.cpp:261-276
+    if (const MachineInstr *MI = getParent()) {
+      if (const MachineBasicBlock *MBB = MI->getParent()) {
+        if (const MachineFunction *MF = MBB->getParent()) {
+          // Calculate the size of the RegMask
+          const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
+          unsigned RegMaskSize = (TRI->getNumRegs() + 31) / 32;
 
----------------
Is this necessary for the printing changes?


================
Comment at: lib/CodeGen/MachineOperand.cpp:368
                            const TargetIntrinsicInfo *IntrinsicInfo) const {
+  tryToGetTargetInfo(*this, TRI, IntrinsicInfo);
+
----------------
This feels a bit strange to me in cases where the user already specified TRI/IntrinsicInfo/...


https://reviews.llvm.org/D40836





More information about the llvm-commits mailing list