diff options
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineBasicBlock.cpp | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/llvm/lib/CodeGen/MachineBasicBlock.cpp b/llvm/lib/CodeGen/MachineBasicBlock.cpp index 1076c19..f2f84cf 100644 --- a/llvm/lib/CodeGen/MachineBasicBlock.cpp +++ b/llvm/lib/CodeGen/MachineBasicBlock.cpp @@ -333,6 +333,30 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, } OS << '\n'; } + + // Print the successors + OS.indent(2) << "successors: "; + for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { + if (I != succ_begin()) + OS << ", "; + OS << printMBBReference(**I); + OS << '(' << format("0x%08" PRIx32, getSuccProbability(I).getNumerator()) + << ')'; + } + // Print human readable probabilities as comments. + OS << "; "; + for (auto I = succ_begin(), E = succ_end(); I != E; ++I) { + const BranchProbability &BP = *getProbabilityIterator(I); + if (I != succ_begin()) + OS << ", "; + OS << printMBBReference(**I) << '(' + << format("%.2f%%", + rint(((double)BP.getNumerator() / BP.getDenominator()) * + 100.0 * 100.0) / + 100.0) + << ')'; + } + // Print the preds of this block according to the CFG. if (!pred_empty()) { if (Indexes) OS << '\t'; @@ -355,17 +379,6 @@ void MachineBasicBlock::print(raw_ostream &OS, ModuleSlotTracker &MST, OS << '\n'; } - // Print the successors of this block according to the CFG. - if (!succ_empty()) { - if (Indexes) OS << '\t'; - OS << " Successors according to CFG:"; - for (const_succ_iterator SI = succ_begin(), E = succ_end(); SI != E; ++SI) { - OS << " " << printMBBReference(*(*SI)); - if (!Probs.empty()) - OS << '(' << *getProbabilityIterator(SI) << ')'; - } - OS << '\n'; - } if (IrrLoopHeaderWeight) { if (Indexes) OS << '\t'; OS << " Irreducible loop header weight: " |