- Make BranchProbability constructor public.

- Add getCompl() method.

llvm-svn: 134857
This commit is contained in:
Jakub Staszak 2011-07-10 02:12:39 +00:00
parent a4a18f092c
commit 03aa963077
2 changed files with 7 additions and 12 deletions

View File

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

View File

@ -18,20 +18,10 @@
namespace llvm { namespace llvm {
template<class BlockT, class FunctionT, class BranchProbInfoT>
class BlockFrequencyImpl;
class BranchProbabilityInfo;
class MachineBranchProbabilityInfo;
class MachineBasicBlock;
class raw_ostream; class raw_ostream;
// This class represents Branch Probability as a non-negative fraction. // This class represents Branch Probability as a non-negative fraction.
class BranchProbability { class BranchProbability {
template<class BlockT, class FunctionT, class BranchProbInfoT>
friend class BlockFrequencyImpl;
friend class BranchProbabilityInfo;
friend class MachineBranchProbabilityInfo;
friend class MachineBasicBlock;
// Numerator // Numerator
uint32_t N; uint32_t N;
@ -39,12 +29,16 @@ class BranchProbability {
// Denominator // Denominator
uint32_t D; uint32_t D;
BranchProbability(uint32_t n, uint32_t d);
public: public:
BranchProbability(uint32_t n, uint32_t d);
uint32_t getNumerator() const { return N; } uint32_t getNumerator() const { return N; }
uint32_t getDenominator() const { return D; } uint32_t getDenominator() const { return D; }
// Return (1 - Probability).
BranchProbability getCompl() {
return BranchProbability(D - N, D);
}
raw_ostream &print(raw_ostream &OS) const; raw_ostream &print(raw_ostream &OS) const;