[llvm-commits] CVS: llvm/lib/VMCore/PassManagerT.h

Chris Lattner lattner at cs.uiuc.edu
Mon Jan 2 23:05:29 PST 2006



Changes in directory llvm/lib/VMCore:

PassManagerT.h updated: 1.58 -> 1.59
---
Log message:

Finally commit Saem's 'patch #3' to refactor the pass manager


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

 PassManagerT.h |  135 +++++++++++++++++++++++++++++++++------------------------
 1 files changed, 80 insertions(+), 55 deletions(-)


Index: llvm/lib/VMCore/PassManagerT.h
diff -u llvm/lib/VMCore/PassManagerT.h:1.58 llvm/lib/VMCore/PassManagerT.h:1.59
--- llvm/lib/VMCore/PassManagerT.h:1.58	Fri Dec 30 14:00:46 2005
+++ llvm/lib/VMCore/PassManagerT.h	Tue Jan  3 01:05:17 2006
@@ -511,7 +511,7 @@
     // batcher class then we can reorder to pass to execute before the batcher
     // does, which will potentially allow us to batch more passes!
     //
-    //const std::vector<AnalysisID> &ProvidedSet = AnUsage.getProvidedSet();
+    // const std::vector<AnalysisID> &ProvidedSet = AnUsage.getProvidedSet();
     if (Batcher /*&& ProvidedSet.empty()*/)
       closeBatcher();                     // This pass cannot be batched!
 
@@ -630,18 +630,6 @@
 // into a single unit.
 //
 class BasicBlockPassManager {
-  //TODO:Start absorbing PassManagerTraits<BasicBlock>
-};
-
-
-//===----------------------------------------------------------------------===//
-// PassManagerTraits<BasicBlock> Specialization
-//
-// This pass manager is used to group together all of the BasicBlockPass's
-// into a single unit.
-//
-template<> class PassManagerTraits<BasicBlock> : public BasicBlockPass,
-                                                 public BasicBlockPassManager {
 public:
   // PassClass - The type of passes tracked by this PassManager
   typedef BasicBlockPass PassClass;
@@ -664,27 +652,47 @@
   // PMType - The type of the passmanager that subclasses this class
   typedef PassManagerT<BasicBlock> PMType;
 
+  // getPMName() - Return the name of the unit the PassManager operates on for
+  // debugging.
+  virtual const char *getPMName() const { return "BasicBlock"; }
+  
+  virtual const char *getPassName() const { return "BasicBlock Pass Manager"; }
+
+  // TODO:Start absorbing PassManagerTraits<BasicBlock>
+};
+
+
+//===----------------------------------------------------------------------===//
+// PassManagerTraits<BasicBlock> Specialization
+//
+// This pass manager is used to group together all of the BasicBlockPass's
+// into a single unit.
+//
+template<> class PassManagerTraits<BasicBlock> : public BasicBlockPass,
+                                                 public BasicBlockPassManager {
+public:
   // runPass - Specify how the pass should be run on the UnitType
   static bool runPass(PassClass *P, BasicBlock *M) {
     // todo, init and finalize
     return P->runOnBasicBlock(*M);
   }
-
-  // getPMName() - Return the name of the unit the PassManager operates on for
-  // debugging.
-  const char *getPMName() const { return "BasicBlock"; }
-  virtual const char *getPassName() const { return "BasicBlock Pass Manager"; }
-
+  
   // Implement the BasicBlockPass interface...
   virtual bool doInitialization(Module &M);
   virtual bool doInitialization(Function &F);
   virtual bool runOnBasicBlock(BasicBlock &BB);
   virtual bool doFinalization(Function &F);
   virtual bool doFinalization(Module &M);
-
+  
+  // Forwarded
+  virtual const char *getPassName() const { 
+    return BasicBlockPassManager::getPassName();
+  }
+  
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
   }
+
 };
 
 
