[llvm] r296007 - [CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.

Ahmed Bougacha via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 11:17:31 PST 2017


Author: ab
Date: Thu Feb 23 13:17:31 2017
New Revision: 296007

URL: http://llvm.org/viewvc/llvm-project?rev=296007&view=rev
Log:
[CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.

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=296007&r1=296006&r2=296007&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Thu Feb 23 13:17:31 2017
@@ -1149,9 +1149,10 @@ public:
   //
   // Debugging support
   //
-  void print(raw_ostream &OS, bool SkipOpers = false,
+  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;
 

Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=296007&r1=296006&r2=296007&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Thu Feb 23 13:17:31 2017
@@ -1699,7 +1699,7 @@ LLVM_DUMP_METHOD void MachineInstr::dump
 }
 #endif
 
-void MachineInstr::print(raw_ostream &OS, bool SkipOpers,
+void MachineInstr::print(raw_ostream &OS, bool SkipOpers, bool SkipDebugLoc,
                          const TargetInstrInfo *TII) const {
   const Module *M = nullptr;
   if (const MachineBasicBlock *MBB = getParent())
@@ -1707,11 +1707,12 @@ void MachineInstr::print(raw_ostream &OS
       M = MF->getFunction()->getParent();
 
   ModuleSlotTracker MST(M);
-  print(OS, MST, SkipOpers, TII);
+  print(OS, MST, SkipOpers, SkipDebugLoc, TII);
 }
 
 void MachineInstr::print(raw_ostream &OS, ModuleSlotTracker &MST,
-                         bool SkipOpers, const TargetInstrInfo *TII) const {
+                         bool SkipOpers, bool SkipDebugLoc,
+                         const TargetInstrInfo *TII) const {
   // We can be a bit tidier if we know the MachineFunction.
   const MachineFunction *MF = nullptr;
   const TargetRegisterInfo *TRI = nullptr;
@@ -1987,7 +1988,7 @@ void MachineInstr::print(raw_ostream &OS
     }
     if (isIndirectDebugValue())
       OS << " indirect";
-  } else if (debugLoc && MF) {
+  } else if (debugLoc && MF && !SkipDebugLoc) {
     if (!HaveSemi)
       OS << ";";
     OS << " dbg:";




More information about the llvm-commits mailing list