[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp

Devang Patel dpatel at apple.com
Mon Nov 13 14:40:23 PST 2006



Changes in directory llvm/lib/VMCore:

PassManager.cpp updated: 1.20 -> 1.21
---
Log message:

Check currently available anlysis in active managers.


---
Diffs of the changes:  (+55 -11)

 PassManager.cpp |   66 ++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 11 deletions(-)


Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.20 llvm/lib/VMCore/PassManager.cpp:1.21
--- llvm/lib/VMCore/PassManager.cpp:1.20	Fri Nov 10 20:22:31 2006
+++ llvm/lib/VMCore/PassManager.cpp	Mon Nov 13 16:40:09 2006
@@ -33,7 +33,9 @@
   bool manageablePass(Pass *P);
 
   /// Return true IFF AnalysisID AID is currently available.
-  bool analysisCurrentlyAvailable(AnalysisID AID);
+  bool isAnalysisAvailable(AnalysisID AID) {
+    return (AvailableAnalysis.count(AID) != 0);
+  }
 
   /// Augment RequiredAnalysis by adding analysis required by pass P.
   void noteDownRequiredAnalysis(Pass *P);
@@ -85,6 +87,9 @@
   /// whether any of the passes modifies the function, and if so, return true.
   bool runOnFunction(Function &F);
 
+  /// Return true IFF AnalysisID AID is currently available.
+  bool analysisCurrentlyAvailable(AnalysisID AID);
+
 private:
 };
 
@@ -115,6 +120,9 @@
   /// so, return true.
   bool runOnModule(Module &M);
 
+  /// Return true IFF AnalysisID AID is currently available.
+  bool analysisCurrentlyAvailable(AnalysisID AID);
+
 private:
   // Active Pass Managers
   BasicBlockPassManager_New *activeBBPassManager;
@@ -134,6 +142,9 @@
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
   bool runOnModule(Module &M);
+
+  /// Return true IFF AnalysisID AID is currently available.
+  bool analysisCurrentlyAvailable(AnalysisID AID);
   
 private:
   // Active Pass Manager
@@ -155,6 +166,9 @@
   /// whether any of the passes modifies the module, and if so, return true.
   bool run(Module &M);
 
+  /// Return true IFF AnalysisID AID is currently available.
+  bool analysisCurrentlyAvailable(AnalysisID AID);
+
 private:
 
   /// Add a pass into a passmanager queue. This is used by schedulePasses
@@ -202,13 +216,6 @@
   return true;
 }
 
-/// Return true IFF AnalysisID AID is currently available.
-bool CommonPassManagerImpl::analysisCurrentlyAvailable(AnalysisID AID) {
-
-  // TODO
-  return false;
-}
-
 /// Augment RequiredAnalysis by adding analysis required by pass P.
 void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) {
   AnalysisUsage AnUsage;
@@ -308,6 +315,11 @@
   return Changed;
 }
 
+/// Return true IFF AnalysisID AID is currently available.
+bool BasicBlockPassManager_New::analysisCurrentlyAvailable(AnalysisID AID) {
+  return isAnalysisAvailable(AID);
+}
+
 // FunctionPassManager_New implementation
 /// Create new Function pass manager
 FunctionPassManager_New::FunctionPassManager_New() {
@@ -387,6 +399,19 @@
   return Changed;
 }
 
+/// Return true IFF AnalysisID AID is currently available.
+bool FunctionPassManagerImpl_New::analysisCurrentlyAvailable(AnalysisID AID) {
+
+  if (isAnalysisAvailable(AID))
+    return true;
+
+  if (activeBBPassManager && 
+      activeBBPassManager->isAnalysisAvailable(AID))
+    return true;
+
+  // TODO : Check inactive managers
+  return false;
+}
 
 // ModulePassManager implementation
 
@@ -442,6 +467,27 @@
   return Changed;
 }
 
+/// Return true IFF AnalysisID AID is currently available.
+bool ModulePassManager_New::analysisCurrentlyAvailable(AnalysisID AID) {
+
+  if (isAnalysisAvailable(AID))
+    return true;
+
+  if (activeFunctionPassManager && 
+      activeFunctionPassManager->isAnalysisAvailable(AID))
+    return true;
+
+  // TODO : Check inactive managers
+  return false;
+}
+
+/// Return true IFF AnalysisID AID is currently available.
+bool PassManagerImpl_New::analysisCurrentlyAvailable(AnalysisID AID) {
+
+  // TODO : Check inactive managers
+  return activeManager->analysisCurrentlyAvailable(AID);
+}
+
 /// 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.
@@ -453,9 +499,7 @@
   for (std::vector<AnalysisID>::const_iterator I = RequiredSet.begin(),
          E = RequiredSet.end(); I != E; ++I) {
 
-    // TODO Check if Analysis is currently available or not.
-    bool available = false;
-    if (!available) {
+    if (!analysisCurrentlyAvailable(*I)) {
       // Schedule this analysis run first.
       Pass *AP = (*I)->createPass();
       schedulePass(AP);






More information about the llvm-commits mailing list