LLVM API Documentation

llvm::Pass Class Reference

#include <Pass.h>

Inheritance diagram for llvm::Pass:

Inheritance graph
[legend]
Collaboration diagram for llvm::Pass:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Pass ()
virtual ~Pass ()
virtual const char * getPassName () const
const PassInfogetPassInfo () const
virtual bool runPass (Module &M)
virtual bool runPass (BasicBlock &)
virtual void print (std::ostream &O, const Module *M) const
void dump () const
virtual void getAnalysisUsage (AnalysisUsage &Info) const
virtual void releaseMemory ()
virtual void dumpPassStructure (unsigned Offset=0)
template<typename AnalysisType>
AnalysisType * getAnalysisToUpdate () const
bool mustPreserveAnalysisID (const PassInfo *AnalysisID) const
template<typename AnalysisType>
AnalysisType & getAnalysis () const
template<typename AnalysisType>
AnalysisType & getAnalysisID (const PassInfo *PI) const

Static Public Member Functions

template<typename AnalysisClass>
static const PassInfogetClassPassInfo ()
static const PassInfolookupPassInfo (const std::type_info &TI)

Friends

struct AnalysisResolver
class PassManagerT
class ModulePassManager
class FunctionPassManagerT
class BasicBlockPassManager

Detailed 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.

Definition at line 61 of file Pass.h.


Constructor & Destructor Documentation

llvm::Pass::Pass (  )  [inline]

Definition at line 74 of file Pass.h.

virtual llvm::Pass::~Pass (  )  [inline, virtual]

Definition at line 75 of file Pass.h.


Member Function Documentation

void Pass::dump (  )  const

Definition at line 227 of file Pass.cpp.

References print().

Referenced by llvm::LiveIntervals::runOnMachineFunction().

void Pass::dumpPassStructure ( unsigned  Offset = 0  )  [virtual]

Reimplemented in llvm::BasicBlockPassManager, llvm::FunctionPassManagerT, and llvm::ModulePassManager.

Definition at line 206 of file Pass.cpp.

References getPassName().

Referenced by llvm::PMDebug::PerformPassStartupStuff().

template<typename AnalysisType>
AnalysisType& llvm::Pass::getAnalysis (  )  const [inline]

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

Definition at line 167 of file Pass.h.

References PI.

Referenced by llvm::AliasAnalysis::InitializeAliasAnalysis().

template<typename AnalysisType>
AnalysisType& llvm::Pass::getAnalysisID ( const PassInfo PI  )  const [inline]

Definition at line 174 of file Pass.h.

References first, and PI.

template<typename AnalysisType>
AnalysisType * llvm::Pass::getAnalysisToUpdate (  )  const

getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses to get to the analysis information that might be around that needs to be updated. This is different than getAnalysis in that it can fail (ie the analysis results haven't been computed), so should only be used if you provide the capability to update an analysis that exists. This method is often used by transformation APIs to update analysis results for a pass automatically as the transform is performed.

Definition at line 147 of file PassAnalysisSupport.h.

References llvm::AnalysisResolver::getAnalysisToUpdate(), and PI.

Referenced by llvm::SplitCriticalEdge().

virtual void llvm::Pass::getAnalysisUsage ( AnalysisUsage Info  )  const [inline, virtual]

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.

Reimplemented in llvm::LocalDataStructures, llvm::BUDataStructures, llvm::TDDataStructures, llvm::CompleteBUDataStructures, llvm::EquivClassGraphs, llvm::ImmediateDominators, llvm::DominatorSet, llvm::ETForestBase, llvm::DominatorTree, llvm::DominanceFrontier, llvm::FindUsedTypes, llvm::IntervalPartition, llvm::LoopInfo, llvm::ImmediatePostDominators, llvm::PostDominatorSet, llvm::PostDominatorTree, llvm::PostETForest, llvm::PostDominanceFrontier, llvm::ScalarEvolution, llvm::PrintModulePass, llvm::PrintFunctionPass, llvm::CallGraphSCCPass, llvm::LiveIntervals, llvm::LiveVariables, llvm::SelectionDAGISel, llvm::UnifyFunctionExitNodes, llvm::FunctionLiveVarInfo, llvm::DependenceAnalyzer, llvm::ModuloSchedulingPass, llvm::ModuloSchedulingSBPass, llvm::PhyRegAlloc, llvm::PeepholeOpts, llvm::X86SharedAsmPrinter, llvm::RSProfilers_std, llvm::BasicBlockPassManager, and llvm::FunctionPassManagerT.

Definition at line 112 of file Pass.h.

Referenced by llvm::PassManagerT< llvm::BBTraits >::add(), llvm::X86SharedAsmPrinter::getAnalysisUsage(), and llvm::LiveIntervals::getAnalysisUsage().

template<typename AnalysisClass>
static const PassInfo* llvm::Pass::getClassPassInfo (  )  [inline, static]

Definition at line 135 of file Pass.h.

References lookupPassInfo().

const PassInfo * Pass::getPassInfo (  )  const

getPassInfo - Return the PassInfo data structure that corresponds to this pass... If the pass has not been registered, this will return null.

Definition at line 324 of file Pass.cpp.

References lookupPassInfo().

Referenced by getPassName().

const char * Pass::getPassName (  )  const [virtual]

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, and if nothing else is available, C++ RTTI will be consulted to get a SOMEWHAT intelligible name for the pass.

Reimplemented in llvm::DependenceAnalyzer, llvm::ModuloSchedulingPass, llvm::ModuloSchedulingSBPass, llvm::PhyRegAlloc, llvm::SparcV9CodeEmitter, llvm::PeepholeOpts, llvm::X86ATTAsmPrinter, llvm::X86IntelAsmPrinter, llvm::BasicBlockPassManager, llvm::FunctionPassManagerT, and llvm::ModulePassManager.

Definition at line 212 of file Pass.cpp.

References getPassInfo(), and PI.

Referenced by llvm::PassManagerT< llvm::BBTraits >::addPass(), dumpPassStructure(), print(), llvm::PMDebug::PrintAnalysisSetInfo(), and llvm::PMDebug::PrintPassInformation().

const PassInfo * Pass::lookupPassInfo ( const std::type_info &  TI  )  [static]

Definition at line 329 of file Pass.cpp.

References I.

Referenced by getClassPassInfo(), getPassInfo(), and llvm::RegisterAGBase::RegisterAGBase().

bool Pass::mustPreserveAnalysisID ( const PassInfo AnalysisID  )  const

mustPreserveAnalysisID - This method serves the same function as getAnalysisToUpdate, 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 getAnalysisToUpdate if you do), but it can tell you if you need to preserve the pass at least.

