class MachineBlockFrequencyInfo

Declaration

class MachineBlockFrequencyInfo : public MachineFunctionPass { /* full declaration omitted */ };

Description

MachineBlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate machine basic block frequencies.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:33

Inherits from: MachineFunctionPass

Member Variables

private std::unique_ptr<ImplType> MBFI
public static char ID

Method Overview

Inherited from MachineFunctionPass:

Inherited from FunctionPass:

Inherited from Pass:

Methods

MachineBlockFrequencyInfo(
    llvm::MachineFunction& F,
    llvm::MachineBranchProbabilityInfo& MBPI,
    llvm::MachineLoopInfo& MLI)

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:41

Parameters

llvm::MachineFunction& F
llvm::MachineBranchProbabilityInfo& MBPI
llvm::MachineLoopInfo& MLI

MachineBlockFrequencyInfo()

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:40

void calculate(
    const llvm::MachineFunction& F,
    const llvm::MachineBranchProbabilityInfo&
        MBPI,
    const llvm::MachineLoopInfo& MLI)

Description

calculate - compute block frequency info for the given function.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:51

Parameters

const llvm::MachineFunction& F
const llvm::MachineBranchProbabilityInfo& MBPI
const llvm::MachineLoopInfo& MLI

void getAnalysisUsage(
    llvm::AnalysisUsage& AU) const

Description

getAnalysisUsage - Subclasses that override getAnalysisUsage must call this. For MachineFunctionPasses, calling AU.preservesCFG() indicates that the pass does not modify the MachineBasicBlock CFG.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:46

Parameters

llvm::AnalysisUsage& AU

llvm::BlockFrequency getBlockFreq(
    const llvm::MachineBasicBlock* MBB) const

Description

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().

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:64

Parameters

const llvm::MachineBasicBlock* MBB

float getBlockFreqRelativeToEntryBlock(
    const llvm::MachineBasicBlock* MBB) const

Description

Compute the frequency of the block, relative to the entry block. This API assumes getEntryFreq() is non-zero.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:68

Parameters

const llvm::MachineBasicBlock* MBB

Optional<uint64_t> getBlockProfileCount(
    const llvm::MachineBasicBlock* MBB) const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:72

Parameters

const llvm::MachineBasicBlock* MBB

uint64_t getEntryFreq() const

Description

Divide a block's BlockFrequency::getFrequency() value by this value to obtain the entry block - relative frequency of said block.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:101

const llvm::MachineFunction* getFunction() const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:83

const llvm::MachineBranchProbabilityInfo*
getMBPI() const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:84

Optional<uint64_t> getProfileCountFromFreq(
    uint64_t Freq) const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:73

Parameters

uint64_t Freq

bool isIrrLoopHeader(
    const llvm::MachineBasicBlock* MBB) const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:75

Parameters

const llvm::MachineBasicBlock* MBB

void onEdgeSplit(
    const llvm::MachineBasicBlock& NewPredecessor,
    const llvm::MachineBasicBlock& NewSuccessor,
    const llvm::MachineBranchProbabilityInfo&
        MBPI)

Description

incrementally calculate block frequencies when we split edges, to avoid full CFG traversal.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:79

Parameters

const llvm::MachineBasicBlock& NewPredecessor
const llvm::MachineBasicBlock& NewSuccessor
const llvm::MachineBranchProbabilityInfo& MBPI

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

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:92

Parameters

llvm::raw_ostream& OS
const llvm::BlockFrequency Freq

llvm::raw_ostream& printBlockFreq(
    llvm::raw_ostream& OS,
    const llvm::MachineBasicBlock* MBB) const

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:96

Parameters

llvm::raw_ostream& OS
const llvm::MachineBasicBlock* MBB

void releaseMemory()

Description

releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memory when it is no longer needed. The default behavior of passes is to hold onto memory for the entire duration of their lifetime (which is the entire compile time). For pipelined passes, this is not a big deal because that memory gets recycled every time the pass is invoked on another program unit. For IP passes, it is more important to free memory when it is unused. Optionally implement this function to release pass memory when it is no longer used.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:55

bool runOnMachineFunction(
    llvm::MachineFunction& F)

Description

runOnMachineFunction - This method must be overloaded to perform the desired machine code transformation or analysis.

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:48

Parameters

llvm::MachineFunction& F

void view(const llvm::Twine& Name,
          bool isSimple = true) const

Description

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

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:88

Parameters

const llvm::Twine& Name
bool isSimple = true

~MachineBlockFrequencyInfo()

Declared at: llvm/include/llvm/CodeGen/MachineBlockFrequencyInfo.h:44