LLVM 20.0.0git
|
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. | |
void | verifyPreservedAnalysis (Pass *P) |
verifyPreservedAnalysis – Verify analysis presreved by pass P. | |
void | removeNotPreservedAnalysis (Pass *P) |
Remove Analysis that is not preserved by the pass. | |
void | removeDeadPasses (Pass *P, StringRef Msg, enum PassDebuggingString) |
Remove dead passes used by P. | |
void | freePass (Pass *P, StringRef Msg, enum PassDebuggingString) |
Remove P. | |
void | add (Pass *P, bool ProcessAnalysis=true) |
Add pass P into the PassVector. | |
virtual void | addLowerLevelRequiredPass (Pass *P, Pass *RequiredPass) |
Add RequiredPass into list of lower level passes required by pass P. | |
virtual std::tuple< Pass *, bool > | getOnTheFlyPass (Pass *P, AnalysisID PI, Function &F) |
void | initializeAnalysisInfo () |
Initialize available analysis information. | |
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. | |
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. | |
Pass * | findAnalysisPass (AnalysisID AID, bool Direction) |
Find the pass that implements Analysis AID. | |
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. | |
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. | |
Protected Member Functions | |
bool | isPassDebuggingExecutionsOrMore () const |
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified. | |
Protected Attributes | |
PMTopLevelManager * | TPM = nullptr |
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 295 of file LegacyPassManagers.h.
|
inlineexplicit |
Definition at line 297 of file LegacyPassManagers.h.
References initializeAnalysisInfo().
|
virtual |
Definition at line 1271 of file LegacyPassManager.cpp.
References P, and PassVector.
Add pass P into the PassVector.
Update AvailableAnalysis appropriately if ProcessAnalysis is true.
Definition at line 995 of file LegacyPassManager.cpp.
References addLowerLevelRequiredPass(), assert(), llvm::SmallVectorImpl< T >::clear(), collectRequiredAndUsedAnalyses(), llvm::PassInfo::createPass(), DM, llvm::SmallVectorBase< Size_T >::empty(), llvm::PMTopLevelManager::findAnalysisPassInfo(), getAsPass(), getDepth(), llvm_unreachable, P, PassVector, llvm::SmallVectorTemplateBase< T, bool >::push_back(), recordAvailableAnalysis(), removeNotPreservedAnalysis(), llvm::PMTopLevelManager::setLastUser(), and TPM.
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 1243 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::PMTopLevelManager::dumpArguments(), llvm::PMTopLevelManager::dumpPasses(), llvm::Pass::getPassName(), llvm_unreachable, P, and TPM.
Referenced by add().
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 1070 of file LegacyPassManager.cpp.
References findAnalysisPass(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::AnalysisUsage::getRequiredSet(), llvm::AnalysisUsage::getUsedSet(), P, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and TPM.
Referenced by add().
Definition at line 1124 of file LegacyPassManager.cpp.
References llvm::PMTopLevelManager::collectLastUses(), llvm::dbgs(), llvm::Offset, P, PassDebugging, and TPM.
Referenced by llvm::LPPassManager::dumpPassStructure(), llvm::RGPassManager::dumpPassStructure(), and llvm::FPPassManager::dumpPassStructure().
void PMDataManager::dumpPassArguments | ( | ) | const |
Definition at line 1142 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::PMTopLevelManager::findAnalysisPassInfo(), P, PassVector, and TPM.
void PMDataManager::dumpPassInfo | ( | Pass * | P, |
enum PassDebuggingString | S1, | ||
enum PassDebuggingString | S2, | ||
StringRef | Msg | ||
) |
Definition at line 1151 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::EXECUTION_MSG, llvm::FREEING_MSG, getDepth(), llvm::MODIFICATION_MSG, llvm::ON_CG_MSG, llvm::ON_FUNCTION_MSG, llvm::ON_LOOP_MSG, llvm::ON_MODULE_MSG, llvm::ON_REGION_MSG, P, PassDebugging, and S1.
Referenced by freePass(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
Definition at line 1201 of file LegacyPassManager.cpp.
References llvm::AnalysisUsage::getPreservedSet(), P, and PassDebugging.
Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
Definition at line 1192 of file LegacyPassManager.cpp.
References llvm::AnalysisUsage::getRequiredSet(), P, and PassDebugging.
Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
Definition at line 1210 of file LegacyPassManager.cpp.
References llvm::AnalysisUsage::getUsedSet(), P, and PassDebugging.
Referenced by llvm::FPPassManager::runOnFunction().
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 88 of file LegacyPassManager.cpp.
References llvm::Function::empty(), F, llvm::find_if(), P, and PassName.
Referenced by llvm::FPPassManager::runOnFunction(), and 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 1108 of file LegacyPassManager.cpp.
References llvm::PMTopLevelManager::findAnalysisPass(), I, and TPM.
Referenced by collectRequiredAndUsedAnalyses(), llvm::AnalysisResolver::getAnalysisIfAvailable(), initializeAnalysisImpl(), and verifyPreservedAnalysis().
void PMDataManager::freePass | ( | Pass * | P, |
StringRef | Msg, | ||
enum PassDebuggingString | DBG_STR | ||
) |
Remove P.
Definition at line 977 of file LegacyPassManager.cpp.
References dumpPassInfo(), llvm::FREEING_MSG, llvm::getPassTimer(), P, and X.
Referenced by removeDeadPasses(), and llvm::LPPassManager::runOnFunction().
|
pure virtual |
Implemented in llvm::LPPassManager, llvm::RGPassManager, llvm::FPPassManager, llvm::legacy::FunctionPassManagerImpl, and llvm::legacy::PassManagerImpl.
Referenced by add().
|
inline |
Definition at line 385 of file LegacyPassManagers.h.
|
inline |
Definition at line 364 of file LegacyPassManagers.h.
Referenced by add(), dumpPassInfo(), llvm::PMStack::push(), and llvm::PMTopLevelManager::setLastUser().
|
inline |
Definition at line 376 of file LegacyPassManagers.h.
References PassVector.
Referenced by llvm::FPPassManager::cleanup(), llvm::FPPassManager::doFinalization(), llvm::FPPassManager::doInitialization(), llvm::LPPassManager::dumpPassStructure(), llvm::RGPassManager::dumpPassStructure(), llvm::FPPassManager::dumpPassStructure(), llvm::legacy::FunctionPassManagerImpl::releaseMemoryOnTheFly(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
|
virtual |
Definition at line 1265 of file LegacyPassManager.cpp.
References llvm_unreachable.
Referenced by llvm::AnalysisResolver::findImplPass().
|
inlinevirtual |
Reimplemented in llvm::LPPassManager, llvm::RGPassManager, and llvm::FPPassManager.
Definition at line 380 of file LegacyPassManagers.h.
References assert(), and llvm::PMT_Unknown.
Referenced by llvm::CallGraphSCCPass::assignPassManager(), llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::ModulePass::assignPassManager(), llvm::FunctionPass::assignPassManager(), llvm::LoopPass::preparePassManager(), llvm::RegionPass::preparePassManager(), and llvm::PMStack::push().
|
inline |
Definition at line 361 of file LegacyPassManagers.h.
References TPM.
Referenced by llvm::CallGraphSCCPass::assignPassManager(), llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::FunctionPass::assignPassManager(), and llvm::PMStack::push().
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 1091 of file LegacyPassManager.cpp.
References llvm::AnalysisResolver::addAnalysisImplsPair(), assert(), findAnalysisPass(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::AnalysisUsage::getRequiredSet(), P, and TPM.
Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
|
inline |
Initialize available analysis information.
Definition at line 333 of file LegacyPassManagers.h.
References InheritedAnalysis.
Referenced by PMDataManager(), and 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 66 of file LegacyPassManager.cpp.
References F, and InstrCount.
Referenced by llvm::FPPassManager::runOnFunction(), and llvm::LPPassManager::runOnFunction().
|
protected |
isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.
Definition at line 62 of file LegacyPassManager.cpp.
References PassDebugging.
Referenced by llvm::RGPassManager::runOnFunction().
|
inline |
Definition at line 390 of file LegacyPassManagers.h.
References InheritedAnalysis.
Referenced by llvm::LoopPass::assignPassManager(), llvm::RegionPass::assignPassManager(), llvm::FunctionPass::assignPassManager(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
Definition at line 876 of file LegacyPassManager.cpp.
References llvm::PMTopLevelManager::findAnalysisUsage(), llvm::AnalysisUsage::getPreservedSet(), llvm::AnalysisUsage::getPreservesAll(), llvm::is_contained(), P, and TPM.
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 868 of file LegacyPassManager.cpp.
References P.
Referenced by add(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
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 956 of file LegacyPassManager.cpp.
References llvm::PMTopLevelManager::collectLastUses(), llvm::dbgs(), llvm::SmallVectorBase< Size_T >::empty(), freePass(), P, PassDebugging, and TPM.
Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::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 910 of file LegacyPassManager.cpp.
References llvm::dbgs(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::Pass::getPassName(), llvm::AnalysisUsage::getPreservedSet(), llvm::AnalysisUsage::getPreservesAll(), I, Info, InheritedAnalysis, llvm::is_contained(), P, PassDebugging, and TPM.
Referenced by add(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
|
inline |
Definition at line 365 of file LegacyPassManagers.h.
Referenced by llvm::PMStack::push().
|
inline |
Definition at line 362 of file LegacyPassManagers.h.
Referenced by llvm::legacy::FunctionPassManager::FunctionPassManager(), llvm::legacy::PassManager::PassManager(), 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 892 of file LegacyPassManager.cpp.
References findAnalysisPass(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::getPassTimer(), llvm::AnalysisUsage::getPreservedSet(), P, and TPM.
Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().
|
protected |
Definition at line 427 of file LegacyPassManagers.h.
Referenced by initializeAnalysisInfo(), populateInheritedAnalysis(), and removeNotPreservedAnalysis().
|
protected |
Definition at line 422 of file LegacyPassManagers.h.
Referenced by add(), dumpPassArguments(), llvm::LPPassManager::getContainedPass(), llvm::RGPassManager::getContainedPass(), llvm::FPPassManager::getContainedPass(), getNumContainedPasses(), and ~PMDataManager().
|
protected |
Definition at line 419 of file LegacyPassManagers.h.
Referenced by add(), addLowerLevelRequiredPass(), collectRequiredAndUsedAnalyses(), dumpLastUses(), dumpPassArguments(), findAnalysisPass(), getTopLevelManager(), initializeAnalysisImpl(), preserveHigherLevelAnalysis(), removeDeadPasses(), removeNotPreservedAnalysis(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), llvm::RGPassManager::runOnFunction(), setTopLevelManager(), and verifyPreservedAnalysis().