LLVM 20.0.0git
|
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 | |
BlockFrequencyInfo & | operator= (const BlockFrequencyInfo &)=delete |
BlockFrequencyInfo (BlockFrequencyInfo &&Arg) | |
BlockFrequencyInfo & | operator= (BlockFrequencyInfo &&RHS) |
~BlockFrequencyInfo () | |
bool | invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &) |
Handle invalidation explicitly. | |
const Function * | getFunction () const |
const BranchProbabilityInfo * | getBPI () const |
void | view (StringRef="BlockFrequencyDAGs") const |
Pop up a ghostview window with the current block frequency propagation rendered using dot. | |
BlockFrequency | getBlockFreq (const BasicBlock *BB) const |
getblockFreq - Return block frequency. | |
std::optional< uint64_t > | getBlockProfileCount (const BasicBlock *BB, bool AllowSynthetic=false) const |
Returns the estimated profile count of BB . | |
std::optional< uint64_t > | getProfileCountFromFreq (BlockFrequency Freq) const |
Returns the estimated profile count of Freq . | |
bool | isIrrLoopHeader (const BasicBlock *BB) |
Returns true if BB is an irreducible loop header block. | |
void | setBlockFreq (const BasicBlock *BB, BlockFrequency Freq) |
void | setBlockFreqAndScale (const BasicBlock *ReferenceBB, BlockFrequency 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. | |
void | calculate (const Function &F, const BranchProbabilityInfo &BPI, const LoopInfo &LI) |
calculate - compute block frequency info for the given function. | |
BlockFrequency | getEntryFreq () const |
void | releaseMemory () |
void | print (raw_ostream &OS) const |
void | verifyMatch (BlockFrequencyInfo &Other) const |
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequencies.
Definition at line 37 of file BlockFrequencyInfo.h.
|
default |
BlockFrequencyInfo::BlockFrequencyInfo | ( | const Function & | F, |
const BranchProbabilityInfo & | BPI, | ||
const LoopInfo & | LI | ||
) |
Definition at line 154 of file BlockFrequencyInfo.cpp.
References calculate(), and F.
|
delete |
BlockFrequencyInfo::BlockFrequencyInfo | ( | BlockFrequencyInfo && | Arg | ) |
Definition at line 160 of file BlockFrequencyInfo.cpp.
|
default |
void BlockFrequencyInfo::calculate | ( | const Function & | F, |
const BranchProbabilityInfo & | BPI, | ||
const LoopInfo & | LI | ||
) |
calculate - compute block frequency info for the given function.
Definition at line 184 of file BlockFrequencyInfo.cpp.
References llvm::dbgs(), F, llvm::GVDT_None, print(), llvm::PrintBFI, llvm::PrintBFIFuncName, view(), llvm::ViewBlockFreqFuncName, and ViewBlockFreqPropagationDAG.
Referenced by BlockFrequencyInfo(), and llvm::BlockFrequencyInfoWrapperPass::runOnFunction().
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 200 of file BlockFrequencyInfo.cpp.
Referenced by llvm::CodeExtractor::extractCodeRegion(), llvm::InlineFunction(), isColdCallSite(), and updateCallerBFI().
std::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 205 of file BlockFrequencyInfo.cpp.
References getFunction().
Referenced by fixFuncEntryCount(), and verifyFuncBFI().
const BranchProbabilityInfo * BlockFrequencyInfo::getBPI | ( | ) | const |
Definition at line 263 of file BlockFrequencyInfo.cpp.
BlockFrequency BlockFrequencyInfo::getEntryFreq | ( | ) | const |
Definition at line 267 of file BlockFrequencyInfo.cpp.
Definition at line 259 of file BlockFrequencyInfo.cpp.
Referenced by getBlockProfileCount(), and getProfileCountFromFreq().
std::optional< uint64_t > BlockFrequencyInfo::getProfileCountFromFreq | ( | BlockFrequency | 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 214 of file BlockFrequencyInfo.cpp.
References getFunction().
Referenced by llvm::CodeExtractor::extractCodeRegion().
bool BlockFrequencyInfo::invalidate | ( | Function & | F, |
const PreservedAnalyses & | PA, | ||
FunctionAnalysisManager::Invalidator & | |||
) |
Handle invalidation explicitly.
Definition at line 175 of file BlockFrequencyInfo.cpp.
References llvm::PreservedAnalyses::getChecker().
bool BlockFrequencyInfo::isIrrLoopHeader | ( | const BasicBlock * | BB | ) |
Returns true if BB
is an irreducible loop header block.
Otherwise false.
Definition at line 220 of file BlockFrequencyInfo.cpp.
References assert().
BlockFrequencyInfo & BlockFrequencyInfo::operator= | ( | BlockFrequencyInfo && | RHS | ) |
Definition at line 163 of file BlockFrequencyInfo.cpp.
References releaseMemory(), and RHS.
|
delete |
void BlockFrequencyInfo::print | ( | raw_ostream & | OS | ) | const |
Definition at line 273 of file BlockFrequencyInfo.cpp.
References OS.
Referenced by calculate(), and llvm::BlockFrequencyInfoWrapperPass::print().
void BlockFrequencyInfo::releaseMemory | ( | ) |
Definition at line 271 of file BlockFrequencyInfo.cpp.
Referenced by operator=(), and llvm::BlockFrequencyInfoWrapperPass::releaseMemory().
void BlockFrequencyInfo::setBlockFreq | ( | const BasicBlock * | BB, |
BlockFrequency | Freq | ||
) |
Definition at line 225 of file BlockFrequencyInfo.cpp.
References assert().
Referenced by llvm::CodeExtractor::extractCodeRegion(), llvm::InlineFunction(), and updateCallerBFI().
void BlockFrequencyInfo::setBlockFreqAndScale | ( | const BasicBlock * | ReferenceBB, |
BlockFrequency | 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 231 of file BlockFrequencyInfo.cpp.
References assert(), BBFreq, and llvm::BlockFrequency::getFrequency().
Referenced by updateCallerBFI().
void BlockFrequencyInfo::verifyMatch | ( | BlockFrequencyInfo & | Other | ) | const |
Definition at line 278 of file BlockFrequencyInfo.cpp.
References llvm::Other.
void BlockFrequencyInfo::view | ( | StringRef | title = "BlockFrequencyDAGs" | ) | const |
Pop up a ghostview window with the current block frequency propagation rendered using dot.
Definition at line 255 of file BlockFrequencyInfo.cpp.
References llvm::ViewGraph().
Referenced by calculate().