Consistency.
[oota-llvm.git] / include / llvm / Pass.h
index 5dd3dba4c6e331d908d3adf283c1158691958a02..cee635bd8a5823748dd954d965e13b2ca1d760ba 100644 (file)
@@ -34,7 +34,6 @@
 #include <deque>
 #include <map>
 #include <iosfwd>
-#include <typeinfo>
 #include <cassert>
 
 namespace llvm {
@@ -46,8 +45,6 @@ class Module;
 class AnalysisUsage;
 class PassInfo;
 class ImmutablePass;
-class BasicBlockPassManager;
-class ModulePassManager;
 class PMStack;
 class AnalysisResolver;
 class PMDataManager;
@@ -77,7 +74,7 @@ typedef enum PassManagerType PassManagerType;
 ///
 class Pass {
   AnalysisResolver *Resolver;  // Used to resolve analysis
-  const PassInfo *PassInfoCache;
+  intptr_t PassID;
 
   // AnalysisImpls - This keeps track of which passes implement the interfaces
   // that are required by the current pass (to implement getAnalysis()).
@@ -87,8 +84,8 @@ class Pass {
   void operator=(const Pass&);  // DO NOT IMPLEMENT
   Pass(const Pass &);           // DO NOT IMPLEMENT
 public:
-  Pass() : Resolver(0), PassInfoCache(0) {}
-  virtual ~Pass() {} // Destructor is virtual so we can be subclassed
+  explicit Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
+  virtual ~Pass();
 
   /// getPassName - Return a nice clean name for a pass.  This usually
   /// implemented in terms of the name that is registered by one of the
@@ -163,12 +160,12 @@ public:
 
   template<typename AnalysisClass>
   static const PassInfo *getClassPassInfo() {
-    return lookupPassInfo(typeid(AnalysisClass));
+    return lookupPassInfo((intptr_t)&AnalysisClass::ID);
   }
 
   // lookupPassInfo - Return the pass info object for the specified pass class,
   // or null if it is not known.
-  static const PassInfo *lookupPassInfo(const std::type_info &TI);
+  static const PassInfo *lookupPassInfo(intptr_t TI);
 
   /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
   /// to get to the analysis information that might be around that needs to be
@@ -232,6 +229,7 @@ public:
     return PMT_ModulePassManager;
   }
 
+  explicit ModulePass(intptr_t pid) : Pass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ModulePass();
 };
@@ -256,6 +254,7 @@ public:
   ///
   virtual bool runOnModule(Module &M) { return false; }
 
+  explicit ImmutablePass(intptr_t pid) : ModulePass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ImmutablePass();
 };
@@ -271,6 +270,8 @@ public:
 ///
 class FunctionPass : public Pass {
 public:
+  explicit FunctionPass(intptr_t pid) : Pass(pid) {}
+
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
@@ -320,6 +321,8 @@ public:
 ///
 class BasicBlockPass : public Pass {
 public:
+  explicit BasicBlockPass(intptr_t pid) : Pass(pid) {}
+
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///