Definition at line 201 of file Pass.cpp.

References llvm::AnalysisResolver::getAnalysisToUpdate().

void Pass::print ( std::ostream &  O,
const Module M 
) const [virtual]

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.

Reimplemented in llvm::LocalDataStructures, llvm::BUDataStructures, llvm::TDDataStructures, llvm::CompleteBUDataStructures, llvm::EquivClassGraphs, llvm::ImmediateDominatorsBase, llvm::DominatorSetBase, llvm::DominatorTreeBase, llvm::ETForestBase, llvm::DominanceFrontierBase, llvm::FindUsedTypes, llvm::IntervalPartition, llvm::LoopInfo, llvm::ScalarEvolution, and llvm::LiveIntervals.

Definition at line 222 of file Pass.cpp.

References getPassName().

Referenced by dump(), and llvm::operator<<().

virtual void llvm::Pass::releaseMemory (  )  [inline, virtual]

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.

Reimplemented in llvm::LocalDataStructures, llvm::ImmediateDominatorsBase, llvm::DominatorSetBase, llvm::DominatorTreeBase, llvm::ETForestBase, llvm::DominanceFrontierBase, llvm::LoopInfo, llvm::ScalarEvolution, llvm::LiveIntervals, llvm::LiveVariables, and llvm::FunctionLiveVarInfo.

Definition at line 127 of file Pass.h.

virtual bool llvm::Pass::runPass ( BasicBlock  )  [inline, virtual]

Reimplemented in llvm::ModulePass, and llvm::BasicBlockPass.

Definition at line 94 of file Pass.h.

virtual bool llvm::Pass::runPass ( Module M  )  [inline, virtual]

runPass - Run this pass, returning true if a modification was made to the module argument. This should be implemented by all concrete subclasses.

Reimplemented in llvm::ModulePass, and llvm::BasicBlockPass.

Definition at line 93 of file Pass.h.


Friends And Related Function Documentation

friend struct AnalysisResolver [friend]

Definition at line 62 of file Pass.h.

friend class BasicBlockPassManager [friend]

Reimplemented in llvm::FunctionPass, and llvm::BasicBlockPass.

Definition at line 206 of file Pass.h.

friend class FunctionPassManagerT [friend]

Reimplemented in llvm::FunctionPass, and llvm::BasicBlockPass.

Definition at line 205 of file Pass.h.

friend class ModulePassManager [friend]

Reimplemented in llvm::ImmutablePass, and llvm::FunctionPass.

Definition at line 204 of file Pass.h.

friend class PassManagerT [friend]

Reimplemented in llvm::ImmutablePass, llvm::FunctionPass, and llvm::BasicBlockPass.

Definition at line 203 of file Pass.h.


The documentation for this class was generated from the following files: