LLVM  14.0.0git
Public Member Functions | List of all members
llvm::BlockFrequencyInfo Class Reference

BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequencies. More...

#include "llvm/Analysis/BlockFrequencyInfo.h"

Public Member Functions

 BlockFrequencyInfo ()
 
 BlockFrequencyInfo (const Function &F, const BranchProbabilityInfo &BPI, const LoopInfo &LI)
 
 BlockFrequencyInfo (const BlockFrequencyInfo &)=delete
 
BlockFrequencyInfooperator= (const BlockFrequencyInfo &)=delete
 
 BlockFrequencyInfo (BlockFrequencyInfo &&Arg)
 
BlockFrequencyInfooperator= (BlockFrequencyInfo &&RHS)
 
 ~BlockFrequencyInfo ()
 
bool invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &)
 Handle invalidation explicitly. More...
 
const FunctiongetFunction () const
 
const BranchProbabilityInfogetBPI () const
 
void view (StringRef="BlockFrequencyDAGs") const
 Pop up a ghostview window with the current block frequency propagation rendered using dot. More...
 
BlockFrequency getBlockFreq (const BasicBlock *BB) const
 getblockFreq - Return block frequency. More...
 
Optional< uint64_tgetBlockProfileCount (const BasicBlock *BB, bool AllowSynthetic=false) const
 Returns the estimated profile count of BB. More...
 
Optional< uint64_tgetProfileCountFromFreq (uint64_t Freq) const
 Returns the estimated profile count of Freq. More...
 
bool isIrrLoopHeader (const BasicBlock *BB)
 Returns true if BB is an irreducible loop header block. More...
 
void setBlockFreq (const BasicBlock *BB, uint64_t Freq)
 
void setBlockFreqAndScale (const BasicBlock *ReferenceBB, uint64_t Freq, SmallPtrSetImpl< BasicBlock * > &BlocksToScale)
 Set the frequency of ReferenceBB to Freq and scale the frequencies of the blocks in BlocksToScale such that their frequencies relative to ReferenceBB remain unchanged. More...
 
void calculate (const Function &F, const BranchProbabilityInfo &BPI, const LoopInfo &LI)
 calculate - compute block frequency info for the given function. More...
 
raw_ostreamprintBlockFreq (raw_ostream &OS, const BlockFrequency Freq) const
 
raw_ostreamprintBlockFreq (raw_ostream &OS, const BasicBlock *BB) const
 
uint64_t getEntryFreq () const
 
void releaseMemory ()
 
void print (raw_ostream &OS) const
 
void verifyMatch (BlockFrequencyInfo &Other) const
 

Detailed Description

BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequencies.

Definition at line 37 of file BlockFrequencyInfo.h.

Constructor & Destructor Documentation

◆ BlockFrequencyInfo() [1/4]

BlockFrequencyInfo::BlockFrequencyInfo ( )
default

◆ BlockFrequencyInfo() [2/4]

BlockFrequencyInfo::BlockFrequencyInfo ( const Function F,
const BranchProbabilityInfo BPI,
const LoopInfo LI 
)

Definition at line 156 of file BlockFrequencyInfo.cpp.

References calculate(), and F.

◆ BlockFrequencyInfo() [3/4]

llvm::BlockFrequencyInfo::BlockFrequencyInfo ( const BlockFrequencyInfo )
delete

◆ BlockFrequencyInfo() [4/4]

BlockFrequencyInfo::BlockFrequencyInfo ( BlockFrequencyInfo &&  Arg)

Definition at line 162 of file BlockFrequencyInfo.cpp.

◆ ~BlockFrequencyInfo()

BlockFrequencyInfo::~BlockFrequencyInfo ( )
default

Member Function Documentation

◆ calculate()

void BlockFrequencyInfo::calculate ( const Function F,
const BranchProbabilityInfo BPI,
const LoopInfo LI 
)

calculate - compute block frequency info for the given function.

Definition at line 186 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI, llvm::dbgs(), F, llvm::GVDT_None, print(), llvm::PrintBlockFreq, llvm::PrintBlockFreqFuncName, view(), llvm::ViewBlockFreqFuncName, and ViewBlockFreqPropagationDAG.

Referenced by BlockFrequencyInfo().

◆ getBlockFreq()

BlockFrequency BlockFrequencyInfo::getBlockFreq ( const BasicBlock BB) const

getblockFreq - Return block frequency.

Return 0 if we don't have the information. Please note that initial frequency is equal to ENTRY_FREQ. It means that we should not rely on the value itself, but only on the comparison to the other block frequencies. We do this to avoid using of floating points.

Definition at line 204 of file BlockFrequencyInfo.cpp.

References BB, and llvm::AMDGPUISD::BFI.

