]> granicus.if.org Git - llvm/commitdiff
[CodeGen] Print MI without a newline when skipping debugloc. NFC.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 23 Feb 2017 21:05:29 +0000 (21:05 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 23 Feb 2017 21:05:29 +0000 (21:05 +0000)
This matches the behavior for skip-operands. While there, document it.
This is a follow-up to r296007.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296011 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/MachineInstr.h
lib/CodeGen/MachineInstr.cpp

index 3331452ce8e8f188795e246b29eb0b6444b10b2c..4a24a0042305f7a1d321d9f9f6ac197104e51f1f 100644 (file)
@@ -1146,15 +1146,21 @@ public:
   /// instruction to this instruction.
   void copyImplicitOps(MachineFunction &MF, const MachineInstr &MI);
 
-  //
-  // Debugging support
-  //
+  /// Debugging support
+  /// @{
+  /// Print this MI to \p OS.
+  /// Only print the defs and the opcode if \p SkipOpers is true.
+  /// Otherwise, also print operands if \p SkipDebugLoc is true.
+  /// Otherwise, also print the debug loc, with a terminating newline.
+  /// \p TII is used to print the opcode name.  If it's not present, but the
+  /// MI is in a function, the opcode will be printed using the function's TII.
   void print(raw_ostream &OS, bool SkipOpers = false, bool SkipDebugLoc = false,
              const TargetInstrInfo *TII = nullptr) const;
   void print(raw_ostream &OS, ModuleSlotTracker &MST, bool SkipOpers = false,
              bool SkipDebugLoc = false,
              const TargetInstrInfo *TII = nullptr) const;
   void dump() const;
+  /// @}
 
   //===--------------------------------------------------------------------===//
   // Accessors used to build up machine instructions.
index acd61dddd2005b656b5ad5fb50defb9facb65e81..f1e16565bca9fdd02256e3b111a624ea6ae9dc4f 100644 (file)
@@ -1988,7 +1988,9 @@ void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
     }
     if (isIndirectDebugValue())
       OS << " indirect";
-  } else if (debugLoc && MF && !SkipDebugLoc) {
+  } else if (SkipDebugLoc) {
+    return;
+  } else if (debugLoc && MF) {
     if (!HaveSemi)
       OS << ";";
     OS << " dbg:";