Update new pass managers to use PassManagerAnalysisHelper API.
authorDevang Patel <dpatel@apple.com>
Tue, 7 Nov 2006 22:56:50 +0000 (22:56 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 7 Nov 2006 22:56:50 +0000 (22:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31526 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/PassManager.cpp

index 766f8ce8b461c757a177290112c2e1f705705a5b..de6ce20a1e9080fb4b6a79e4ce3c809d8e40a4d8 100644 (file)
@@ -69,8 +69,13 @@ BasicBlockPassManager_New::addPass (Pass *P) {
   if (!BP)
     return false;
 
-  // TODO: Check if it suitable to manage P using this BasicBlockPassManager
-  // or we need another instance of BasicBlockPassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+    return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   // Add pass
   PassVector.push_back(BP);
@@ -124,8 +129,13 @@ FunctionPassManager_New::addPass (Pass *P) {
   if (!FP)
     return false;
 
-  // TODO: Check if it suitable to manage P using this FunctionPassManager
-  // or we need another instance of FunctionPassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+    return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   PassVector.push_back(FP);
   activeBBPassManager = NULL;
@@ -179,8 +189,13 @@ ModulePassManager_New::addPass (Pass *P) {
   if (!MP)
     return false;
 
-  // TODO: Check if it suitable to manage P using this ModulePassManager
-  // or we need another instance of ModulePassManager
+  // If this pass does not preserve anlysis that is used by other passes
+  // managed by this manager than it is not a suiable pass for this manager.
+  if (!manageablePass (P))
+    return false;
+
+  // Take a note of analysis required by this pass.
+  noteDownRequiredAnalysis(P);
 
   PassVector.push_back(MP);
   activeFunctionPassManager = NULL;