[llvm] r296011 - [CodeGen] Print MI without a newline when skipping debugloc. NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 13:05:29 PST 2017


Author: ab
Date: Thu Feb 23 15:05:29 2017
New Revision: 296011

URL: http://llvm.org/viewvc/llvm-project?rev=296011&view=rev
Log:
[CodeGen] Print MI without a newline when skipping debugloc. NFC.

This matches the behavior for skip-operands. While there, document it.
This is a follow-up to r296007.

Modified:
    llvm/trunk/include/llvm/CodeGen/MachineInstr.h
    llvm/trunk/lib/CodeGen/MachineInstr.cpp

Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=296011&r1=296010&r2=296011&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Feb 23 15:05:29 2017
@@ -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.

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=296011&r1=296010&r2=296011&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Feb 23 15:05:29 2017
@@ -1988,7 +1988,9 @@ void MachineInstr::print(raw_ostream &OS
     }
     if (isIndirectDebugValue())
       OS << " indirect";
-  } else if (debugLoc && MF && !SkipDebugLoc) {
+  } else if (SkipDebugLoc) {
+    return;
+  } else if (debugLoc && MF) {
     if (!HaveSemi)
       OS << ";";
     OS << " dbg:";




More information about the llvm-commits mailing list