LLVM API Documentation

llvm::Pass Class Reference

#include <Pass.h>

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

List of all members.

Public Member Functions

 Pass (intptr_t pid)
 Pass (const void *pid)
virtual ~Pass ()
virtual const char * getPassName () const
const PassInfo * getPassInfo () const
virtual void print (std::ostream &O, const Module *M) const
void print (std::ostream *O, const Module *M) const
void dump () const
virtual void assignPassManager (PMStack &, PassManagerType=PMT_Unknown)
virtual void preparePassManager (PMStack &)
 Check if available pass managers are suitable for this pass or not.
virtual PassManagerType getPotentialPassManagerType () const
 Return what kind of Pass Manager can manage this pass.
void setResolver (AnalysisResolver *AR)
AnalysisResolver * getResolver ()
virtual void getAnalysisUsage (AnalysisUsage &) const
virtual void releaseMemory ()
virtual void verifyAnalysis () const
virtual void dumpPassStructure (unsigned Offset=0)
template<typename AnalysisType>
AnalysisType * getAnalysisIfAvailable () const
bool mustPreserveAnalysisID (const PassInfo *AnalysisID) const
template<typename AnalysisType>
AnalysisType & getAnalysis () const
template<typename AnalysisType>
AnalysisType & getAnalysis (Function &F)
template<typename AnalysisType>
AnalysisType & getAnalysisID (const PassInfo *PI) const
template<typename AnalysisType>
AnalysisType & getAnalysisID (const PassInfo *PI, Function &F)

Static Public Member Functions

template<typename AnalysisClass>
static const PassInfo * getClassPassInfo ()
static const PassInfo * lookupPassInfo (intptr_t TI)


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 72 of file Pass.h.


Constructor & Destructor Documentation

llvm::Pass::Pass ( intptr_t  pid  )  [inline, explicit]

Definition at line 83 of file Pass.h.

llvm::Pass::Pass ( const void *  pid  )  [inline, explicit]

Definition at line 86 of file Pass.h.

Pass::~Pass (  )  [virtual]

Definition at line 32 of file Pass.cpp.


Member Function Documentation

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.

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.

Reimplemented in llvm::LPPassManager, llvm::FPPassManager, llvm::DebugLabelFolder, llvm::MachOWriter, llvm::X86ATTAsmPrinter, llvm::X86IntelAsmPrinter, and llvm::MPPassManager.

Definition at line 52 of file Pass.cpp.

References getPassInfo(), and PI.

Referenced by llvm::PMDataManager::addLowerLevelRequiredPass(), llvm::PMStack::dump(), llvm::PMDataManager::dumpPassInfo(), dumpPassStructure(), print(), llvm::PMDataManager::removeDeadPasses(), llvm::PMDataManager::removeNotPreservedAnalysis(), and llvm::PMDataManager::verifyDomInfo().

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 202 of file Pass.cpp.

References lookupPassInfo().

Referenced by getPassName(), llvm::PMDataManager::preserveHigherLevelAnalysis(), llvm::PMDataManager::recordAvailableAnalysis(), and llvm::PMTopLevelManager::schedulePass().

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::DominatorTree, llvm::DominanceFrontierBase, llvm::FindUsedTypes, llvm::IntervalPartition, llvm::LoopInfo, llvm::LoopVR, llvm::PostDominatorTree, llvm::ScalarEvolution, llvm::LiveIntervals, llvm::LiveStacks, llvm::MachineDominatorTree, and llvm::SimpleRegisterCoalescing.

Definition at line 62 of file Pass.cpp.

References getPassName().

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

void llvm::Pass::print ( std::ostream *  O,
const Module *  M 
) const [inline]

void Pass::dump (  )  const

Definition at line 67 of file Pass.cpp.

References llvm::cerr(), and print().

Referenced by llvm::LiveIntervals::runOnMachineFunction(), and llvm::PMDataManager::verifyDomInfo().

virtual void llvm::Pass::assignPassManager ( PMStack &  ,
PassManagerType  = PMT_Unknown 
) [inline, virtual]

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

Reimplemented in llvm::LoopPass, llvm::CallGraphSCCPass, llvm::ModulePass, llvm::FunctionPass, and llvm::BasicBlockPass.

Definition at line 115 of file Pass.h.

Referenced by llvm::PassManagerImpl::addTopLevelPass(), and llvm::FunctionPassManagerImpl::addTopLevelPass().

virtual void llvm::Pass::preparePassManager ( PMStack &   )  [inline, virtual]

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

Reimplemented in llvm::LoopPass.

Definition at line 118 of file Pass.h.

Referenced by llvm::PMTopLevelManager::schedulePass().

virtual PassManagerType llvm::Pass::getPotentialPassManagerType (  )  const [inline, virtual]

Return what kind of Pass Manager can manage this pass.

Reimplemented in llvm::LoopPass, llvm::CallGraphSCCPass, llvm::ModulePass, llvm::FunctionPass, and llvm::BasicBlockPass.

Definition at line 121 of file Pass.h.

References llvm::PMT_Unknown.

Referenced by llvm::MPPassManager::addLowerLevelRequiredPass(), and llvm::PMTopLevelManager::schedulePass().

void llvm::Pass::setResolver ( AnalysisResolver *  AR  )  [inline]

AnalysisResolver* llvm::Pass::getResolver (  )  [inline]

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

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::DominatorTree, llvm::DominanceFrontierBase, llvm::IntervalPartition, llvm::LoopInfo, llvm::LoopVR, llvm::MemoryDependenceAnalysis, llvm::ScalarEvolution, llvm::LiveIntervals, llvm::LiveStacks, llvm::LiveVariables, llvm::MachineDominatorTree, llvm::MachineLoopInfo, and llvm::SimpleRegisterCoalescing.

Definition at line 154 of file Pass.h.

virtual void llvm::Pass::verifyAnalysis (  )  const [inline, virtual]

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

Definition at line 158 of file Pass.h.

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

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

Definition at line 164 of file Pass.h.

References ID, and lookupPassInfo().

const PassInfo * Pass::lookupPassInfo ( intptr_t  TI  )  [static]

Definition at line 206 of file Pass.cpp.

References getPassRegistrar().

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

template<typename AnalysisType>
AnalysisType * llvm::Pass::getAnalysisIfAvailable (  )  const [inline]

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.

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.

Definition at line 169 of file PassAnalysisSupport.h.

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

Referenced by llvm::CloneLoop(), llvm::MergeBlockIntoPredecessor(), llvm::SplitBlock(), llvm::SplitBlockPredecessors(), llvm::SplitCriticalEdge(), and llvm::PMDataManager::verifyDomInfo().

bool Pass::mustPreserveAnalysisID ( const PassInfo *  AnalysisID  )  const

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.

Definition at line 39 of file Pass.cpp.

References llvm::AnalysisResolver::getAnalysisIfAvailable().

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.

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 183 of file PassAnalysisSupport.h.

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

template<typename AnalysisType>
AnalysisType & llvm::Pass::getAnalysis ( Function &  F  )  [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 216 of file PassAnalysisSupport.h.

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

Definition at line 190 of file PassAnalysisSupport.h.

References llvm::AnalysisResolver::findImplPass().

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

Definition at line 223 of file PassAnalysisSupport.h.

References llvm::AnalysisResolver::findImplPass().


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