diff options
author | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-09 00:10:31 +0000 |
---|---|---|
committer | Francis Visoiu Mistrih <francisvm@yahoo.com> | 2018-02-09 00:10:31 +0000 |
commit | 39ec2e95ae6bb24940a1aecdf51d4a096cc0c9de (patch) | |
tree | 0a21014889fcdc3d0c230a45afad2b757b4c28fd /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | d42b1c0534e04e988406f02c2161f4d84720d4b5 (diff) | |
download | llvm-39ec2e95ae6bb24940a1aecdf51d4a096cc0c9de.zip llvm-39ec2e95ae6bb24940a1aecdf51d4a096cc0c9de.tar.gz llvm-39ec2e95ae6bb24940a1aecdf51d4a096cc0c9de.tar.bz2 |
[CodeGen] Unify the syntax of MBB successors in MIR and -debug output
Instead of:
Successors according to CFG: %bb.6(0x12492492 / 0x80000000 = 14.29%)
print:
successors: %bb.6(0x12492492); %bb.6(14.29%)
llvm-svn: 324685
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: " |