Eliminate the TopLevelManagerType enum; instead, just make
authorDan Gohman <gohman@apple.com>
Mon, 16 Aug 2010 21:38:42 +0000 (21:38 +0000)
committerDan Gohman <gohman@apple.com>
Mon, 16 Aug 2010 21:38:42 +0000 (21:38 +0000)
PMTopLevelManager's constructor take a PMDataManager *, which already
provides the needed abstraction support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111189 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/PassManagers.h
lib/VMCore/PassManager.cpp

index 4ef73b878ae8b435773fe224b026370ab9d788eb..e918091b4a06597aab65bcccf04fc1643f4f9f76 100644 (file)
@@ -98,13 +98,6 @@ namespace llvm {
   class Timer;
   class PMDataManager;
 
-/// FunctionPassManager and PassManager, two top level managers, serve 
-/// as the public interface of pass manager infrastructure.
-enum TopLevelManagerType {
-  TLM_Function,  // FunctionPassManager
-  TLM_Pass       // PassManager
-};
-    
 // enums for debugging strings
 enum PassDebuggingString {
   EXECUTION_MSG, // "Executing Pass '"
@@ -199,7 +192,7 @@ public:
   /// Find analysis usage information for the pass P.
   AnalysisUsage *findAnalysisUsage(Pass *P);
 
-  explicit PMTopLevelManager(enum TopLevelManagerType t);
+  explicit PMTopLevelManager(PMDataManager *PMDM);
   virtual ~PMTopLevelManager(); 
 
   /// Add immutable pass and initialize it.
index 547036a7818956826dc46ced7825919b302383fb..df96190b43b27ac274624382acbe0209287ee1cc 100644 (file)
@@ -226,7 +226,7 @@ public:
   static char ID;
   explicit FunctionPassManagerImpl(int Depth) :
     Pass(PT_PassManager, ID), PMDataManager(Depth),
-    PMTopLevelManager(TLM_Function), wasRun(false) { }
+    PMTopLevelManager(new FPPassManager(1)), wasRun(false) {}
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
@@ -386,7 +386,7 @@ public:
   static char ID;
   explicit PassManagerImpl(int Depth) :
     Pass(PT_PassManager, ID), PMDataManager(Depth),
-                              PMTopLevelManager(TLM_Pass) { }
+                              PMTopLevelManager(new MPPassManager(1)) {}
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
   /// the Pass to the PassManager.  When the PassManager is destroyed, the pass
@@ -490,18 +490,10 @@ static TimingInfo *TheTimeInfo;
 // PMTopLevelManager implementation
 
 /// Initialize top level manager. Create first pass manager.
-PMTopLevelManager::PMTopLevelManager(enum TopLevelManagerType t) {
-  if (t == TLM_Pass) {
-    MPPassManager *MPP = new MPPassManager(1);
-    MPP->setTopLevelManager(this);
-    addPassManager(MPP);
-    activeStack.push(MPP);
-  } else if (t == TLM_Function) {
-    FPPassManager *FPP = new FPPassManager(1);
-    FPP->setTopLevelManager(this);
-    addPassManager(FPP);
-    activeStack.push(FPP);
-  }
+PMTopLevelManager::PMTopLevelManager(PMDataManager *PMDM) {
+  PMDM->setTopLevelManager(this);
+  addPassManager(PMDM);
+  activeStack.push(PMDM);
 }
 
 /// Set pass P as the last user of the given analysis passes.