Index: lib/VMCore/PassManagerT.h
===================================================================
RCS file: /var/cvs/llvm/llvm/lib/VMCore/PassManagerT.h,v
retrieving revision 1.65
diff -U3 -r1.65 PassManagerT.h
--- lib/VMCore/PassManagerT.h	8 Jan 2006 22:57:07 -0000	1.65
+++ lib/VMCore/PassManagerT.h	10 Jan 2006 06:45:36 -0000
@@ -31,6 +31,8 @@
 
 namespace llvm {
 
+class LoopPass : public Pass {}; // Temporary.
+
 //===----------------------------------------------------------------------===//
 // Pass debugging information.  Often it is useful to find out what pass is
 // running when a crash occurs in a utility.  When this library is compiled with
@@ -186,6 +188,116 @@
   typedef ModulePassManager PMType;
 };
 
+// TODO: Start migration towards a single passmanagert.  This PMT will manage 
+// all passes as one, rather than having any sort of hierarchy.  The trick is 
+// to have all the passes wrapped into a single abstract PassUnit.  Each 
+// PassUnit will then have concrete implmentations for all the various 
+// passes, such as, module, function, basicblock, loop, callgraphscc, and 
+// immutable.  These PassUnit will provide a single point of entry as an 
+// interface while its concrete implementations will handle all the pass
+// specific details.  Then a two types of PassCollection will be required, 
+// one ordered and another unordered.  This will allow either batches of 
+// Passes which can be run in parallel (unordered) or a sequence of Passes 
+// which depend upon each other.
+
+//The following is the foundation for the above.
+
+class PassUnit {
+  Pass *pass;
+  
+  enum Traversal { 
+    LINEAR,      // Standard top down traversal.
+    CALLGRAPHSCC // Bottom Up Traversal
+  };
+  
+  Traversal traversal;
+  
+  std::vector<Pass*> RequiredPasses;
+  
+public:
+  PassUnit(Traversal traversal = LINEAR, Pass *Pass) : 
+    traversal(traversal),
+  
+  virtual const char *getPMName() const =0;
+  
+  virtual const char *getPassName() const =0;
+
+  virtual bool runPass(PassClass *P, UnitType *M) =0;
+};
+
+class BBPassUnit : public PassUnit {
+  BasicBlockPass *BBPass;
+  
+public:
+  BBPassUnit(Traversal traversal = LINEAR, BasicBlockPass *Pass) : 
+    PassUnit::traversal(traversal), 
+    PassUnit::Pass(static_cast<Pass*>(Pass))
+    BBPassUnit::BBPass(Pass) {}
+};
+
+class LPassUnit : public PassUnit {
+  LoopPass *LPass;
+  
+public:
+  LPassUnit(Traversal traversal = LINEAR, LoopPass *Pass) : 
+    PassUnit::traversal(traversal), 
+    PassUnit::Pass(static_cast<Pass*>(Pass))
+    LPassUnit::LPass(Pass) {}
+};
+
+class FPassUnit : public PassUnit {
+  FunctionPass *FPass;
+  
+public:
+  FPassUnit(Traversal traversal = LINEAR, FunctionPass *Pass) : 
+    PassUnit::traversal(traversal), 
+    PassUnit::Pass(static_cast<Pass*>(Pass))
+    FPassUnit::FPass(Pass) {}
+};
+
+// For CallGraphSCC passes, really they're a FunctionPass for instance told to 
+// change traversal methods, this adds to their requiredPasses CallGraphSCC 
+// and when told to run, simply checks the traversal and uses CGSCC bottom-up.
+
+class MPassUnit : public PassUnit {
+  ModulePass *MPass;
+  
+public:
+  MPassUnit(Traversal traversal = LINEAR, ModulePass *Pass) : 
+    PassUnit::traversal(traversal), 
+    PassUnit::Pass(static_cast<Pass*>(Pass))
+    MPassUnit::MPass(Pass) {}
+};
+
+// PassCollection and its implmentations will actually posses a significant 
+// amount of the logic in terms of handling passes.  The passmanager will in 
+// fact be a simple interface and entry point.
+class PassCollection {
+public:
+  enum Ordering {
+    ORDERED,
+    UNORDERED
+  };
+  
+private:
+  Ordering order;
+  
+public:
+  PassCollection(Ordering order) : order(order) {}
+  virtual void add(PassUnit pass) = 0;
+  virtual bool remove(PassUnit pass) = 0; // false if pass is not present.
+  virtual void runPasses() = 0;
+  
+  // TODO: Figure out a reasonable data access strategy, might just be 
+  // iterators and potentionally returning vectors.  The actual storage 
+  // is thankfully flexible, so for instance in the case of LoopPasses, we 
+  // should be able to use a PriorityQueue and not have that explode in our 
+  // faces.
+};
+
+// TODO: Hammer out a bit of the PassCollection Implementations.
+
+// END OF NEW PASSMANAGER
 
 //===----------------------------------------------------------------------===//
 // PassManagerT - Container object for passes.  The PassManagerT destructor
