[llvm] r324694 - [CodeGen] Unify the syntax of MBB liveins in MIR and -debug output

Francis Visoiu Mistrih via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 17:14:44 PST 2018


Author: thegameg
Date: Thu Feb  8 17:14:44 2018
New Revision: 324694

URL: http://llvm.org/viewvc/llvm-project?rev=324694&view=rev
Log:
[CodeGen] Unify the syntax of MBB liveins in MIR and -debug output

Instead of:

Live Ins: %r0 %r1

print:

liveins: %r0, %r1

Modified:
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
    llvm/trunk/lib/Target/PowerPC/PPCBranchCoalescing.cpp
    llvm/trunk/test/CodeGen/Hexagon/branch-folder-hoist-kills.mir

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=324694&r1=324693&r2=324694&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Thu Feb  8 17:14:44 2018
@@ -323,18 +323,25 @@ void MachineBasicBlock::print(raw_ostrea
   OS << ":\n";
 
   const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
-  if (!livein_empty()) {
+  const MachineRegisterInfo &MRI = MF->getRegInfo();
+  if (!livein_empty() && MRI.tracksLiveness()) {
     if (Indexes) OS << '\t';
-    OS << "    Live Ins:";
-    for (const auto &LI : LiveIns) {
-      OS << ' ' << printReg(LI.PhysReg, TRI);
+    OS.indent(2) << "liveins: ";
+
+    bool First = true;
+    for (const auto &LI : liveins()) {
+      if (!First)
+        OS << ", ";
+      First = false;
+      OS << printReg(LI.PhysReg, TRI);
       if (!LI.LaneMask.all())
-        OS << ':' << PrintLaneMask(LI.LaneMask);
+        OS << ":0x" << PrintLaneMask(LI.LaneMask);
     }
     OS << '\n';
   }
 
   if (!succ_empty()) {
+    if (Indexes) OS << '\t';
     // Print the successors
     OS.indent(2) << "successors: ";
     for (auto I = succ_begin(), E = succ_end(); I != E; ++I) {

Modified: llvm/trunk/lib/Target/PowerPC/PPCBranchCoalescing.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCBranchCoalescing.cpp?rev=324694&r1=324693&r2=324694&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCBranchCoalescing.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCBranchCoalescing.cpp Thu Feb  8 17:14:44 2018
@@ -60,7 +60,7 @@ namespace llvm {
 /// expands to the following machine code:
 ///
 /// %bb.0: derived from LLVM BB %entry
-///    Live Ins: %f1 %f3 %x6
+///    liveins: %f1 %f3 %x6
 ///        <SNIP1>
 ///        %0 = COPY %f1; F8RC:%0
 ///        %5 = CMPLWI killed %4, 0; CRRC:%5 GPRC:%4
@@ -98,7 +98,7 @@ namespace llvm {
 /// If all conditions are meet, IR should collapse to:
 ///
 /// %bb.0: derived from LLVM BB %entry
-///    Live Ins: %f1 %f3 %x6
+///    liveins: %f1 %f3 %x6
 ///        <SNIP1>
 ///        %0 = COPY %f1; F8RC:%0
 ///        %5 = CMPLWI killed %4, 0; CRRC:%5 GPRC:%4

Modified: llvm/trunk/test/CodeGen/Hexagon/branch-folder-hoist-kills.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/branch-folder-hoist-kills.mir?rev=324694&r1=324693&r2=324694&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/branch-folder-hoist-kills.mir (original)
+++ llvm/trunk/test/CodeGen/Hexagon/branch-folder-hoist-kills.mir Thu Feb  8 17:14:44 2018
@@ -12,13 +12,13 @@
 # implicit use of r0:
 #
 # %bb.0:
-#     Live Ins: %R0
-#         %R1 = A2_sxth killed %R0               ; hoisted, kills r0
+#     liveins: %r0
+#         %r1 = A2_sxth killed %r0               ; hoisted, kills r0
 #         A2_nop implicit-def %P0
-#         %R0 = C2_cmoveit %P0, 2, implicit %R0 ; predicated A2_tfrsi
-#         %R0 = C2_cmoveif killed %P0, 1, implicit %R0 ; predicated A2_tfrsi
-#         %R0 = A2_add killed %R0, killed %R1
-#         J2_jumpr %R31, implicit dead %PC
+#         %r0 = C2_cmoveit %P0, 2, implicit %r0 ; predicated A2_tfrsi
+#         %r0 = C2_cmoveif killed %P0, 1, implicit %r0 ; predicated A2_tfrsi
+#         %r0 = A2_add killed %r0, killed %r1
+#         J2_jumpr %r31, implicit dead %PC
 #
 
 # CHECK: $r1 = A2_sxth killed $r0




More information about the llvm-commits mailing list