From 687dc24e1d17d3d8bb4f4f095929db16f65f3067 Mon Sep 17 00:00:00 2001 From: Jakub Staszak Date: Sun, 10 Jul 2011 02:12:39 +0000 Subject: [PATCH] - Make BranchProbability constructor public. - Add getCompl() method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134857 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineBranchProbabilityInfo.h | 1 + include/llvm/Support/BranchProbability.h | 18 ++++++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h index f3b3e0e687..d9673e2197 100644 --- a/include/llvm/CodeGen/MachineBranchProbabilityInfo.h +++ b/include/llvm/CodeGen/MachineBranchProbabilityInfo.h @@ -22,6 +22,7 @@ namespace llvm { class raw_ostream; +class MachineBasicBlock; class MachineBranchProbabilityInfo : public ImmutablePass { diff --git a/include/llvm/Support/BranchProbability.h b/include/llvm/Support/BranchProbability.h index c66d224886..2e81490ebf 100644 --- a/include/llvm/Support/BranchProbability.h +++ b/include/llvm/Support/BranchProbability.h @@ -18,20 +18,10 @@ namespace llvm { -template -class BlockFrequencyImpl; -class BranchProbabilityInfo; -class MachineBranchProbabilityInfo; -class MachineBasicBlock; class raw_ostream; // This class represents Branch Probability as a non-negative fraction. class BranchProbability { - template - friend class BlockFrequencyImpl; - friend class BranchProbabilityInfo; - friend class MachineBranchProbabilityInfo; - friend class MachineBasicBlock; // Numerator uint32_t N; @@ -39,12 +29,16 @@ class BranchProbability { // Denominator uint32_t D; - BranchProbability(uint32_t n, uint32_t d); - public: + BranchProbability(uint32_t n, uint32_t d); uint32_t getNumerator() const { return N; } uint32_t getDenominator() const { return D; } + + // Return (1 - Probability). + BranchProbability getCompl() { + return BranchProbability(D - N, D); + } raw_ostream &print(raw_ostream &OS) const; -- 2.11.4.GIT