summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/Analysis/BlockFrequencyInfo.h9
-rw-r--r--llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h12
-rw-r--r--llvm/lib/Analysis/BlockFrequencyInfo.cpp11
-rw-r--r--llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp16
4 files changed, 48 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/BlockFrequencyInfo.h b/llvm/include/llvm/Analysis/BlockFrequencyInfo.h
index a123d0b8c13..bd44ae34e5b 100644
--- a/llvm/include/llvm/Analysis/BlockFrequencyInfo.h
+++ b/llvm/include/llvm/Analysis/BlockFrequencyInfo.h
@@ -50,6 +50,15 @@ public:
/// comparison to the other block frequencies. We do this to avoid using of
/// floating points.
BlockFrequency getBlockFreq(const BasicBlock *BB) const;
+
+ // Print the block frequency Freq to OS using the current functions entry
+ // frequency to convert freq into a relative decimal form.
+ raw_ostream &printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const;
+
+ // Convenience method that attempts to look up the frequency associated with
+ // BB and print it to OS.
+ raw_ostream &printBlockFreq(raw_ostream &OS, const BasicBlock *BB) const;
+
};
}
diff --git a/llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h b/llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
index 2bd51e8a75d..761b59cb1d2 100644
--- a/llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
+++ b/llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h
@@ -52,6 +52,18 @@ public:
MachineFunction *getFunction() const;
void view() const;
+
+ // Print the block frequency Freq to OS using the current functions entry
+ // frequency to convert freq into a relative decimal form.
+ raw_ostream &printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const;
+
+ // Convenience method that attempts to look up the frequency associated with
+ // BB and print it to OS.
+ raw_ostream &printBlockFreq(raw_ostream &OS,
+ const MachineBasicBlock *MBB) const;
+
+ uint64_t getEntryFrequency() const;
+
};
}
diff --git a/llvm/lib/Analysis/BlockFrequencyInfo.cpp b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
index 62f3ab16ca7..3c6f67811e6 100644
--- a/llvm/lib/Analysis/BlockFrequencyInfo.cpp
+++ b/llvm/lib/Analysis/BlockFrequencyInfo.cpp
@@ -159,3 +159,14 @@ void BlockFrequencyInfo::view() const {
const Function *BlockFrequencyInfo::getFunction() const {
return BFI->Fn;
}
+
+raw_ostream &BlockFrequencyInfo::
+printBlockFreq(raw_ostream &OS, const BlockFrequency Freq) const {
+ return BFI->printBlockFreq(OS, Freq);
+}
+
+raw_ostream &
+BlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+ const BasicBlock *BB) const {
+ return BFI->printBlockFreq(OS, BB);
+}
diff --git a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
index 64e8ecdec9e..86d30949a32 100644
--- a/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
+++ b/llvm/lib/CodeGen/MachineBlockFrequencyInfo.cpp
@@ -168,3 +168,19 @@ getBlockFreq(const MachineBasicBlock *MBB) const {
MachineFunction *MachineBlockFrequencyInfo::getFunction() const {
return MBFI->Fn;
}
+
+raw_ostream &
+MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+ const BlockFrequency Freq) const {
+ return MBFI->printBlockFreq(OS, Freq);
+}
+
+raw_ostream &
+MachineBlockFrequencyInfo::printBlockFreq(raw_ostream &OS,
+ const MachineBasicBlock *MBB) const {
+ return MBFI->printBlockFreq(OS, MBB);
+}
+
+uint64_t MachineBlockFrequencyInfo::getEntryFrequency() const {
+ return MBFI->getEntryFrequency();
+}
OpenPOWER on IntegriCloud