[CodeGen] Add a way to SkipDebugLoc in MachineInstr::print(). NFC.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 23 Feb 2017 19:17:31 +0000 (19:17 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Thu, 23 Feb 2017 19:17:31 +0000 (19:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296007 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 828aef590aa34f5e5fcbbfc1b4927f36d53dc868..3331452ce8e8f188795e246b29eb0b6444b10b2c 100644 (file)
@@ -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;
 
index 011f6be77706055a1d457de94396a8e933a589b8..acd61dddd2005b656b5ad5fb50defb9facb65e81 100644 (file)
@@ -1699,7 +1699,7 @@ LLVM_DUMP_METHOD void MachineInstr::dump() const {
 }
 #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, bool SkipOpers,
       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, ModuleSlotTracker &MST,
     }
     if (isIndirectDebugValue())
       OS << " indirect";
-  } else if (debugLoc && MF) {
+  } else if (debugLoc && MF && !SkipDebugLoc) {
     if (!HaveSemi)
       OS << ";";
     OS << " dbg:";