13#ifndef LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
14#define LLVM_CODEGEN_MACHINEBLOCKFREQUENCYINFO_H
25template <
class BlockT>
class BlockFrequencyInfoImpl;
26class MachineBasicBlock;
27class MachineBranchProbabilityInfo;
36 std::unique_ptr<ImplType> MBFI;
72 "getEntryFreq() should not return 0 here!");
77 std::optional<uint64_t>
105 BlockFrequency Freq);
110 const MachineBasicBlock &
MBB);
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static bool isSimple(Instruction *I)
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
Represent the analysis usage information of a pass.
Shared implementation for block frequency analysis.
uint64_t getFrequency() const
Returns the frequency as a fixpoint number scaled by the entry frequency.
Result run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
bool runOnMachineFunction(MachineFunction &F) override
runOnMachineFunction - This method must be overloaded to perform the desired machine code transformat...
MachineBlockFrequencyInfo & getMBFI()
const MachineBlockFrequencyInfo & getMBFI() const
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
MachineBlockFrequencyInfoWrapperPass()
MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic b...
void view(const Twine &Name, bool isSimple=true) const
Pop up a ghostview window with the current block frequency propagation rendered using dot.
void print(raw_ostream &OS)
bool isIrrLoopHeader(const MachineBasicBlock *MBB) const
const MachineBranchProbabilityInfo * getMBPI() const
BlockFrequency getBlockFreq(const MachineBasicBlock *MBB) const
getblockFreq - Return block frequency.
void onEdgeSplit(const MachineBasicBlock &NewPredecessor, const MachineBasicBlock &NewSuccessor, const MachineBranchProbabilityInfo &MBPI)
incrementally calculate block frequencies when we split edges, to avoid full CFG traversal.
void calculate(const MachineFunction &F, const MachineBranchProbabilityInfo &MBPI, const MachineLoopInfo &MLI)
calculate - compute block frequency info for the given function.
const MachineFunction * getFunction() const
double getBlockFreqRelativeToEntryBlock(const MachineBasicBlock *MBB) const
Compute the frequency of the block, relative to the entry block.
std::optional< uint64_t > getProfileCountFromFreq(BlockFrequency Freq) const
bool invalidate(MachineFunction &F, const PreservedAnalyses &PA, MachineFunctionAnalysisManager::Invalidator &)
Handle invalidation explicitly.
BlockFrequency getEntryFreq() const
Divide a block's BlockFrequency::getFrequency() value by this value to obtain the entry block - relat...
~MachineBlockFrequencyInfo()
std::optional< uint64_t > getBlockProfileCount(const MachineBasicBlock *MBB) const
MachineBlockFrequencyInfo(MachineBlockFrequencyInfo &&)
MachineBlockFrequencyInfo()
Printer pass for the MachineBlockFrequencyInfo results.
MachineBlockFrequencyPrinterPass(raw_ostream &OS)
PreservedAnalyses run(MachineFunction &MF, MachineFunctionAnalysisManager &MFAM)
MachineFunctionPass - This class adapts the FunctionPass interface to allow convenient creation of pa...
A set of analyses that are preserved following a run of a transformation pass.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
Printable printBlockFreq(const BlockFrequencyInfo &BFI, BlockFrequency Freq)
Print the block frequency Freq relative to the current functions entry frequency.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A CRTP mix-in to automatically provide informational APIs needed for passes.