[CodeGen] Print predecessors, successors, then liveins in -debug printing

Reorder them to match MIR.

Predecessors are only comments, and they're not usually printed in MIR.

llvm-svn: 325166
This commit is contained in:
Francis Visoiu Mistrih 2018-02-14 20:23:05 +00:00
parent 15647b778b
commit afad84e676
1 changed files with 18 additions and 17 deletions

View File

@ -325,18 +325,16 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo(); const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
const MachineRegisterInfo &MRI = MF->getRegInfo(); const MachineRegisterInfo &MRI = MF->getRegInfo();
const TargetInstrInfo &TII = *getParent()->getSubtarget().getInstrInfo(); const TargetInstrInfo &TII = *getParent()->getSubtarget().getInstrInfo();
if (!livein_empty() && MRI.tracksLiveness()) {
if (Indexes) OS << '\t';
OS.indent(2) << "liveins: ";
bool First = true; // Print the preds of this block according to the CFG.
for (const auto &LI : liveins()) { if (!pred_empty()) {
if (!First) if (Indexes) OS << '\t';
// Don't indent(2), align with previous line attributes.
OS << "; predecessors: ";
for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
if (I != pred_begin())
OS << ", "; OS << ", ";
First = false; OS << printMBBReference(**I);
OS << printReg(LI.PhysReg, TRI);
if (!LI.LaneMask.all())
OS << ":0x" << PrintLaneMask(LI.LaneMask);
} }
OS << '\n'; OS << '\n';
} }
@ -372,15 +370,18 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST,
} }
} }
// Print the preds of this block according to the CFG. if (!livein_empty() && MRI.tracksLiveness()) {
if (!pred_empty()) {
if (Indexes) OS << '\t'; if (Indexes) OS << '\t';
// Don't indent(2), align with previous line attributes. OS.indent(2) << "liveins: ";
OS << "; predecessors: ";
for (auto I = pred_begin(), E = pred_end(); I != E; ++I) { bool First = true;
if (I != pred_begin()) for (const auto &LI : liveins()) {
if (!First)
OS << ", "; OS << ", ";
OS << printMBBReference(**I); First = false;
OS << printReg(LI.PhysReg, TRI);
if (!LI.LaneMask.all())
OS << ":0x" << PrintLaneMask(LI.LaneMask);
} }
OS << '\n'; OS << '\n';
} }