LLVM  8.0.1
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/= (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/ (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 31 of file BranchProbability.h.

Constructor & Destructor Documentation

◆ BranchProbability() [1/2]

llvm::BranchProbability::BranchProbability ( )
inline

Definition at line 44 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 40 of file BranchProbability.cpp.

References assert().

Member Function Documentation

◆ dump()

LLVM_DUMP_METHOD void BranchProbability::dump ( ) const

Definition at line 37 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 55 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 47 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 156 of file BranchProbability.h.

◆ operator*() [1/2]

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

Definition at line 140 of file BranchProbability.h.

◆ operator*() [2/2]

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

Definition at line 145 of file BranchProbability.h.

◆ operator*=() [1/2]

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

Definition at line 108 of file BranchProbability.h.

References assert().

◆ operator*=() [2/2]

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

Definition at line 115 of file BranchProbability.h.

References assert().

◆ operator+()

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

Definition at line 130 of file BranchProbability.h.

◆ operator+=()

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

Definition at line 92 of file BranchProbability.h.

References assert().

◆ operator-()

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

Definition at line 135 of file BranchProbability.h.

◆ operator-=()

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

Definition at line 100 of file BranchProbability.h.

References assert().

◆ operator/()

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

Definition at line 150 of file BranchProbability.h.

◆ operator/=()

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

Definition at line 122 of file BranchProbability.h.

References assert().

◆ operator<()

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

Definition at line 158 of file BranchProbability.h.

References assert().

◆ operator<=()

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

Definition at line 170 of file BranchProbability.h.

References assert().

◆ operator==()

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

Definition at line 155 of file BranchProbability.h.

◆ operator>()

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

Definition at line 164 of file BranchProbability.h.

References assert().

◆ operator>=()

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

Definition at line 176 of file BranchProbability.h.

References assert().

◆ print()

raw_ostream & BranchProbability::print ( raw_ostream OS) const

Definition at line 25 of file BranchProbability.cpp.

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

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 111 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 115 of file BranchProbability.cpp.

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


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