diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-08 05:02:00 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-08 05:02:00 +0000 |
commit | da89d1812aa31f7b5f5407514109e362cf92c882 (patch) | |
tree | d0f61dc0cd649db243a35589913b89fbf94bcb02 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | cbfe41ac2f01886ac44815a14e5b1178d05067f0 (diff) | |
download | llvm-da89d1812aa31f7b5f5407514109e362cf92c882.zip llvm-da89d1812aa31f7b5f5407514109e362cf92c882.tar.gz llvm-da89d1812aa31f7b5f5407514109e362cf92c882.tar.bz2 |
[CodeGen] Print MachineBasicBlock labels using MIR syntax in -debug output
Instead of:
%bb.1: derived from LLVM BB %for.body
print:
bb.1.for.body:
Also use MIR syntax for MBB attributes like "align", "landing-pad", etc.
llvm-svn: 324563
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 1ed810b..7da604c 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -270,6 +270,7 @@ void MachineBasicBlock::print(raw_ostream &OS, const SlotIndexes *Indexes, const Function &F = MF->getFunction(); const Module *M = F.getParent(); ModuleSlotTracker MST(M); + MST.incorporateFunction(F); print(OS, MST, Indexes, IsStandalone); } @@ -286,21 +287,40 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << Indexes->getMBBStartIdx(this) << '\t'; - OS << printMBBReference(*this) << ": "; - - const char *Comma = ""; - if (const BasicBlock *LBB = getBasicBlock()) { - OS << Comma << "derived from LLVM BB "; - LBB->printAsOperand(OS, /*PrintType=*/false, MST); - Comma = ", "; + OS << "bb." << getNumber(); + bool HasAttributes = false; + if (const auto *BB = getBasicBlock()) { + if (BB->hasName()) { + OS << "." << BB->getName(); + } else { + HasAttributes = true; + OS << " ("; + int Slot = MST.getLocalSlot(BB); + if (Slot == -1) + OS << "<ir-block badref>"; + else + OS << (Twine("%ir-block.") + Twine(Slot)).str(); + } } - if (isEHPad()) { OS << Comma << "EH LANDING PAD"; Comma = ", "; } - if (hasAddressTaken()) { OS << Comma << "ADDRESS TAKEN"; Comma = ", "; } - if (Alignment) - OS << Comma << "Align " << Alignment << " (" << (1u << Alignment) - << " bytes)"; - OS << '\n'; + if (hasAddressTaken()) { + OS << (HasAttributes ? ", " : " ("); + OS << "address-taken"; + HasAttributes = true; + } + if (isEHPad()) { + OS << (HasAttributes ? ", " : " ("); + OS << "landing-pad"; + HasAttributes = true; + } + if (getAlignment()) { + OS << (HasAttributes ? ", " : " ("); + OS << "align " << getAlignment(); + HasAttributes = true; + } + if (HasAttributes) + OS << ")"; + OS << ":\n"; const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); if (!livein_empty()) { |