Referenced by llvm::CodeExtractor::extractCodeRegion(), llvm::InlineFunction(), and isColdCallSite().

◆ getBlockProfileCount()

Optional< uint64_t > BlockFrequencyInfo::getBlockProfileCount ( const BasicBlock BB,
bool  AllowSynthetic = false 
) const

Returns the estimated profile count of BB.

This computes the relative block frequency of BB and multiplies it by the enclosing function's count (if available) and returns the value.

Definition at line 209 of file BlockFrequencyInfo.cpp.

References BB, llvm::AMDGPUISD::BFI, getFunction(), and llvm::None.

Referenced by fixFuncEntryCount(), and verifyFuncBFI().

◆ getBPI()

const BranchProbabilityInfo * BlockFrequencyInfo::getBPI ( ) const

Definition at line 266 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

◆ getEntryFreq()

uint64_t BlockFrequencyInfo::getEntryFreq ( ) const

Definition at line 281 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

◆ getFunction()

const Function * BlockFrequencyInfo::getFunction ( ) const

Definition at line 262 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

Referenced by getBlockProfileCount(), and getProfileCountFromFreq().

◆ getProfileCountFromFreq()

Optional< uint64_t > BlockFrequencyInfo::getProfileCountFromFreq ( uint64_t  Freq) const

Returns the estimated profile count of Freq.

This uses the frequency Freq and multiplies it by the enclosing function's count (if available) and returns the value.

Definition at line 218 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI, getFunction(), and llvm::None.

◆ invalidate()

bool BlockFrequencyInfo::invalidate ( Function F,
const PreservedAnalyses PA,
FunctionAnalysisManager::Invalidator  
)

Handle invalidation explicitly.

Definition at line 177 of file BlockFrequencyInfo.cpp.

References llvm::PreservedAnalyses::getChecker().

◆ isIrrLoopHeader()

bool BlockFrequencyInfo::isIrrLoopHeader ( const BasicBlock BB)

Returns true if BB is an irreducible loop header block.

Otherwise false.

Definition at line 224 of file BlockFrequencyInfo.cpp.

References assert(), BB, and llvm::AMDGPUISD::BFI.

◆ operator=() [1/2]

BlockFrequencyInfo & BlockFrequencyInfo::operator= ( BlockFrequencyInfo &&  RHS)

Definition at line 165 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI, move, and releaseMemory().

◆ operator=() [2/2]

BlockFrequencyInfo& llvm::BlockFrequencyInfo::operator= ( const BlockFrequencyInfo )
delete

◆ print()

void BlockFrequencyInfo::print ( raw_ostream OS) const

Definition at line 287 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

Referenced by calculate().

◆ printBlockFreq() [1/2]

raw_ostream & BlockFrequencyInfo::printBlockFreq ( raw_ostream OS,
const BasicBlock BB 
) const

Definition at line 276 of file BlockFrequencyInfo.cpp.

References BB, and llvm::AMDGPUISD::BFI.

◆ printBlockFreq() [2/2]

raw_ostream & BlockFrequencyInfo::printBlockFreq ( raw_ostream OS,
const BlockFrequency  Freq 
) const

Definition at line 271 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

◆ releaseMemory()

void BlockFrequencyInfo::releaseMemory ( )

Definition at line 285 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI.

Referenced by operator=().

◆ setBlockFreq()

void BlockFrequencyInfo::setBlockFreq ( const BasicBlock BB,
uint64_t  Freq 
)

Definition at line 229 of file BlockFrequencyInfo.cpp.

References assert(), BB, and llvm::AMDGPUISD::BFI.

Referenced by llvm::InlineFunction().

◆ setBlockFreqAndScale()

void BlockFrequencyInfo::setBlockFreqAndScale ( const BasicBlock ReferenceBB,
uint64_t  Freq,
SmallPtrSetImpl< BasicBlock * > &  BlocksToScale 
)

Set the frequency of ReferenceBB to Freq and scale the frequencies of the blocks in BlocksToScale such that their frequencies relative to ReferenceBB remain unchanged.

Definition at line 234 of file BlockFrequencyInfo.cpp.

References assert(), BB, llvm::AMDGPUISD::BFI, llvm::APInt::getLimitedValue(), and llvm::APInt::udiv().

◆ verifyMatch()

void BlockFrequencyInfo::verifyMatch ( BlockFrequencyInfo Other) const

Definition at line 292 of file BlockFrequencyInfo.cpp.

References llvm::AMDGPUISD::BFI, and Other.

◆ view()

void BlockFrequencyInfo::view ( StringRef  title = "BlockFrequencyDAGs") const

Pop up a ghostview window with the current block frequency propagation rendered using dot.

Definition at line 258 of file BlockFrequencyInfo.cpp.

References llvm::ViewGraph().

Referenced by calculate().


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