@@ -695,18 +703,6 @@
 // into a single unit.
 //
 class FunctionPassManagerT {
-  //TODO:Start absorbing PassManagerTraits<Function>
-};
-
-
-//===----------------------------------------------------------------------===//
-// PassManagerTraits<Function> Specialization
-//
-// This pass manager is used to group together all of the FunctionPass's
-// into a single unit.
-//
-template<> class PassManagerTraits<Function> : public FunctionPass, 
-                                               public FunctionPassManagerT {
 public:
   // PassClass - The type of passes tracked by this PassManager
   typedef FunctionPass PassClass;
@@ -722,25 +718,44 @@
 
   // PMType - The type of the passmanager that subclasses this class
   typedef PassManagerT<Function> PMType;
+  
+  // getPMName() - Return the name of the unit the PassManager operates on for
+  // debugging.
+  virtual const char *getPMName() const { return "Function"; }
+  
+  virtual const char *getPassName() const { return "Function Pass Manager"; }
 
+  // TODO:Start absorbing PassManagerTraits<Function>
+};
+
+
+//===----------------------------------------------------------------------===//
+// PassManagerTraits<Function> Specialization
+//
+// This pass manager is used to group together all of the FunctionPass's
+// into a single unit.
+//
+template<> class PassManagerTraits<Function> : public FunctionPass, 
+                                               public FunctionPassManagerT {
+public:
   // runPass - Specify how the pass should be run on the UnitType
   static bool runPass(PassClass *P, Function *F) {
     return P->runOnFunction(*F);
   }
-
-  // getPMName() - Return the name of the unit the PassManager operates on for
-  // debugging.
-  const char *getPMName() const { return "Function"; }
-  virtual const char *getPassName() const { return "Function Pass Manager"; }
-
+  
   // Implement the FunctionPass interface...
   virtual bool doInitialization(Module &M);
   virtual bool runOnFunction(Function &F);
   virtual bool doFinalization(Module &M);
-
+  
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
   }
+  
+  // Forwarded
+  virtual const char *getPassName() const { 
+    return FunctionPassManagerT::getPassName();
+  }
 };
 
 
@@ -750,17 +765,6 @@
 // This is the top level PassManager implementation that holds generic passes.
 //
 class ModulePassManager {
-  //TODO:Start absorbing PassManagerTraits<Module>
-};
-
-
-//===----------------------------------------------------------------------===//
-// PassManagerTraits<Module> Specialization
-//
-// This is the top level PassManager implementation that holds generic passes.
-//
-template<> class PassManagerTraits<Module> : public ModulePass, 
-                                             public ModulePassManager {
 public:
   // PassClass - The type of passes tracked by this PassManager
   typedef ModulePass PassClass;
@@ -773,19 +777,40 @@
 
   // ParentClass - The type of the parent PassManager...
   typedef AnalysisResolver ParentClass;
-
-  // runPass - Specify how the pass should be run on the UnitType
-  static bool runPass(PassClass *P, Module *M) { return P->runOnModule(*M); }
-
+  
   // getPMName() - Return the name of the unit the PassManager operates on for
   // debugging.
-  const char *getPMName() const { return "Module"; }
   virtual const char *getPassName() const { return "Module Pass Manager"; }
+  
+  // getPMName() - Return the name of the unit the PassManager operates on for
+  // debugging.
+  virtual const char *getPMName() const { return "Module"; }
+  
+  
+  // TODO:Start absorbing PassManagerTraits<Module>
+};
 
+
+//===----------------------------------------------------------------------===//
+// PassManagerTraits<Module> Specialization
+//
+// This is the top level PassManager implementation that holds generic passes.
+//
+template<> class PassManagerTraits<Module> : public ModulePass, 
+                                             public ModulePassManager {
+public:
+  // runPass - Specify how the pass should be run on the UnitType
+  static bool runPass(PassClass *P, Module *M) { return P->runOnModule(*M); }
+  
   // runOnModule - Implement the PassManager interface.
   bool runOnModule(Module &M) {
     return ((PassManagerT<Module>*)this)->runOnUnit(&M);
   }
+  
+  // Forwarded
+  virtual const char *getPassName() const { 
+    return ModulePassManager::getPassName();
+  }
 };
 
 






More information about the llvm-commits mailing list