diff options
author | Devang Patel <dpatel@apple.com> | 2006-12-07 23:05:44 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2006-12-07 23:05:44 +0000 |
commit | c17bbb6da7e17c06c1f0ae7baa2f151db0e966d9 (patch) | |
tree | 0cc6a6ad76512aa056d9970451142d2cf036403f /lib/VMCore/PassManager.cpp | |
parent | 1c411dee4f406e33d70666898f62ab9ba23bb73d (diff) |
New method, PMDataManager::collectRequiredAnalysisPasses()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32338 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/PassManager.cpp')
-rw-r--r-- | lib/VMCore/PassManager.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 76869fe464..99e7bc5872 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -241,7 +241,7 @@ public: /// AvailableAnalysis appropriately if ProcessAnalysis is true. void addPassToManager (Pass *P, bool ProcessAnalysis = true); - // Initialize available analysis information. + /// Initialize available analysis information. void initializeAnalysisInfo() { AvailableAnalysis.clear(); @@ -252,12 +252,16 @@ public: recordAvailableAnalysis(*I); } - // 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. - // - void initializeAnalysisImpl(Pass *P); + /// Populate RequiredPasses with the analysis pass that are required by + /// pass P. + void collectRequiredAnalysisPasses(std::vector<Pass *> &RequiredPasses, + 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. + void initializeAnalysisImpl(Pass *P); inline std::vector<Pass *>::iterator passVectorBegin() { return PassVector.begin(); @@ -520,6 +524,22 @@ void PMDataManager::addPassToManager(Pass *P, PassVector.push_back(P); } +/// Populate RequiredPasses with the analysis pass that are required by +/// pass P. +void PMDataManager::collectRequiredAnalysisPasses(std::vector<Pass *> &RP, + 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 = NULL; //FIXME findAnalysisPass(*I,true); + assert (AnalysisPass && "Analysis pass is not available"); + RP.push_back(AnalysisPass); + } +} + // 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 |