LLVM  6.0.0svn
Public Member Functions | Static Public Member Functions | List of all members
llvm::Pass Class Referenceabstract

Pass interface - Implemented by all 'passes'. More...

#include "llvm/Pass.h"

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

Public Member Functions

 Pass (PassKind K, char &pid)
 
 Pass (const Pass &)=delete
 
Passoperator= (const Pass &)=delete
 
virtual ~Pass ()
 
PassKind getPassKind () const
 
virtual StringRef getPassName () const
 getPassName - Return a nice clean name for a pass. More...
 
AnalysisID getPassID () const
 getPassID - Return the PassID number that corresponds to this pass. More...
 
virtual bool doInitialization (Module &)
 doInitialization - Virtual method overridden by subclasses to do any necessary initialization before any pass is run. More...
 
virtual bool doFinalization (Module &)
 doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes have run. More...
 
virtual void print (raw_ostream &OS, const Module *M) const
 print - Print out the internal state of the pass. More...
 
void dump () const
 
virtual PasscreatePrinterPass (raw_ostream &OS, const std::string &Banner) const =0
 createPrinterPass - Get a Pass appropriate to print the IR this pass operates on (Module, Function or MachineFunction). More...
 
virtual void assignPassManager (PMStack &, PassManagerType)
 Each pass is responsible for assigning a pass manager to itself. More...
 
virtual void preparePassManager (PMStack &)
 Check if available pass managers are suitable for this pass or not. More...
 
virtual PassManagerType getPotentialPassManagerType () const
 Return what kind of Pass Manager can manage this pass. More...
 
void setResolver (AnalysisResolver *AR)
 
AnalysisResolvergetResolver () const
 
virtual void getAnalysisUsage (AnalysisUsage &) const
 getAnalysisUsage - This function should be overriden by passes that need analysis information to do their job. More...
 
virtual void releaseMemory ()
 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. More...
 
virtual void * getAdjustedAnalysisPointer (AnalysisID ID)
 getAdjustedAnalysisPointer - This method is used when a pass implements an analysis interface through multiple inheritance. More...
 
virtual ImmutablePassgetAsImmutablePass ()
 
virtual PMDataManagergetAsPMDataManager ()
 
virtual void verifyAnalysis () const
 verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis information. More...
 
virtual void dumpPassStructure (unsigned Offset=0)
 
template<typename AnalysisType >
AnalysisType * getAnalysisIfAvailable () const
 getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information that might be around, for example to update it. More...
 
bool mustPreserveAnalysisID (char &AID) const
 mustPreserveAnalysisID - This method serves the same function as getAnalysisIfAvailable, but works if you just have an AnalysisID. More...
 
template<typename AnalysisType >
AnalysisType & 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. More...
 
template<typename AnalysisType >
AnalysisType & 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. More...
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI) const
 
template<typename AnalysisType >
AnalysisType & getAnalysisID (AnalysisID PI, Function &F)
 

Static Public Member Functions

static const PassInfolookupPassInfo (const void *TI)
 
static const PassInfolookupPassInfo (StringRef Arg)
 
static PasscreatePass (AnalysisID ID)
 

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

Constructor & Destructor Documentation

◆ Pass() [1/2]

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

Definition at line 87 of file Pass.h.

References operator=(), and ~Pass().

◆ Pass() [2/2]

llvm::Pass::Pass ( const Pass )
delete

◆ ~Pass()

Pass::~Pass ( )
virtual

Definition at line 42 of file Pass.cpp.

References llvm::ModulePass::~ModulePass().

Referenced by Pass().

Member Function Documentation

◆ assignPassManager()

virtual void llvm::Pass::assignPassManager ( PMStack ,
PassManagerType   
)
inlinevirtual

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

References getPotentialPassManagerType(), preparePassManager(), and setResolver().

Referenced by llvm::BasicBlockPass::BasicBlockPass(), llvm::FunctionPass::FunctionPass(), llvm::ModulePass::ModulePass(), and llvm::PMTopLevelManager::schedulePass().

◆ createPass()

Pass * Pass::createPass ( AnalysisID  ID)
static

◆ createPrinterPass()

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

◆ doFinalization()

virtual bool llvm::Pass::doFinalization ( Module )
inlinevirtual

◆ doInitialization()

virtual bool llvm::Pass::doInitialization ( Module )
inlinevirtual

◆ dump()

LLVM_DUMP_METHOD void Pass::dump ( ) const

◆ dumpPassStructure()

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

