LLVM  10.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
llvm::BranchProbability Class Reference

#include "llvm/Support/BranchProbability.h"

Public Member Functions

 BranchProbability ()
 
 BranchProbability (uint32_t Numerator, uint32_t Denominator)
 
bool isZero () const
 
bool isUnknown () const
 
uint32_t getNumerator () const
 
BranchProbability getCompl () const
 
raw_ostreamprint (raw_ostream &OS) const
 
void dump () const
 
uint64_t scale (uint64_t Num) const
 Scale a large integer. More...
 
uint64_t scaleByInverse (uint64_t Num) const
 Scale a large integer by the inverse. More...
 
BranchProbabilityoperator+= (BranchProbability RHS)
 
BranchProbabilityoperator-= (BranchProbability RHS)
 
BranchProbabilityoperator*= (BranchProbability RHS)
 
BranchProbabilityoperator*= (uint32_t RHS)
 
BranchProbabilityoperator/= (BranchProbability RHS)
 
BranchProbabilityoperator/= (uint32_t RHS)
 
BranchProbability operator+ (BranchProbability RHS) const
 
BranchProbability operator- (BranchProbability RHS) const
 
BranchProbability operator* (BranchProbability RHS) const
 
BranchProbability operator* (uint32_t RHS) const
 
BranchProbability operator/ (BranchProbability RHS) const
 
BranchProbability operator/ (uint32_t RHS) const
 
bool operator== (BranchProbability RHS) const
 
bool operator!= (BranchProbability RHS) const
 
bool operator< (BranchProbability RHS) const
 
bool operator> (BranchProbability RHS) const
 
bool operator<= (BranchProbability RHS) const
 
bool operator>= (BranchProbability RHS) const
 

Static Public Member Functions

static BranchProbability getZero ()
 
static BranchProbability getOne ()
 
static BranchProbability getUnknown ()
 
static BranchProbability getRaw (uint32_t N)
 
static BranchProbability getBranchProbability (uint64_t Numerator, uint64_t Denominator)
 
template<class ProbabilityIter >
static void normalizeProbabilities (ProbabilityIter Begin, ProbabilityIter End)
 
static uint32_t getDenominator ()
 

Detailed Description

Definition at line 30 of file BranchProbability.h.

Constructor & Destructor Documentation

◆ BranchProbability() [1/2]

llvm::BranchProbability::BranchProbability ( )
inline

Definition at line 43 of file BranchProbability.h.

Referenced by getBranchProbability(), getCompl(), getOne(), getRaw(), getUnknown(), and getZero().

◆ BranchProbability() [2/2]

BranchProbability::BranchProbability ( uint32_t  Numerator,
uint32_t  Denominator 
)

Definition at line 39 of file BranchProbability.cpp.

References assert().

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void BranchProbability::dump ( ) const

Definition at line 36 of file BranchProbability.cpp.

References llvm::dbgs(), and print().

Referenced by getCompl().

◆ getBranchProbability()

BranchProbability BranchProbability::getBranchProbability ( uint64_t  Numerator,
uint64_t  Denominator 
)
static

◆ getCompl()

BranchProbability llvm::BranchProbability::getCompl ( ) const
inline

◆ getDenominator()

static uint32_t llvm::BranchProbability::getDenominator ( )
inlinestatic

◆ getNumerator()

uint32_t llvm::BranchProbability::getNumerator ( ) const
inline

◆ getOne()

static BranchProbability llvm::BranchProbability::getOne ( )
inlinestatic

◆ getRaw()

static BranchProbability llvm::BranchProbability::getRaw ( uint32_t  N)
inlinestatic

Definition at line 54 of file BranchProbability.h.

References BranchProbability(), getBranchProbability(), and normalizeProbabilities().

Referenced by toString().

◆ getUnknown()

static BranchProbability llvm::BranchProbability::getUnknown ( )
inlinestatic

◆ getZero()

static BranchProbability llvm::BranchProbability::getZero ( )
inlinestatic

◆ isUnknown()

bool llvm::BranchProbability::isUnknown ( ) const
inline

◆ isZero()

bool llvm::BranchProbability::isZero ( ) const
inline

Definition at line 46 of file BranchProbability.h.

◆ normalizeProbabilities()

template<class ProbabilityIter >
void llvm::BranchProbability::normalizeProbabilities ( ProbabilityIter  Begin,
ProbabilityIter  End 
)
static

◆ operator!=()

