summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-06-28 00:15:45 +0000
committerXinliang David Li <davidxl@google.com>2016-06-28 00:15:45 +0000
commit3264fdd3caa0acf19c91a4eb0d09a282cc788bbd (patch)
treed6ffebe197d954f4f77d15353180c2879387d5e6 /llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
parent0f684b0d0403ba27fe6124919a51420912e1d92a (diff)
downloadbcm5719-llvm-3264fdd3caa0acf19c91a4eb0d09a282cc788bbd.tar.gz
bcm5719-llvm-3264fdd3caa0acf19c91a4eb0d09a282cc788bbd.zip
[BFI]: code cleanup
Expose getBPI interface from BFI impl and use it in graph viewer. This eliminates the dependency on old PM interface. llvm-svn: 273967
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
index 689deb8c370..e994aec4e1e 100644
--- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
+++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
@@ -120,13 +120,14 @@ struct DOTGraphTraits<MachineBlockFrequencyInfo *>
static std::string getEdgeAttributes(const MachineBasicBlock *Node,
EdgeIter EI,
const MachineBlockFrequencyInfo *MBFI) {
- MachineBranchProbabilityInfo &MBPI =
- MBFI->getAnalysis<MachineBranchProbabilityInfo>();
- BranchProbability BP = MBPI.getEdgeProbability(Node, EI);
+ std::string Str;
+ const MachineBranchProbabilityInfo *MBPI = MBFI->getMBPI();
+ if (!MBPI)
+ return Str;
+ BranchProbability BP = MBPI->getEdgeProbability(Node, EI);
uint32_t N = BP.getNumerator();
uint32_t D = BP.getDenominator();
double Percent = 100.0 * N / D;
- std::string Str;
raw_string_ostream OS(Str);
OS << format("label=\"%.1f%%\"", Percent);
OS.flush();
@@ -207,6 +208,10 @@ const MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
return MBFI ? MBFI->getFunction() : nullptr;
}
+const MachineBranchProbabilityInfo *MachineBlockFrequencyInfo::getMBPI() const {
+ return MBFI ? &MBFI->getBPI() : nullptr;
+}
+
raw_ostream &
MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
const BlockFrequency Freq) const {
OpenPOWER on IntegriCloud