◆ getAdjustedAnalysisPointer()

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.

Definition at line 103 of file Pass.cpp.

Referenced by getAnalysisID(), getAnalysisIfAvailable(), and getResolver().

◆ getAnalysis() [1/2]

template<typename AnalysisType >
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 220 of file PassAnalysisSupport.h.

References assert().

Referenced by llvm::createLegacyPMAAResults(), llvm::createLegacyPMBasicAAResult(), getResolver(), llvm::SITargetLowering::LowerFormalArguments(), and llvm::SITargetLowering::passSpecialInputs().

◆ getAnalysis() [2/2]

template<typename AnalysisType >
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 248 of file PassAnalysisSupport.h.

References assert(), and F().

◆ getAnalysisID() [1/2]

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

Definition at line 226 of file PassAnalysisSupport.h.

References assert(), and getAdjustedAnalysisPointer().

Referenced by getResolver().

◆ getAnalysisID() [2/2]

template<typename AnalysisType >
AnalysisType & llvm::Pass::getAnalysisID ( AnalysisID  PI,
Function F 
)

Definition at line 255 of file PassAnalysisSupport.h.

References assert(), and getAdjustedAnalysisPointer().

◆ getAnalysisIfAvailable()

template<typename AnalysisType >
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 201 of file PassAnalysisSupport.h.

References assert(), getAdjustedAnalysisPointer(), and getAnalysisIfAvailable().

Referenced by createAMDGPUExternalAAWrapperPass(), llvm::createLegacyPMAAResults(), llvm::RegBankSelect::InstrInsertPoint::frequency(), llvm::RegBankSelect::MBBInsertPoint::frequency(), llvm::RegBankSelect::EdgeInsertPoint::frequency(), getAnalysisIfAvailable(), llvm::getBestSimplifyQuery(), getResolver(), llvm::AMDGPUTargetMachine::getTargetIRAnalysis(), llvm::MachineBasicBlock::SplitCriticalEdge(), and llvm::MachineFunction::verify().

◆ getAnalysisUsage()

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::sroa::SROALegacyPass, llvm::gvn::GVNLegacyPass, llvm::ScalarEvolutionWrapperPass, llvm::GVNHoistLegacyPass, llvm::AAResultsWrapperPass, llvm::RegionInfoPass, llvm::DependenceAnalysisWrapperPass, llvm::LoopInfoWrapperPass, llvm::MemorySSAWrapperPass, llvm::MemorySSAPrinterLegacyPass, llvm::LoopAccessLegacyAnalysis, llvm::RegBankSelect, llvm::MemoryDependenceWrapperPass, llvm::FPPassManager, llvm::IRTranslator, llvm::legacy::PassManagerImpl, llvm::CallGraphWrapperPass, llvm::SlotIndexes, llvm::AAEvalLegacyPass, llvm::NVPTXAsmPrinter, llvm::DominatorTreeWrapperPass, llvm::LiveIntervals, llvm::PredicateInfoPrinterLegacyPass, llvm::legacy::FunctionPassManagerImpl, llvm::AsmPrinter, llvm::LiveVariables, llvm::BasicAAWrapperPass, llvm::BranchProbabilityInfoWrapperPass, llvm::MachineOptimizationRemarkEmitterPass, llvm::ExecutionDepsFix, llvm::IVUsersWrapperPass, llvm::DOTGraphTraitsModulePrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::DominanceFrontierWrapperPass, llvm::LCSSAVerificationPass, llvm::AMDGPUArgumentUsageInfo, llvm::LazyValueInfoWrapperPass, llvm::GlobalsAAWrapperPass, llvm::OptimizationRemarkEmitterWrapperPass, llvm::BlockFrequencyInfoWrapperPass, llvm::DOTGraphTraitsModuleViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::MachineLoopInfo, llvm::CFLSteensAAWrapperPass, llvm::DummyCGSCCPass, llvm::ProfileSummaryInfoWrapperPass, llvm::StackProtector, llvm::LazyBlockFrequencyInfoPass, llvm::CFLAndersAAWrapperPass, llvm::DOTGraphTraitsPrinter< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::AMDGPUAAWrapperPass, llvm::LPPassManager, llvm::RGPassManager, llvm::MachineDominanceFrontier, llvm::MachineTraceMetrics, llvm::MachineRegionInfoPass, llvm::LazyBranchProbabilityInfoPass, llvm::objcarc::ObjCARCAAWrapperPass, llvm::LiveStacks, llvm::MachineDominatorTree, llvm::IntervalPartition, llvm::DemandedBitsWrapperPass, llvm::TypeBasedAAWrapperPass, llvm::MachinePostDominatorTree, llvm::CallGraphSCCPass, llvm::PostDominatorTreeWrapperPass, llvm::VirtRegMap, llvm::ScopedNoAliasAAWrapperPass, llvm::SelectionDAGISel, llvm::ModuleSummaryIndexWrapperPass, llvm::LazyMachineBlockFrequencyInfoPass, llvm::DOTGraphTraitsViewer< AnalysisT, IsSimple, GraphT, AnalysisGraphTraitsT >, llvm::SCEVAAWrapperPass, llvm::InstructionCombiningPass, llvm::MachineFunctionPass, llvm::Legalizer, llvm::MachineBlockFrequencyInfo, llvm::MachineBranchProbabilityInfo, llvm::PhysicalRegisterUsageInfo, llvm::LegacyInlinerBase, llvm::UnifyFunctionExitNodes, llvm::InstructionSelect, and llvm::DivergenceAnalysis.

