LLVM
8.0.1
|
PMDataManager provides the common place to manage the analysis data used by pass managers. More...
#include "llvm/IR/LegacyPassManagers.h"
Public Member Functions | |
PMDataManager () | |
virtual | ~PMDataManager () |
virtual Pass * | getAsPass ()=0 |
void | recordAvailableAnalysis (Pass *P) |
Augment AvailableAnalysis by adding analysis made available by pass P. More... | |
void | verifyPreservedAnalysis (Pass *P) |
verifyPreservedAnalysis – Verify analysis presreved by pass P. More... | |
void | removeNotPreservedAnalysis (Pass *P) |
Remove Analysis that is not preserved by the pass. More... | |
void | removeDeadPasses (Pass *P, StringRef Msg, enum PassDebuggingString) |
Remove dead passes used by P. More... | |
void | freePass (Pass *P, StringRef Msg, enum PassDebuggingString) |
Remove P. More... | |
void | add (Pass *P, bool ProcessAnalysis=true) |
Add pass P into the PassVector. More... | |
virtual void | addLowerLevelRequiredPass (Pass *P, Pass *RequiredPass) |
Add RequiredPass into list of lower level passes required by pass P. More... | |
virtual Pass * | getOnTheFlyPass (Pass *P, AnalysisID PI, Function &F) |
void | initializeAnalysisInfo () |
Initialize available analysis information. More... | |
bool | preserveHigherLevelAnalysis (Pass *P) |
void | collectRequiredAndUsedAnalyses (SmallVectorImpl< Pass *> &UsedPasses, SmallVectorImpl< AnalysisID > &ReqPassNotAvailable, Pass *P) |
Populate UsedPasses with analysis pass that are used or required by pass P and are available. More... | |
void | initializeAnalysisImpl (Pass *P) |
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls member of the pass so that it can successfully use the getAnalysis() method to retrieve the implementations it needs. More... | |
Pass * | findAnalysisPass (AnalysisID AID, bool Direction) |
Find the pass that implements Analysis AID. More... | |
PMTopLevelManager * | getTopLevelManager () |
void | setTopLevelManager (PMTopLevelManager *T) |
unsigned | getDepth () const |
void | setDepth (unsigned newDepth) |
void | dumpLastUses (Pass *P, unsigned Offset) const |
void | dumpPassArguments () const |
void | dumpPassInfo (Pass *P, enum PassDebuggingString S1, enum PassDebuggingString S2, StringRef Msg) |
void | dumpRequiredSet (const Pass *P) const |
void | dumpPreservedSet (const Pass *P) const |
void | dumpUsedSet (const Pass *P) const |
unsigned | getNumContainedPasses () const |
virtual PassManagerType | getPassManagerType () const |
DenseMap< AnalysisID, Pass * > * | getAvailableAnalysis () |
void | populateInheritedAnalysis (PMStack &PMS) |
unsigned | initSizeRemarkInfo (Module &M, StringMap< std::pair< unsigned, unsigned >> &FunctionToInstrCount) |
Set the initial size of the module if the user has specified that they want remarks for size. More... | |
void | emitInstrCountChangedRemark (Pass *P, Module &M, int64_t Delta, unsigned CountBefore, StringMap< std::pair< unsigned, unsigned >> &FunctionToInstrCount, Function *F=nullptr) |
Emit a remark signifying that the number of IR instructions in the module changed. More... | |
Protected Member Functions | |
bool | isPassDebuggingExecutionsOrMore () const |
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified. More... | |
Protected Attributes | |
PMTopLevelManager * | TPM |
SmallVector< Pass *, 16 > | PassVector |
DenseMap< AnalysisID, Pass * > * | InheritedAnalysis [PMT_Last] |
PMDataManager provides the common place to manage the analysis data used by pass managers.
Definition at line 303 of file LegacyPassManagers.h.
|
inlineexplicit |
Definition at line 305 of file LegacyPassManagers.h.
References llvm::ARM_AM::add, F(), and P.
|
virtual |
Definition at line 1353 of file LegacyPassManager.cpp.
References P.
Add pass P into the PassVector.
Update AvailableAnalysis appropriately if ProcessAnalysis is true.
Definition at line 1068 of file LegacyPassManager.cpp.
References assert(), llvm::SmallVectorImpl< T >::clear(), llvm::PassInfo::createPass(), llvm::SmallVectorBase::empty(), llvm::Pass::getAsPMDataManager(), llvm_unreachable, llvm::SmallVectorTemplateBase< T >::push_back(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::Pass::setResolver().
Referenced by llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::ModulePass::assignPassManager(), and llvm::FunctionPass::assignPassManager().
Add RequiredPass into list of lower level passes required by pass P.
RequiredPass is run on the fly by Pass Manager when P requests it through getAnalysis interface.
RequiredPass is run on the fly by Pass Manager when P requests it through getAnalysis interface. This should be handled by specific pass manager.
Definition at line 1326 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::Pass::getPassName(), and llvm_unreachable.
void PMDataManager::collectRequiredAndUsedAnalyses | ( | SmallVectorImpl< Pass *> & | UP, |
SmallVectorImpl< AnalysisID > & | RP_NotAvail, | ||
Pass * | P | ||
) |
Populate UsedPasses with analysis pass that are used or required by pass P and are available.
Populate UP with analysis pass that are used or required by pass P and are available.
Populate ReqPassNotAvailable with analysis pass that are required by pass P but are not available.
Populate RP_NotAvail with analysis pass that are required by pass P but are not available.
Definition at line 1143 of file LegacyPassManager.cpp.
References llvm::AnalysisUsage::getRequiredSet(), llvm::AnalysisUsage::getRequiredTransitiveSet(), llvm::AnalysisUsage::getUsedSet(), llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorTemplateBase< T >::push_back().
Definition at line 1203 of file LegacyPassManager.cpp.
References llvm::dbgs(), and llvm::Pass::dumpPassStructure().
Referenced by llvm::RGPassManager::dumpPassStructure(), and llvm::LPPassManager::dumpPassStructure().
void PMDataManager::dumpPassArguments | ( | ) | const |
Definition at line 1219 of file LegacyPassManager.cpp.
References llvm::dbgs(), and P.
void PMDataManager::dumpPassInfo | ( | Pass * | P, |
enum PassDebuggingString | S1, | ||
enum PassDebuggingString | S2, | ||
StringRef | Msg | ||
) |
Definition at line 1231 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::EXECUTION_MSG, llvm::FREEING_MSG, llvm::Pass::getPassName(), llvm::MODIFICATION_MSG, now(), llvm::ON_BASICBLOCK_MSG, llvm::ON_CG_MSG, llvm::ON_FUNCTION_MSG, llvm::ON_LOOP_MSG, llvm::ON_MODULE_MSG, and llvm::ON_REGION_MSG.
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
Definition at line 1284 of file LegacyPassManager.cpp.
References llvm::Pass::getAnalysisUsage(), and llvm::AnalysisUsage::getPreservedSet().
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
Definition at line 1275 of file LegacyPassManager.cpp.
References llvm::Pass::getAnalysisUsage(), and llvm::AnalysisUsage::getRequiredSet().
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
Definition at line 1293 of file LegacyPassManager.cpp.
References assert(), llvm::dbgs(), llvm::SmallVectorBase::empty(), llvm::Pass::getAnalysisUsage(), llvm::PassInfo::getPassName(), llvm::AnalysisUsage::getUsedSet(), P, and llvm::SmallVectorBase::size().
void PMDataManager::emitInstrCountChangedRemark | ( | Pass * | P, |
Module & | M, | ||
int64_t | Delta, | ||
unsigned | CountBefore, | ||
StringMap< std::pair< unsigned, unsigned >> & | FunctionToInstrCount, | ||
Function * | F = nullptr |
||
) |
Emit a remark signifying that the number of IR instructions in the module changed.
F
is optionally passed by passes which run on Functions, and thus always know whether or not a non-empty function is available.
FunctionToInstrCount
maps the name of a Function
to a pair. The first member of the pair is the IR count of the Function
before running P
, and the second member is the IR count of the Function
after running P
.
Definition at line 165 of file LegacyPassManager.cpp.
References llvm::Module::begin(), llvm::Function::begin(), llvm::LLVMContext::diagnose(), llvm::Module::end(), F(), llvm::find_if(), llvm::for_each(), llvm::Pass::getAsPMDataManager(), llvm::Function::getContext(), llvm::Pass::getPassName(), and llvm::StringRef::str().
Referenced by llvm::LPPassManager::runOnFunction().
Pass * PMDataManager::findAnalysisPass | ( | AnalysisID | AID, |
bool | SearchParent | ||
) |
Find the pass that implements Analysis AID.
If desired pass is not found then return NULL.
Definition at line 1187 of file LegacyPassManager.cpp.
void PMDataManager::freePass | ( | Pass * | P, |
StringRef | Msg, | ||
enum PassDebuggingString | DBG_STR | ||
) |
Remove P.
Definition at line 1037 of file LegacyPassManager.cpp.
References llvm::FREEING_MSG, llvm::Pass::getPassID(), llvm::getPassTimer(), P, llvm::Pass::releaseMemory(), and X.
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
|
pure virtual |
Implemented in llvm::legacy::PassManagerImpl, llvm::FPPassManager, llvm::legacy::FunctionPassManagerImpl, llvm::LPPassManager, and llvm::RGPassManager.
Referenced by llvm::PMTopLevelManager::setLastUser().
|
inline |
Definition at line 394 of file LegacyPassManagers.h.
|
inline |
Definition at line 373 of file LegacyPassManagers.h.
References llvm::Depth.
Referenced by llvm::PMStack::push(), and llvm::PMTopLevelManager::setLastUser().
|
inline |
Definition at line 385 of file LegacyPassManagers.h.
Referenced by llvm::LPPassManager::cloneBasicBlockSimpleAnalysis(), llvm::LPPassManager::deleteSimpleAnalysisLoop(), llvm::LPPassManager::deleteSimpleAnalysisValue(), llvm::RGPassManager::dumpPassStructure(), llvm::LPPassManager::dumpPassStructure(), llvm::legacy::FunctionPassManagerImpl::releaseMemoryOnTheFly(), llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
|
virtual |
Definition at line 1348 of file LegacyPassManager.cpp.
References llvm_unreachable.
|
inlinevirtual |
Reimplemented in llvm::FPPassManager, llvm::LPPassManager, and llvm::RGPassManager.
Definition at line 389 of file LegacyPassManagers.h.
References assert(), and llvm::PMT_Unknown.
Referenced by llvm::LoopPass::assignPassManager(), llvm::CallGraphSCCPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::ModulePass::assignPassManager(), llvm::FunctionPass::assignPassManager(), llvm::BasicBlockPass::assignPassManager(), llvm::LoopPass::preparePassManager(), llvm::RegionPass::preparePassManager(), and llvm::PMStack::push().
|
inline |
Definition at line 370 of file LegacyPassManagers.h.
void PMDataManager::initializeAnalysisImpl | ( | Pass * | P | ) |
All Required analyses should be available to the pass as it runs! Here we fill in the AnalysisImpls member of the pass so that it can successfully use the getAnalysis() method to retrieve the implementations it needs.
Definition at line 1170 of file LegacyPassManager.cpp.
References llvm::AnalysisResolver::addAnalysisImplsPair(), assert(), llvm::AnalysisUsage::getRequiredSet(), and llvm::Pass::getResolver().
Referenced by llvm::RGPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::PMTopLevelManager::schedulePass().
|
inline |
Initialize available analysis information.
Definition at line 342 of file LegacyPassManagers.h.
References llvm::PMT_Last.
Referenced by llvm::PMStack::pop().
unsigned PMDataManager::initSizeRemarkInfo | ( | Module & | M, |
StringMap< std::pair< unsigned, unsigned >> & | FunctionToInstrCount | ||
) |
Set the initial size of the module if the user has specified that they want remarks for size.
Returns 0 if the remark was not requested.
Definition at line 143 of file LegacyPassManager.cpp.
References F(), and InstrCount.
Referenced by llvm::LPPassManager::runOnFunction().
|
protected |
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
Definition at line 139 of file LegacyPassManager.cpp.
Referenced by llvm::RGPassManager::runOnFunction().
|
inline |
Definition at line 399 of file LegacyPassManagers.h.
References llvm::PMStack::begin(), E, llvm::PMStack::end(), and I.
Referenced by llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::FunctionPass::assignPassManager(), llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
Definition at line 935 of file LegacyPassManager.cpp.
References llvm::AnalysisUsage::getPreservedSet(), llvm::AnalysisUsage::getPreservesAll(), and llvm::is_contained().
Referenced by llvm::LoopPass::preparePassManager(), and llvm::RegionPass::preparePassManager().
void PMDataManager::recordAvailableAnalysis | ( | Pass * | P | ) |
Augment AvailableAnalysis by adding analysis made available by pass P.
Augement AvailableAnalysis by adding analysis made available by pass P.
Definition at line 917 of file LegacyPassManager.cpp.
References assert(), llvm::PassInfo::getInterfacesImplemented(), llvm::Pass::getPassID(), and P.
Referenced by llvm::RGPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::PMTopLevelManager::schedulePass().
void PMDataManager::removeDeadPasses | ( | Pass * | P, |
StringRef | Msg, | ||
enum PassDebuggingString | DBG_STR | ||
) |
Remove dead passes used by P.
Remove analysis passes that are not used any longer.
Definition at line 1016 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::SmallVectorBase::empty(), and llvm::Pass::getPassName().
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
void PMDataManager::removeNotPreservedAnalysis | ( | Pass * | P | ) |
Remove Analysis that is not preserved by the pass.
Remove Analysis not preserved by Pass P.
Definition at line 969 of file LegacyPassManager.cpp.
References llvm::sys::path::begin(), llvm::dbgs(), E, llvm::sys::path::end(), llvm::Pass::getPassName(), llvm::AnalysisUsage::getPreservedSet(), llvm::AnalysisUsage::getPreservesAll(), I, Info, llvm::is_contained(), and llvm::PMT_Last.
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
|
inline |
Definition at line 374 of file LegacyPassManagers.h.
References llvm::Depth.
Referenced by llvm::PMStack::push().
|
inline |
Definition at line 371 of file LegacyPassManagers.h.
References T.
Referenced by llvm::FPPassManager::doFinalization(), llvm::legacy::FunctionPassManager::FunctionPassManager(), llvm::PMTopLevelManager::PMTopLevelManager(), and llvm::PMStack::push().
void PMDataManager::verifyPreservedAnalysis | ( | Pass * | P | ) |
verifyPreservedAnalysis – Verify analysis presreved by pass P.
verifyPreservedAnalysis – Verify analysis preserved by pass P.
Definition at line 951 of file LegacyPassManager.cpp.
References llvm::getPassTimer(), and llvm::AnalysisUsage::getPreservedSet().
Referenced by llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
|
protected |
Definition at line 437 of file LegacyPassManagers.h.
|
protected |
Definition at line 432 of file LegacyPassManagers.h.
|
protected |
Definition at line 429 of file LegacyPassManagers.h.
Referenced by llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::RGPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().