aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2006-12-07 21:10:57 +0000
committerDevang Patel <dpatel@apple.com>2006-12-07 21:10:57 +0000
commit1209f416cf2f2ec0f335d91a7c115e3b0a37d603 (patch)
tree2598e63402b3472a5794c6fc5d303e05b322a7a8
parent1b17033bc741814777988b56f5e958355ceb0096 (diff)
downloadexternal_llvm-1209f416cf2f2ec0f335d91a7c115e3b0a37d603.zip
external_llvm-1209f416cf2f2ec0f335d91a7c115e3b0a37d603.tar.gz
external_llvm-1209f416cf2f2ec0f335d91a7c115e3b0a37d603.tar.bz2
Reimplement schedulePass interface. Move it into PMTopLevelManager.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32324 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/PassManager.cpp79
1 files changed, 28 insertions, 51 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 3ab0185..c0aeaa2 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -173,6 +173,33 @@ void PMTopLevelManager::collectLastUses(std::vector<Pass *> &LastUses,
LastUses.push_back(LUI->first);
}
+/// Schedule pass P for execution. Make sure that passes required by
+/// P are run before P is run. Update analysis info maintained by
+/// the manager. Remove dead passes. This is a recursive function.
+void PMTopLevelManager::schedulePass(Pass *P, Pass *PM) {
+
+ // TODO : Allocate function manager for this pass, other wise required set
+ // may be inserted into previous function manager
+
+ AnalysisUsage AnUsage;
+ P->getAnalysisUsage(AnUsage);
+ const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
+ for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
+ E = RequiredSet.end(); I != E; ++I) {
+
+ Pass *AnalysisPass = NULL; // FIXME PM->getAnalysisPass(*I, true);
+ if (!AnalysisPass) {
+ // Schedule this analysis run first.
+ AnalysisPass = (*I)->createPass();
+ schedulePass(AnalysisPass, PM);
+ }
+ }
+
+ // Now all required passes are available.
+ addTopLevelPass(P);
+}
+
+
//===----------------------------------------------------------------------===//
// PMDataManager
@@ -399,18 +426,9 @@ public:
private:
- /// Add a pass into a passmanager queue. This is used by schedulePasses
+ /// Add a pass into a passmanager queue.
bool addPass(Pass *p);
- /// Schedule pass P for execution. Make sure that passes required by
- /// P are run before P is run. Update analysis info maintained by
- /// the manager. Remove dead passes. This is a recursive function.
- void schedulePass(Pass *P);
-
- /// Schedule all passes collected in pass queue using add(). Add all the
- /// schedule passes into various manager's queue using addPass().
- void schedulePasses();
-
// Collection of pass managers
std::vector<ModulePassManager_New *> PassManagers;
@@ -842,46 +860,6 @@ Pass *PassManagerImpl_New::getAnalysisPassFromManager(AnalysisID AID) {
return P;
}
-/// Schedule pass P for execution. Make sure that passes required by
-/// P are run before P is run. Update analysis info maintained by
-/// the manager. Remove dead passes. This is a recursive function.
-void PassManagerImpl_New::schedulePass(Pass *P) {
-
- AnalysisUsage AnUsage;
- P->getAnalysisUsage(AnUsage);
- const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();
- for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
- E = RequiredSet.end(); I != E; ++I) {
-
- Pass *AnalysisPass = getAnalysisPassFromManager(*I);
- if (!AnalysisPass) {
- // Schedule this analysis run first.
- AnalysisPass = (*I)->createPass();
- schedulePass(AnalysisPass);
- }
- setLastUser (AnalysisPass, P);
-
- // Prolong live range of analyses that are needed after an analysis pass
- // is destroyed, for querying by subsequent passes
- const std::vector<AnalysisID> &IDs = AnUsage.getRequiredTransitiveSet();
- for (std::vector<AnalysisID>::const_iterator I = IDs.begin(),
- E = IDs.end(); I != E; ++I) {
- Pass *AP = getAnalysisPassFromManager(*I);
- assert (AP && "Analysis pass is not available");
- setLastUser(AP, P);
- }
- }
- addPass(P);
-}
-
-/// Schedule all passes from the queue by adding them in their
-/// respective manager's queue.
-void PassManagerImpl_New::schedulePasses() {
- for (std::vector<Pass *>::iterator I = passVectorBegin(),
- E = passVectorEnd(); I != E; ++I)
- schedulePass (*I);
-}
-
/// Add pass P to the queue of passes to run.
void PassManagerImpl_New::add(Pass *P) {
// Do not process Analysis now. Analysis is process while scheduling
@@ -906,7 +884,6 @@ bool PassManagerImpl_New::addPass(Pass *P) {
/// whether any of the passes modifies the module, and if so, return true.
bool PassManagerImpl_New::run(Module &M) {
- schedulePasses();
bool Changed = false;
for (std::vector<ModulePassManager_New *>::iterator itr = PassManagers.begin(),
e = PassManagers.end(); itr != e; ++itr) {