LLVM 22.0.0git
llvm::PMDataManager Class Referenceabstract

PMDataManager provides the common place to manage the analysis data used by pass managers. More...

#include "llvm/IR/LegacyPassManagers.h"

Inheritance diagram for llvm::PMDataManager:
[legend]

Public Member Functions

 PMDataManager ()
virtual ~PMDataManager ()
virtual PassgetAsPass ()=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 *, boolgetOnTheFlyPass (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!
PassfindAnalysisPass (AnalysisID AID, bool Direction)
 Find the pass that implements Analysis AID.
PMTopLevelManagergetTopLevelManager ()
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

PMTopLevelManagerTPM = nullptr
SmallVector< Pass *, 16 > PassVector
DenseMap< AnalysisID, Pass * > * InheritedAnalysis [PMT_Last]

Detailed Description

PMDataManager provides the common place to manage the analysis data used by pass managers.

Definition at line 296 of file LegacyPassManagers.h.

Constructor & Destructor Documentation

◆ PMDataManager()

◆ ~PMDataManager()

PMDataManager::~PMDataManager ( )
virtual

Definition at line 1261 of file LegacyPassManager.cpp.

References P, and PassVector.

Member Function Documentation

◆ add()

◆ addLowerLevelRequiredPass()

void PMDataManager::addLowerLevelRequiredPass ( Pass * P,
Pass * RequiredPass )
virtual

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 1233 of file LegacyPassManager.cpp.

References llvm::dbgs(), llvm::Pass::getPassName(), llvm_unreachable, P, and TPM.

Referenced by add(), and getAsPass().

◆ collectRequiredAndUsedAnalyses()

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 1060 of file LegacyPassManager.cpp.

References findAnalysisPass(), llvm::AnalysisUsage::getRequiredSet(), llvm::AnalysisUsage::getUsedSet(), P, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and TPM.

Referenced by add().

◆ dumpLastUses()

void PMDataManager::dumpLastUses ( Pass * P,
unsigned Offset ) const

◆ dumpPassArguments()

void PMDataManager::dumpPassArguments ( ) const

Definition at line 1132 of file LegacyPassManager.cpp.

References llvm::dbgs(), P, PassVector, PMDataManager(), and TPM.

◆ dumpPassInfo()

◆ dumpPreservedSet()

◆ dumpRequiredSet()

◆ dumpUsedSet()

void PMDataManager::dumpUsedSet ( const Pass * P) const

◆ emitInstrCountChangedRemark()

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 87 of file LegacyPassManager.cpp.

References llvm::Function::empty(), F, llvm::find_if(), llvm::for_each(), P, and PassName.

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

◆ findAnalysisPass()

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 1098 of file LegacyPassManager.cpp.

References I, and TPM.

Referenced by collectRequiredAndUsedAnalyses(), initializeAnalysisImpl(), and verifyPreservedAnalysis().

◆ freePass()

void PMDataManager::freePass ( Pass * P,
StringRef Msg,
enum PassDebuggingString DBG_STR )

◆ getAsPass()

◆ getAvailableAnalysis()

DenseMap< AnalysisID, Pass * > * llvm::PMDataManager::getAvailableAnalysis ( )
inline

Definition at line 385 of file LegacyPassManagers.h.

◆ getDepth()

unsigned llvm::PMDataManager::getDepth ( ) const
inline

◆ getNumContainedPasses()

◆ getOnTheFlyPass()

std::tuple< Pass *, bool > PMDataManager::getOnTheFlyPass ( Pass * P,
AnalysisID PI,
Function & F )
virtual

Definition at line 1255 of file LegacyPassManager.cpp.

References F, llvm_unreachable, and P.

Referenced by getAsPass().

◆ getPassManagerType()

◆ getTopLevelManager()

◆ initializeAnalysisImpl()

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 1081 of file LegacyPassManager.cpp.

References llvm::AnalysisResolver::addAnalysisImplsPair(), assert(), findAnalysisPass(), llvm::AnalysisUsage::getRequiredSet(), P, and TPM.

Referenced by llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().

◆ initializeAnalysisInfo()

void llvm::PMDataManager::initializeAnalysisInfo ( )
inline

Initialize available analysis information.

Definition at line 334 of file LegacyPassManagers.h.

References llvm::fill(), and InheritedAnalysis.

Referenced by PMDataManager(), and llvm::PMStack::pop().

◆ initSizeRemarkInfo()

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 65 of file LegacyPassManager.cpp.

References F, and InstrCount.

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

◆ isPassDebuggingExecutionsOrMore()

bool PMDataManager::isPassDebuggingExecutionsOrMore ( ) const
protected

isPassDebuggingExecutionsOrMore - Return true if -debug-pass=Executions or higher is specified.

Definition at line 61 of file LegacyPassManager.cpp.

References PassDebugging.

Referenced by llvm::RGPassManager::runOnFunction().

◆ populateInheritedAnalysis()

◆ preserveHigherLevelAnalysis()

◆ recordAvailableAnalysis()

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 858 of file LegacyPassManager.cpp.

References P.

Referenced by add(), getAsPass(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().

◆ removeDeadPasses()

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 946 of file LegacyPassManager.cpp.

References llvm::dbgs(), llvm::SmallVectorTemplateCommon< T, typename >::empty(), freePass(), P, PassDebugging, and TPM.

Referenced by getAsPass(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().

◆ removeNotPreservedAnalysis()

void PMDataManager::removeNotPreservedAnalysis ( Pass * P)

◆ setDepth()

void llvm::PMDataManager::setDepth ( unsigned newDepth)
inline

Definition at line 365 of file LegacyPassManagers.h.

Referenced by llvm::PMStack::push().

◆ setTopLevelManager()

void llvm::PMDataManager::setTopLevelManager ( PMTopLevelManager * T)
inline

Definition at line 362 of file LegacyPassManagers.h.

References T, and TPM.

Referenced by llvm::PMTopLevelManager::PMTopLevelManager(), and llvm::PMStack::push().

◆ verifyPreservedAnalysis()

void PMDataManager::verifyPreservedAnalysis ( Pass * P)

verifyPreservedAnalysis – Verify analysis presreved by pass P.

verifyPreservedAnalysis – Verify analysis preserved by pass P.

Definition at line 882 of file LegacyPassManager.cpp.

References findAnalysisPass(), llvm::getPassTimer(), llvm::AnalysisUsage::getPreservedSet(), P, and TPM.

Referenced by getAsPass(), llvm::FPPassManager::runOnFunction(), llvm::LPPassManager::runOnFunction(), and llvm::RGPassManager::runOnFunction().

Member Data Documentation

◆ InheritedAnalysis

DenseMap<AnalysisID, Pass *>* llvm::PMDataManager::InheritedAnalysis[PMT_Last]
protected

◆ PassVector

◆ TPM


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