Definition at line 91 of file Pass.cpp.

Referenced by llvm::slpvectorizer::BoUpSLP::computeMinimumValueSizes(), llvm::createGCInfoPrinter(), llvm::MachineModuleInfo::deleteMachineFunctionFor(), llvm::PMDataManager::dumpPreservedSet(), llvm::PMDataManager::dumpRequiredSet(), llvm::PMDataManager::dumpUsedSet(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::MachineFunctionPass::getAnalysisUsage(), getResolver(), INITIALIZE_PASS_BEGIN(), optimizeDivRem(), llvm::SinkingPass::run(), and llvm::PartiallyInlineLibCallsPass::run().

◆ getAsImmutablePass()

ImmutablePass * Pass::getAsImmutablePass ( )
virtual

Reimplemented in llvm::ImmutablePass.

Definition at line 107 of file Pass.cpp.

Referenced by getResolver(), and llvm::PMTopLevelManager::schedulePass().

◆ getAsPMDataManager()

PMDataManager * Pass::getAsPMDataManager ( )
virtual

◆ getPassID()

AnalysisID llvm::Pass::getPassID ( ) const
inline

◆ getPassKind()

PassKind llvm::Pass::getPassKind ( ) const
inline

Definition at line 92 of file Pass.h.

References getPassName().

◆ getPassName()

StringRef 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::sroa::SROALegacyPass, llvm::RegBankSelect, llvm::AVRDynAllocaSR, llvm::FPPassManager, llvm::AVRFrameAnalyzer, llvm::IRTranslator, llvm::AMDGPUAsmPrinter, llvm::MipsAsmPrinter, llvm::LPPassManager, llvm::RGPassManager, llvm::X86AsmPrinter, llvm::FixAllFDIVSQRT, llvm::ARMAsmPrinter, llvm::DetectRoundChange, llvm::Localizer, llvm::InsertNOPLoad, llvm::Legalizer, llvm::AVRAsmPrinter, llvm::NVPTXDAGToDAGISel, llvm::HexagonAsmPrinter, llvm::MipsDAGToDAGISel, llvm::WebAssemblyAsmPrinter, llvm::AVRDAGToDAGISel, llvm::InstructionSelect, and llvm::SystemZAsmPrinter.

Definition at line 74 of file Pass.cpp.

References getPassID(), llvm::PassRegistry::getPassInfo(), llvm::PassInfo::getPassName(), and llvm::PassRegistry::getPassRegistry().

Referenced by llvm::PMDataManager::addLowerLevelRequiredPass(), llvm::TargetPassConfig::addPass(), llvm::Module::createRNG(), llvm::MachineModuleInfo::deleteMachineFunctionFor(), llvm::PMDataManager::dumpPassInfo(), dumpPassStructure(), llvm::legacy::PassManagerImpl::getContainedManager(), getPassKind(), isSecondInstructionInSequence(), print(), llvm::PMDataManager::removeDeadPasses(), llvm::PMDataManager::removeNotPreservedAnalysis(), llvm::PMTopLevelManager::schedulePass(), llvm::OptBisect::shouldRunPass(), llvm::BasicBlockPass::skipBasicBlock(), and llvm::FunctionPass::skipFunction().

◆ getPotentialPassManagerType()

PassManagerType Pass::getPotentialPassManagerType ( ) const
virtual

◆ getResolver()

AnalysisResolver* llvm::Pass::getResolver ( ) const
inline

◆ lookupPassInfo() [1/2]

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

◆ lookupPassInfo() [2/2]

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

◆ mustPreserveAnalysisID()

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

References llvm::AnalysisResolver::getAnalysisIfAvailable().

Referenced by getResolver(), and llvm::LPPassManager::runOnFunction().

◆ operator=()

Pass& llvm::Pass::operator= ( const Pass )
delete

Referenced by Pass().

◆ preparePassManager()

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

Referenced by assignPassManager(), and llvm::PMTopLevelManager::schedulePass().

◆ print()

void Pass::print ( raw_ostream OS,
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::ScalarEvolutionWrapperPass, llvm::RegionInfoPass, llvm::DependenceAnalysisWrapperPass, llvm::LoopInfoWrapperPass, llvm::MemorySSAWrapperPass, llvm::LoopAccessLegacyAnalysis, llvm::CallGraphWrapperPass, llvm::DominatorTreeWrapperPass, llvm::LiveIntervals, llvm::BranchProbabilityInfoWrapperPass, llvm::MachineDominatorTree, llvm::IVUsersWrapperPass, llvm::VirtRegMap, llvm::DominanceFrontierWrapperPass, llvm::AMDGPUArgumentUsageInfo, llvm::BlockFrequencyInfoWrapperPass, llvm::LazyBlockFrequencyInfoPass, llvm::LazyBranchProbabilityInfoPass, llvm::MachineRegionInfoPass, llvm::LiveStacks, llvm::DemandedBitsWrapperPass, llvm::PostDominatorTreeWrapperPass, llvm::MachinePostDominatorTree, llvm::LazyMachineBlockFrequencyInfoPass, llvm::IntervalPartition, llvm::PhysicalRegisterUsageInfo, and llvm::DivergenceAnalysis.

Definition at line 123 of file Pass.cpp.

References getPassName().

Referenced by llvm::A57ChainingConstraint::apply(), llvm::RegBankSelect::EdgeInsertPoint::canMaterialize(), doFinalization(), llvm::LiveDebugVariables::dump(), llvm::MachineLoop::dump(), dump(), llvm::SlotIndex::dump(), findInsertLocation(), getOpenCLAlignment(), llvm::NVPTXAsmPrinter::ignoreLoc(), llvm::LazyMachineBlockFrequencyInfoPass::print(), llvm::WebAssemblyAsmPrinter::PrintAsmOperand(), printExtendedName(), llvm::HexagonAsmPrinter::printOperand(), llvm::ARMAsmPrinter::printOperand(), llvm::MipsAsmPrinter::printOperand(), printSymbolOperand(), llvm::PredicateInfoPrinterPass::run(), llvm::RegBankSelect::RepairingPlacement::switchTo(), and llvm::LiveDebugVariables::~LiveDebugVariables().

◆ releaseMemory()

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::ScalarEvolutionWrapperPass, llvm::RegionInfoPass, llvm::DependenceAnalysisWrapperPass, llvm::LoopInfoWrapperPass, llvm::MemorySSAWrapperPass, llvm::LoopAccessLegacyAnalysis, llvm::MemoryDependenceWrapperPass, llvm::CallGraphWrapperPass, llvm::SlotIndexes, llvm::DominatorTreeWrapperPass, llvm::LiveIntervals, llvm::LiveVariables, llvm::BranchProbabilityInfoWrapperPass, llvm::MachineDominatorTree, llvm::AssumptionCacheTracker, llvm::IVUsersWrapperPass, llvm::DominanceFrontierWrapperPass, llvm::LazyValueInfoWrapperPass, llvm::BlockFrequencyInfoWrapperPass, llvm::MachineLoopInfo, llvm::LazyBlockFrequencyInfoPass, llvm::MachineTraceMetrics, llvm::LazyBranchProbabilityInfoPass, llvm::MachineDominanceFrontier, llvm::MachineRegionInfoPass, llvm::IntervalPartition, llvm::LiveStacks, llvm::DemandedBitsWrapperPass, llvm::PostDominatorTreeWrapperPass, llvm::LazyMachineBlockFrequencyInfoPass, and llvm::MachineBlockFrequencyInfo.

Definition at line 95 of file Pass.cpp.

Referenced by llvm::PMDataManager::freePass(), getResolver(), and llvm::legacy::FunctionPassManagerImpl::releaseMemoryOnTheFly().

◆ setResolver()

void Pass::setResolver ( AnalysisResolver AR)

◆ verifyAnalysis()

void Pass::verifyAnalysis ( ) const
virtual

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