LLVM 20.0.0git
|
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic block frequencies. More...
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic block frequencies.
Definition at line 34 of file MachineBlockFrequencyInfo.h.
|
default |
|
explicit |
Definition at line 204 of file MachineBlockFrequencyInfo.cpp.
References calculate(), and F.
|
default |
|
default |
void MachineBlockFrequencyInfo::calculate | ( | const MachineFunction & | F, |
const MachineBranchProbabilityInfo & | MBPI, | ||
const MachineLoopInfo & | MLI | ||
) |
calculate - compute block frequency info for the given function.
Definition at line 231 of file MachineBlockFrequencyInfo.cpp.
References llvm::dbgs(), F, llvm::GVDT_None, llvm::PrintBFIFuncName, llvm::PrintMachineBlockFreq, view(), llvm::ViewBlockFreqFuncName, and llvm::ViewMachineBlockFreqPropagationDAG.
Referenced by MachineBlockFrequencyInfo(), and llvm::MachineBlockFrequencyInfoWrapperPass::runOnMachineFunction().
BlockFrequency MachineBlockFrequencyInfo::getBlockFreq | ( | const MachineBasicBlock * | MBB | ) | const |
getblockFreq - Return block frequency.
Return 0 if we don't have the information. Please note that initial frequency is equal to 1024. 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. For example, to get the frequency of a block relative to the entry block, divide the integral value returned by this function (the BlockFrequency::getFrequency() value) by getEntryFreq().
Definition at line 268 of file MachineBlockFrequencyInfo.cpp.
References MBB.
Referenced by llvm::RegBankSelect::computeMapping(), llvm::AsmPrinter::emitBBAddrMapSection(), llvm::RegBankSelect::InstrInsertPoint::frequency(), llvm::RegBankSelect::MBBInsertPoint::frequency(), llvm::RegBankSelect::EdgeInsertPoint::frequency(), llvm::MBFIWrapper::getBlockFreq(), getBlockFreqRelativeToEntryBlock(), and llvm::printBlockFreq().
|
inline |
Compute the frequency of the block, relative to the entry block.
This API assumes getEntryFreq() is non-zero.
Definition at line 70 of file MachineBlockFrequencyInfo.h.
References assert(), getBlockFreq(), getEntryFreq(), llvm::BlockFrequency::getFrequency(), and MBB.
Referenced by llvm::calculateRegAllocScore(), and llvm::LiveIntervals::getSpillWeight().
std::optional< uint64_t > MachineBlockFrequencyInfo::getBlockProfileCount | ( | const MachineBasicBlock * | MBB | ) | const |
Definition at line 272 of file MachineBlockFrequencyInfo.cpp.
Referenced by llvm::MBFIWrapper::getBlockProfileCount(), and isColdBlock().
BlockFrequency MachineBlockFrequencyInfo::getEntryFreq | ( | ) | const |
Divide a block's BlockFrequency::getFrequency() value by this value to obtain the entry block - relative frequency of said block.
Definition at line 315 of file MachineBlockFrequencyInfo.cpp.
Referenced by getBlockFreqRelativeToEntryBlock(), llvm::MBFIWrapper::getEntryFreq(), and llvm::printBlockFreq().
const MachineFunction * MachineBlockFrequencyInfo::getFunction | ( | ) | const |
Definition at line 307 of file MachineBlockFrequencyInfo.cpp.
const MachineBranchProbabilityInfo * MachineBlockFrequencyInfo::getMBPI | ( | ) | const |
Definition at line 311 of file MachineBlockFrequencyInfo.cpp.
Referenced by llvm::DOTGraphTraits< MachineBlockFrequencyInfo * >::getEdgeAttributes(), and llvm::MIRProfileLoader::setBranchProbs().
std::optional< uint64_t > MachineBlockFrequencyInfo::getProfileCountFromFreq | ( | BlockFrequency | Freq | ) | const |
Definition at line 282 of file MachineBlockFrequencyInfo.cpp.
References F.
Referenced by llvm::MBFIWrapper::getBlockProfileCount().
bool MachineBlockFrequencyInfo::invalidate | ( | MachineFunction & | F, |
const PreservedAnalyses & | PA, | ||
MachineFunctionAnalysisManager::Invalidator & | |||
) |
Handle invalidation explicitly.
Definition at line 212 of file MachineBlockFrequencyInfo.cpp.
References llvm::PreservedAnalyses::getChecker().
bool MachineBlockFrequencyInfo::isIrrLoopHeader | ( | const MachineBasicBlock * | MBB | ) | const |
Definition at line 290 of file MachineBlockFrequencyInfo.cpp.
void MachineBlockFrequencyInfo::onEdgeSplit | ( | const MachineBasicBlock & | NewPredecessor, |
const MachineBasicBlock & | NewSuccessor, | ||
const MachineBranchProbabilityInfo & | MBPI | ||
) |
incrementally calculate block frequencies when we split edges, to avoid full CFG traversal.
Definition at line 296 of file MachineBlockFrequencyInfo.cpp.
References assert(), and llvm::MachineBranchProbabilityInfo::getEdgeProbability().
void MachineBlockFrequencyInfo::print | ( | raw_ostream & | OS | ) |
Definition at line 256 of file MachineBlockFrequencyInfo.cpp.
References OS.
void MachineBlockFrequencyInfo::releaseMemory | ( | ) |
Definition at line 258 of file MachineBlockFrequencyInfo.cpp.
Referenced by llvm::MachineBlockFrequencyInfoWrapperPass::releaseMemory().
Pop up a ghostview window with the current block frequency propagation rendered using dot.
Definition at line 262 of file MachineBlockFrequencyInfo.cpp.
References isSimple(), Name, and llvm::ViewGraph().
Referenced by calculate(), and llvm::MBFIWrapper::view().