LLVM 19.0.0git
Public Member Functions | Static Public Member Functions | List of all members
llvm::BlockFrequency Class Reference

#include "llvm/Support/BlockFrequency.h"

Public Member Functions

 BlockFrequency ()
 
 BlockFrequency (uint64_t Freq)
 
uint64_t getFrequency () const
 Returns the frequency as a fixpoint number scaled by the entry frequency.
 
BlockFrequencyoperator*= (BranchProbability Prob)
 Multiplies with a branch probability.
 
BlockFrequency operator* (BranchProbability Prob) const
 
BlockFrequencyoperator/= (BranchProbability Prob)
 Divide by a non-zero branch probability using saturating arithmetic.
 
BlockFrequency operator/ (BranchProbability Prob) const
 
BlockFrequencyoperator+= (BlockFrequency Freq)
 Adds another block frequency using saturating arithmetic.
 
BlockFrequency operator+ (BlockFrequency Freq) const
 
BlockFrequencyoperator-= (BlockFrequency Freq)
 Subtracts another block frequency using saturating arithmetic.
 
BlockFrequency operator- (BlockFrequency Freq) const
 
std::optional< BlockFrequencymul (uint64_t Factor) const
 Multiplies frequency with Factor. Returns nullopt in case of overflow.
 
BlockFrequencyoperator>>= (const unsigned count)
 Shift block frequency to the right by count digits saturating to 1.
 
bool operator< (BlockFrequency RHS) const
 
bool operator<= (BlockFrequency RHS) const
 
bool operator> (BlockFrequency RHS) const
 
bool operator>= (BlockFrequency RHS) const
 
bool operator== (BlockFrequency RHS) const
 
bool operator!= (BlockFrequency RHS) const
 

Static Public Member Functions

static BlockFrequency max ()
 Returns the maximum possible frequency, the saturation value.
 

Detailed Description

Definition at line 26 of file BlockFrequency.h.

Constructor & Destructor Documentation

◆ BlockFrequency() [1/2]

llvm::BlockFrequency::BlockFrequency ( )
inline

Definition at line 30 of file BlockFrequency.h.

Referenced by max(), and mul().

◆ BlockFrequency() [2/2]

llvm::BlockFrequency::BlockFrequency ( uint64_t  Freq)
inlineexplicit

Definition at line 31 of file BlockFrequency.h.

Member Function Documentation

◆ getFrequency()

uint64_t llvm::BlockFrequency::getFrequency ( ) const
inline

◆ max()

static BlockFrequency llvm::BlockFrequency::max ( )
inlinestatic

Returns the maximum possible frequency, the saturation value.

Definition at line 34 of file BlockFrequency.h.

References BlockFrequency(), and UINT64_MAX.

Referenced by llvm::SpillPlacement::Node::addBias().

◆ mul()

std::optional< BlockFrequency > BlockFrequency::mul ( uint64_t  Factor) const

Multiplies frequency with Factor. Returns nullopt in case of overflow.

Definition at line 43 of file BlockFrequency.cpp.

References BlockFrequency(), and llvm::SaturatingMultiply().

◆ operator!=()

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

Definition at line 118 of file BlockFrequency.h.

References RHS.

◆ operator*()

BlockFrequency BlockFrequency::operator* ( BranchProbability  Prob) const

Definition at line 26 of file BlockFrequency.cpp.

◆ operator*=()

BlockFrequency & BlockFrequency::operator*= ( BranchProbability  Prob)

Multiplies with a branch probability.

The computation will never overflow.

Definition at line 21 of file BlockFrequency.cpp.

References llvm::BranchProbability::scale().

◆ operator+()

BlockFrequency llvm::BlockFrequency::operator+ ( BlockFrequency  Freq) const
inline

Definition at line 61 of file BlockFrequency.h.

◆ operator+=()

BlockFrequency & llvm::BlockFrequency::operator+= ( BlockFrequency  Freq)
inline

Adds another block frequency using saturating arithmetic.

Definition at line 51 of file BlockFrequency.h.

References Before, and UINT64_MAX.

◆ operator-()

BlockFrequency llvm::BlockFrequency::operator- ( BlockFrequency  Freq) const
inline

Definition at line 76 of file BlockFrequency.h.

◆ operator-=()

BlockFrequency & llvm::BlockFrequency::operator-= ( BlockFrequency  Freq)
inline

Subtracts another block frequency using saturating arithmetic.

Definition at line 68 of file BlockFrequency.h.

◆ operator/()

BlockFrequency BlockFrequency::operator/ ( BranchProbability  Prob) const

Definition at line 37 of file BlockFrequency.cpp.

◆ operator/=()

BlockFrequency & BlockFrequency::operator/= ( BranchProbability  Prob)

Divide by a non-zero branch probability using saturating arithmetic.

Definition at line 32 of file BlockFrequency.cpp.

References llvm::BranchProbability::scaleByInverse().

◆ operator<()

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

Definition at line 98 of file BlockFrequency.h.

References RHS.

◆ operator<=()

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

Definition at line 102 of file BlockFrequency.h.

References RHS.

◆ operator==()

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

Definition at line 114 of file BlockFrequency.h.

References RHS.

◆ operator>()

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

Definition at line 106 of file BlockFrequency.h.

References RHS.

◆ operator>=()

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

Definition at line 110 of file BlockFrequency.h.

References RHS.

◆ operator>>=()

BlockFrequency & llvm::BlockFrequency::operator>>= ( const unsigned  count)
inline

Shift block frequency to the right by count digits saturating to 1.

Definition at line 86 of file BlockFrequency.h.

References assert(), and llvm::count().


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