summaryrefslogtreecommitdiff
path: root/include/llvm/Support/BlockFrequency.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/Support/BlockFrequency.h')
-rw-r--r--include/llvm/Support/BlockFrequency.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Support/BlockFrequency.h b/include/llvm/Support/BlockFrequency.h
index 839cf93712..77b1bf4413 100644
--- a/include/llvm/Support/BlockFrequency.h
+++ b/include/llvm/Support/BlockFrequency.h
@@ -30,12 +30,19 @@ class BlockFrequency {
public:
BlockFrequency(uint64_t Freq = 0) : Frequency(Freq) { }
+ /// \brief Returns the frequency of the entry block of the function.
static uint64_t getEntryFrequency() { return ENTRY_FREQ; }
+
+ /// \brief Returns the frequency as a fixpoint number scaled by the entry
+ /// frequency.
uint64_t getFrequency() const { return Frequency; }
+ /// \brief Multiplies with a branch probability. The computation will never
+ /// overflow.
BlockFrequency &operator*=(const BranchProbability &Prob);
const BlockFrequency operator*(const BranchProbability &Prob) const;
+ /// \brief Adds another block frequency using saturating arithmetic.
BlockFrequency &operator+=(const BlockFrequency &Freq);
const BlockFrequency operator+(const BlockFrequency &Freq) const;