Add preparePassManager() hook. This allows each pass to check whether

current active pass manager is appropriate or not.

A loop pass may consider current LPPassManager in appropraite if loop
pass is not preserving analysis information that is used by other
passes managed by current LPPassManager. In such situation, loop pass
can pop current LPPassManager from the PMStack using this  hook
and use new LPPassManager for itself.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Devang Patel 2007-03-06 01:06:16 +00:00
parent b9a7bea99c
commit 22a1cf9d3a
2 changed files with 8 additions and 0 deletions

View File

@ -119,8 +119,13 @@ public:
void print(std::ostream *O, const Module *M) const { if (O) print(*O, M); }
void dump() const; // dump - call print(std::cerr, 0);
/// Each pass is responsible for assigning a pass manager to itself.
/// PMS is the stack of available pass manager.
virtual void assignPassManager(PMStack &PMS,
PassManagerType T = PMT_Unknown) {}
/// Check if available pass managers are suitable for this pass or not.
virtual void preparePassManager(PMStack &PMS) {}
// Access AnalysisResolver
inline void setResolver(AnalysisResolver *AR) { Resolver = AR; }
inline AnalysisResolver *getResolver() { return Resolver; }

View File

@ -385,6 +385,9 @@ void PMTopLevelManager::schedulePass(Pass *P) {
if (findAnalysisPass(P->getPassInfo()))
return;
// Give pass a chance to prepare the stage.
P->preparePassManager(activeStack);
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();