LLVM API Documentation
#include <Pass.h>
Public Member Functions | |
Pass (PassKind K, char &pid) | |
virtual | ~Pass () |
PassKind | getPassKind () const |
virtual const char * | getPassName () const |
AnalysisID | getPassID () const |
getPassID - Return the PassID number that corresponds to this pass. | |
virtual bool | doInitialization (Module &) |
virtual bool | doFinalization (Module &) |
virtual void | print (raw_ostream &O, const Module *M) const |
void | dump () const |
virtual Pass * | createPrinterPass (raw_ostream &O, const std::string &Banner) const =0 |
virtual void | assignPassManager (PMStack &, PassManagerType) |
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 () const |
virtual void | getAnalysisUsage (AnalysisUsage &) const |
virtual void | releaseMemory () |
virtual void * | getAdjustedAnalysisPointer (AnalysisID ID) |
virtual ImmutablePass * | getAsImmutablePass () |
virtual PMDataManager * | getAsPMDataManager () |
virtual void | verifyAnalysis () const |
virtual void | dumpPassStructure (unsigned Offset=0) |
template<typename AnalysisType > | |
AnalysisType * | getAnalysisIfAvailable () const |
bool | mustPreserveAnalysisID (char &AID) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis () const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysis (Function &F) |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI) const |
template<typename AnalysisType > | |
AnalysisType & | getAnalysisID (AnalysisID PI, Function &F) |
Static Public Member Functions | |
static const PassInfo * | lookupPassInfo (const void *TI) |
static const PassInfo * | lookupPassInfo (StringRef Arg) |
static Pass * | createPass (AnalysisID ID) |
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.
llvm::Pass::Pass | ( | PassKind | K, |
char & | pid | ||
) | [inline, explicit] |
Pass::~Pass | ( | ) | [virtual] |
virtual void llvm::Pass::assignPassManager | ( | PMStack & | , |
PassManagerType | |||
) | [inline, virtual] |
Each pass is responsible for assigning a pass manager to itself. PMS is the stack of available pass manager.
Reimplemented in llvm::BasicBlockPass, llvm::FunctionPass, llvm::ModulePass, llvm::RegionPass, llvm::CallGraphSCCPass, and llvm::LoopPass.
Definition at line 135 of file Pass.h.
Referenced by llvm::PMTopLevelManager::schedulePass().
Pass * Pass::createPass | ( | AnalysisID | ID | ) | [static] |
Definition at line 195 of file Pass.cpp.
References llvm::PassInfo::createPass(), llvm::PassRegistry::getPassInfo(), and llvm::PassRegistry::getPassRegistry().
Referenced by llvm::TargetPassConfig::addPass().
virtual Pass* llvm::Pass::createPrinterPass | ( | raw_ostream & | O, |
const std::string & | Banner | ||
) | const [pure virtual] |
createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module, Function or MachineFunction).
Implemented in llvm::legacy::PassManagerImpl, llvm::BasicBlockPass, llvm::FunctionPass, llvm::ModulePass, llvm::legacy::FunctionPassManagerImpl, llvm::RegionPass, llvm::CallGraphSCCPass, and llvm::LoopPass.
Referenced by llvm::PMTopLevelManager::schedulePass().
virtual bool llvm::Pass::doFinalization | ( | Module & | ) | [inline, virtual] |
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run.
Reimplemented in llvm::DataLayoutPass, llvm::FPPassManager, llvm::legacy::FunctionPassManagerImpl, llvm::NVPTXAsmPrinter, llvm::MachineModuleInfo, llvm::AsmPrinter, and llvm::AssumptionTracker.
virtual bool llvm::Pass::doInitialization | ( | Module & | ) | [inline, virtual] |
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run.
Reimplemented in llvm::DataLayoutPass, llvm::FPPassManager, llvm::legacy::FunctionPassManagerImpl, llvm::NVPTXAsmPrinter, llvm::MachineModuleInfo, llvm::AsmPrinter, and llvm::X86AsmPrinter.
void Pass::dump | ( | ) | const |
Reimplemented in llvm::RegionInfoPass, llvm::CallGraphWrapperPass, llvm::SlotIndexes, llvm::DominanceFrontier, llvm::VirtRegMap, llvm::IVUsers, and llvm::MachineRegionInfoPass.
Definition at line 116 of file Pass.cpp.
References llvm::dbgs(), and print().
Referenced by llvm::LiveIntervals::runOnMachineFunction().
void Pass::dumpPassStructure | ( | unsigned | Offset = 0 | ) | [virtual] |
Reimplemented in llvm::FPPassManager, llvm::LPPassManager, and llvm::RGPassManager.
Definition at line 53 of file Pass.cpp.
References llvm::dbgs(), getPassName(), and llvm::raw_ostream::indent().
Referenced by llvm::RGPassManager::dumpPassStructure(), llvm::LPPassManager::dumpPassStructure(), and llvm::FPPassManager::dumpPassStructure().
void * Pass::getAdjustedAnalysisPointer | ( | AnalysisID | ID | ) | [virtual] |
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.
Reimplemented in llvm::LibCallAliasAnalysis.
Definition at line 90 of file Pass.cpp.
Referenced by getAnalysisID(), and getAnalysisIfAvailable().
AnalysisType & llvm::Pass::getAnalysis | ( | ) | const |
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 199 of file PassAnalysisSupport.h.
Referenced by llvm::AliasAnalysis::InitializeAliasAnalysis(), llvm::TargetTransformInfo::pushTTIStack(), and llvm::simplifyUsersOfIV().
AnalysisType & llvm::Pass::getAnalysis | ( | Function & | F | ) |
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 228 of file PassAnalysisSupport.h.
References F().
AnalysisType & llvm::Pass::getAnalysisID | ( | AnalysisID | PI | ) | const |
Definition at line 205 of file PassAnalysisSupport.h.
References llvm::AnalysisResolver::findImplPass(), and getAdjustedAnalysisPointer().
AnalysisType & llvm::Pass::getAnalysisID | ( | AnalysisID | PI, |
Function & | F | ||
) |
Definition at line 235 of file PassAnalysisSupport.h.
References llvm::AnalysisResolver::findImplPass(), and getAdjustedAnalysisPointer().
AnalysisType * llvm::Pass::getAnalysisIfAvailable | ( | ) | const |
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 179 of file PassAnalysisSupport.h.
References getAdjustedAnalysisPointer(), and llvm::AnalysisResolver::getAnalysisIfAvailable().
Referenced by FoldBlockIntoPredecessor(), llvm::FoldSingleEntryPHINodes(), llvm::AliasAnalysis::InitializeAliasAnalysis(), llvm::MergeBasicBlockIntoOnlyPred(), llvm::MergeBlockIntoPredecessor(), llvm::SplitBlock(), llvm::SplitCriticalEdge(), llvm::MachineBasicBlock::SplitCriticalEdge(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopProlog(), UpdateAnalysisInformation(), and UpdatePHINodes().
void Pass::getAnalysisUsage | ( | AnalysisUsage & | ) | const [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::DependenceAnalysis, llvm::ScalarEvolution, llvm::RegionInfoPass, llvm::LoopInfo, llvm::FPPassManager, llvm::legacy::PassManagerImpl, llvm::CallGraphWrapperPass, llvm::SlotIndexes, llvm::MemoryDependenceAnalysis, llvm::LiveIntervals, llvm::legacy::FunctionPassManagerImpl, llvm::LiveVariables, llvm::DominanceFrontier, llvm::DominatorTreeWrapperPass, llvm::AsmPrinter, llvm::MachineDominatorTree, llvm::DOTGraphTraitsModulePrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::MachineLoopInfo, llvm::InstCombiner, llvm::StackProtector, llvm::MachineRegionInfoPass, llvm::InlineCostAnalysis, llvm::DOTGraphTraitsModuleViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::MachineDominanceFrontier, llvm::LPPassManager, llvm::RGPassManager, llvm::LiveStacks, llvm::DOTGraphTraitsPrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::LazyValueInfo, llvm::IntervalPartition, llvm::MachinePostDominatorTree, llvm::MachineTraceMetrics, llvm::CallGraphSCCPass, llvm::VirtRegMap, llvm::SelectionDAGISel, llvm::FindUsedTypes, llvm::JumpInstrTables, llvm::DOTGraphTraitsViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::LibCallAliasAnalysis, llvm::BranchProbabilityInfo, llvm::MachineFunctionPass, llvm::StackMapLiveness, llvm::MachineBranchProbabilityInfo, llvm::MachineBlockFrequencyInfo, llvm::PEI, llvm::BlockFrequencyInfo, llvm::Inliner, llvm::final< T >, llvm::PostDominatorTree, llvm::UnifyFunctionExitNodes, llvm::NVPTXAllocaHoisting, and llvm::NVPTXLowerAggrCopies.
Definition at line 78 of file Pass.cpp.
Referenced by llvm::PMDataManager::dumpPreservedSet(), llvm::PMDataManager::dumpRequiredSet(), llvm::PMTopLevelManager::findAnalysisUsage(), and INITIALIZE_PASS().
ImmutablePass * Pass::getAsImmutablePass | ( | ) | [virtual] |
Reimplemented in llvm::ImmutablePass.
Definition at line 94 of file Pass.cpp.
Referenced by llvm::PMDataManager::preserveHigherLevelAnalysis(), and llvm::PMTopLevelManager::schedulePass().
PMDataManager * Pass::getAsPMDataManager | ( | ) | [virtual] |
Reimplemented in llvm::FPPassManager, llvm::legacy::PassManagerImpl, llvm::legacy::FunctionPassManagerImpl, llvm::LPPassManager, and llvm::RGPassManager.
Definition at line 98 of file Pass.cpp.
Referenced by llvm::PMDataManager::add().
AnalysisID llvm::Pass::getPassID | ( | ) | const [inline] |
getPassID - Return the PassID number that corresponds to this pass.
Definition at line 104 of file Pass.h.
Referenced by llvm::TargetPassConfig::addPass(), llvm::PMDataManager::freePass(), getPassName(), llvm::TargetPassConfig::insertPass(), llvm::PMDataManager::preserveHigherLevelAnalysis(), llvm::PMDataManager::recordAvailableAnalysis(), and llvm::PMTopLevelManager::schedulePass().
PassKind llvm::Pass::getPassKind | ( | ) | const [inline] |
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.
Reimplemented in llvm::FPPassManager, llvm::LPPassManager, llvm::RGPassManager, llvm::MipsAsmPrinter, llvm::X86AsmPrinter, llvm::AMDGPUAsmPrinter, llvm::JumpInstrTables, llvm::ARMAsmPrinter, llvm::DebugIR, llvm::MipsModuleDAGToDAGISel, llvm::JumpInstrTableInfo, llvm::NVPTXLowerAggrCopies, llvm::NVPTXAllocaHoisting, llvm::MachineFunctionAnalysis, llvm::MipsDAGToDAGISel, llvm::Mips16HardFloat, llvm::MipsOs16, llvm::SystemZAsmPrinter, and llvm::HexagonAsmPrinter.
Definition at line 61 of file Pass.cpp.
References getPassID(), llvm::PassRegistry::getPassInfo(), llvm::PassInfo::getPassName(), and llvm::PassRegistry::getPassRegistry().
Referenced by llvm::PMDataManager::addLowerLevelRequiredPass(), llvm::PMDataManager::dumpPassInfo(), dumpPassStructure(), print(), llvm::PMDataManager::removeDeadPasses(), llvm::PMDataManager::removeNotPreservedAnalysis(), llvm::PMTopLevelManager::schedulePass(), llvm::LoopPass::skipOptnoneFunction(), llvm::FunctionPass::skipOptnoneFunction(), and llvm::BasicBlockPass::skipOptnoneFunction().
PassManagerType Pass::getPotentialPassManagerType | ( | ) | const [virtual] |
Return what kind of Pass Manager can manage this pass.
Reimplemented in llvm::BasicBlockPass, llvm::FunctionPass, llvm::ModulePass, llvm::RegionPass, llvm::CallGraphSCCPass, and llvm::LoopPass.
Definition at line 73 of file Pass.cpp.
References llvm::PMT_Unknown.
Referenced by llvm::PMTopLevelManager::schedulePass().
AnalysisResolver* llvm::Pass::getResolver | ( | ) | const [inline] |
Definition at line 145 of file Pass.h.
Referenced by llvm::PMDataManager::add(), llvm::FPPassManager::cleanup(), llvm::PMDataManager::initializeAnalysisImpl(), and llvm::PMTopLevelManager::setLastUser().
const PassInfo * Pass::lookupPassInfo | ( | const void * | TI | ) | [static] |
Definition at line 187 of file Pass.cpp.
References llvm::PassRegistry::getPassInfo(), and llvm::PassRegistry::getPassRegistry().
Referenced by llvm::AnalysisUsage::addPreserved().
const PassInfo * Pass::lookupPassInfo | ( | StringRef | Arg | ) | [static] |
Definition at line 191 of file Pass.cpp.
References llvm::PassRegistry::getPassInfo(), and llvm::PassRegistry::getPassRegistry().
bool Pass::mustPreserveAnalysisID | ( | char & | AID | ) | 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 48 of file Pass.cpp.
References llvm::AnalysisResolver::getAnalysisIfAvailable().
Referenced by llvm::SplitCriticalEdge(), and UpdateAnalysisInformation().
void Pass::preparePassManager | ( | PMStack & | ) | [virtual] |
Check if available pass managers are suitable for this pass or not.
Reimplemented in llvm::RegionPass, and llvm::LoopPass.
Definition at line 69 of file Pass.cpp.
Referenced by llvm::PMTopLevelManager::schedulePass().
void Pass::print | ( | raw_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::DependenceAnalysis, llvm::ScalarEvolution, llvm::RegionInfoPass, llvm::LoopInfo, llvm::CallGraphWrapperPass, llvm::MachineDominatorTree, llvm::LiveIntervals, llvm::DominanceFrontier, llvm::DominatorTreeWrapperPass, llvm::VirtRegMap, llvm::IVUsers, llvm::MachineRegionInfoPass, llvm::LiveStacks, llvm::PostDominatorTree, llvm::MachinePostDominatorTree, llvm::IntervalPartition, llvm::BranchProbabilityInfo, llvm::BlockFrequencyInfo, and llvm::FindUsedTypes.
Definition at line 111 of file Pass.cpp.
References getPassName().
Referenced by llvm::LiveDebugVariables::dump(), and dump().
void Pass::releaseMemory | ( | ) | [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::DependenceAnalysis, llvm::ScalarEvolution, llvm::RegionInfoPass, llvm::LoopInfo, llvm::CallGraphWrapperPass, llvm::SlotIndexes, llvm::MemoryDependenceAnalysis, llvm::MachineDominatorTree, llvm::LiveIntervals, llvm::LiveVariables, llvm::DominanceFrontier, llvm::DominatorTreeWrapperPass, llvm::MachineLoopInfo, llvm::MachineRegionInfoPass, llvm::AssumptionTracker, llvm::MachineDominanceFrontier, llvm::IntervalPartition, llvm::LiveStacks, llvm::PostDominatorTree, llvm::LazyValueInfo, llvm::MachineTraceMetrics, llvm::MachineBlockFrequencyInfo, llvm::BlockFrequencyInfo, and llvm::final< T >.
Definition at line 82 of file Pass.cpp.
Referenced by llvm::PMDataManager::freePass(), and llvm::legacy::FunctionPassManagerImpl::releaseMemoryOnTheFly().
void Pass::setResolver | ( | AnalysisResolver * | AR | ) |
Definition at line 102 of file Pass.cpp.
Referenced by llvm::PMDataManager::add(), llvm::legacy::FunctionPassManager::FunctionPassManager(), and llvm::PMTopLevelManager::schedulePass().
void Pass::verifyAnalysis | ( | ) | const [virtual] |
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information.
Reimplemented in llvm::ScalarEvolution, llvm::RegionInfoPass, llvm::LoopInfo, llvm::DominatorTreeWrapperPass, llvm::AssumptionTracker, llvm::MachineRegionInfoPass, and llvm::MachineTraceMetrics.