- Make BranchProbability constructor public.

- Add getCompl() method.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134857 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jakub Staszak 2011-07-10 02:12:39 +00:00
parent 2b33f4cbad
commit 687dc24e1d
2 changed files with 7 additions and 12 deletions

View File

@ -22,6 +22,7 @@
namespace llvm {
class raw_ostream;
class MachineBasicBlock;
class MachineBranchProbabilityInfo : public ImmutablePass {

View File

@ -18,20 +18,10 @@
namespace llvm {
template<class BlockT, class FunctionT, class BranchProbInfoT>
class BlockFrequencyImpl;
class BranchProbabilityInfo;
class MachineBranchProbabilityInfo;
class MachineBasicBlock;
class raw_ostream;
// This class represents Branch Probability as a non-negative fraction.
class BranchProbability {
template<class BlockT, class FunctionT, class BranchProbInfoT>
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;