diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 14a270f..c7b404e 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -353,11 +353,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, 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 << printMBBReference(**I); - } + SubsequentDelim SD; + for (auto *Pred : predecessors()) + OS << SD << printMBBReference(*Pred); OS << '\n'; HasLineAttributes = true; } @@ -366,10 +364,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; // Print the successors OS.indent(2) << "successors: "; + SubsequentDelim SD; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { - if (I != succ_begin()) - OS << ", "; - OS << printMBBReference(**I); + OS << SD << printMBBReference(**I); if (!Probs.empty()) OS << '(' << format("0x%08" PRIx32, getSuccProbability(I).getNumerator()) @@ -378,11 +375,10 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (!Probs.empty() && IsStandalone) { // Print human readable probabilities as comments. OS << "; "; + SubsequentDelim SD; for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { const BranchProbability &BP = getSuccProbability(I); - if (I != succ_begin()) - OS << ", "; - OS << printMBBReference(**I) << '(' + OS << SD << printMBBReference(**I) << '(' << format("%.2f%%", rint(((double)BP.getNumerator() / BP.getDenominator()) * 100.0 * 100.0) / @@ -399,12 +395,9 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, if (Indexes) OS << '\t'; OS.indent(2) << "liveins: "; - bool First = true; + SubsequentDelim SD; for (const auto &LI : liveins()) { - if (!First) - OS << ", "; - First = false; - OS << printReg(LI.PhysReg, TRI); + OS << SD << printReg(LI.PhysReg, TRI); if (!LI.LaneMask.all()) OS << ":0x" << PrintLaneMask(LI.LaneMask); } |