[llvm] r325166 - [CodeGen] Print predecessors, successors, then liveins in -debug printing
Francis Visoiu Mistrih via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 14 12:23:05 PST 2018
Author: thegameg
Date: Wed Feb 14 12:23:05 2018
New Revision: 325166
URL: http://llvm.org/viewvc/llvm-project?rev=325166&view=rev
Log:
[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.
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=325166&r1=325165&r2=325166&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Wed Feb 14 12:23:05 2018
@@ -325,18 +325,16 @@ void MachineBasicBlock::print(raw_ostrea
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: ";
- bool First = true;
- for (const auto &LI : liveins()) {
- if (!First)
+ // Print the preds of this block according to the CFG.
+ if (!pred_empty()) {
+ 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 << ", ";
- First = false;
- OS << printReg(LI.PhysReg, TRI);
- if (!LI.LaneMask.all())
- OS << ":0x" << PrintLaneMask(LI.LaneMask);
+ OS << printMBBReference(**I);
}
OS << '\n';
}
@@ -372,15 +370,18 @@ void MachineBasicBlock::print(raw_ostrea
}
}
- // Print the preds of this block according to the CFG.
- if (!pred_empty()) {
+ if (!livein_empty() && MRI.tracksLiveness()) {
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.indent(2) << "liveins: ";
+
+ bool First = true;
+ for (const auto &LI : liveins()) {
+ if (!First)
OS << ", ";
- OS << printMBBReference(**I);
+ First = false;
+ OS << printReg(LI.PhysReg, TRI);
+ if (!LI.LaneMask.all())
+ OS << ":0x" << PrintLaneMask(LI.LaneMask);
}
OS << '\n';
}
More information about the llvm-commits
mailing list