class Pass

Declaration

class Pass { /* full declaration omitted */ };

Description

Pass interface - Implemented by all 'passes'. Subclass this if you are an interprocedural optimization or you do not fit into any of the more constrained passes described below.

Declared at: llvm/include/llvm/Pass.h:91

Member Variables

private llvm::AnalysisResolver* Resolver = nullptr
private const void* PassID
private llvm::PassKind Kind

Method Overview

Methods

Pass(const llvm::Pass&)

Declared at: llvm/include/llvm/Pass.h:98

Parameters

const llvm::Pass&

Pass(llvm::PassKind K, char& pid)

Declared at: llvm/include/llvm/Pass.h:97

Parameters

llvm::PassKind K
char& pid

virtual void assignPassManager(
    llvm::PMStack&,
    llvm::PassManagerType)

Description

Each pass is responsible for assigning a pass manager to itself. PMS is the stack of available pass manager.

Declared at: llvm/include/llvm/Pass.h:139

Parameters

llvm::PMStack&
llvm::PassManagerType

static llvm::Pass* createPass(llvm::AnalysisID ID)

Declared at: llvm/include/llvm/Pass.h:195

Parameters

llvm::AnalysisID ID

virtual llvm::Pass* createPrinterPass(
    llvm::raw_ostream& OS,
    const std::string& Banner) const

Description

createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module, Function or MachineFunction).

Declared at: llvm/include/llvm/Pass.h:134

Parameters

llvm::raw_ostream& OS
const std::string& Banner

virtual bool doFinalization(llvm::Module&)

Description

doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run.

Declared at: llvm/include/llvm/Pass.h:120

Parameters

llvm::Module&

virtual bool doInitialization(llvm::Module&)

Description

doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run.

Declared at: llvm/include/llvm/Pass.h:116

Parameters

llvm::Module&

void dump() const

Declared at: llvm/include/llvm/Pass.h:130

virtual void dumpPassStructure(
    unsigned int Offset = 0)

Declared at: llvm/include/llvm/Pass.h:183

Parameters

unsigned int Offset = 0

virtual void* getAdjustedAnalysisPointer(
    llvm::AnalysisID ID)

Description

getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance. If needed, it should override this to adjust the this pointer as needed for the specified pass info.

Declared at: llvm/include/llvm/Pass.h:174

Parameters

llvm::AnalysisID ID

template <typename AnalysisType>
AnalysisType& getAnalysis(llvm::Function& F,
                          bool* Changed = nullptr)

Description

getAnalysis <AnalysisType >() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function. If as part of the dependencies, an IR transformation is triggered (e.g. because the analysis requires BreakCriticalEdges), and Changed is non null, *Changed is updated.

Declared at: llvm/include/llvm/Pass.h:222

Templates

AnalysisType

Parameters

llvm::Function& F
bool* Changed = nullptr

template <typename AnalysisType>
AnalysisType& getAnalysis() const

Description

getAnalysis <AnalysisType >() - This function is used by subclasses to get to the analysis information that they claim to use by overriding the getAnalysisUsage function.

Declared at: llvm/include/llvm/Pass.h:218

Templates

AnalysisType

template <typename AnalysisType>
AnalysisType& getAnalysisID(
    llvm::AnalysisID PI,
    llvm::Function& F,
    bool* Changed = nullptr)

Declared at: llvm/include/llvm/Pass.h:229

Templates

AnalysisType

Parameters

llvm::AnalysisID PI
llvm::Function& F
bool* Changed = nullptr

template <typename AnalysisType>
AnalysisType& getAnalysisID(
    llvm::AnalysisID PI) const

Declared at: llvm/include/llvm/Pass.h:226

Templates

AnalysisType

Parameters

llvm::AnalysisID PI

template <typename AnalysisType>
AnalysisType* getAnalysisIfAvailable() const

Description

getAnalysisIfAvailable <AnalysisType >() - Subclasses use this function to get analysis information that might be around, for example to update it. This is different than getAnalysis in that it can fail (if the analysis results haven't been computed), so should only be used if you can handle the case when the analysis is not available. This method is often used by transformation APIs to update analysis results for a pass automatically as the transform is performed.

Declared at: llvm/include/llvm/Pass.h:205

Templates

AnalysisType

virtual void getAnalysisUsage(
    llvm::AnalysisUsage&) 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/Pass.h:156

Parameters

llvm::AnalysisUsage&

virtual llvm::ImmutablePass* getAsImmutablePass()

Declared at: llvm/include/llvm/Pass.h:175

virtual llvm::PMDataManager* getAsPMDataManager()

Declared at: llvm/include/llvm/Pass.h:176

llvm::AnalysisID getPassID() const

Description

getPassID - Return the PassID number that corresponds to this pass.

Declared at: llvm/include/llvm/Pass.h:110

llvm::PassKind getPassKind() const

Declared at: llvm/include/llvm/Pass.h:102

virtual llvm::StringRef getPassName() const

Description

getPassName - Return a nice clean name for a pass. This usually implemented in terms of the name that is registered by one of the Registration templates, but can be overloaded directly.

Declared at: llvm/include/llvm/Pass.h:107

virtual llvm::PassManagerType
getPotentialPassManagerType() const

Description

Return what kind of Pass Manager can manage this pass.

Declared at: llvm/include/llvm/Pass.h:146

llvm::AnalysisResolver* getResolver() const

Declared at: llvm/include/llvm/Pass.h:150

static const llvm::PassInfo* lookupPassInfo(
    const void* TI)

Declared at: llvm/include/llvm/Pass.h:187

Parameters

const void* TI

static const llvm::PassInfo* lookupPassInfo(
    llvm::StringRef Arg)

Declared at: llvm/include/llvm/Pass.h:191

Parameters

llvm::StringRef Arg

bool mustPreserveAnalysisID(char& AID) const

Description

mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. This obviously cannot give you a properly typed instance of the class if you don't have the class name available (use getAnalysisIfAvailable if you do), but it can tell you if you need to preserve the pass at least.

Declared at: llvm/include/llvm/Pass.h:212

Parameters

char& AID

virtual void preparePassManager(llvm::PMStack&)

Description

Check if available pass managers are suitable for this pass or not.

Declared at: llvm/include/llvm/Pass.h:143

Parameters

llvm::PMStack&

virtual 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/Pass.h:128

Parameters

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

virtual 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/Pass.h:168

void setResolver(llvm::AnalysisResolver* AR)

Declared at: llvm/include/llvm/Pass.h:149

Parameters

llvm::AnalysisResolver* AR

virtual void verifyAnalysis() const

Description

verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.

Declared at: llvm/include/llvm/Pass.h:180

virtual ~Pass()

Declared at: llvm/include/llvm/Pass.h:100