class LazyBranchProbabilityInfoPass

Declaration

class LazyBranchProbabilityInfoPass : public FunctionPass { /* full declaration omitted */ };

Description

This is an alternative analysis pass to BranchProbabilityInfoWrapperPass. The difference is that with this pass the branch probabilities are not computed when the analysis pass is executed but rather when the BPI results is explicitly requested by the analysis client. There are some additional requirements for any client pass that wants to use the analysis: 1. The pass needs to initialize dependent passes with: INITIALIZE_PASS_DEPENDENCY(LazyBPIPass) 2. Similarly, getAnalysisUsage should call: LazyBranchProbabilityInfoPass::getLazyBPIAnalysisUsage(AU) 3. The computed BPI should be requested with getAnalysis <LazyBranchProbabilityInfoPass >().getBPI() before LoopInfo could be invalidated for example by changing the CFG. Note that it is expected that we wouldn't need this functionality for the new PM since with the new PM, analyses are executed on demand.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:50

Inherits from: FunctionPass

Member Variables

private std::unique_ptr<LazyBranchProbabilityInfo> LBPI
public static char ID

Method Overview

Inherited from FunctionPass:

Inherited from Pass:

Methods

LazyBranchProbabilityInfoPass()

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:89

void getAnalysisUsage(
    llvm::AnalysisUsage& AU) const

Description

getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. If a pass specifies that it uses a particular analysis result to this function, it can then use the getAnalysis <AnalysisType >() function, below.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:97

Parameters

llvm::AnalysisUsage& AU

llvm::BranchProbabilityInfo& getBPI()

Description

Compute and return the branch probabilities.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:92

const llvm::BranchProbabilityInfo& getBPI() const

Description

Compute and return the branch probabilities.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:95

static void getLazyBPIAnalysisUsage(
    llvm::AnalysisUsage& AU)

Description

Helper for client passes to set up the analysis usage on behalf of this pass.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:101

Parameters

llvm::AnalysisUsage& AU

void print(llvm::raw_ostream& OS,
           const llvm::Module* M) const

Description

print - Print out the internal state of the pass. This is called by Analyze to print out the contents of an analysis. Otherwise it is not necessary to implement this method. Beware that the module pointer MAY be null. This automatically forwards to a virtual function that does not provide the Module* in case the analysis doesn't need it it can just be ignored.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:105

Parameters

llvm::raw_ostream& OS
const llvm::Module* M

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/Analysis/LazyBranchProbabilityInfo.h:104

bool runOnFunction(llvm::Function& F)

Description

runOnFunction - Virtual method overriden by subclasses to do the per-function processing of the pass.

Declared at: llvm/include/llvm/Analysis/LazyBranchProbabilityInfo.h:103

Parameters

llvm::Function& F