LLVM  13.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]
Collaboration diagram for llvm::PMDataManager:
Collaboration 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. 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 std::tuple< Pass *, bool > 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...
 
PassfindAnalysisPass (AnalysisID AID, bool Direction)
 Find the pass that implements Analysis AID. More...
 
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. 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

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

llvm::PMDataManager::PMDataManager ( )
inlineexplicit

Definition at line 298 of file LegacyPassManagers.h.

References initializeAnalysisInfo().

◆ ~PMDataManager()

PMDataManager::~PMDataManager ( )
virtual

Definition at line 1307 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 1279 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 1103 of file LegacyPassManager.cpp.

References findAnalysisPass(), llvm::PMTopLevelManager::findAnalysisUsage(), llvm::AnalysisUsage::getRequiredSet(), llvm::AnalysisUsage::getUsedSet(), P, 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 92 of file LegacyPassManager.cpp.

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

Referenced by llvm::LPPassManager::runOnFunction(), and llvm::FPPassManager::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 1141 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 
)

◆ getAsPass()

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

◆ getAvailableAnalysis()

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

Definition at line 388 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 1301 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 1124 of file LegacyPassManager.cpp.

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

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

◆ initializeAnalysisInfo()

void llvm::PMDataManager::initializeAnalysisInfo ( )
inline

Initialize available analysis information.

Definition at line 336 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 70 of file LegacyPassManager.cpp.

References F, InstrCount, and M.

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

◆ isPassDebuggingExecutionsOrMore()

bool PMDataManager::isPassDebuggingExecutionsOrMore ( ) const
protected

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

Definition at line 66 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 878 of file LegacyPassManager.cpp.

References assert(), llvm::numbers::e, llvm::PMTopLevelManager::findAnalysisPassInfo(), llvm::PassInfo::getInterfacesImplemented(), i, P, and TPM.

Referenced by add(), llvm::LPPassManager::runOnFunction(), llvm::RGPassManager::runOnFunction(), and llvm::FPPassManager::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 976 of file LegacyPassManager.cpp.

References llvm::PMTopLevelManager::collectLastUses(), llvm::dbgs(), freePass(), P, PassDebugging, and TPM.

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

◆ removeNotPreservedAnalysis()

void PMDataManager::removeNotPreservedAnalysis ( Pass P)

◆ setDepth()

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

Definition at line 368 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 912 of file LegacyPassManager.cpp.

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

Referenced by llvm::LPPassManager::runOnFunction(), llvm::RGPassManager::runOnFunction(), and llvm::FPPassManager::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
protected

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