[llvm-commits] CVS: llvm/include/llvm/Pass.h PassSupport.h

Chris Lattner sabre at nondot.org
Tue May 1 21:25:54 PDT 2007



Changes in directory llvm/include/llvm:

Pass.h updated: 1.87 -> 1.88
PassSupport.h updated: 1.39 -> 1.40
---
Log message:

revert enough of devang's recent patches to get the tree basically working again


---
Diffs of the changes:  (+20 -20)

 Pass.h        |   14 +++++++-------
 PassSupport.h |   26 +++++++++++++-------------
 2 files changed, 20 insertions(+), 20 deletions(-)


Index: llvm/include/llvm/Pass.h
diff -u llvm/include/llvm/Pass.h:1.87 llvm/include/llvm/Pass.h:1.88
--- llvm/include/llvm/Pass.h:1.87	Tue May  1 16:15:46 2007
+++ llvm/include/llvm/Pass.h	Tue May  1 23:25:30 2007
@@ -34,8 +34,8 @@
 #include <deque>
 #include <map>
 #include <iosfwd>
+#include <typeinfo>
 #include <cassert>
-#include <stdint.h>
 
 namespace llvm {
 
@@ -77,7 +77,7 @@
 ///
 class Pass {
   AnalysisResolver *Resolver;  // Used to resolve analysis
-  intptr_t PassID;
+  const PassInfo *PassInfoCache;
 
   // AnalysisImpls - This keeps track of which passes implement the interfaces
   // that are required by the current pass (to implement getAnalysis()).
@@ -87,7 +87,7 @@
   void operator=(const Pass&);  // DO NOT IMPLEMENT
   Pass(const Pass &);           // DO NOT IMPLEMENT
 public:
-  Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
+  Pass(intptr_t pid = 0) : Resolver(0), PassInfoCache(0) {}
   virtual ~Pass();
 
   /// getPassName - Return a nice clean name for a pass.  This usually
@@ -163,12 +163,12 @@
 
   template<typename AnalysisClass>
   static const PassInfo *getClassPassInfo() {
-    return lookupPassInfo((intptr_t)&AnalysisClass::ID);
+    return lookupPassInfo(typeid(AnalysisClass));
   }
 
   // lookupPassInfo - Return the pass info object for the specified pass class,
   // or null if it is not known.
-  static const PassInfo *lookupPassInfo(intptr_t TI);
+  static const PassInfo *lookupPassInfo(const std::type_info &TI);
 
   /// getAnalysisToUpdate<AnalysisType>() - This function is used by subclasses
   /// to get to the analysis information that might be around that needs to be
@@ -274,7 +274,7 @@
 class FunctionPass : public Pass {
 public:
   FunctionPass(intptr_t pid) : Pass(pid) {}
-
+  
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
@@ -325,7 +325,7 @@
 class BasicBlockPass : public Pass {
 public:
   BasicBlockPass(intptr_t pid) : Pass(pid) {}
-
+  
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///


Index: llvm/include/llvm/PassSupport.h
diff -u llvm/include/llvm/PassSupport.h:1.39 llvm/include/llvm/PassSupport.h:1.40
--- llvm/include/llvm/PassSupport.h:1.39	Tue May  1 16:15:46 2007
+++ llvm/include/llvm/PassSupport.h	Tue May  1 23:25:30 2007
@@ -37,19 +37,19 @@
 class PassInfo {
   const char           *PassName;      // Nice name for Pass
   const char           *PassArgument;  // Command Line argument to run this pass
-  intptr_t             PassID;      
+  const std::type_info &TypeInfo;      // type_info object for this Pass class
   bool IsCFGOnlyPass;                  // Pass only looks at the CFG.
   bool IsAnalysisGroup;                // True if an analysis group.
   std::vector<const PassInfo*> ItfImpl;// Interfaces implemented by this pass
 
-  Pass *(*NormalCtor)();
+  Pass *(*NormalCtor)();               // No argument ctor
 
 public:
   /// PassInfo ctor - Do not call this directly, this should only be invoked
   /// through RegisterPass.
-  PassInfo(const char *name, const char *arg, intptr_t pi,
+  PassInfo(const char *name, const char *arg, const std::type_info &ti,
            Pass *(*normal)() = 0, bool isCFGOnly = false)
-    : PassName(name), PassArgument(arg), PassID(pi), 
+    : PassName(name), PassArgument(arg), TypeInfo(ti), 
       IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) {
   }
 
@@ -65,8 +65,8 @@
   const char *getPassArgument() const { return PassArgument; }
 
   /// getTypeInfo - Return the type_info object for the pass...
-  /// TODO : Rename
-  intptr_t getTypeInfo() const { return PassID; }
+  ///
+  const std::type_info &getTypeInfo() const { return TypeInfo; }
 
   /// isAnalysisGroup - Return true if this is an analysis group, not a normal
   /// pass.
@@ -139,12 +139,12 @@
 
   typedef Pass* (*NormalCtor_t)();
   
-  RegisterPassBase(const char *Name, const char *Arg, intptr_t TI,
+  RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI,
                    NormalCtor_t NormalCtor = 0, bool CFGOnly = false)
     : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) {
     registerPass();
   }
-  RegisterPassBase(intptr_t TI)
+  RegisterPassBase(const std::type_info &TI)
     : PIObj("", "", TI) {
     // This ctor may only be used for analysis groups: it does not auto-register
     // the pass.
@@ -165,7 +165,7 @@
 
   // Register Pass using default constructor...
   RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
-    : RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID,
+  : RegisterPassBase(Name, PassArg, typeid(PassName),
                      (RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) {
   }
 };
@@ -195,8 +195,8 @@
   const PassInfo *ImplementationInfo;
   bool isDefaultImplementation;
 protected:
-  explicit RegisterAGBase(intptr_t InterfaceID,
-                          intptr_t PassID = 0,
+  explicit RegisterAGBase(const std::type_info &Interface,
+                          const std::type_info *Pass = 0,
                           bool isDefault = false);
   void setGroupName(const char *Name);
 };
@@ -204,12 +204,12 @@
 template<typename Interface, bool Default = false>
 struct RegisterAnalysisGroup : public RegisterAGBase {
   explicit RegisterAnalysisGroup(RegisterPassBase &RPB)
-    : RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(),
+    : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(), 
                      Default) {
   }
 
   explicit RegisterAnalysisGroup(const char *Name)
-    : RegisterAGBase((intptr_t) &Interface::ID) {
+  : RegisterAGBase(typeid(Interface)) {
     setGroupName(Name);
   }
 };






More information about the llvm-commits mailing list