summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-02-13 18:08:26 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-02-13 18:08:26 +0000
commitf6ed795d0c06a66f0a29ea4f3f37e60dba79de57 (patch)
tree417e06dadc4f2d50ce7f26dcece6026153a80521 /llvm
parent651bd73c025248cea9e9c61ceef359edbde88eb7 (diff)
downloadbcm5719-llvm-f6ed795d0c06a66f0a29ea4f3f37e60dba79de57.tar.gz
bcm5719-llvm-f6ed795d0c06a66f0a29ea4f3f37e60dba79de57.zip
[CodeGen] Print bundled instructions using the MIR syntax in -debug output
Old syntax: BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2 * %r0 = SOME_OP %r2 * %r1 = ANOTHER_OP internal %r0 New syntax: BUNDLE implicit-def %r0, implicit-def %r1, implicit %r2 { %r0 = SOME_OP %r2 %r1 = ANOTHER_OP internal %r0 } llvm-svn: 325032
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/CodeGen/MachineBasicBlock.cpp30
-rw-r--r--llvm/test/CodeGen/ARM/sched-it-debug-nodes.mir6
2 files changed, 26 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp
index 923aad6395d..46419ed0ab2 100644
--- a/llvm/lib/CodeGen/MachineBasicBlock.cpp
+++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp
@@ -324,6 +324,7 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
const MachineRegisterInfo &MRI = MF->getRegInfo();
+ const TargetInstrInfo &TII = *getParent()->getSubtarget().getInstrInfo();
if (!livein_empty() && MRI.tracksLiveness()) {
if (Indexes) OS << '\t';
OS.indent(2) << "liveins: ";
@@ -384,19 +385,34 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
OS << '\n';
}
- for (auto &I : instrs()) {
+ bool IsInBundle = false;
+ for (const MachineInstr &MI : instrs()) {
if (Indexes) {
- if (Indexes->hasIndex(I))
- OS << Indexes->getInstructionIndex(I);
+ if (Indexes->hasIndex(MI))
+ OS << Indexes->getInstructionIndex(MI);
OS << '\t';
}
- OS << '\t';
- if (I.isInsideBundle())
- OS << " * ";
- I.print(OS, MST, IsStandalone);
+
+ if (IsInBundle && !MI.isInsideBundle()) {
+ OS.indent(2) << "}\n";
+ IsInBundle = false;
+ }
+
+ OS.indent(IsInBundle ? 4 : 2);
+ MI.print(OS, MST, IsStandalone, /*SkipOpers=*/false, /*SkipDebugLoc=*/false,
+ &TII);
+
+ if (!IsInBundle && MI.getFlag(MachineInstr::BundledSucc)) {
+ OS << " {";
+ IsInBundle = true;
+ }
+
OS << '\n';
}
+ if (IsInBundle)
+ OS.indent(2) << "}\n";
+
if (IrrLoopHeaderWeight) {
if (Indexes) OS << '\t';
OS << " Irreducible loop header weight: "
diff --git a/llvm/test/CodeGen/ARM/sched-it-debug-nodes.mir b/llvm/test/CodeGen/ARM/sched-it-debug-nodes.mir
index b70c3e5786a..318a371e87c 100644
--- a/llvm/test/CodeGen/ARM/sched-it-debug-nodes.mir
+++ b/llvm/test/CodeGen/ARM/sched-it-debug-nodes.mir
@@ -32,9 +32,9 @@
; debug value as KILL'ed, resulting in a DEBUG_VALUE node changing codegen! (or
; hopefully, triggering an assert).
- ; CHECK: BUNDLE implicit-def dead $itstate
- ; CHECK: * DBG_VALUE debug-use $r1, debug-use $noreg, !"u"
- ; CHECK-NOT: * DBG_VALUE killed $r1, $noreg, !"u"
+ ; CHECK: BUNDLE implicit-def dead $itstate{{.*}} {
+ ; CHECK: DBG_VALUE debug-use $r1, debug-use $noreg, !"u"
+ ; CHECK-NOT: DBG_VALUE killed $r1, $noreg, !"u"
declare arm_aapcscc void @g(%struct.s*, i8*, i32) #1
OpenPOWER on IntegriCloud