LLVM 20.0.0git
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
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:
Inheritance graph
[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! 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.
 
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 295 of file LegacyPassManagers.h.

Constructor & Destructor Documentation

◆ PMDataManager()

llvm::PMDataManager::PMDataManager ( )
inlineexplicit

Definition at line 297 of file LegacyPassManagers.h.

References initializeAnalysisInfo().

◆ ~PMDataManager()

PMDataManager::~PMDataManager ( )
virtual

Definition at line 1271 of file LegacyPassManager.cpp.

References P, and PassVector.

Member Function Documentation

◆ add()

void PMDataManager::add ( Pass P,
bool  ProcessAnalysis = true 
)

◆ 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 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().

◆ 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 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().

◆ dumpLastUses()

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

◆ dumpPassArguments()

void PMDataManager::dumpPassArguments ( ) const

◆ dumpPassInfo()

void PMDataManager::dumpPassInfo ( Pass P,
enum PassDebuggingString  S1,
enum PassDebuggingString  S2,
StringRef  Msg 
)

◆ dumpPreservedSet()

void PMDataManager::dumpPreservedSet ( const Pass P) const

◆ dumpRequiredSet()

void PMDataManager::dumpRequiredSet ( const Pass P) const

◆ 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 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().

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

References llvm::PMTopLevelManager::findAnalysisPass(), I, and TPM.

Referenced by collectRequiredAndUsedAnalyses(), llvm::AnalysisResolver::getAnalysisIfAvailable(), initializeAnalysisImpl(), and verifyPreservedAnalysis().

◆ freePass()

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().

◆ getAsPass()

virtual Pass * llvm::PMDataManager::getAsPass ( )
pure virtual

◆ getAvailableAnalysis()

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

Definition at line 385 of file LegacyPassManagers.h.

◆ getDepth()

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

◆ getNumContainedPasses()

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

◆ getOnTheFlyPass()

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

Definition at line 1265 of file LegacyPassManager.cpp.

References llvm_unreachable.

Referenced by llvm::AnalysisResolver::findImplPass().

◆ getPassManagerType()

virtual PassManagerType llvm::PMDataManager::getPassManagerType ( ) const
inlinevirtual

◆ getTopLevelManager()

PMTopLevelManager * llvm::PMDataManager::getTopLevelManager ( )
inline

◆ 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 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().

◆ initializeAnalysisInfo()

void llvm::PMDataManager::initializeAnalysisInfo ( )
inline

Initialize available analysis information.

Definition at line 333 of file LegacyPassManagers.h.

References 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 66 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 62 of file LegacyPassManager.cpp.

References PassDebugging.

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

◆ populateInheritedAnalysis()

void llvm::PMDataManager::populateInheritedAnalysis ( PMStack PMS)
inline

◆ preserveHigherLevelAnalysis()

bool PMDataManager::preserveHigherLevelAnalysis ( Pass P)

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

References P.

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

◆ removeDeadPasses()

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

◆ 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

◆ verifyPreservedAnalysis()

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().

Member Data Documentation

◆ InheritedAnalysis

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

◆ PassVector

SmallVector<Pass *, 16> llvm::PMDataManager::PassVector
protected

◆ TPM

PMTopLevelManager* llvm::PMDataManager::TPM = nullptr
protected

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