bool llvm::BranchProbability::operator!= ( BranchProbability  RHS) const
inline

Definition at line 173 of file BranchProbability.h.

◆ operator*() [1/2]

BranchProbability llvm::BranchProbability::operator* ( BranchProbability  RHS) const
inline

Definition at line 148 of file BranchProbability.h.

◆ operator*() [2/2]

BranchProbability llvm::BranchProbability::operator* ( uint32_t  RHS) const
inline

Definition at line 154 of file BranchProbability.h.

◆ operator*=() [1/2]

BranchProbability& llvm::BranchProbability::operator*= ( BranchProbability  RHS)
inline

Definition at line 107 of file BranchProbability.h.

References assert().

◆ operator*=() [2/2]

BranchProbability& llvm::BranchProbability::operator*= ( uint32_t  RHS)
inline

Definition at line 114 of file BranchProbability.h.

References assert().

◆ operator+()

BranchProbability llvm::BranchProbability::operator+ ( BranchProbability  RHS) const
inline

Definition at line 136 of file BranchProbability.h.

◆ operator+=()

BranchProbability& llvm::BranchProbability::operator+= ( BranchProbability  RHS)
inline

Definition at line 91 of file BranchProbability.h.

References assert().

◆ operator-()

BranchProbability llvm::BranchProbability::operator- ( BranchProbability  RHS) const
inline

Definition at line 142 of file BranchProbability.h.

◆ operator-=()

BranchProbability& llvm::BranchProbability::operator-= ( BranchProbability  RHS)
inline

Definition at line 99 of file BranchProbability.h.

References assert().

◆ operator/() [1/2]

BranchProbability llvm::BranchProbability::operator/ ( BranchProbability  RHS) const
inline

Definition at line 160 of file BranchProbability.h.

◆ operator/() [2/2]

BranchProbability llvm::BranchProbability::operator/ ( uint32_t  RHS) const
inline

Definition at line 166 of file BranchProbability.h.

◆ operator/=() [1/2]

BranchProbability& llvm::BranchProbability::operator/= ( BranchProbability  RHS)
inline

Definition at line 121 of file BranchProbability.h.

References assert().

◆ operator/=() [2/2]

BranchProbability& llvm::BranchProbability::operator/= ( uint32_t  RHS)
inline

Definition at line 128 of file BranchProbability.h.

References assert().

◆ operator<()

bool llvm::BranchProbability::operator< ( BranchProbability  RHS) const
inline

Definition at line 175 of file BranchProbability.h.

References assert().

◆ operator<=()

bool llvm::BranchProbability::operator<= ( BranchProbability  RHS) const
inline

Definition at line 187 of file BranchProbability.h.

References assert().

◆ operator==()

bool llvm::BranchProbability::operator== ( BranchProbability  RHS) const
inline

Definition at line 172 of file BranchProbability.h.

◆ operator>()

bool llvm::BranchProbability::operator> ( BranchProbability  RHS) const
inline

Definition at line 181 of file BranchProbability.h.

References assert().

◆ operator>=()

bool llvm::BranchProbability::operator>= ( BranchProbability  RHS) const
inline

Definition at line 193 of file BranchProbability.h.

References assert().

◆ print()

raw_ostream & BranchProbability::print ( raw_ostream OS) const

Definition at line 24 of file BranchProbability.cpp.

References llvm::format(), isUnknown(), and llvm::Percent.

Referenced by dump(), getCompl(), and llvm::operator<<().

◆ scale()

uint64_t BranchProbability::scale ( uint64_t  Num) const

Scale a large integer.

Scales Num. Guarantees full precision. Returns the floor of the result.

Returns
Num times this.

Definition at line 106 of file BranchProbability.cpp.

Referenced by llvm::CFGMST< Edge, BBInfo >::buildEdges(), getCompl(), llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), llvm::BlockFrequency::operator*=(), llvm::bfi_detail::BlockMass::operator*=(), scaleCaseProbality(), and sumEdgeCount().

◆ scaleByInverse()

uint64_t BranchProbability::scaleByInverse ( uint64_t  Num) const

Scale a large integer by the inverse.

Scales Num by the inverse of this. Guarantees full precision. Returns the floor of the result.

Returns
Num divided by this.

Definition at line 110 of file BranchProbability.cpp.

Referenced by getCompl(), and llvm::BlockFrequency::operator/=().


The documentation for this class was generated from the following files: