LLVM 20.0.0git
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.
 
uint64_t scaleByInverse (uint64_t Num) const
 Scale a large integer by the inverse.
 
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.

References N.

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().

◆ 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(), and N.

Referenced by decodeBBAddrMapImpl(), and normalizeProbabilities().

◆ getUnknown()

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

Definition at line 51 of file BranchProbability.h.

References BranchProbability().

Referenced by splitMBB(), and llvm::MachineBasicBlock::splitSuccessor().

◆ 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.

References N.

◆ 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.

References RHS.

◆ operator*() [1/2]

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

Definition at line 148 of file BranchProbability.h.

References RHS.

◆ operator*() [2/2]

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

Definition at line 154 of file BranchProbability.h.

References RHS.

◆ operator*=() [1/2]

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

Definition at line 107 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator*=() [2/2]

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

Definition at line 114 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator+()

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

Definition at line 136 of file BranchProbability.h.

References RHS.

◆ operator+=()

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

Definition at line 91 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator-()

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

Definition at line 142 of file BranchProbability.h.

References RHS.

◆ operator-=()

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

Definition at line 99 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator/() [1/2]

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

Definition at line 160 of file BranchProbability.h.

References RHS.

◆ operator/() [2/2]

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

Definition at line 166 of file BranchProbability.h.

References RHS.

◆ operator/=() [1/2]

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

Definition at line 121 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator/=() [2/2]

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

Definition at line 128 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator<()

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

Definition at line 175 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator<=()

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

Definition at line 187 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator==()

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

Definition at line 172 of file BranchProbability.h.

References N, and RHS.

◆ operator>()

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

Definition at line 181 of file BranchProbability.h.

References assert(), N, and RHS.

◆ operator>=()

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

Definition at line 193 of file BranchProbability.h.

References assert(), N, and RHS.

◆ print()

raw_ostream & BranchProbability::print ( raw_ostream OS) const

Definition at line 25 of file BranchProbability.cpp.

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

Referenced by dump(), 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 107 of file BranchProbability.cpp.

Referenced by llvm::ARMBaseInstrInfo::isProfitableToIfCvt(), llvm::BlockFrequency::operator*=(), and scaleCaseProbality().

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

Referenced by llvm::BlockFrequency::operator/=().


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