[llvm] r325258 - [CodeGen] Separate MBB metadata from instructions in -debug printing

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 08:23:59 PST 2018


Author: thegameg
Date: Thu Feb 15 08:23:59 2018
New Revision: 325258

URL: http://llvm.org/viewvc/llvm-project?rev=325258&view=rev
Log:
[CodeGen] Separate MBB metadata from instructions in -debug printing

Add an empty line after 'liveins:', 'successors:', or '; predecessors:',
the one that ends up to be the last one.

Modified:
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=325258&r1=325257&r2=325258&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Thu Feb 15 08:23:59 2018
@@ -325,6 +325,7 @@ void MachineBasicBlock::print(raw_ostrea
   const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
   const MachineRegisterInfo &MRI = MF->getRegInfo();
   const TargetInstrInfo &TII = *getParent()->getSubtarget().getInstrInfo();
+  bool HasLineAttributes = false;
 
   // Print the preds of this block according to the CFG.
   if (!pred_empty()) {
@@ -337,6 +338,7 @@ void MachineBasicBlock::print(raw_ostrea
       OS << printMBBReference(**I);
     }
     OS << '\n';
+    HasLineAttributes = true;
   }
 
   if (!succ_empty()) {
@@ -366,8 +368,10 @@ void MachineBasicBlock::print(raw_ostrea
                          100.0)
            << ')';
       }
-      OS << '\n';
     }
+
+    OS << '\n';
+    HasLineAttributes = true;
   }
 
   if (!livein_empty() && MRI.tracksLiveness()) {
@@ -384,8 +388,12 @@ void MachineBasicBlock::print(raw_ostrea
         OS << ":0x" << PrintLaneMask(LI.LaneMask);
     }
     OS << '\n';
+    HasLineAttributes = true;
   }
 
+  if (HasLineAttributes)
+    OS << '\n';
+
   bool IsInBundle = false;
   for (const MachineInstr &MI : instrs()) {
     if (Indexes) {




More information about the llvm-commits mailing list