Do not use typeinfo to identify pass in pass manager.
authorDevang Patel <dpatel@apple.com>
Tue, 1 May 2007 21:15:47 +0000 (21:15 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 1 May 2007 21:15:47 +0000 (21:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8

154 files changed:
include/llvm/Analysis/AliasAnalysis.h
include/llvm/Analysis/CallGraph.h
include/llvm/Analysis/Dominators.h
include/llvm/Analysis/FindUsedTypes.h
include/llvm/Analysis/IntervalPartition.h
include/llvm/Analysis/LoopInfo.h
include/llvm/Analysis/LoopPass.h
include/llvm/Analysis/PostDominators.h
include/llvm/Analysis/ProfileInfo.h
include/llvm/Analysis/ScalarEvolution.h
include/llvm/Analysis/ValueNumbering.h
include/llvm/Assembly/PrintModulePass.h
include/llvm/Bytecode/WriteBytecodePass.h
include/llvm/CallGraphSCCPass.h
include/llvm/CodeGen/AsmPrinter.h
include/llvm/CodeGen/LiveIntervalAnalysis.h
include/llvm/CodeGen/LiveVariables.h
include/llvm/CodeGen/MachineFunctionPass.h
include/llvm/CodeGen/MachineModuleInfo.h
include/llvm/CodeGen/SelectionDAGISel.h
include/llvm/Pass.h
include/llvm/PassManagers.h
include/llvm/PassSupport.h
include/llvm/Target/TargetData.h
include/llvm/Transforms/RSProfiling.h
include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
lib/Analysis/AliasAnalysis.cpp
lib/Analysis/AliasAnalysisCounter.cpp
lib/Analysis/AliasAnalysisEvaluator.cpp
lib/Analysis/AliasDebugger.cpp
lib/Analysis/AliasSetTracker.cpp
lib/Analysis/BasicAliasAnalysis.cpp
lib/Analysis/CFGPrinter.cpp
lib/Analysis/IPA/Andersens.cpp
lib/Analysis/IPA/CallGraph.cpp
lib/Analysis/IPA/CallGraphSCCPass.cpp
lib/Analysis/IPA/FindUsedTypes.cpp
lib/Analysis/IPA/GlobalsModRef.cpp
lib/Analysis/InstCount.cpp
lib/Analysis/IntervalPartition.cpp
lib/Analysis/LoadValueNumbering.cpp
lib/Analysis/LoopInfo.cpp
lib/Analysis/LoopPass.cpp
lib/Analysis/PostDominators.cpp
lib/Analysis/ProfileInfo.cpp
lib/Analysis/ProfileInfoLoaderPass.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Analysis/ValueNumbering.cpp
lib/Bytecode/Writer/Writer.cpp
lib/CodeGen/AsmPrinter.cpp
lib/CodeGen/BranchFolding.cpp
lib/CodeGen/ELFWriter.cpp
lib/CodeGen/ELFWriter.h
lib/CodeGen/LiveIntervalAnalysis.cpp
lib/CodeGen/LiveVariables.cpp
lib/CodeGen/MachOWriter.cpp
lib/CodeGen/MachOWriter.h
lib/CodeGen/MachineFunction.cpp
lib/CodeGen/MachineModuleInfo.cpp
lib/CodeGen/PHIElimination.cpp
lib/CodeGen/PrologEpilogInserter.cpp
lib/CodeGen/RegAllocLinearScan.cpp
lib/CodeGen/RegAllocLocal.cpp
lib/CodeGen/RegAllocSimple.cpp
lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
lib/CodeGen/TwoAddressInstructionPass.cpp
lib/CodeGen/UnreachableBlockElim.cpp
lib/Target/ARM/ARMConstantIslandPass.cpp
lib/Target/ARM/ARMLoadStoreOptimizer.cpp
lib/Target/Alpha/AlphaBranchSelector.cpp
lib/Target/Alpha/AlphaCodeEmitter.cpp
lib/Target/Alpha/AlphaLLRP.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/IA64/IA64Bundling.cpp
lib/Target/MSIL/MSILWriter.cpp
lib/Target/MSIL/MSILWriter.h
lib/Target/PowerPC/PPCBranchSelector.cpp
lib/Target/PowerPC/PPCCodeEmitter.cpp
lib/Target/Sparc/DelaySlotFiller.cpp
lib/Target/Sparc/FPMover.cpp
lib/Target/TargetData.cpp
lib/Target/X86/X86CodeEmitter.cpp
lib/Target/X86/X86FloatingPoint.cpp
lib/Transforms/Hello/Hello.cpp
lib/Transforms/IPO/ArgumentPromotion.cpp
lib/Transforms/IPO/ConstantMerge.cpp
lib/Transforms/IPO/DeadArgumentElimination.cpp
lib/Transforms/IPO/DeadTypeElimination.cpp
lib/Transforms/IPO/ExtractFunction.cpp
lib/Transforms/IPO/GlobalDCE.cpp
lib/Transforms/IPO/GlobalOpt.cpp
lib/Transforms/IPO/IPConstantPropagation.cpp
lib/Transforms/IPO/IndMemRemoval.cpp
lib/Transforms/IPO/InlineSimple.cpp
lib/Transforms/IPO/Inliner.cpp
lib/Transforms/IPO/Inliner.h
lib/Transforms/IPO/Internalize.cpp
lib/Transforms/IPO/LoopExtractor.cpp
lib/Transforms/IPO/LowerSetJmp.cpp
lib/Transforms/IPO/PruneEH.cpp
lib/Transforms/IPO/RaiseAllocations.cpp
lib/Transforms/IPO/SimplifyLibCalls.cpp
lib/Transforms/IPO/StripDeadPrototypes.cpp
lib/Transforms/IPO/StripSymbols.cpp
lib/Transforms/Instrumentation/BlockProfiling.cpp
lib/Transforms/Instrumentation/EdgeProfiling.cpp
lib/Transforms/Instrumentation/RSProfiling.cpp
lib/Transforms/Instrumentation/RSProfiling.h
lib/Transforms/Scalar/ADCE.cpp
lib/Transforms/Scalar/BasicBlockPlacement.cpp
lib/Transforms/Scalar/CodeGenPrepare.cpp
lib/Transforms/Scalar/CondPropagate.cpp
lib/Transforms/Scalar/ConstantProp.cpp
lib/Transforms/Scalar/CorrelatedExprs.cpp
lib/Transforms/Scalar/DCE.cpp
lib/Transforms/Scalar/DeadStoreElimination.cpp
lib/Transforms/Scalar/GCSE.cpp
lib/Transforms/Scalar/IndVarSimplify.cpp
lib/Transforms/Scalar/InstructionCombining.cpp
lib/Transforms/Scalar/LICM.cpp
lib/Transforms/Scalar/LoopRotation.cpp
lib/Transforms/Scalar/LoopStrengthReduce.cpp
lib/Transforms/Scalar/LoopUnroll.cpp
lib/Transforms/Scalar/LoopUnswitch.cpp
lib/Transforms/Scalar/LowerGC.cpp
lib/Transforms/Scalar/LowerPacked.cpp
lib/Transforms/Scalar/PredicateSimplifier.cpp
lib/Transforms/Scalar/Reassociate.cpp
lib/Transforms/Scalar/Reg2Mem.cpp
lib/Transforms/Scalar/SCCP.cpp
lib/Transforms/Scalar/ScalarReplAggregates.cpp
lib/Transforms/Scalar/SimplifyCFG.cpp
lib/Transforms/Scalar/TailDuplication.cpp
lib/Transforms/Scalar/TailRecursionElimination.cpp
lib/Transforms/Utils/BreakCriticalEdges.cpp
lib/Transforms/Utils/LCSSA.cpp
lib/Transforms/Utils/LoopSimplify.cpp
lib/Transforms/Utils/LowerAllocations.cpp
lib/Transforms/Utils/LowerInvoke.cpp
lib/Transforms/Utils/LowerSelect.cpp
lib/Transforms/Utils/LowerSwitch.cpp
lib/Transforms/Utils/Mem2Reg.cpp
lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/Dominators.cpp
lib/VMCore/Pass.cpp
lib/VMCore/PassManager.cpp
lib/VMCore/Verifier.cpp
tools/bugpoint/ExtractFunction.cpp
tools/bugpoint/TestPasses.cpp
tools/opt/AnalysisWrappers.cpp
tools/opt/GraphPrinters.cpp
tools/opt/PrintSCC.cpp
tools/opt/opt.cpp

index f91403acb97e801f8e54b76282ff6074a9f12845..d61c886e7c11f9afa4891d52053ff26d402fd608 100644 (file)
@@ -61,6 +61,7 @@ protected:
   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 
 public:
+  static const int ID; // Class identification, replacement for typeinfo
   AliasAnalysis() : TD(0), AA(0) {}
   virtual ~AliasAnalysis();  // We want to be subclassed
 
index 24effd8d49d2ec3d390e5fd48ffb67b0794dd6ed..cd27e318cd99db8ee8e2de93ea80c221ade42b12 100644 (file)
@@ -73,6 +73,7 @@ protected:
   FunctionMapTy FunctionMap;    // Map from a function to its node
 
 public:
+  static const int ID; // Class identification, replacement for typeinfo
   //===---------------------------------------------------------------------
   // Accessors...
   //
index 45eed7fcdaf133ff9790ebb632496e84d21ec5dd..b172b792fcaba58af4b5481a86569a098e6e323d 100644 (file)
@@ -42,9 +42,10 @@ class DominatorBase : public FunctionPass {
 protected:
   std::vector<BasicBlock*> Roots;
   const bool IsPostDominators;
-
-  inline DominatorBase(bool isPostDom) : Roots(), IsPostDominators(isPostDom) {}
+  inline DominatorBase(intptr_t ID, bool isPostDom) : 
+    FunctionPass(ID), Roots(), IsPostDominators(isPostDom) {}
 public:
+
   /// getRoots -  Return the root blocks of the current CFG.  This may include
   /// multiple blocks if we are computing post dominators.  For forward
   /// dominators, this will always be a single block (the entry node).
@@ -135,7 +136,8 @@ public:
   };
 
 public:
-  DominatorTreeBase(bool isPostDom) : DominatorBase(isPostDom) {}
+  DominatorTreeBase(intptr_t ID, bool isPostDom) 
+    : DominatorBase(ID, isPostDom) {}
   ~DominatorTreeBase() { reset(); }
 
   virtual void releaseMemory() { reset(); }
@@ -206,7 +208,8 @@ public:
 ///
 class DominatorTree : public DominatorTreeBase {
 public:
-  DominatorTree() : DominatorTreeBase(false) {}
+  static const int ID; // Pass ID, replacement for typeid
+  DominatorTree() : DominatorTreeBase((intptr_t)&ID, false) {}
   
   BasicBlock *getRoot() const {
     assert(Roots.size() == 1 && "Should always have entry node!");
@@ -264,8 +267,9 @@ template <> struct GraphTraits<DominatorTree*>
 ///
 class ETForestBase : public DominatorBase {
 public:
-  ETForestBase(bool isPostDom) : DominatorBase(isPostDom), Nodes(), 
-                                 DFSInfoValid(false), SlowQueries(0) {}
+  ETForestBase(intptr_t ID, bool isPostDom) 
+    : DominatorBase(ID, isPostDom), Nodes(), 
+      DFSInfoValid(false), SlowQueries(0) {}
   
   virtual void releaseMemory() { reset(); }
 
@@ -395,7 +399,9 @@ protected:
 
 class ETForest : public ETForestBase {
 public:
-  ETForest() : ETForestBase(false) {}
+  static const int ID; // Pass identifcation, replacement for typeid
+
+  ETForest() : ETForestBase((intptr_t)&ID, false) {}
 
   BasicBlock *getRoot() const {
     assert(Roots.size() == 1 && "Should always have entry node!");
@@ -425,7 +431,8 @@ public:
 protected:
   DomSetMapType Frontiers;
 public:
-  DominanceFrontierBase(bool isPostDom) : DominatorBase(isPostDom) {}
+  DominanceFrontierBase(intptr_t ID, bool isPostDom) 
+    : DominatorBase(ID, isPostDom) {}
 
   virtual void releaseMemory() { Frontiers.clear(); }
 
@@ -470,7 +477,9 @@ public:
 ///
 class DominanceFrontier : public DominanceFrontierBase {
 public:
-  DominanceFrontier() : DominanceFrontierBase(false) {}
+  static const int ID; // Pass ID, replacement for typeid
+  DominanceFrontier() : 
+    DominanceFrontierBase((intptr_t)& ID, false) {}
 
   BasicBlock *getRoot() const {
     assert(Roots.size() == 1 && "Should always have entry node!");
index 008e30c93efe4d6faa5e53288869d5f0f9294a88..de892f1b9cae0711588ad6c1d991d15bb39bb6ad 100644 (file)
@@ -24,6 +24,9 @@ class Type;
 class FindUsedTypes : public ModulePass {
   std::set<const Type *> UsedTypes;
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+  FindUsedTypes() : ModulePass((intptr_t)&ID) {}
+
   /// getTypes - After the pass has been run, return the set containing all of
   /// the types used in the module.
   ///
index bd998e81de22380f1092df9b5017d47dd5b86292..07f054b131090b9c401359ec060bbc230bce7115 100644 (file)
@@ -45,7 +45,9 @@ class IntervalPartition : public FunctionPass {
   std::vector<Interval*> Intervals;
 
 public:
-  IntervalPartition() : RootInterval(0) {}
+  static const int ID; // Pass identifcation, replacement for typeid
+
+  IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
 
   // run - Calculate the interval partition for this function
   virtual bool runOnFunction(Function &F);
index 62f19e3c29eea69f35652146e1febcdae1dac875..8e38c07a477b654570a25fd8e6da75d4a81c3902 100644 (file)
@@ -241,6 +241,9 @@ class LoopInfo : public FunctionPass {
   std::vector<Loop*> TopLevelLoops;
   friend class Loop;
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+
+  LoopInfo() : FunctionPass((intptr_t)&ID) {}
   ~LoopInfo() { releaseMemory(); }
 
   /// iterator/begin/end - The interface to the top-level loops in the current
index 4163a09d333cb8b399e9ff8e6fd3d94ec8eaefe8..24e61435ff8a6550bfbf9143f8c4b08de32ad81a 100644 (file)
@@ -29,6 +29,8 @@ class Function;
 class LoopPass : public Pass {
 
  public:
+ LoopPass(intptr_t pid) : Pass(pid) {}
+
   // runOnLoop - THis method should be implemented by the subclass to perform
   // whatever action is necessary for the specfied Loop. 
   virtual bool runOnLoop (Loop *L, LPPassManager &LPM) = 0;
@@ -66,6 +68,7 @@ class LoopPass : public Pass {
 class LPPassManager : public FunctionPass, public PMDataManager {
 
 public:
+  static const int ID;
   LPPassManager(int Depth);
 
   /// run - Execute all of the passes scheduled for execution.  Keep track of
index 359f19daf881f283397fab1e28b07d12f94bc21d..793c7f48892703feffcd64c4c5f48aee53a647c0 100644 (file)
@@ -22,7 +22,10 @@ namespace llvm {
 /// compute the a post-dominator tree.
 ///
 struct PostDominatorTree : public DominatorTreeBase {
-  PostDominatorTree() : DominatorTreeBase(true) {}
+  static const int ID; // Pass identifcation, replacement for typeid
+
+  PostDominatorTree() : 
+    DominatorTreeBase((intptr_t)&ID, true) {}
 
   virtual bool runOnFunction(Function &F) {
     reset();     // Reset from the last time we were run...
@@ -51,7 +54,8 @@ private:
 /// PostETForest Class - Concrete subclass of ETForestBase that is used to
 /// compute a forwards post-dominator ET-Forest.
 struct PostETForest : public ETForestBase {
-  PostETForest() : ETForestBase(true) {}
+  static const int ID;
+  PostETForest() : ETForestBase((intptr_t)&ID, true) {}
 
   virtual void getAnalysisUsage(AnalysisUsage &AU) const {
     AU.setPreservesAll();
@@ -75,7 +79,9 @@ struct PostETForest : public ETForestBase {
 /// used to compute the a post-dominance frontier.
 ///
 struct PostDominanceFrontier : public DominanceFrontierBase {
-  PostDominanceFrontier() : DominanceFrontierBase(true) {}
+  static const int ID;
+  PostDominanceFrontier() 
+    : DominanceFrontierBase((intptr_t) &ID, true) {}
 
   virtual bool runOnFunction(Function &) {
     Frontiers.clear();
index 88b2ea1c8c6b1c695be453dd5bb793b6bea9432b..dc17ac1664d6b1503d30b8dac47083df693eac53 100644 (file)
@@ -38,6 +38,7 @@ namespace llvm {
     // entered.
     std::map<std::pair<BasicBlock*, BasicBlock*>, unsigned> EdgeCounts;
   public:
+    static const int ID; // Class identification, replacement for typeinfo
     virtual ~ProfileInfo();  // We want to be subclassed
 
     //===------------------------------------------------------------------===//
index 27d7e04a3e25cc042ce2624b3ea9d893f9b6aa73..6b05714358d04319efdaba839cbda1d48ffd1e28 100644 (file)
@@ -197,7 +197,8 @@ namespace llvm {
   class ScalarEvolution : public FunctionPass {
     void *Impl;    // ScalarEvolution uses the pimpl pattern
   public:
-    ScalarEvolution() : Impl(0) {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    ScalarEvolution() : FunctionPass((intptr_t)&ID), Impl(0) {}
 
     /// getSCEV - Return a SCEV expression handle for the full generality of the
     /// specified expression.
index f708f48382b9c113db8e1d9b36fbdde4be3b0962..9d1aeb564dcc1438652e96e591bd1e96501544e0 100644 (file)
@@ -29,6 +29,7 @@ class Value;
 class Instruction;
 
 struct ValueNumbering {
+  static const int ID; // Class identification, replacement for typeinfo
   virtual ~ValueNumbering();    // We want to be subclassed
 
   /// getEqualNumberNodes - Return nodes with the same value number as the
index cc9bca92882a80afa4e552e53e5628aee8ba3a7c..4da55484eee2be514dc44234159621b25154a142 100644 (file)
@@ -28,9 +28,10 @@ class PrintModulePass : public ModulePass {
   OStream *Out;           // ostream to print on
   bool DeleteStream;      // Delete the ostream in our dtor?
 public:
-  PrintModulePass() : Out(&cerr), DeleteStream(false) {}
+  static const int ID;
+  PrintModulePass() : ModulePass((intptr_t)&ID), Out(&cerr), DeleteStream(false) {}
   PrintModulePass(OStream *o, bool DS = false)
-    : Out(o), DeleteStream(DS) {}
+    : ModulePass((intptr_t)&ID), Out(o), DeleteStream(DS) {}
 
   ~PrintModulePass() {
     if (DeleteStream) delete Out;
@@ -51,10 +52,12 @@ class PrintFunctionPass : public FunctionPass {
   OStream *Out;           // ostream to print on
   bool DeleteStream;      // Delete the ostream in our dtor?
 public:
-  PrintFunctionPass() : Banner(""), Out(&cerr), DeleteStream(false) {}
+  static const int ID;
+  PrintFunctionPass() : FunctionPass((intptr_t)&ID), Banner(""), Out(&cerr), 
+                        DeleteStream(false) {}
   PrintFunctionPass(const std::string &B, OStream *o = &cout,
                     bool DS = false)
-    : Banner(B), Out(o), DeleteStream(DS) {}
+    : FunctionPass((intptr_t)&ID), Banner(B), Out(o), DeleteStream(DS) {}
 
   inline ~PrintFunctionPass() {
     if (DeleteStream) delete Out;
index b0155e4ddf6921576790222248e842c89a0518ab..5c21ccded5de2d97eddb27fcaca9c1ccae071001 100644 (file)
@@ -26,10 +26,12 @@ class WriteBytecodePass : public ModulePass {
   bool DeleteStream;
   bool CompressFile;
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
   WriteBytecodePass()
-    : Out(&cout), DeleteStream(false), CompressFile(false) {}
+    : ModulePass((intptr_t) &ID), Out(&cout), DeleteStream(false), 
+      CompressFile(false) {}
   WriteBytecodePass(OStream *o, bool DS = false, bool CF = false)
-    : Out(o), DeleteStream(DS), CompressFile(CF) {}
+    : ModulePass((intptr_t) &ID), Out(o), DeleteStream(DS), CompressFile(CF) {}
 
   inline ~WriteBytecodePass() {
     if (DeleteStream) delete Out;
index af5cb849a38afa3782ee434148a953f6c19d13e7..90894c280c6c9162df5a0f487c40b0705c33a8eb 100644 (file)
@@ -31,6 +31,8 @@ class PMStack;
 
 struct CallGraphSCCPass : public Pass {
 
+  CallGraphSCCPass(intptr_t pid) : Pass(pid) {}
+
   /// doInitialization - This method is called before the SCC's of the program
   /// has been processed, allowing the pass to do initialization as necessary.
   virtual bool doInitialization(CallGraph &CG) {
index 024001e9d66b9fc83edfad1d576780fd70652a82..3a5418d937b0e0f98aa3c53ed3bf59b5e41d4b3d 100644 (file)
@@ -34,6 +34,8 @@ namespace llvm {
   /// AsmPrinter - This class is intended to be used as a driving class for all
   /// asm writers.
   class AsmPrinter : public MachineFunctionPass {
+    static const int ID;
+
     /// FunctionNumber - This provides a unique ID for each function emitted in
     /// this translation unit.  It is autoincremented by SetupMachineFunction,
     /// and can be accessed with getFunctionNumber() and 
index a42471d63128124dc804c5ce10a93166fd80cde5..3ea0272425dce4f340448fb66b385b02a647ae96 100644 (file)
@@ -65,6 +65,9 @@ namespace llvm {
     BitVector JoinedLIs;
 
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    LiveIntervals() : MachineFunctionPass((intptr_t)&ID) {}
+
     struct CopyRec {
       MachineInstr *MI;
       unsigned SrcReg, DstReg;
index ebbe610ed0140792e298fb1acfe3935021f63a38..ce377cd2cfafb7e8394c173bd597b41fb1e77926 100644 (file)
@@ -40,6 +40,9 @@ class MRegisterInfo;
 
 class LiveVariables : public MachineFunctionPass {
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+  LiveVariables() : MachineFunctionPass((intptr_t)&ID) {}
+
   /// VarInfo - This represents the regions where a virtual register is live in
   /// the program.  We represent this with three different pieces of
   /// information: the instruction that uniquely defines the value, the set of
index 77af52a34748f47c3a54c13e2857e3f77fcba5d5..7429e7b96c40eb0e165a02fe6cb425106cfee323 100644 (file)
@@ -26,6 +26,8 @@ namespace llvm {
 
 struct MachineFunctionPass : public FunctionPass {
 
+  MachineFunctionPass(intptr_t ID) : FunctionPass(ID) {}
+
   /// runOnMachineFunction - This method must be overloaded to perform the
   /// desired machine code transformation or analysis.
   ///
index 28201dcfdc69c9ef6d897fb5800e7cae38d6ca3c..c23916def9ccc4aeb28ace55aaaeb284fd7fce6d 100644 (file)
@@ -1022,6 +1022,8 @@ private:
   std::vector<GlobalVariable *> TypeInfos;
 
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+
   MachineModuleInfo();
   ~MachineModuleInfo();
   
index 9d5b059759e3766ea372108dfcb74ece5be73ed6..f363daf9e4c7b30d3e50423a572d51cbf8c1ebfc 100644 (file)
@@ -41,8 +41,10 @@ public:
   MachineBasicBlock *BB;
   std::vector<SDNode*> TopOrder;
   unsigned DAGSize;
+  static const int ID;
 
-  explicit SelectionDAGISel(TargetLowering &tli) : TLI(tli), DAGSize(0) {}
+  explicit SelectionDAGISel(TargetLowering &tli) : 
+    FunctionPass((intptr_t)&ID), TLI(tli), DAGSize(0) {}
   
   TargetLowering &getTargetLowering() { return TLI; }
 
index 1ab6ff9a720c88fe13a8a296be3420243e399968..d678df6430b9da06f789268e9ed10f0df43ab175 100644 (file)
@@ -34,8 +34,8 @@
 #include <deque>
 #include <map>
 #include <iosfwd>
-#include <typeinfo>
 #include <cassert>
+#include <stdint.h>
 
 namespace llvm {
 
@@ -77,7 +77,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,7 +87,7 @@ class Pass {
   void operator=(const Pass&);  // DO NOT IMPLEMENT
   Pass(const Pass &);           // DO NOT IMPLEMENT
 public:
-  Pass() : Resolver(0), PassInfoCache(0) {}
+  Pass(intptr_t pid) : Resolver(0), PassID(pid) {}
   virtual ~Pass();
 
   /// getPassName - Return a nice clean name for a pass.  This usually
@@ -163,12 +163,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 +232,7 @@ public:
     return PMT_ModulePassManager;
   }
 
+  ModulePass(intptr_t pid) : Pass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ModulePass();
 };
@@ -256,6 +257,7 @@ public:
   ///
   virtual bool runOnModule(Module &M) { return false; }
 
+  ImmutablePass(intptr_t pid) : ModulePass(pid) {}
   // Force out-of-line virtual method.
   virtual ~ImmutablePass();
 };
@@ -271,6 +273,8 @@ public:
 ///
 class FunctionPass : public Pass {
 public:
+  FunctionPass(intptr_t pid) : Pass(pid) {}
+
   /// doInitialization - Virtual method overridden by subclasses to do
   /// any necessary per-module initialization.
   ///
@@ -320,6 +324,8 @@ public:
 ///
 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 29912b140d764f74bdaced46a4a56b1aa015fdf8..81e89a7ff5f8a90c8f33f608dc0aa10af4f49d71 100644 (file)
@@ -336,7 +336,9 @@ private:
 class FPPassManager : public ModulePass, public PMDataManager {
  
 public:
-  explicit FPPassManager(int Depth) : PMDataManager(Depth) { }
+  static const int ID;
+  explicit FPPassManager(int Depth) 
+  : ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
   
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
index 7c3c4a9d660376d9d268b2492f29eaf83b39c939..f594d45f1522b83cd73d288662cf226131ae2b9c 100644 (file)
@@ -37,19 +37,19 @@ class TargetMachine;
 class PassInfo {
   const char           *PassName;      // Nice name for Pass
   const char           *PassArgument;  // Command Line argument to run this pass
-  const std::type_info &TypeInfo;      // type_info object for this Pass class
+  intptr_t             PassID;      
   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)();               // No argument ctor
+  Pass *(*NormalCtor)();
 
 public:
   /// PassInfo ctor - Do not call this directly, this should only be invoked
   /// through RegisterPass.
-  PassInfo(const char *name, const char *arg, const std::type_info &ti,
+  PassInfo(const char *name, const char *arg, intptr_t pi,
            Pass *(*normal)() = 0, bool isCFGOnly = false)
-    : PassName(name), PassArgument(arg), TypeInfo(ti), 
+    : PassName(name), PassArgument(arg), PassID(pi), 
       IsCFGOnlyPass(isCFGOnly), IsAnalysisGroup(false), NormalCtor(normal) {
   }
 
@@ -65,8 +65,8 @@ public:
   const char *getPassArgument() const { return PassArgument; }
 
   /// getTypeInfo - Return the type_info object for the pass...
-  ///
-  const std::type_info &getTypeInfo() const { return TypeInfo; }
+  /// TODO : Rename
+  intptr_t getTypeInfo() const { return PassID; }
 
   /// isAnalysisGroup - Return true if this is an analysis group, not a normal
   /// pass.
@@ -139,12 +139,12 @@ struct RegisterPassBase {
 
   typedef Pass* (*NormalCtor_t)();
   
-  RegisterPassBase(const char *Name, const char *Arg, const std::type_info &TI,
+  RegisterPassBase(const char *Name, const char *Arg, intptr_t TI,
                    NormalCtor_t NormalCtor = 0, bool CFGOnly = false)
     : PIObj(Name, Arg, TI, NormalCtor, CFGOnly) {
     registerPass();
   }
-  RegisterPassBase(const std::type_info &TI)
+  RegisterPassBase(intptr_t TI)
     : PIObj("", "", TI) {
     // This ctor may only be used for analysis groups: it does not auto-register
     // the pass.
@@ -165,7 +165,7 @@ struct RegisterPass : public RegisterPassBase {
 
   // Register Pass using default constructor...
   RegisterPass(const char *PassArg, const char *Name, bool CFGOnly = false)
-  : RegisterPassBase(Name, PassArg, typeid(PassName),
+    : RegisterPassBase(Name, PassArg, (intptr_t)&PassName::ID,
                      (RegisterPassBase::NormalCtor_t)callDefaultCtor<PassName>, CFGOnly) {
   }
 };
@@ -195,8 +195,8 @@ class RegisterAGBase : public RegisterPassBase {
   const PassInfo *ImplementationInfo;
   bool isDefaultImplementation;
 protected:
-  explicit RegisterAGBase(const std::type_info &Interface,
-                          const std::type_info *Pass = 0,
+  explicit RegisterAGBase(intptr_t InterfaceID,
+                          intptr_t PassID = 0,
                           bool isDefault = false);
   void setGroupName(const char *Name);
 };
@@ -204,12 +204,12 @@ protected:
 template<typename Interface, bool Default = false>
 struct RegisterAnalysisGroup : public RegisterAGBase {
   explicit RegisterAnalysisGroup(RegisterPassBase &RPB)
-    : RegisterAGBase(typeid(Interface), &RPB.getPassInfo()->getTypeInfo(), 
+    : RegisterAGBase((intptr_t) &Interface::ID, RPB.getPassInfo()->getTypeInfo(),
                      Default) {
   }
 
   explicit RegisterAnalysisGroup(const char *Name)
-  : RegisterAGBase(typeid(Interface)) {
+    : RegisterAGBase((intptr_t) &Interface::ID) {
     setGroupName(Name);
   }
 };
index 4e330e862dba7364d9d7e270d87d19677427faef..bfc41b1640c8c68d61e6fe9cd6b1dcab9215ab03 100644 (file)
@@ -108,14 +108,15 @@ public:
   ///
   /// @note This has to exist, because this is a pass, but it should never be
   /// used.
-  TargetData() {
+  TargetData() : ImmutablePass((intptr_t)&ID) {
     assert(0 && "ERROR: Bad TargetData ctor used.  "
            "Tool did not specify a TargetData to use?");
     abort();
   }
     
   /// Constructs a TargetData from a specification string. See init().
-  TargetData(const std::string &TargetDescription) {
+  TargetData(const std::string &TargetDescription) 
+    : ImmutablePass((intptr_t)&ID) {
     init(TargetDescription);
   }
 
@@ -123,7 +124,7 @@ public:
   TargetData(const Module *M);
 
   TargetData(const TargetData &TD) : 
-    ImmutablePass(),
+    ImmutablePass((intptr_t)&ID),
     LittleEndian(TD.isLittleEndian()),
     PointerMemSize(TD.PointerMemSize),
     PointerABIAlign(TD.PointerABIAlign),
@@ -200,6 +201,8 @@ public:
   /// specified global, returned in log form.  This includes an explicitly
   /// requested alignment (if the global has one).
   unsigned getPreferredAlignmentLog(const GlobalVariable *GV) const;
+
+  static const int ID; // Pass identifcation, replacement for typeid
 };
 
 /// StructLayout - used to lazily calculate structure layout information for a
index 2df2932f295eb4231ed56b707b65b506f63eb15f..900d147f7d6a0337f595bb7b3ae5564c3f340f4c 100644 (file)
@@ -23,6 +23,9 @@ namespace llvm {
   /// this interface are expected to chain to other implementations, such that
   /// multiple profilers can be support simultaniously.
   struct RSProfilers : public ModulePass {
+    static const int ID; // Pass identification, replacement for typeinfo
+    RSProfilers() : ModulePass((intptr_t)&ID) {}
+
     /// isProfiling - This method returns true if the value passed it was 
     /// inserted by the profiler.
     virtual bool isProfiling(Value* v) = 0;
index 526851ba44853a47d241f128f435cb61617ef1fb..c120acce6bfd200f709f9986e20630a8479014c5 100644 (file)
@@ -25,7 +25,9 @@ namespace llvm {
 struct UnifyFunctionExitNodes : public FunctionPass {
   BasicBlock *ReturnBlock, *UnwindBlock, *UnreachableBlock;
 public:
-  UnifyFunctionExitNodes() : ReturnBlock(0), UnwindBlock(0) {}
+  static const int ID; // Pass identifcation, replacement for typeid
+  UnifyFunctionExitNodes() : FunctionPass((intptr_t)&ID),
+                             ReturnBlock(0), UnwindBlock(0) {}
 
   // We can preserve non-critical-edgeness when we unify function exit nodes
   virtual void getAnalysisUsage(AnalysisUsage &AU) const;
index c7b68fab686a3172aa1660d7cda70734f610a7b3..7499db562b761c0fa48abdb9ec141d7d8d974815 100644 (file)
@@ -34,6 +34,7 @@ using namespace llvm;
 
 // Register the AliasAnalysis interface, providing a nice name to refer to.
 namespace {
+  const int AliasAnalysis::ID = 0;
   RegisterAnalysisGroup<AliasAnalysis> Z("Alias Analysis");
 }
 
index fcd5edc768b7256986e04d91aafa6ae8bba49f9a..ee1980fc4c00e0b4b60bccd18d7a463793e55c6c 100644 (file)
@@ -34,7 +34,8 @@ namespace {
     const char *Name;
     Module *M;
   public:
-    AliasAnalysisCounter() {
+    static const int ID; // Class identification, replacement for typeinfo
+    AliasAnalysisCounter() : ModulePass((intptr_t) &ID) {
       No = May = Must = 0;
       NoMR = JustRef = JustMod = MR = 0;
     }
@@ -107,6 +108,7 @@ namespace {
     }
   };
 
+  const int AliasAnalysisCounter::ID = 0;
   RegisterPass<AliasAnalysisCounter>
   X("count-aa", "Count Alias Analysis Query Responses");
   RegisterAnalysisGroup<AliasAnalysis> Y(X);
index 73ea423c45fdf6086fa32c9d2a005988fdf3d70c..f2631cb8ba658106562fd448922ac0f7a4612d6c 100644 (file)
@@ -50,6 +50,9 @@ namespace {
     unsigned NoModRef, Mod, Ref, ModRef;
 
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    AAEval() : FunctionPass((intptr_t)&ID) {}
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<AliasAnalysis>();
       AU.setPreservesAll();
@@ -70,6 +73,7 @@ namespace {
     bool doFinalization(Module &M);
   };
 
+  const int AAEval::ID = 0;
   RegisterPass<AAEval>
   X("aa-eval", "Exhaustive Alias Analysis Precision Evaluator");
 }
index 3f7f1cccae094089bf21c27ca62e993108a42acd..a4df97a196fe112bb62702d4556db6caca191237 100644 (file)
@@ -40,6 +40,9 @@ namespace {
     std::set<const Value*> Vals;
     
   public:
+    static const int ID; // Class identification, replacement for typeinfo
+    AliasDebugger() : ModulePass((intptr_t)&ID) {}
+
     bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);                 // set up super class
 
@@ -119,6 +122,7 @@ namespace {
 
   };
 
+  const int AliasDebugger::ID = 0;
   RegisterPass<AliasDebugger> X("debug-aa", "AA use debugger");
   RegisterAnalysisGroup<AliasAnalysis> Y(X);
 }
index 9564326685b0b854cc67fc7e785777ce2fc64131..90c90fe58f5cf84b2869cff67214cf46d1b2492c 100644 (file)
@@ -555,6 +555,9 @@ namespace {
   class VISIBILITY_HIDDEN AliasSetPrinter : public FunctionPass {
     AliasSetTracker *Tracker;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    AliasSetPrinter() : FunctionPass((intptr_t)&ID) {}
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
       AU.addRequired<AliasAnalysis>();
@@ -570,5 +573,6 @@ namespace {
       return false;
     }
   };
+  const int AliasSetPrinter::ID = 0;
   RegisterPass<AliasSetPrinter> X("print-alias-sets", "Alias Set Printer");
 }
index 1ca1a35b9f52edbcd4c7189f9549d4337d04cd14..b1369a29206286c955ad0d769d4d77f37b843fae 100644 (file)
@@ -36,6 +36,9 @@ namespace {
   /// such it doesn't follow many of the rules that other alias analyses must.
   ///
   struct VISIBILITY_HIDDEN NoAA : public ImmutablePass, public AliasAnalysis {
+    static const int ID; // Class identification, replacement for typeinfo
+    NoAA() : ImmutablePass((intptr_t)&ID) {}
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
     }
@@ -74,6 +77,7 @@ namespace {
   };
 
   // Register this pass...
+  const int NoAA::ID = 0;
   RegisterPass<NoAA>
   U("no-aa", "No Alias Analysis (always returns 'may' alias)");
 
@@ -88,6 +92,7 @@ namespace {
   /// Because it doesn't chain to a previous alias analysis (like -no-aa), it
   /// derives from the NoAA class.
   struct VISIBILITY_HIDDEN BasicAliasAnalysis : public NoAA {
+    static const int ID; // Class identification, replacement for typeinfo
     AliasResult alias(const Value *V1, unsigned V1Size,
                       const Value *V2, unsigned V2Size);
 
@@ -119,6 +124,7 @@ namespace {
   };
 
   // Register this pass...
+  const int BasicAliasAnalysis::ID = 0;
   RegisterPass<BasicAliasAnalysis>
   X("basicaa", "Basic Alias Analysis (default AA impl)");
 
index a57a0685a7e7ae6863219194fd6db28786b0d225..6154460375871e27054ab0daff918099d893ad5b 100644 (file)
@@ -91,6 +91,9 @@ struct DOTGraphTraits<const Function*> : public DefaultDOTGraphTraits {
 
 namespace {
   struct VISIBILITY_HIDDEN CFGPrinter : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    CFGPrinter() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F) {
       std::string Filename = "cfg." + F.getName() + ".dot";
       cerr << "Writing '" << Filename << "'...";
@@ -111,10 +114,12 @@ namespace {
     }
   };
 
+  const int CFGPrinter::ID = 0;
   RegisterPass<CFGPrinter> P1("print-cfg",
                               "Print CFG of function to 'dot' file");
 
   struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
+    static const int ID; // Pass identifcation, replacement for typeid
     virtual bool runOnFunction(Function &F) {
       bool OldCFGOnly = CFGOnly;
       CFGOnly = true;
@@ -129,6 +134,7 @@ namespace {
     }
   };
 
+  const int CFGOnlyPrinter::ID = 0;
   RegisterPass<CFGOnlyPrinter>
   P2("print-cfg-only",
      "Print CFG of function to 'dot' file (with no function bodies)");
index 0a281c89458325f5df60af05f5cacc7f16757919..cd90a6f22b013ed1532cc9e826c4ae8da29135e9 100644 (file)
@@ -75,12 +75,17 @@ STATISTIC(NumIndirectCallees  , "Number of indirect callees found");
 namespace {
   class VISIBILITY_HIDDEN Andersens : public ModulePass, public AliasAnalysis,
                                       private InstVisitor<Andersens> {
+  public:
+    static const int ID; // Class identification, replacement for typeinfo
+    Andersens() : ModulePass((intptr_t)&ID) {}
+  private:
     /// Node class - This class is used to represent a memory object in the
     /// program, and is the primitive used to build the points-to graph.
     class Node {
       std::vector<Node*> Pointees;
       Value *Val;
     public:
+      static const unsigned ID; // Pass identifcation, replacement for typeid
       Node() : Val(0) {}
       Node *setValue(Value *V) {
         assert(Val == 0 && "Value already set for this node!");
@@ -334,6 +339,7 @@ namespace {
     void visitInstruction(Instruction &I);
   };
 
+  const int Andersens::ID = 0;
   RegisterPass<Andersens> X("anders-aa",
                             "Andersen's Interprocedural Alias Analysis");
   RegisterAnalysisGroup<AliasAnalysis> Y(X);
index bb96bb2d654ef2d36b626335dfe3ccbd271d2ff0..43e70bb2184bc2f564284fbb5365fb54670c2d14 100644 (file)
@@ -51,7 +51,9 @@ class VISIBILITY_HIDDEN BasicCallGraph : public CallGraph, public ModulePass {
   CallGraphNode *CallsExternalNode;
 
 public:
-  BasicCallGraph() : Root(0), ExternalCallingNode(0), CallsExternalNode(0) {}
+  static const int ID; // Class identification, replacement for typeinfo
+  BasicCallGraph() : ModulePass((intptr_t)&ID), Root(0), 
+    ExternalCallingNode(0), CallsExternalNode(0) {}
 
   // runOnModule - Compute the call graph for the specified module.
   virtual bool runOnModule(Module &M) {
@@ -188,7 +190,9 @@ private:
   }
 };
 
+const int CallGraph::ID = 0;
 RegisterAnalysisGroup<CallGraph> X("Call Graph");
+const int BasicCallGraph::ID = 0;
 RegisterPass<BasicCallGraph> Y("basiccg", "Basic CallGraph Construction");
 RegisterAnalysisGroup<CallGraph, true> Z(Y);
 
index 0640b63e6b6887b2967c34bb972b0df5b1b3152b..2c5aeaa4c2a29173995629e44e04ea03ccf4d1a4 100644 (file)
@@ -30,7 +30,9 @@ using namespace llvm;
 class CGPassManager : public ModulePass, public PMDataManager {
 
 public:
-  CGPassManager(int Depth) : PMDataManager(Depth) { }
+  static const int ID;
+  CGPassManager(int Depth) 
+    : ModulePass((intptr_t)&ID), PMDataManager(Depth) { }
 
   /// run - Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the module, and if so, return true.
@@ -71,6 +73,7 @@ public:
   }
 };
 
+const int CGPassManager::ID = 0;
 /// run - Execute all of the passes scheduled for execution.  Keep track of
 /// whether any of the passes modifies the module, and if so, return true.
 bool CGPassManager::runOnModule(Module &M) {
index 1208dd1ccca4d8268201839440dff0fe34ef520e..d35f7beed1ce687eed593aeda7c812e68483d1b4 100644 (file)
@@ -21,6 +21,7 @@
 #include "llvm/Support/InstIterator.h"
 using namespace llvm;
 
+const int FindUsedTypes::ID = 0;
 static RegisterPass<FindUsedTypes>
 X("printusedtypes", "Find Used Types");
 
index 8d41751b88d5b8712166544e6b4f20b4b2fa9522..ea8b1d84871553c26408377c4f6b16953a598ba9 100644 (file)
@@ -83,6 +83,9 @@ namespace {
     std::map<Function*, FunctionRecord> FunctionInfo;
 
   public:
+    static const int ID;
+    GlobalsModRef() : ModulePass((intptr_t)&ID) {}
+
     bool runOnModule(Module &M) {
       InitializeAliasAnalysis(this);                 // set up super class
       AnalyzeGlobals(M);                          // find non-addr taken globals
@@ -143,6 +146,7 @@ namespace {
     bool AnalyzeIndirectGlobalMemory(GlobalValue *GV);
   };
 
+  const int GlobalsModRef::ID = 0;
   RegisterPass<GlobalsModRef> X("globalsmodref-aa",
                                 "Simple mod/ref analysis for globals");
   RegisterAnalysisGroup<AliasAnalysis> Y(X);
index e075fee9f6a391380bc435eaa3c24d5107b262c7..23c891b5ed8df05e07584c05b2ee49f07734340e 100644 (file)
@@ -51,6 +51,9 @@ namespace {
       abort();
     }
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    InstCount() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -60,6 +63,7 @@ namespace {
 
   };
 
+  const int InstCount::ID = 0;
   RegisterPass<InstCount> X("instcount",
                             "Counts the various types of Instructions");
 }
index 2385a7d2470436991ae0073bef0e00f10f1c62a5..b380a5190d52aada525479407926b4ebc5c61292 100644 (file)
@@ -15,6 +15,7 @@
 #include "llvm/Analysis/IntervalIterator.h"
 using namespace llvm;
 
+const int IntervalPartition::ID = 0;
 static RegisterPass<IntervalPartition>
 X("intervals", "Interval Partition Construction", true);
 
@@ -88,7 +89,8 @@ bool IntervalPartition::runOnFunction(Function &F) {
 // existing interval graph.  This takes an additional boolean parameter to
 // distinguish it from a copy constructor.  Always pass in false for now.
 //
-IntervalPartition::IntervalPartition(IntervalPartition &IP, bool) {
+IntervalPartition::IntervalPartition(IntervalPartition &IP, bool)
+  : FunctionPass((intptr_t) &ID) {
   Interval *FunctionStart = IP.getRootInterval();
   assert(FunctionStart && "Cannot operate on empty IntervalPartitions!");
 
index 16687b0419416ca12cfe24281d6e6d07b84fe025..fdb5545c2bbe044b4ced997a7f874b0026b8ec5e 100644 (file)
@@ -40,6 +40,8 @@ using namespace llvm;
 namespace {
   // FIXME: This should not be a FunctionPass.
   struct VISIBILITY_HIDDEN LoadVN : public FunctionPass, public ValueNumbering {
+    static const int ID; // Class identification, replacement for typeinfo
+    LoadVN() : FunctionPass((intptr_t)&ID) {}
 
     /// Pass Implementation stuff.  This doesn't do any analysis.
     ///
@@ -81,6 +83,7 @@ namespace {
                                  std::vector<Value*> &RetVals) const;
   };
 
+  const int LoadVN::ID = 0;
   // Register this pass...
   RegisterPass<LoadVN> X("load-vn", "Load Value Numbering");
 
index ab71b883a114d8e666fb100b247ba1c079663f18..fd66d295840ca903119a9d6c277b78eed33d565f 100644 (file)
@@ -27,6 +27,7 @@
 #include <ostream>
 using namespace llvm;
 
+const int LoopInfo::ID = 0;
 static RegisterPass<LoopInfo>
 X("loops", "Natural Loop Construction", true);
 
index fc431035c0729db33510b35707f04f389f0c6d98..eeb27ac1b3640125314da386057fea09323249b4 100644 (file)
@@ -20,9 +20,12 @@ using namespace llvm;
 //===----------------------------------------------------------------------===//
 // LPPassManager
 //
+
+const int LPPassManager::ID = 0;
 /// LPPassManager manages FPPassManagers and CalLGraphSCCPasses.
 
-LPPassManager::LPPassManager(int Depth) : PMDataManager(Depth) { 
+LPPassManager::LPPassManager(int Depth) 
+  : FunctionPass((intptr_t)&ID), PMDataManager(Depth) { 
   skipThisLoop = false;
   redoThisLoop = false;
   LI = NULL;
index add25fdf42fe2e6bc70d249faa6b831ce5f4c7f8..a328a89414da415706e051cc6fee9f38f408d551 100644 (file)
@@ -22,6 +22,9 @@ using namespace llvm;
 //  PostDominatorTree Implementation
 //===----------------------------------------------------------------------===//
 
+const int PostDominatorTree::ID = 0;
+const int PostDominanceFrontier::ID = 0;
+const int PostETForest::ID = 0;
 static RegisterPass<PostDominatorTree>
 F("postdomtree", "Post-Dominator Tree Construction", true);
 
index 6eead0fd6ecad2a040d2b1b3ebe333cbf8dea0d8..27da8162080e6473130ee39f0915c0a4b8e21a35 100644 (file)
@@ -22,6 +22,7 @@ using namespace llvm;
 
 // Register the ProfileInfo interface, providing a nice name to refer to.
 namespace {
+  const int ProfileInfo::ID = 0;
   RegisterAnalysisGroup<ProfileInfo> Z("Profile Information");
 }
 
@@ -84,8 +85,12 @@ unsigned ProfileInfo::getExecutionCount(BasicBlock *BB) const {
 
 namespace {
   struct VISIBILITY_HIDDEN NoProfileInfo 
-    : public ImmutablePass, public ProfileInfo {};
+    : public ImmutablePass, public ProfileInfo {
+    static const int ID; // Class identification, replacement for typeinfo
+    NoProfileInfo() : ImmutablePass((intptr_t)&ID) {}
+  };
 
+  const int NoProfileInfo::ID = 0;
   // Register this pass...
   RegisterPass<NoProfileInfo>
   X("no-profile", "No Profile Information");
index 9a597a27e4c0f5a51f096deac4312e095607bebf..9697de8cdde7d2eefc9e64d0107ddfa00435f0b4 100644 (file)
@@ -32,8 +32,9 @@ namespace {
   class VISIBILITY_HIDDEN LoaderPass : public ModulePass, public ProfileInfo {
     std::string Filename;
   public:
+    static const int ID; // Class identification, replacement for typeinfo
     LoaderPass(const std::string &filename = "")
-      : Filename(filename) {
+      : ModulePass((intptr_t)&ID), Filename(filename) {
       if (filename.empty()) Filename = ProfileInfoFilename;
     }
 
@@ -49,6 +50,7 @@ namespace {
     virtual bool runOnModule(Module &M);
   };
 
+  const int LoaderPass::ID = 0;
   RegisterPass<LoaderPass>
   X("profile-loader", "Load profile information from llvmprof.out");
 
index 473eadcd87864bac583aefbffb628813789757f4..5dae7f0bf1c78f1362957ecaa2192b1297d37091 100644 (file)
@@ -102,6 +102,7 @@ MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden,
                         cl::init(100));
 
 namespace {
+  const int ScalarEvolution::ID = 0;
   RegisterPass<ScalarEvolution>
   R("scalar-evolution", "Scalar Evolution Analysis");
 }
index 963ccb90f3ea7cacb9c3680d9c21b77789556318..2ecbce55c206465e4c5bef3d0f98d72a21ee24f9 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Support/Compiler.h"
 using namespace llvm;
 
+const int ValueNumbering::ID = 0;
 // Register the ValueNumbering interface, providing a nice name to refer to.
 static RegisterAnalysisGroup<ValueNumbering> X("Value Numbering");
 
@@ -51,6 +52,9 @@ namespace {
   ///
   struct VISIBILITY_HIDDEN BasicVN 
       : public ImmutablePass, public ValueNumbering {
+    static const int ID; // Class identification, replacement for typeinfo
+    BasicVN() : ImmutablePass((intptr_t)&ID) {}
+
     /// getEqualNumberNodes - Return nodes with the same value number as the
     /// specified Value.  This fills in the argument vector with any equal
     /// values.
@@ -61,6 +65,7 @@ namespace {
                                      std::vector<Value*> &RetVals) const;
   };
 
+  const int BasicVN::ID = 0;
   // Register this pass...
   RegisterPass<BasicVN>
   X("basicvn", "Basic Value Numbering (default GVN impl)");
index b4a26916008a3aa2e1cba4bb32c9a7af8176f9a1..3e09a92e9fa3b5ddc66af77d91babd2ebe4c4e00 100644 (file)
@@ -47,6 +47,7 @@ using namespace llvm;
 /// @brief The bytecode version number
 const unsigned BCVersionNum = 7;
 
+const int WriteBytecodePass::ID = 0;
 static RegisterPass<WriteBytecodePass> X("emitbytecode", "Bytecode Writer");
 
 STATISTIC(BytesWritten, "Number of bytecode bytes written");
index aa71ee0b6dbc66631415b538ee9b81733b8e5bca..4ce379c3e4bd3a2ff553f8450e42985e759dfbb1 100644 (file)
@@ -32,9 +32,10 @@ using namespace llvm;
 static cl::opt<bool>
 AsmVerbose("asm-verbose", cl::Hidden, cl::desc("Add comments to directives."));
 
+const int AsmPrinter::ID = 0;
 AsmPrinter::AsmPrinter(std::ostream &o, TargetMachine &tm,
                        const TargetAsmInfo *T)
-: FunctionNumber(0), O(o), TM(tm), TAI(T)
+  : MachineFunctionPass((intptr_t)&ID), FunctionNumber(0), O(o), TM(tm), TAI(T)
 {}
 
 std::string AsmPrinter::getSectionForFunction(const Function &F) const {
index 33f96df302f8c800fcaf0c391c15dcc286244c00..394fe7b81b1613dee78a0832cd2cf5483e7c8e8d 100644 (file)
@@ -39,6 +39,9 @@ static cl::opt<bool> EnableTailMerge("enable-tail-merge", cl::Hidden);
 
 namespace {
   struct BranchFolder : public MachineFunctionPass {
+    static const int ID;
+    BranchFolder() : MachineFunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnMachineFunction(MachineFunction &MF);
     virtual const char *getPassName() const { return "Control Flow Optimizer"; }
     const TargetInstrInfo *TII;
@@ -64,6 +67,7 @@ namespace {
                         MachineBasicBlock *TBB, MachineBasicBlock *FBB,
                         const std::vector<MachineOperand> &Cond);
   };
+  const int BranchFolder::ID = 0;
 }
 
 FunctionPass *llvm::createBranchFoldingPass() { return new BranchFolder(); }
index ffc0a929f318d67ef2ac7dea84a44d2719c918be..ce534092ba3e5b843ca7eba5a9b1d4b6ed44d8ee 100644 (file)
@@ -47,6 +47,7 @@
 #include <list>
 using namespace llvm;
 
+const int ELFWriter::ID = 0;
 /// AddELFWriter - Concrete function to add the ELF writer to the function pass
 /// manager.
 MachineCodeEmitter *llvm::AddELFWriter(FunctionPassManager &FPM,
@@ -176,7 +177,8 @@ bool ELFCodeEmitter::finishFunction(MachineFunction &F) {
 //                          ELFWriter Implementation
 //===----------------------------------------------------------------------===//
 
-ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
+ELFWriter::ELFWriter(std::ostream &o, TargetMachine &tm) 
+  : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
   e_flags = 0;    // e_flags defaults to 0, no flags.
 
   is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
index e64a9c946b6db354e5be7b162b2746f03ce6b321..8b577a0a783573b40cd2125681704e7c0264ad18 100644 (file)
@@ -30,6 +30,8 @@ namespace llvm {
   class ELFWriter : public MachineFunctionPass {
     friend class ELFCodeEmitter;
   public:
+    static const int ID;
+
     MachineCodeEmitter &getMachineCodeEmitter() const {
       return *(MachineCodeEmitter*)MCE;
     }
index c542033548dabcdc46b93dc3c3993f84e3b2e8d0..cc6c23f59f64e68d323828cd35a3703f681054be 100644 (file)
@@ -45,6 +45,7 @@ STATISTIC(numFolded   , "Number of loads/stores folded into instructions");
 STATISTIC(numAborts   , "Number of times interval joining aborted");
 
 namespace {
+  const int LiveIntervals::ID = 0;
   RegisterPass<LiveIntervals> X("liveintervals", "Live Interval Analysis");
 
   static cl::opt<bool>
index 4816cc12577ed5211e57f54ef068a33c13c19474..3ea60bcf15ce6bf1da681478993298b53c53b92e 100644 (file)
@@ -37,6 +37,7 @@
 #include <algorithm>
 using namespace llvm;
 
+const int LiveVariables::ID = 0;
 static RegisterPass<LiveVariables> X("livevars", "Live Variable Analysis");
 
 void LiveVariables::VarInfo::dump() const {
index 5164103d273f991296c5db90ddb771fbaf4c186e..f8dccc1895e55b1d33ac242a2084f0329062be28 100644 (file)
@@ -317,7 +317,9 @@ void MachOCodeEmitter::emitJumpTables(MachineJumpTableInfo *MJTI) {
 //                          MachOWriter Implementation
 //===----------------------------------------------------------------------===//
 
-MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) : O(o), TM(tm) {
+const int MachOWriter::ID = 0;
+MachOWriter::MachOWriter(std::ostream &o, TargetMachine &tm) 
+  : MachineFunctionPass((intptr_t)&ID), O(o), TM(tm) {
   is64Bit = TM.getTargetData()->getPointerSizeInBits() == 64;
   isLittleEndian = TM.getTargetData()->isLittleEndian();
 
index 0792ac8a7df9dd7a4022e4fd530ee1b07e5cfd94..d4c146d3bfe4ec9665f5445053b10961429342c3 100644 (file)
@@ -84,6 +84,7 @@ namespace llvm {
   class MachOWriter : public MachineFunctionPass {
     friend class MachOCodeEmitter;
   public:
+    static const int ID;
     MachineCodeEmitter &getMachineCodeEmitter() const {
       return *(MachineCodeEmitter*)MCE;
     }
index 29eee3612f64dad64499983cfa14cf017696ea19..9b43e655bc999c4f2faff29b3ef658fd39d0478f 100644 (file)
@@ -44,11 +44,13 @@ void MachineFunctionPass::virtfn() {}
 
 namespace {
   struct VISIBILITY_HIDDEN Printer : public MachineFunctionPass {
+    static const int ID;
+
     std::ostream *OS;
     const std::string Banner;
 
-    Printer (std::ostream *_OS, const std::string &_Banner) :
-      OS (_OS), Banner (_Banner) { }
+    Printer (std::ostream *_OS, const std::string &_Banner) 
+      : MachineFunctionPass((intptr_t)&ID), OS (_OS), Banner (_Banner) { }
 
     const char *getPassName() const { return "MachineFunction Printer"; }
 
@@ -62,6 +64,7 @@ namespace {
       return false;
     }
   };
+  const int Printer::ID = 0;
 }
 
 /// Returns a newly-created MachineFunction Printer pass. The default output
@@ -74,6 +77,9 @@ FunctionPass *llvm::createMachineFunctionPrinterPass(std::ostream *OS,
 
 namespace {
   struct VISIBILITY_HIDDEN Deleter : public MachineFunctionPass {
+    static const int ID;
+    Deleter() : MachineFunctionPass((intptr_t)&ID) {}
+
     const char *getPassName() const { return "Machine Code Deleter"; }
 
     bool runOnMachineFunction(MachineFunction &MF) {
@@ -82,6 +88,7 @@ namespace {
       return true;
     }
   };
+  const int Deleter::ID = 0;
 }
 
 /// MachineCodeDeletion Pass - This pass deletes all of the machine code for
index d37021e0a31b12d32cc7d35495ff1fac928f84c4..6421396faac1ef3fb87074f96f47dd7c2913b38d 100644 (file)
@@ -28,6 +28,7 @@ using namespace llvm::dwarf;
 
 // Handle the Pass registration stuff necessary to use TargetData's.
 namespace {
+  const int MachineModuleInfo::ID = 0;
   RegisterPass<MachineModuleInfo> X("machinemoduleinfo", "Module Information");
 }
 
@@ -1462,7 +1463,8 @@ DebugScope::~DebugScope() {
 //===----------------------------------------------------------------------===//
 
 MachineModuleInfo::MachineModuleInfo()
-: DR()
+: ImmutablePass((intptr_t)&ID)
+, DR()
 , VR()
 , CompileUnits()
 , Directories()
@@ -1749,10 +1751,15 @@ Function *MachineModuleInfo::getPersonality() const {
 namespace llvm {
 
 struct DebugLabelFolder : public MachineFunctionPass {
+  static const int ID;
+  DebugLabelFolder() : MachineFunctionPass((intptr_t)&ID) {}
+
   virtual bool runOnMachineFunction(MachineFunction &MF);
   virtual const char *getPassName() const { return "Label Folder"; }
 };
 
+const int  DebugLabelFolder::ID = 0;
+
 bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) {
   // Get machine module info.
   MachineModuleInfo *MMI = getAnalysisToUpdate<MachineModuleInfo>();
index 0b77fe266964e865859478f90173c9eecc24f1ff..f26819d9e2943adf78c1da6219fd8061316a903f 100644 (file)
@@ -33,6 +33,9 @@ STATISTIC(NumAtomic, "Number of atomic phis lowered");
 
 namespace {
   struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    PNE() : MachineFunctionPass((intptr_t)&ID) {}
+
     bool runOnMachineFunction(MachineFunction &Fn) {
       analyzePHINodes(Fn);
 
@@ -73,6 +76,7 @@ namespace {
     VRegPHIUse VRegPHIUseCount;
   };
 
+  const int PNE::ID = 0;
   RegisterPass<PNE> X("phi-node-elimination",
                       "Eliminate PHI nodes for register allocation");
 }
index 98c2085ccd8caac8d4678a6bd5399d1577e72dbf..927f7d12269c96fc77f8d09232f38ad488e2f897 100644 (file)
@@ -32,6 +32,9 @@ using namespace llvm;
 
 namespace {
   struct VISIBILITY_HIDDEN PEI : public MachineFunctionPass {
+    static const int ID;
+    PEI() : MachineFunctionPass((intptr_t)&ID) {}
+
     const char *getPassName() const {
       return "Prolog/Epilog Insertion & Frame Finalization";
     }
@@ -98,6 +101,7 @@ namespace {
     void replaceFrameIndices(MachineFunction &Fn);
     void insertPrologEpilogCode(MachineFunction &Fn);
   };
+  const int PEI::ID = 0;
 }
 
 
index 8ad347bb7dad15fa90e7c4a2141b701e4dfd96dd..b45d983eebe49ff52824b52cde77e9a83c8c8860 100644 (file)
@@ -48,6 +48,9 @@ namespace {
   static unsigned numIntervals = 0;
 
   struct VISIBILITY_HIDDEN RA : public MachineFunctionPass {
+    static const int ID;
+    RA() : MachineFunctionPass((intptr_t)&ID) {}
+
     typedef std::pair<LiveInterval*, LiveInterval::iterator> IntervalPtr;
     typedef std::vector<IntervalPtr> IntervalPtrs;
   private:
@@ -146,6 +149,7 @@ namespace {
       }
     }
   };
+  const int RA::ID = 0;
 }
 
 void RA::ComputeRelatedRegClasses() {
index d3d5796e851c203fa01d0e3a6a121a4a78e7d1ce..4494552c9f2a2318138491d0c551073bb1f8e829 100644 (file)
@@ -43,6 +43,10 @@ namespace {
 
 
   class VISIBILITY_HIDDEN RA : public MachineFunctionPass {
+  public:
+    static const int ID;
+    RA() : MachineFunctionPass((intptr_t)&ID) {}
+  private:
     const TargetMachine *TM;
     MachineFunction *MF;
     const MRegisterInfo *RegInfo;
@@ -224,6 +228,7 @@ namespace {
     void reloadPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator &I,
                        unsigned PhysReg);
   };
+  const int RA::ID = 0;
 }
 
 /// getStackSpaceFor - This allocates space for the specified virtual register
index 576d2b421c56363fe1a3f708d176ddaf6ae7e067..771c68b1acc5ec3fbf536fe1c6ed671acdc9d503 100644 (file)
@@ -38,6 +38,10 @@ namespace {
                    createSimpleRegisterAllocator);
 
   class VISIBILITY_HIDDEN RegAllocSimple : public MachineFunctionPass {
+  public:
+    static const int ID;
+    RegAllocSimple() : MachineFunctionPass((intptr_t)&ID) {}
+  private:
     MachineFunction *MF;
     const TargetMachine *TM;
     const MRegisterInfo *RegInfo;
@@ -90,7 +94,7 @@ namespace {
     void spillVirtReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
                       unsigned VirtReg, unsigned PhysReg);
   };
-
+  const int RegAllocSimple::ID = 0;
 }
 
 /// getStackSpaceFor - This allocates space for the specified virtual
index 7f710040fe5c74caa329d3c8a736e9b524dc7075..c83eb5bb3daf73ab941478206a9a066394c24e7a 100644 (file)
@@ -5011,3 +5011,5 @@ SelectInlineAsmMemoryOperands(std::vector<SDOperand> &Ops, SelectionDAG &DAG) {
   if (e != InOps.size())
     Ops.push_back(InOps.back());
 }
+
+const int SelectionDAGISel::ID = 0;
index b14a95e406c5eba273111bdca144446799d0137a..455993c45d702bd02401906798e8bac803f1fbfd 100644 (file)
@@ -50,12 +50,16 @@ STATISTIC(NumConvertedTo3Addr, "Number of instructions promoted to 3-address");
 namespace {
   struct VISIBILITY_HIDDEN TwoAddressInstructionPass
    : public MachineFunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    TwoAddressInstructionPass() : MachineFunctionPass((intptr_t)&ID) {}
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
 
     /// runOnMachineFunction - pass entry point
     bool runOnMachineFunction(MachineFunction&);
   };
 
+  const int TwoAddressInstructionPass::ID = 0;
   RegisterPass<TwoAddressInstructionPass>
   X("twoaddressinstruction", "Two-Address instruction pass");
 }
index 951deb60d96bf5c6be9f51199e3ce5ed622d698b..f66a7713d7f97798dfba2dfe76fd8b95bef1f550 100644 (file)
@@ -34,7 +34,11 @@ using namespace llvm;
 namespace {
   class VISIBILITY_HIDDEN UnreachableBlockElim : public FunctionPass {
     virtual bool runOnFunction(Function &F);
+  public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    UnreachableBlockElim() : FunctionPass((intptr_t)&ID) {}
   };
+  const int UnreachableBlockElim::ID = 0;
   RegisterPass<UnreachableBlockElim>
   X("unreachableblockelim", "Remove unreachable blocks from the CFG");
 }
index 9237228a91cc443caa422c72dcf522aa6584bbb9..0850d229945058902b63515ab162a196f8671411 100644 (file)
@@ -128,6 +128,9 @@ namespace {
     ARMFunctionInfo *AFI;
     bool isThumb;
   public:
+    static const int ID;
+    ARMConstantIslands() : MachineFunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnMachineFunction(MachineFunction &Fn);
 
     virtual const char *getPassName() const {
@@ -171,6 +174,7 @@ namespace {
     void dumpBBs();
     void verify(MachineFunction &Fn);
   };
+  const int ARMConstantIslands::ID = 0;
 }
 
 /// verify - check BBOffsets, BBSizes, alignment of islands
index 3f8f35016d19d8632399c6966a8ec8d56cbedb55..143fa1bbdaacf6f20e34ae5da15e8dc1a50c7864 100644 (file)
@@ -38,6 +38,9 @@ STATISTIC(NumFSTMGened, "Number of fstm instructions generated");
 
 namespace {
   struct VISIBILITY_HIDDEN ARMLoadStoreOpt : public MachineFunctionPass {
+    static const int ID;
+    ARMLoadStoreOpt() : MachineFunctionPass((intptr_t)&ID) {}
+
     const TargetInstrInfo *TII;
     const MRegisterInfo *MRI;
     ARMFunctionInfo *AFI;
@@ -70,6 +73,7 @@ namespace {
     bool LoadStoreMultipleOpti(MachineBasicBlock &MBB);
     bool MergeReturnIntoLDM(MachineBasicBlock &MBB);
   };
+  const int ARMLoadStoreOpt::ID = 0;
 }
 
 /// createARMLoadStoreOptimizationPass - returns an instance of the load / store
index 65bacb8a749006fa0069aeab8213ad4ca6f95791..f0f70adffef1d7d6056fd715c0507ab5645b9d39 100644 (file)
@@ -22,6 +22,8 @@ using namespace llvm;
 
 namespace {
   struct VISIBILITY_HIDDEN AlphaBSel : public MachineFunctionPass {
+    static const int ID;
+    AlphaBSel() : MachineFunctionPass((intptr_t)&ID) {}
 
     virtual bool runOnMachineFunction(MachineFunction &Fn);
 
@@ -29,6 +31,7 @@ namespace {
       return "Alpha Branch Selection";
     }
   };
+  const int AlphaBSel::ID = 0;
 }
 
 /// createAlphaBranchSelectionPass - returns an instance of the Branch Selection
index 15aef8532d5fb4acbd8e0643d251ed0a539274a3..006e57176e0388f794c43af018e921427837470a 100644 (file)
@@ -36,11 +36,12 @@ namespace {
     int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
 
   public:
+    static const int ID;
     explicit AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce)
-      : II(0), TM(tm), MCE(mce) {}
+      : MachineFunctionPass((intptr_t)&ID), II(0), TM(tm), MCE(mce) {}
     AlphaCodeEmitter(TargetMachine &tm, MachineCodeEmitter &mce,
                      const AlphaInstrInfo& ii)
-      : II(&ii), TM(tm), MCE(mce) {}
+      : MachineFunctionPass((intptr_t)&ID), II(&ii), TM(tm), MCE(mce) {}
 
     bool runOnMachineFunction(MachineFunction &MF);
 
@@ -60,6 +61,7 @@ namespace {
     void emitBasicBlock(MachineBasicBlock &MBB);
 
   };
+  const int AlphaCodeEmitter::ID = 0;
 }
 
 /// createAlphaCodeEmitterPass - Return a pass that emits the collected Alpha code
index 6d2d243e3d0f3f3af0b873aff380014697aec012..c5a20e7a0c6aec8788d9943d860fb8ab2b0b5404 100644 (file)
@@ -37,7 +37,9 @@ namespace {
     ///
     AlphaTargetMachine &TM;
 
-    AlphaLLRPPass(AlphaTargetMachine &tm) : TM(tm) { }
+    static const int ID;
+    AlphaLLRPPass(AlphaTargetMachine &tm) 
+      : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
 
     virtual const char *getPassName() const {
       return "Alpha NOP inserter";
@@ -152,6 +154,7 @@ namespace {
       return Changed;
     }
   };
+  const int AlphaLLRPPass::ID = 0;
 } // end of anonymous namespace
 
 FunctionPass *llvm::createAlphaLLRPPass(AlphaTargetMachine &tm) {
index ac7251f89829f2c3985cc40e98cec6748af54dfd..e29edff13b55dea3b44cfab70642fec92d9acc2c 100644 (file)
@@ -56,6 +56,10 @@ namespace {
   /// external functions with the same name.
   ///
   class CBackendNameAllUsedStructsAndMergeFunctions : public ModulePass {
+  public:
+    static const int ID;
+    CBackendNameAllUsedStructsAndMergeFunctions() 
+      : ModulePass((intptr_t)&ID) {}
     void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<FindUsedTypes>();
     }
@@ -67,6 +71,8 @@ namespace {
     virtual bool runOnModule(Module &M);
   };
 
+  const int CBackendNameAllUsedStructsAndMergeFunctions::ID = 0;
+
   /// CWriter - This class is the main chunk of code that converts an LLVM
   /// module to a C translation unit.
   class CWriter : public FunctionPass, public InstVisitor<CWriter> {
@@ -82,8 +88,10 @@ namespace {
     std::set<Function*> intrinsicPrototypesAlreadyGenerated;
 
   public:
-    CWriter(std::ostream &o) : Out(o), IL(0), Mang(0), LI(0), TheModule(0), 
-                               TAsm(0), TD(0) {}
+    static const int ID;
+    CWriter(std::ostream &o) 
+      : FunctionPass((intptr_t)&ID), Out(o), IL(0), Mang(0), LI(0), 
+        TheModule(0), TAsm(0), TD(0) {}
 
     virtual const char *getPassName() const { return "C backend"; }
 
@@ -256,6 +264,8 @@ namespace {
   };
 }
 
+const int CWriter::ID = 0;
+
 /// This method inserts names for any unnamed structure types that are used by
 /// the program, and removes names from structure types that are not used by the
 /// program.
index 08e4ba8d376a0e6ae837bf48743c637854a21dd8..89732aed5f38b0525d9cdf7659a5fb85dfdf65c9 100644 (file)
@@ -36,12 +36,14 @@ STATISTIC(StopBitsAdded, "Number of stop bits added");
 
 namespace {
   struct IA64BundlingPass : public MachineFunctionPass {
+    static const int ID;
     /// Target machine description which we query for reg. names, data
     /// layout, etc.
     ///
     IA64TargetMachine &TM;
 
-    IA64BundlingPass(IA64TargetMachine &tm) : TM(tm) { }
+    IA64BundlingPass(IA64TargetMachine &tm) 
+      : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
 
     virtual const char *getPassName() const {
       return "IA64 (Itanium) Bundling Pass";
@@ -61,6 +63,7 @@ namespace {
     // 'fallthrough' code
     std::set<unsigned> PendingRegWrites;
   };
+  const int IA64BundlingPass::ID = 0;
 } // end of anonymous namespace
 
 /// createIA64BundlingPass - Returns a pass that adds STOP (;;) instructions
index 55eb03c7d0120b714b4011f88b59cd2b0d01bb03..86bea59db42bbba369ce61d28ae3c1bf87bababf 100644 (file)
@@ -80,6 +80,8 @@ bool MSILModule::runOnModule(Module &M) {
   return Changed;
 }
 
+const int MSILModule::ID = 0;
+const int MSILWriter::ID = 0;
 
 bool MSILWriter::runOnFunction(Function &F) {
   if (F.isDeclaration()) return false;
index 7fa039e3d9dff5e31aab4a7a4a106ea990b90216..15a463d73dd31bba56ccdf3b15a649ca603516c6 100644 (file)
@@ -37,9 +37,10 @@ namespace {
     const TargetData*& TD;
 
   public:
+    static const int ID;
     MSILModule(const std::set<const Type *>*& _UsedTypes,
                const TargetData*& _TD)
-      : UsedTypes(_UsedTypes), TD(_TD) {}
+      : ModulePass((intptr_t)&ID), UsedTypes(_UsedTypes), TD(_TD) {}
 
     void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<FindUsedTypes>();
@@ -82,8 +83,8 @@ namespace {
     std::map<const GlobalVariable*,std::vector<StaticInitializer> >
       StaticInitList;
     const std::set<const Type *>* UsedTypes;
-
-    MSILWriter(std::ostream &o) : Out(o) {
+    static const int ID;
+    MSILWriter(std::ostream &o) : FunctionPass((intptr_t)&ID), Out(o) {
       UniqID = 0;
     }
 
index 2cd8325ce3d598c13f9e5d83e9f5a1fa0028002f..a4f0caee8a63609870eb8386f0382cef746ac8e5 100644 (file)
@@ -32,6 +32,9 @@ STATISTIC(NumExpanded, "Number of branches expanded to long format");
 
 namespace {
   struct VISIBILITY_HIDDEN PPCBSel : public MachineFunctionPass {
+    static const int ID;
+    PPCBSel() : MachineFunctionPass((intptr_t)&ID) {}
+
     /// BlockSizes - The sizes of the basic blocks in the function.
     std::vector<unsigned> BlockSizes;
 
@@ -41,6 +44,7 @@ namespace {
       return "PowerPC Branch Selector";
     }
   };
+  const int PPCBSel::ID = 0;
 }
 
 /// createPPCBranchSelectionPass - returns an instance of the Branch Selection
index 6e3d68d0477a28848148e38686e9978c685c75d8..acca7a30ebc0312212efaf8489fc45736ed5fc49 100644 (file)
@@ -40,8 +40,9 @@ namespace {
     int getMachineOpValue(MachineInstr &MI, MachineOperand &MO);
 
   public:
+    static const int ID;
     PPCCodeEmitter(TargetMachine &T, MachineCodeEmitter &M)
-      : TM(T), MCE(M) {}
+      : MachineFunctionPass((intptr_t)&ID), TM(T), MCE(M) {}
 
     const char *getPassName() const { return "PowerPC Machine Code Emitter"; }
 
@@ -63,6 +64,7 @@ namespace {
     ///
     unsigned getBinaryCodeForInstr(MachineInstr &MI);
   };
+  const int PPCCodeEmitter::ID = 0;
 }
 
 /// createPPCCodeEmitterPass - Return a pass that emits the collected PPC code
index 898b23ab50fb9892b4697c65e5d9ed64cdda6663..313eab9319ffbc51cc2d627aeb74cc8b8b0c12a8 100644 (file)
@@ -30,7 +30,9 @@ namespace {
     TargetMachine &TM;
     const TargetInstrInfo *TII;
 
-    Filler(TargetMachine &tm) : TM(tm), TII(tm.getInstrInfo()) { }
+    static const int ID;
+    Filler(TargetMachine &tm) 
+      : MachineFunctionPass((intptr_t)&ID), TM(tm), TII(tm.getInstrInfo()) { }
 
     virtual const char *getPassName() const {
       return "SPARC Delay Slot Filler";
@@ -46,6 +48,7 @@ namespace {
     }
 
   };
+  const int Filler::ID = 0;
 } // end of anonymous namespace
 
 /// createSparcDelaySlotFillerPass - Returns a pass that fills in delay
index f7e6506de4310963c8deea89714d77e85e9ea950..5596586f0c0d1b918754d6e6f56e65842a91d065 100644 (file)
@@ -31,8 +31,10 @@ namespace {
     /// layout, etc.
     ///
     TargetMachine &TM;
-
-    FPMover(TargetMachine &tm) : TM(tm) { }
+    
+    static const int ID;
+    FPMover(TargetMachine &tm) 
+      : MachineFunctionPass((intptr_t)&ID), TM(tm) { }
 
     virtual const char *getPassName() const {
       return "Sparc Double-FP Move Fixer";
@@ -41,6 +43,7 @@ namespace {
     bool runOnMachineBasicBlock(MachineBasicBlock &MBB);
     bool runOnMachineFunction(MachineFunction &F);
   };
+  const int FPMover::ID = 0;
 } // end of anonymous namespace
 
 /// createSparcFPMoverPass - Returns a pass that turns FpMOVD
index 2cbb903b96308acbfaed41ed67b5819356c3bdd5..d1842fe7de21aa7c5e572214b7c3dbc234dc5e9c 100644 (file)
@@ -33,6 +33,7 @@ using namespace llvm;
 // Handle the Pass registration stuff necessary to use TargetData's.
 namespace {
   // Register the default SparcV9 implementation...
+  const int TargetData::ID = 0;
   RegisterPass<TargetData> X("targetdata", "Target Data Layout");
 }
 
@@ -221,7 +222,8 @@ void TargetData::init(const std::string &TargetDescription) {
   }
 }
 
-TargetData::TargetData(const Module *M) {
+TargetData::TargetData(const Module *M) 
+  : ImmutablePass((intptr_t)&ID) {
   init(M->getDataLayout());
 }
 
index 7371aada077b74ad69bd91943b9399acb3f99837..db80d9f892eb20f4891602844d073225e3622e9e 100644 (file)
@@ -39,11 +39,14 @@ namespace {
     MachineCodeEmitter  &MCE;
     bool Is64BitMode;
   public:
+    static const int ID;
     explicit Emitter(TargetMachine &tm, MachineCodeEmitter &mce)
-      : II(0), TD(0), TM(tm), MCE(mce), Is64BitMode(false) {}
+      : MachineFunctionPass((intptr_t)&ID), II(0), TD(0), TM(tm), 
+      MCE(mce), Is64BitMode(false) {}
     Emitter(TargetMachine &tm, MachineCodeEmitter &mce,
             const X86InstrInfo &ii, const TargetData &td, bool is64)
-      : II(&ii), TD(&td), TM(tm), MCE(mce), Is64BitMode(is64) {}
+      : MachineFunctionPass((intptr_t)&ID), II(&ii), TD(&td), TM(tm), 
+      MCE(mce), Is64BitMode(is64) {}
 
     bool runOnMachineFunction(MachineFunction &MF);
 
@@ -79,6 +82,7 @@ namespace {
     bool isX86_64ExtendedReg(const MachineOperand &MO);
     unsigned determineREX(const MachineInstr &MI);
   };
+  const int Emitter::ID = 0;
 }
 
 /// createX86CodeEmitterPass - Return a pass that emits the collected X86 code
index 2439d19234c8fe1d9c8e4664d541ffdc9759b4e7..4667b91ba6213cd9e3455362f96ee27ea518df9e 100644 (file)
@@ -52,6 +52,9 @@ STATISTIC(NumFP  , "Number of floating point instructions");
 
 namespace {
   struct VISIBILITY_HIDDEN FPS : public MachineFunctionPass {
+    static const int ID;
+    FPS() : MachineFunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnMachineFunction(MachineFunction &MF);
 
     virtual const char *getPassName() const { return "X86 FP Stackifier"; }
@@ -151,6 +154,7 @@ namespace {
     void handleCondMovFP(MachineBasicBlock::iterator &I);
     void handleSpecialFP(MachineBasicBlock::iterator &I);
   };
+  const int FPS::ID = 0;
 }
 
 FunctionPass *llvm::createX86FloatingPointStackifierPass() { return new FPS(); }
index df8866279f2463a461c24e2cea63483f027ea347..d9af9df18b5910efa5b0246671888646f585e5db 100644 (file)
@@ -25,6 +25,9 @@ STATISTIC(HelloCounter, "Counts number of functions greeted");
 namespace {
   // Hello - The first implementation, without getAnalysisUsage.
   struct Hello : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    Hello() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F) {
       HelloCounter++;
       std::string fname = F.getName();
@@ -33,10 +36,15 @@ namespace {
       return false;
     }
   };
+
+  const int Hello::ID = 0;
   RegisterPass<Hello> X("hello", "Hello World Pass");
 
   // Hello2 - The second implementation with getAnalysisUsage implemented.
   struct Hello2 : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    Hello2() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F) {
       HelloCounter++;
       std::string fname = F.getName();
@@ -50,6 +58,7 @@ namespace {
       AU.setPreservesAll();
     };
   };
+  const int Hello2::ID = 0;
   RegisterPass<Hello2> Y("hello2",
                         "Hello World Pass (with getAnalysisUsage implemented)");
 }
index e1fe118686e902f83a8f14d02588662fa3d3b1f5..6310e5dc0fe11c6a20d92cf42f2db54ae54280d3 100644 (file)
@@ -63,12 +63,16 @@ namespace {
     }
 
     virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
+    static const int ID; // Pass identifcation, replacement for typeid
+    ArgPromotion() : CallGraphSCCPass((intptr_t)&ID) {}
+
   private:
     bool PromoteArguments(CallGraphNode *CGN);
     bool isSafeToPromoteArgument(Argument *Arg) const;
     Function *DoPromotion(Function *F, std::vector<Argument*> &ArgsToPromote);
   };
 
+  const int ArgPromotion::ID = 0;
   RegisterPass<ArgPromotion> X("argpromotion",
                                "Promote 'by reference' arguments to scalars");
 }
index 400b5e2031297893a41173d8862518cc2937024f..5c226438c2b45bb7a4545471cc01705f75624778 100644 (file)
@@ -29,12 +29,16 @@ STATISTIC(NumMerged, "Number of global constants merged");
 
 namespace {
   struct VISIBILITY_HIDDEN ConstantMerge : public ModulePass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    ConstantMerge() : ModulePass((intptr_t)&ID) {}
+
     // run - For this pass, process all of the globals in the module,
     // eliminating duplicate constants.
     //
     bool runOnModule(Module &M);
   };
 
+  const int ConstantMerge::ID = 0;
   RegisterPass<ConstantMerge>X("constmerge","Merge Duplicate Global Constants");
 }
 
index d0dbc8b4288531a661a85795ee310b611ffa6783..162d078514e5a01ea22e573dd31436a66fed4c71 100644 (file)
@@ -76,6 +76,8 @@ namespace {
     std::multimap<Function*, CallSite> CallSites;
 
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    DAE() : ModulePass((intptr_t)&ID) {}
     bool runOnModule(Module &M);
 
     virtual bool ShouldHackArguments() const { return false; }
@@ -93,14 +95,17 @@ namespace {
 
     void RemoveDeadArgumentsFromFunction(Function *F);
   };
+  const int DAE::ID = 0;
   RegisterPass<DAE> X("deadargelim", "Dead Argument Elimination");
 
   /// DAH - DeadArgumentHacking pass - Same as dead argument elimination, but
   /// deletes arguments to functions which are external.  This is only for use
   /// by bugpoint.
   struct DAH : public DAE {
+    static const int ID;
     virtual bool ShouldHackArguments() const { return true; }
   };
+  const int DAH::ID = 0;
   RegisterPass<DAH> Y("deadarghaX0r",
                       "Dead Argument Hacking (BUGPOINT USE ONLY; DO NOT USE)");
 }
index a72a48cc635f18ad81ee8f68fa2d31819fbf7110..8ecd4b7688e0f98ca2bab9c12b6f69955f6673c7 100644 (file)
@@ -26,6 +26,9 @@ STATISTIC(NumKilled, "Number of unused typenames removed from symtab");
 
 namespace {
   struct VISIBILITY_HIDDEN DTE : public ModulePass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    DTE() : ModulePass((intptr_t)&ID) {}
+
     // doPassInitialization - For this pass, it removes global symbol table
     // entries for primitive types.  These are never used for linking in GCC and
     // they make the output uglier to look at, so we nuke them.
@@ -40,6 +43,7 @@ namespace {
       AU.addRequired<FindUsedTypes>();
     }
   };
+  const int DTE::ID = 0;
   RegisterPass<DTE> X("deadtypeelim", "Dead Type Elimination");
 }
 
index afaf38d280824dd6f7d14bdf3342ba94c42ed4dd..7a4765533ee8714766eb63c0b41bcd06f87151c8 100644 (file)
@@ -25,13 +25,16 @@ namespace {
     bool deleteFunc;
     bool reLink;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+
     /// FunctionExtractorPass - If deleteFn is true, this pass deletes as the
     /// specified function. Otherwise, it deletes as much of the module as
     /// possible, except for the function specified.
     ///
     FunctionExtractorPass(Function *F = 0, bool deleteFn = true,
                           bool relinkCallees = false)
-      : Named(F), deleteFunc(deleteFn), reLink(relinkCallees) {}
+      : ModulePass((intptr_t)&ID), Named(F), deleteFunc(deleteFn), 
+      reLink(relinkCallees) {}
 
     bool runOnModule(Module &M) {
       if (Named == 0) {
@@ -131,6 +134,7 @@ namespace {
     }
   };
 
+  const int FunctionExtractorPass::ID = 0;
   RegisterPass<FunctionExtractorPass> X("extract", "Function Extractor");
 }
 
index 56879e2b1362e83e512d4f9ec6a67365327e214c..00b16a839e3f951f95f2299218d2cbded5d04f27 100644 (file)
@@ -30,6 +30,9 @@ STATISTIC(NumVariables, "Number of global variables removed");
 
 namespace {
   struct VISIBILITY_HIDDEN GlobalDCE : public ModulePass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    GlobalDCE() : ModulePass((intptr_t)&ID) {}
     // run - Do the GlobalDCE pass on the specified module, optionally updating
     // the specified callgraph to reflect the changes.
     //
@@ -46,6 +49,7 @@ namespace {
     bool SafeToDestroyConstant(Constant* C);
     bool RemoveUnusedGlobalValue(GlobalValue &GV);
   };
+  const int GlobalDCE::ID = 0;
   RegisterPass<GlobalDCE> X("globaldce", "Dead Global Elimination");
 }
 
index 9ac36548708abcb4fde55a737bf880afe0a9e5fa..cfa8998b2f984c3cfbb5b7b59ed9ae48d5388679 100644 (file)
@@ -50,6 +50,8 @@ namespace {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
     }
+    static const int ID; // Pass identifcation, replacement for typeid
+    GlobalOpt() : ModulePass((intptr_t)&ID) {}
 
     bool runOnModule(Module &M);
 
@@ -61,6 +63,7 @@ namespace {
     bool ProcessInternalGlobal(GlobalVariable *GV,Module::global_iterator &GVI);
   };
 
+  const int GlobalOpt::ID = 0;
   RegisterPass<GlobalOpt> X("globalopt", "Global Variable Optimizer");
 }
 
index af4fb69c82134ea7e2ec525c77077cf8452515b7..9ef775660a61e9893eeac68ec1528713ca9446c3 100644 (file)
@@ -33,11 +33,15 @@ namespace {
   /// IPCP - The interprocedural constant propagation pass
   ///
   struct VISIBILITY_HIDDEN IPCP : public ModulePass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    IPCP() : ModulePass((intptr_t)&ID) {}
+
     bool runOnModule(Module &M);
   private:
     bool PropagateConstantsIntoArguments(Function &F);
     bool PropagateConstantReturn(Function &F);
   };
+  const int IPCP::ID = 0;
   RegisterPass<IPCP> X("ipconstprop", "Interprocedural constant propagation");
 }
 
index eeddad71a9795e66d97305ba2cf9f6f5ae4aed8f..20d11178bf9f6e04d0c5e97ab2430c9f8c98ad5a 100644 (file)
@@ -32,8 +32,12 @@ STATISTIC(NumBounce     , "Number of bounce functions created");
 namespace {
   class VISIBILITY_HIDDEN IndMemRemPass : public ModulePass {
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    IndMemRemPass() : ModulePass((intptr_t)&ID) {}
+
     virtual bool runOnModule(Module &M);
   };
+  const int IndMemRemPass::ID = 0;
   RegisterPass<IndMemRemPass> X("indmemrem","Indirect Malloc and Free Removal");
 } // end anonymous namespace
 
index 64de9c395e32e000ec744ef27f02a9102ab0c5bb..8f9a1f64d9148c4c1e302d1bbef7aa8170eb7829 100644 (file)
@@ -54,8 +54,10 @@ namespace {
   class VISIBILITY_HIDDEN SimpleInliner : public Inliner {
     std::map<const Function*, FunctionInfo> CachedFunctionInfo;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
     int getInlineCost(CallSite CS);
   };
+  const int SimpleInliner::ID = 0;
   RegisterPass<SimpleInliner> X("inline", "Function Integration/Inlining");
 }
 
index 5990b65837d338622a846db3a8b5b0c68ed60743..82611cbc8ffa7046bd02b1be098c20d19d90f24e 100644 (file)
@@ -36,7 +36,9 @@ namespace {
         cl::desc("Control the amount of inlining to perform (default = 200)"));
 }
 
-Inliner::Inliner() : InlineThreshold(InlineLimit) {}
+const int Inliner::ID = 0;
+Inliner::Inliner() 
+  : CallGraphSCCPass((intptr_t)&ID), InlineThreshold(InlineLimit) {}
 
 /// getAnalysisUsage - For this class, we declare that we require and preserve
 /// the call graph.  If the derived class implements this method, it should
index a59f80b86d2d954ac713e2b03d93ff04c4b89c44..321a65f4888d54b412d8b3d4ca959b683c743246 100644 (file)
@@ -27,6 +27,7 @@ namespace llvm {
 /// perform the inlining operations that does not depend on the policy.
 ///
 struct Inliner : public CallGraphSCCPass {
+  static const int ID;
   Inliner();
 
   /// getAnalysisUsage - For this class, we declare that we require and preserve
index 46d80e592ffb76f7b5e3c4c8afeac1a5d54275d2..17de131590f1538223f752650bec395766b23905 100644 (file)
@@ -46,16 +46,18 @@ namespace {
     std::set<std::string> ExternalNames;
     bool DontInternalize;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
     InternalizePass(bool InternalizeEverything = true);
     InternalizePass(const std::vector <const char *>& exportList);
     void LoadFile(const char *Filename);
     virtual bool runOnModule(Module &M);
   };
+  const int InternalizePass::ID = 0;
   RegisterPass<InternalizePass> X("internalize", "Internalize Global Symbols");
 } // end anonymous namespace
 
 InternalizePass::InternalizePass(bool InternalizeEverything) 
-  : DontInternalize(false){
+  : ModulePass((intptr_t)&ID), DontInternalize(false){
   if (!APIFile.empty())           // If a filename is specified, use it
     LoadFile(APIFile.c_str());
   else if (!APIList.empty())      // Else, if a list is specified, use it.
@@ -66,7 +68,7 @@ InternalizePass::InternalizePass(bool InternalizeEverything)
 }
 
 InternalizePass::InternalizePass(const std::vector<const char *>&exportList) 
-  : DontInternalize(false){
+  : ModulePass((intptr_t)&ID), DontInternalize(false){
   for(std::vector<const char *>::const_iterator itr = exportList.begin();
         itr != exportList.end(); itr++) {
     ExternalNames.insert(*itr);
index c5f4fca12af2c28e44596db6ab7a0d1082901afb..0ea544daa6081c0b3783b20ce4d9f132aec63d4e 100644 (file)
@@ -34,9 +34,11 @@ namespace {
   // Module passes to require FunctionPasses, so we can't get loop info if we're
   // not a function pass.
   struct VISIBILITY_HIDDEN LoopExtractor : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
     unsigned NumLoops;
 
-    LoopExtractor(unsigned numLoops = ~0) : NumLoops(numLoops) {}
+    LoopExtractor(unsigned numLoops = ~0) 
+      : FunctionPass((intptr_t)&ID), NumLoops(numLoops) {}
 
     virtual bool runOnFunction(Function &F);
 
@@ -49,14 +51,17 @@ namespace {
     }
   };
 
+  const int LoopExtractor::ID = 0;
   RegisterPass<LoopExtractor>
   X("loop-extract", "Extract loops into new functions");
 
   /// SingleLoopExtractor - For bugpoint.
   struct SingleLoopExtractor : public LoopExtractor {
+    static const int ID; // Pass identifcation, replacement for typeid
     SingleLoopExtractor() : LoopExtractor(1) {}
   };
 
+  const int SingleLoopExtractor::ID = 0;
   RegisterPass<SingleLoopExtractor>
   Y("loop-extract-single", "Extract at most one loop into a new function");
 } // End anonymous namespace
@@ -147,11 +152,15 @@ namespace {
   class BlockExtractorPass : public ModulePass {
     std::vector<BasicBlock*> BlocksToNotExtract;
   public:
-    BlockExtractorPass(std::vector<BasicBlock*> &B) : BlocksToNotExtract(B) {}
-    BlockExtractorPass() {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    BlockExtractorPass(std::vector<BasicBlock*> &B) 
+      : ModulePass((intptr_t)&ID), BlocksToNotExtract(B) {}
+    BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
 
     bool runOnModule(Module &M);
   };
+
+  const int BlockExtractorPass::ID = 0;
   RegisterPass<BlockExtractorPass>
   XX("extract-blocks", "Extract Basic Blocks From Module (for bugpoint use)");
 }
index 3f32c0c76d59c7fffb9755b1fbf7bd99a80455c6..010bc592afc702db712fc7a08aeac07281d8ccda 100644 (file)
@@ -109,6 +109,9 @@ namespace {
 
     bool IsTransformableFunction(const std::string& Name);
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerSetJmp() : ModulePass((intptr_t)&ID) {}
+
     void visitCallInst(CallInst& CI);
     void visitInvokeInst(InvokeInst& II);
     void visitReturnInst(ReturnInst& RI);
@@ -118,6 +121,7 @@ namespace {
     bool doInitialization(Module& M);
   };
 
+  const int LowerSetJmp::ID = 0;
   RegisterPass<LowerSetJmp> X("lowersetjmp", "Lower Set Jump");
 } // end anonymous namespace
 
index 6040379d58e29747ae153aa87152492c890ad68f..ee37992d163b93cf16a8525ce00ee62d629b65c6 100644 (file)
@@ -35,6 +35,9 @@ STATISTIC(NumUnreach, "Number of noreturn calls optimized");
 
 namespace {
   struct VISIBILITY_HIDDEN PruneEH : public CallGraphSCCPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    PruneEH() : CallGraphSCCPass((intptr_t)&ID) {}
+
     /// DoesNotUnwind - This set contains all of the functions which we have
     /// determined cannot unwind.
     std::set<CallGraphNode*> DoesNotUnwind;
@@ -49,6 +52,8 @@ namespace {
     bool SimplifyFunction(Function *F);
     void DeleteBasicBlock(BasicBlock *BB);
   };
+
+  const int PruneEH::ID = 0;
   RegisterPass<PruneEH> X("prune-eh", "Remove unused exception handling info");
 }
 
index ce6db5624a08975ad40d0e4c9b4ab5178a4d68c6..f7f40377f0d268ece02c11b38571df2d0d8c6340 100644 (file)
@@ -35,7 +35,9 @@ namespace {
     Function *MallocFunc;   // Functions in the module we are processing
     Function *FreeFunc;     // Initialized by doPassInitializationVirt
   public:
-    RaiseAllocations() : MallocFunc(0), FreeFunc(0) {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    RaiseAllocations() 
+      : ModulePass((intptr_t)&ID), MallocFunc(0), FreeFunc(0) {}
 
     // doPassInitialization - For the raise allocations pass, this finds a
     // declaration for malloc and free if they exist.
@@ -47,6 +49,7 @@ namespace {
     bool runOnModule(Module &M);
   };
 
+  const int RaiseAllocations::ID = 0;
   RegisterPass<RaiseAllocations>
   X("raiseallocs", "Raise allocations from calls to instructions");
 }  // end anonymous namespace
index 5900a0254fcb98d17e7af258345cccfe181aac0d..f5a8fee38779aff0abb0002cab7d01dd7cd093f3 100644 (file)
@@ -152,6 +152,9 @@ public:
 /// @brief A ModulePass for optimizing well-known function calls.
 class VISIBILITY_HIDDEN SimplifyLibCalls : public ModulePass {
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+  SimplifyLibCalls() : ModulePass((intptr_t)&ID) {}
+
   /// We need some target data for accurate signature details that are
   /// target dependent. So we require target data in our AnalysisUsage.
   /// @brief Require TargetData from AnalysisUsage.
@@ -373,6 +376,7 @@ private:
   TargetData *TD;        ///< Cached TargetData
 };
 
+const int SimplifyLibCalls::ID = 0;
 // Register the pass
 RegisterPass<SimplifyLibCalls>
 X("simplify-libcalls", "Simplify well-known library calls");
index 7d03ae68abf68d9dd3614cbff156eb006a53c238..d1467f9b58b39122502e37f2aab1d2f20703d994 100644 (file)
@@ -27,9 +27,12 @@ namespace {
 /// @brief Pass to remove unused function declarations.
 class VISIBILITY_HIDDEN StripDeadPrototypesPass : public ModulePass {
 public:
-  StripDeadPrototypesPass() { }
+  static const int ID; // Pass identifcation, replacement for typeid
+  StripDeadPrototypesPass() : ModulePass((intptr_t)&ID) { }
   virtual bool runOnModule(Module &M);
 };
+
+const int StripDeadPrototypesPass::ID = 0;
 RegisterPass<StripDeadPrototypesPass> X("strip-dead-prototypes", 
                                         "Strip Unused Function Prototypes");
 
index 2a5e8309296eddce7b72c6bdecf06868346327c3..3330f7afaec6c90c911234dacf1f344c649173b5 100644 (file)
@@ -37,7 +37,9 @@ namespace {
   class VISIBILITY_HIDDEN StripSymbols : public ModulePass {
     bool OnlyDebugInfo;
   public:
-    StripSymbols(bool ODI = false) : OnlyDebugInfo(ODI) {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    StripSymbols(bool ODI = false) 
+      : ModulePass((intptr_t)&ID), OnlyDebugInfo(ODI) {}
 
     virtual bool runOnModule(Module &M);
 
@@ -45,6 +47,8 @@ namespace {
       AU.setPreservesAll();
     }
   };
+
+  const int StripSymbols::ID = 0;
   RegisterPass<StripSymbols> X("strip", "Strip all symbols from a module");
 }
 
index fb7268e57b9c67f53aaea2854400f29aeb155a01..a44899e1b91c1c32243505fb4af3942cfc7d5ee1 100644 (file)
@@ -32,9 +32,13 @@ using namespace llvm;
 
 namespace {
   class VISIBILITY_HIDDEN FunctionProfiler : public RSProfilers_std {
+  public:
+    static const int ID;
     bool runOnModule(Module &M);
   };
 
+  const int FunctionProfiler::ID = 0;
+
   RegisterPass<FunctionProfiler> X("insert-function-profiling",
                                "Insert instrumentation for function profiling");
   RegisterAnalysisGroup<RSProfilers> XG(X);
@@ -79,8 +83,11 @@ bool FunctionProfiler::runOnModule(Module &M) {
 namespace {
   class BlockProfiler : public RSProfilers_std {
     bool runOnModule(Module &M);
+  public:
+    static const int ID;
   };
 
+  const int BlockProfiler::ID = 0;
   RegisterPass<BlockProfiler> Y("insert-block-profiling",
                                 "Insert instrumentation for block profiling");
   RegisterAnalysisGroup<RSProfilers> YG(Y);
index e45d2bfd151f9c37a4994c36b826037daa0461ae..ff7d4270ba492244c7a7975cede5151a3a4f4247 100644 (file)
@@ -32,8 +32,12 @@ using namespace llvm;
 namespace {
   class VISIBILITY_HIDDEN EdgeProfiler : public ModulePass {
     bool runOnModule(Module &M);
+  public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    EdgeProfiler() : ModulePass((intptr_t)&ID) {}
   };
 
+  const int EdgeProfiler::ID = 0;
   RegisterPass<EdgeProfiler> X("insert-edge-profiling",
                                "Insert instrumentation for edge profiling");
 }
index f97b2bcd3e78f3d86b149d3b9695ca97f8f2abde..ad9a841cb0d935cd424af47fb285f3dea182e992 100644 (file)
@@ -69,6 +69,7 @@ namespace {
   /// measuring framework overhead
   class VISIBILITY_HIDDEN NullProfilerRS : public RSProfilers {
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
     bool isProfiling(Value* v) {
       return false;
     }
@@ -80,7 +81,9 @@ namespace {
     }
   };
 
+  const int RSProfilers::ID = 0;
   static RegisterAnalysisGroup<RSProfilers> A("Profiling passes");
+  const int NullProfilerRS::ID = 0;
   static RegisterPass<NullProfilerRS> NP("insert-null-profiling-rs",
                                          "Measure profiling framework overhead");
   static RegisterAnalysisGroup<RSProfilers, true> NPT(NP);
@@ -138,6 +141,9 @@ namespace {
 
   /// ProfilerRS - Insert the random sampling framework
   struct VISIBILITY_HIDDEN ProfilerRS : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    ProfilerRS() : FunctionPass((intptr_t)&ID) {}
+
     std::map<Value*, Value*> TransCache;
     std::set<BasicBlock*> ChoicePoints;
     Chooser* c;
@@ -154,6 +160,7 @@ namespace {
     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
   };
 
+  const int ProfilerRS::ID = 0;
   RegisterPass<ProfilerRS> X("insert-rs-profiling-framework",
                              "Insert random sampling instrumentation framework");
 }
index 747773a87c5476cf418232864ad6839a93717026..3f7d92f17abbad97f394f82415e1faaa74ce32a0 100644 (file)
@@ -17,6 +17,7 @@ namespace llvm {
   /// RSProfilers_std - a simple support class for profilers that handles most
   /// of the work of chaining and tracking inserted code.
   struct RSProfilers_std : public RSProfilers {
+    static const int ID;
     std::set<Value*> profcode;
     // Lookup up values in profcode
     virtual bool isProfiling(Value* v);
index 3946f5707cd161160eeccaea9338b6e76198c250..75e9d2f61b50807ecf44f47e273dedd1954c6d59 100644 (file)
@@ -52,6 +52,9 @@ class VISIBILITY_HIDDEN ADCE : public FunctionPass {
   // The public interface for this class
   //
 public:
+  static const int ID; // Pass identifcation, replacement for typeid
+  ADCE() : FunctionPass((intptr_t)&ID) {}
+
   // Execute the Aggressive Dead Code Elimination Algorithm
   //
   virtual bool runOnFunction(Function &F) {
@@ -104,6 +107,7 @@ private:
   }
 };
 
+  const int ADCE::ID = 0;
   RegisterPass<ADCE> X("adce", "Aggressive Dead Code Elimination");
 } // End of anonymous namespace
 
index 14de1f1f4754571e5c121d4469b29b04becf545f..a560d559bd920cd15904c9a718fedc2ee11855da 100644 (file)
@@ -41,6 +41,9 @@ STATISTIC(NumMoved, "Number of basic blocks moved");
 
 namespace {
   struct VISIBILITY_HIDDEN BlockPlacement : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    BlockPlacement() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -70,6 +73,7 @@ namespace {
     void PlaceBlocks(BasicBlock *BB);
   };
 
+  const int BlockPlacement::ID = 0;
   RegisterPass<BlockPlacement> X("block-placement",
                                  "Profile Guided Basic Block Placement");
 }
index 7a3eac78c56fd3533e1c7d6835e1a81019a39b3a..738db8027a8f2ed6364196fbf412bdd5ada6bf45 100644 (file)
@@ -39,7 +39,9 @@ namespace {
     /// transformation profitability.
     const TargetLowering *TLI;
   public:
-    CodeGenPrepare(const TargetLowering *tli = 0) : TLI(tli) {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    CodeGenPrepare(const TargetLowering *tli = 0) : FunctionPass((intptr_t)&ID),
+      TLI(tli) {}
     bool runOnFunction(Function &F);
     
   private:
@@ -52,6 +54,8 @@ namespace {
                                DenseMap<Value*,Value*> &SunkAddrs);
   };
 }
+
+const int CodeGenPrepare::ID = 0;
 static RegisterPass<CodeGenPrepare> X("codegenprepare",
                                       "Optimize for code generation");
 
index 90a4f3048fe935d7ac0022c96aa1d3ef1e67a43a..4f41b1badf6e53e9f3238f636eb5d8c8ca48ca5a 100644 (file)
@@ -31,6 +31,9 @@ STATISTIC(NumSwThread, "Number of CFG edges threaded through switches");
 
 namespace {
   struct VISIBILITY_HIDDEN CondProp : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    CondProp() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -45,6 +48,8 @@ namespace {
     void SimplifyPredecessors(SwitchInst *SI);
     void RevectorBlockTo(BasicBlock *FromBB, BasicBlock *ToBB);
   };
+  
+  const int CondProp::ID = 0;
   RegisterPass<CondProp> X("condprop", "Conditional Propagation");
 }
 
index 226d1deb41b06eb0fceaa2bd6593b80e1daafde7..32f5879911cc04b0aa8ce9145b1b46cc64c47341 100644 (file)
@@ -34,6 +34,9 @@ STATISTIC(NumInstKilled, "Number of instructions killed");
 
 namespace {
   struct VISIBILITY_HIDDEN ConstantPropagation : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    ConstantPropagation() : FunctionPass((intptr_t)&ID) {}
+
     bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -41,6 +44,7 @@ namespace {
     }
   };
 
+  const int ConstantPropagation::ID = 0;
   RegisterPass<ConstantPropagation> X("constprop",
                                       "Simple constant propagation");
 }
index d42dd9a7e2730d83beb80fa61895f30ed6b7789f..540f62c67477bd5125d893e8a16f71aaf99e53c3 100644 (file)
@@ -225,6 +225,9 @@ namespace {
     std::map<BasicBlock*, RegionInfo> RegionInfoMap;
     ETForest *EF;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    CEE() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
     // We don't modify the program, so we preserve all analyses
@@ -284,6 +287,8 @@ namespace {
     bool SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI);
     bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI);
   };
+  
+  const int CEE::ID = 0;
   RegisterPass<CEE> X("cee", "Correlated Expression Elimination");
 }
 
index 998d87cf1b67a0640a7ce0eff3ac2c295387e115..1bfa73d91ff1850db7eda83707ccac3c7355734a 100644 (file)
@@ -35,6 +35,8 @@ namespace {
   // DeadInstElimination pass implementation
   //
   struct VISIBILITY_HIDDEN DeadInstElimination : public BasicBlockPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    DeadInstElimination() : BasicBlockPass(intptr_t(&ID)) {}
     virtual bool runOnBasicBlock(BasicBlock &BB) {
       bool Changed = false;
       for (BasicBlock::iterator DI = BB.begin(); DI != BB.end(); )
@@ -51,6 +53,7 @@ namespace {
     }
   };
 
+  const int DeadInstElimination::ID = 0;
   RegisterPass<DeadInstElimination> X("die", "Dead Instruction Elimination");
 }
 
@@ -64,6 +67,9 @@ namespace {
   // DeadCodeElimination pass implementation
   //
   struct DCE : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    DCE() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
      virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -71,6 +77,7 @@ namespace {
     }
  };
 
+  const int DCE::ID = 0;
   RegisterPass<DCE> Y("dce", "Dead Code Elimination");
 }
 
index 9ebb9b4974be60851a0885979d7229300f003ab9..709d1689f8d3b13f1f82627cd72b2e3da6a49d82 100644 (file)
@@ -34,6 +34,8 @@ STATISTIC(NumOther , "Number of other instrs removed");
 
 namespace {
   struct VISIBILITY_HIDDEN DSE : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    DSE() : FunctionPass((intptr_t)&ID) {}
 
     virtual bool runOnFunction(Function &F) {
       bool Changed = false;
@@ -56,6 +58,7 @@ namespace {
       AU.addPreserved<AliasAnalysis>();
     }
   };
+  const int DSE::ID = 0;
   RegisterPass<DSE> X("dse", "Dead Store Elimination");
 }
 
index f4727d4e30305def281b96480ed18c20aa2b909e..bf84c937ace100d17ed49ac763ad1ea45080ba8d 100644 (file)
@@ -37,6 +37,9 @@ STATISTIC(NumArgsRepl   , "Number of function arguments replaced "
                           "with constant values");
 namespace {
   struct VISIBILITY_HIDDEN GCSE : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    GCSE() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
   private:
@@ -51,6 +54,7 @@ namespace {
     }
   };
 
+  const int GCSE::ID = 0;
   RegisterPass<GCSE> X("gcse", "Global Common Subexpression Elimination");
 }
 
index aad6cc9a5e828e57774fcdfbf64a6f522641217b..313f811051fe9fe28b0350538b5f1c6174a1b6d4 100644 (file)
@@ -68,7 +68,10 @@ namespace {
     ScalarEvolution *SE;
     bool Changed;
   public:
-    
+
+   static const int ID; // Pass identifcation, replacement for typeid
+   IndVarSimplify() : LoopPass((intptr_t)&ID) {}
+
    bool runOnLoop(Loop *L, LPPassManager &LPM);
    bool doInitialization(Loop *L, LPPassManager &LPM);
    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -91,6 +94,8 @@ namespace {
 
     void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts);
   };
+
+  const int IndVarSimplify::ID = 0;
   RegisterPass<IndVarSimplify> X("indvars", "Canonicalize Induction Variables");
 }
 
index b3496c343996d7864d611d6e00651f0e15a93e27..c1bc47d5439d4185568958ed3a443b9a39e9d651 100644 (file)
@@ -76,6 +76,9 @@ namespace {
     TargetData *TD;
     bool MustPreserveLCSSA;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    InstCombiner() : FunctionPass((intptr_t)&ID) {}
+
     /// AddToWorkList - Add the specified instruction to the worklist if it
     /// isn't already in it.
     void AddToWorkList(Instruction *I) {
@@ -358,6 +361,7 @@ namespace {
     Value *EvaluateInDifferentType(Value *V, const Type *Ty, bool isSigned);
   };
 
+  const int InstCombiner::ID = 0;
   RegisterPass<InstCombiner> X("instcombine", "Combine redundant instructions");
 }
 
index f367973fddc96cbab3e0e681d9ebb16813861f26..6a16243ebaf7417e120a55819cde21532b700038 100644 (file)
@@ -63,6 +63,9 @@ namespace {
                    cl::desc("Disable memory promotion in LICM pass"));
 
   struct VISIBILITY_HIDDEN LICM : public LoopPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    LICM() : LoopPass((intptr_t)&ID) {}
+
     virtual bool runOnLoop(Loop *L, LPPassManager &LPM);
 
     /// This transformation requires natural loop information & requires that
@@ -201,6 +204,7 @@ namespace {
                                     std::map<Value*, AllocaInst*> &Val2AlMap);
   };
 
+  const int LICM::ID = 0;
   RegisterPass<LICM> X("licm", "Loop Invariant Code Motion");
 }
 
index b9db3f6f90cf7cee5aedb04101969167684a341e..8abd96eb06fea5af30d96d26732a84c7f4a0ad51 100644 (file)
@@ -44,7 +44,9 @@ namespace {
   class VISIBILITY_HIDDEN LoopRotate : public LoopPass {
 
   public:
-    
+    static const int ID; // Pass ID, replacement for typeid
+    LoopRotate() : LoopPass((intptr_t)&ID) {}
+
     // Rotate Loop L as many times as possible. Return true if
     // loop is rotated at least once.
     bool runOnLoop(Loop *L, LPPassManager &LPM);
@@ -92,6 +94,7 @@ namespace {
     SmallVector<RenameData, MAX_HEADER_SIZE> LoopHeaderInfo;
   };
   
+  const int LoopRotate::ID = 0;
   RegisterPass<LoopRotate> X ("loop-rotate", "Rotate Loops");
 }
 
index 6bece9cfb7ebcb3437b1765dd29678da86d6cf97..5f9562b6b3f785ed3ae7fccbe76144e06fc2f509 100644 (file)
@@ -143,7 +143,9 @@ namespace {
     const TargetLowering *TLI;
 
   public:
-    LoopStrengthReduce(const TargetLowering *tli = NULL) : TLI(tli) {
+    static const int ID; // Pass ID, replacement for typeid
+    LoopStrengthReduce(const TargetLowering *tli = NULL) : 
+      LoopPass((intptr_t)&ID), TLI(tli) {
     }
 
     bool runOnLoop(Loop *L, LPPassManager &LPM);
@@ -186,6 +188,7 @@ private:
                                       Loop *L, bool isOnlyStride);
     void DeleteTriviallyDeadInstructions(std::set<Instruction*> &Insts);
   };
+  const int LoopStrengthReduce::ID = 0;
   RegisterPass<LoopStrengthReduce> X("loop-reduce", "Loop Strength Reduction");
 }
 
index 63696025cbb43e0c52498ed34dc7e4e308fdc3ed..0cdef0f8a392b1fe45a21aecd53192d5484ffca6 100644 (file)
@@ -49,6 +49,9 @@ namespace {
   class VISIBILITY_HIDDEN LoopUnroll : public LoopPass {
     LoopInfo *LI;  // The current loop information
   public:
+    static const int ID; // Pass ID, replacement for typeid
+    LoopUnroll()  : LoopPass((intptr_t)&ID) {}
+
     bool runOnLoop(Loop *L, LPPassManager &LPM);
     BasicBlock* FoldBlockIntoPredecessor(BasicBlock* BB);
 
@@ -63,6 +66,7 @@ namespace {
       AU.addPreserved<LoopInfo>();
     }
   };
+  const int LoopUnroll::ID = 0;
   RegisterPass<LoopUnroll> X("loop-unroll", "Unroll loops");
 }
 
index 77dfb908fa774ea78b2e9c7587fe140b09c62d49..ce459e708ad433ccf7c71e215bb64f0a7c0b8639 100644 (file)
@@ -69,6 +69,9 @@ namespace {
     SmallPtrSet<Value *,8> UnswitchedVals;
 
   public:
+    static const int ID; // Pass ID, replacement for typeid
+    LoopUnswitch() : LoopPass((intptr_t)&ID) {}
+
     bool runOnLoop(Loop *L, LPPassManager &LPM);
 
     /// This transformation requires natural loop information & requires that
@@ -109,6 +112,7 @@ namespace {
                            std::vector<Instruction*> &Worklist);
     void RemoveLoopFromHierarchy(Loop *L);
   };
+  const int LoopUnswitch::ID = 0;
   RegisterPass<LoopUnswitch> X("loop-unswitch", "Unswitch loops");
 }
 
index c10849e297f4439fde74e6142cf3650909da7842..93e7e85ab3c525464a61654472e6a3baa31ebafc 100644 (file)
@@ -47,7 +47,9 @@ namespace {
     /// had zero roots.
     const Type *MainRootRecordType;
   public:
-    LowerGC() : GCRootInt(0), GCReadInt(0), GCWriteInt(0),
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerGC() : FunctionPass((intptr_t)&ID), 
+                GCRootInt(0), GCReadInt(0), GCWriteInt(0),
                 GCRead(0), GCWrite(0), RootChain(0), MainRootRecordType(0) {}
     virtual bool doInitialization(Module &M);
     virtual bool runOnFunction(Function &F);
@@ -56,6 +58,7 @@ namespace {
     const StructType *getRootRecordType(unsigned NumRoots);
   };
 
+  const int LowerGC::ID = 0;
   RegisterPass<LowerGC>
   X("lowergc", "Lower GC intrinsics, for GCless code generators");
 }
index 10a5e60a86108cbf66631d2dd755ae273a5376e9..11949dbc6742aebc1739a314732e681774d980e9 100644 (file)
@@ -40,6 +40,9 @@ namespace {
 class VISIBILITY_HIDDEN LowerPacked 
   : public FunctionPass, public InstVisitor<LowerPacked> {
 public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerPacked() : FunctionPass((intptr_t)&ID) {}
+
    /// @brief Lowers packed operations to scalar operations.
    /// @param F The fuction to process
    virtual bool runOnFunction(Function &F);
@@ -104,6 +107,7 @@ private:
    std::vector<Instruction*> instrsToRemove;
 };
 
+const int LowerPacked::ID = 0;
 RegisterPass<LowerPacked>
 X("lower-packed",
   "lowers packed operations to operations on smaller packed datatypes");
index 289f9c96557c7e85036f6614c73edeadb6a31de4..ce2741bdce6f6cb28480bd38b38cd0602f1f3e5b 100644 (file)
@@ -1989,6 +1989,9 @@ namespace {
     std::vector<DominatorTree::Node *> WorkList;
 
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    PredicateSimplifier() : FunctionPass((intptr_t)&ID) {}
+
     bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -2374,6 +2377,7 @@ namespace {
     }
   }
 
+  const int PredicateSimplifier::ID = 0;
   RegisterPass<PredicateSimplifier> X("predsimplify",
                                       "Predicate Simplifier");
 }
index 8030a76eced4f91511233c8826a710f6ea6e42d0..a07b0febebecab853d280ef7d344a527c5a309ed 100644 (file)
@@ -69,6 +69,9 @@ namespace {
     std::map<Value*, unsigned> ValueRankMap;
     bool MadeChange;
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    Reassociate() : FunctionPass((intptr_t)&ID) {}
+
     bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -89,6 +92,7 @@ namespace {
     void RemoveDeadBinaryOp(Value *V);
   };
 
+  const int Reassociate::ID = 0;
   RegisterPass<Reassociate> X("reassociate", "Reassociate expressions");
 }
 
index e013cedb0d1c389cae637eb013aec17c64ee4e40..6abe4dc39efc8e0cd3cd0ad30c6005051cbddddf 100644 (file)
@@ -33,6 +33,8 @@ STATISTIC(NumDemoted, "Number of registers demoted");
 
 namespace {
   struct VISIBILITY_HIDDEN RegToMem : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    RegToMem() : FunctionPass((intptr_t)&ID) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequiredID(BreakCriticalEdgesID);
@@ -76,6 +78,7 @@ namespace {
     }
   };
   
+  const int RegToMem::ID = 0;
   RegisterPass<RegToMem> X("reg2mem", "Demote all values to stack slots");
 }
 
index 16e7a8e269b1b484243cf01a1c02a19e13842e9f..4ead2757b47bf06ffd9d767d9ec464c57fb5abc1 100644 (file)
@@ -1334,6 +1334,9 @@ namespace {
   /// Sparse Conditional Constant Propagator.
   ///
   struct VISIBILITY_HIDDEN SCCP : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    SCCP() : FunctionPass((intptr_t)&ID) {}
+
     // runOnFunction - Run the Sparse Conditional Constant Propagation
     // algorithm, and return true if the function was modified.
     //
@@ -1344,6 +1347,7 @@ namespace {
     }
   };
 
+  const int SCCP::ID = 0;
   RegisterPass<SCCP> X("sccp", "Sparse Conditional Constant Propagation");
 } // end anonymous namespace
 
@@ -1443,9 +1447,12 @@ namespace {
   /// Constant Propagation.
   ///
   struct VISIBILITY_HIDDEN IPSCCP : public ModulePass {
+    static const int ID;
+    IPSCCP() : ModulePass((intptr_t)&ID) {}
     bool runOnModule(Module &M);
   };
 
+  const int IPSCCP::ID = 0;
   RegisterPass<IPSCCP>
   Y("ipsccp", "Interprocedural Sparse Conditional Constant Propagation");
 } // end anonymous namespace
index 71007d29fe38d0cc8633c33e3beb8cbfa70e34ca..da5488be762661d094b8dd867e336ba34cc7c455 100644 (file)
@@ -47,6 +47,9 @@ STATISTIC(NumGlobals,   "Number of allocas copied from constant global");
 
 namespace {
   struct VISIBILITY_HIDDEN SROA : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    SROA() : FunctionPass((intptr_t)&ID) {}
+
     bool runOnFunction(Function &F);
 
     bool performScalarRepl(Function &F);
@@ -81,6 +84,7 @@ namespace {
     static Instruction *isOnlyCopiedFromConstantGlobal(AllocationInst *AI);
   };
 
+  const int SROA::ID = 0;
   RegisterPass<SROA> X("scalarrepl", "Scalar Replacement of Aggregates");
 }
 
index 872232fb3edae935b12e669c43402a14c59e051c..4a4bcb6eac4d824a7ea81a05dcc31bf70ee8dfab 100644 (file)
@@ -35,8 +35,12 @@ STATISTIC(NumSimpl, "Number of blocks simplified");
 
 namespace {
   struct VISIBILITY_HIDDEN CFGSimplifyPass : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    CFGSimplifyPass() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
   };
+  const int CFGSimplifyPass::ID = 0;
   RegisterPass<CFGSimplifyPass> X("simplifycfg", "Simplify the CFG");
 }
 
index 398da0aa9b6aa8fa640b7c989a77913b876c5cdc..dcd57ce212f4496e04cd9d84fda2205290f27dd1 100644 (file)
@@ -42,10 +42,15 @@ namespace {
             cl::init(6), cl::Hidden);
   class VISIBILITY_HIDDEN TailDup : public FunctionPass {
     bool runOnFunction(Function &F);
+  public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    TailDup() : FunctionPass((intptr_t)&ID) {}
+
   private:
     inline bool shouldEliminateUnconditionalBranch(TerminatorInst *TI);
     inline void eliminateUnconditionalBranch(BranchInst *BI);
   };
+  const int TailDup::ID = 0;
   RegisterPass<TailDup> X("tailduplicate", "Tail Duplication");
 }
 
index cd3b79aab6ceb1b64a7a5f674aa3afd0b2f583f8..c75b93015ca3f914e9028b3e2430b72dcc8f3309 100644 (file)
@@ -67,6 +67,9 @@ STATISTIC(NumAccumAdded, "Number of accumulators introduced");
 
 namespace {
   struct VISIBILITY_HIDDEN TailCallElim : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    TailCallElim() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
   private:
@@ -77,6 +80,7 @@ namespace {
     bool CanMoveAboveCall(Instruction *I, CallInst *CI);
     Value *CanTransformAccumulatorRecursion(Instruction *I, CallInst *CI);
   };
+  const int TailCallElim::ID = 0;
   RegisterPass<TailCallElim> X("tailcallelim", "Tail Call Elimination");
 }
 
index 7761e9361e7facf0c7db37391679aa28eaacd44f..561b71dd2c53469bbb34b2129dba7c53d7a32f1a 100644 (file)
@@ -34,6 +34,9 @@ STATISTIC(NumBroken, "Number of blocks inserted");
 
 namespace {
   struct VISIBILITY_HIDDEN BreakCriticalEdges : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    BreakCriticalEdges() : FunctionPass((intptr_t)&ID) {}
+
     virtual bool runOnFunction(Function &F);
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -47,6 +50,7 @@ namespace {
     }
   };
 
+  const int BreakCriticalEdges::ID = 0;
   RegisterPass<BreakCriticalEdges> X("break-crit-edges",
                                     "Break critical edges in CFG");
 }
index 0c223c53024bb247ef6dcef78d0c85126e423d90..e46e35b3cad2a84cd56ef99080bc87ae6464249e 100644 (file)
@@ -47,6 +47,9 @@ STATISTIC(NumLCSSA, "Number of live out of a loop variables");
 
 namespace {
   struct VISIBILITY_HIDDEN LCSSA : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    LCSSA() : FunctionPass((intptr_t)&ID) {}
+
     // Cached analysis information for the current function.
     LoopInfo *LI;
     DominatorTree *DT;
@@ -81,6 +84,7 @@ namespace {
     }
   };
   
+  const int LCSSA::ID = 0;
   RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
 }
 
index d27bc8c7ad217bacc75254230b0ce38a403d1d2b..cea0bca939dbcbb29d35c297a3db6ad16f556732 100644 (file)
@@ -54,6 +54,9 @@ STATISTIC(NumNested  , "Number of nested loops split out");
 
 namespace {
   struct VISIBILITY_HIDDEN LoopSimplify : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    LoopSimplify() : FunctionPass((intptr_t)&ID) {}
+
     // AA - If we have an alias analysis object to update, this is it, otherwise
     // this is null.
     AliasAnalysis *AA;
@@ -89,6 +92,7 @@ namespace {
                                          std::vector<BasicBlock*> &PredBlocks);
   };
 
+  const int LoopSimplify::ID = 0;
   RegisterPass<LoopSimplify>
   X("loopsimplify", "Canonicalize natural loops", true);
 }
index cb2f88558ef09e3da5e96bd55f64f7c47f01c148..0ecc775c354bb2ba1427724b7b3127bcc7bf973f 100644 (file)
@@ -36,8 +36,10 @@ namespace {
     Constant *FreeFunc;     // Initialized by doInitialization
     bool LowerMallocArgToInteger;
   public:
+    static const int ID; // Pass ID, replacement for typeid
     LowerAllocations(bool LowerToInt = false)
-      : MallocFunc(0), FreeFunc(0), LowerMallocArgToInteger(LowerToInt) {}
+      : BasicBlockPass((intptr_t)&ID), MallocFunc(0), FreeFunc(0), 
+        LowerMallocArgToInteger(LowerToInt) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.addRequired<TargetData>();
@@ -66,6 +68,7 @@ namespace {
     bool runOnBasicBlock(BasicBlock &BB);
   };
 
+  const int LowerAllocations::ID = 0;
   RegisterPass<LowerAllocations>
   X("lowerallocs", "Lower allocations from instructions to calls");
 }
index e0332d28f72f6a65794411f99df18b820bf156bb..3f8d06f31aaa66ead4a39757d5c24ba764cb9ee4 100644 (file)
@@ -75,7 +75,9 @@ namespace {
     const TargetLowering *TLI;
     
   public:
-    LowerInvoke(const TargetLowering *tli = NULL) : TLI(tli) { }
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerInvoke(const TargetLowering *tli = NULL) : FunctionPass((intptr_t)&ID),
+      TLI(tli) { }
     bool doInitialization(Module &M);
     bool runOnFunction(Function &F);
  
@@ -97,6 +99,7 @@ namespace {
     bool insertExpensiveEHSupport(Function &F);
   };
 
+  const int LowerInvoke::ID = 0;
   RegisterPass<LowerInvoke>
   X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
 }
index 120c3b19c7193b543875251b40d8f1bf006399be..fda26c9e1f1cc08d8d3a60647ae93978ad322b2f 100644 (file)
@@ -33,7 +33,9 @@ namespace {
   class VISIBILITY_HIDDEN LowerSelect : public FunctionPass {
     bool OnlyFP;   // Only lower FP select instructions?
   public:
-    LowerSelect(bool onlyfp = false) : OnlyFP(onlyfp) {}
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerSelect(bool onlyfp = false) : FunctionPass((intptr_t)&ID), 
+      OnlyFP(onlyfp) {}
 
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       // This certainly destroys the CFG.
@@ -48,6 +50,7 @@ namespace {
     bool runOnFunction(Function &F);
   };
 
+  const int LowerSelect::ID = 0;
   RegisterPass<LowerSelect>
   X("lowerselect", "Lower select instructions to branches");
 }
index 61fa85c5eb61a085dd6b124c2b6e91e8de7ff3ef..482ada9b6a28b9265d8d2cefbc681d2bbae8e868 100644 (file)
@@ -30,6 +30,9 @@ namespace {
   /// modifies the CFG!
   class VISIBILITY_HIDDEN LowerSwitch : public FunctionPass {
   public:
+    static const int ID; // Pass identifcation, replacement for typeid
+    LowerSwitch() : FunctionPass((intptr_t) &ID) {} 
+
     virtual bool runOnFunction(Function &F);
     
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -75,6 +78,7 @@ namespace {
     }
   };
 
+  const int LowerSwitch::ID = 0;
   RegisterPass<LowerSwitch>
   X("lowerswitch", "Lower SwitchInst's to branches");
 }
index 7d69fd25001a7fcc3372a12f5be751e7ca3b0388..37bc318545c0b05040f3c84f88c137c4cea3847e 100644 (file)
@@ -27,6 +27,9 @@ STATISTIC(NumPromoted, "Number of alloca's promoted");
 
 namespace {
   struct VISIBILITY_HIDDEN PromotePass : public FunctionPass {
+    static const int ID; // Pass identifcation, replacement for typeid
+    PromotePass() : FunctionPass((intptr_t)&ID) {}
+
     // runOnFunction - To run this pass, first we calculate the alloca
     // instructions that are safe for promotion, then we promote each one.
     //
@@ -47,6 +50,7 @@ namespace {
     }
   };
 
+  const int PromotePass::ID = 0;
   RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
 }  // end of anonymous namespace
 
index 07512b94f48525bf9217fc8674c061091ee75838..f7dd1139caa14ce4b8ba6c929560db0d5e59a801 100644 (file)
@@ -22,6 +22,7 @@
 #include "llvm/Type.h"
 using namespace llvm;
 
+const int UnifyFunctionExitNodes::ID = 0;
 static RegisterPass<UnifyFunctionExitNodes>
 X("mergereturn", "Unify function exit nodes");
 
index 3a065b0cdfe806b62d76af258bbf21cd802b553b..53828f618e94bbdab632007e718e321d75ed8247 100644 (file)
@@ -135,8 +135,10 @@ public:
 
 }  // end namespace llvm
 
+const int PrintModulePass::ID = 0;
 static RegisterPass<PrintModulePass>
 X("printm", "Print module to stderr");
+const int PrintFunctionPass::ID = 0;
 static RegisterPass<PrintFunctionPass>
 Y("print","Print function to stderr");
 
index 9ed4c44fa5eae99c7a81c4a81f0de130f14579fc..905b56ee63e3e626555766d688f4e51c87483927 100644 (file)
@@ -58,6 +58,7 @@ static std::ostream &operator<<(std::ostream &o,
 //
 //===----------------------------------------------------------------------===//
 
+const int DominatorTree::ID = 0;
 static RegisterPass<DominatorTree>
 E("domtree", "Dominator Tree Construction", true);
 
@@ -353,6 +354,7 @@ bool DominatorTree::runOnFunction(Function &F) {
 //  DominanceFrontier Implementation
 //===----------------------------------------------------------------------===//
 
+const int DominanceFrontier::ID = 0;
 static RegisterPass<DominanceFrontier>
 G("domfrontier", "Dominance Frontier Construction", true);
 
@@ -833,6 +835,7 @@ void ETNode::assignDFSNumber(int num) {
 // ETForest implementation
 //===----------------------------------------------------------------------===//
 
+const int ETForest::ID = 0;
 static RegisterPass<ETForest>
 D("etforest", "ET Forest Construction", true);
 
index e6b31b302a952dd52ffb694df6b865cd95f87bd3..2f581c51abf0dc49bfe5132549f3e40299bff52f 100644 (file)
@@ -133,7 +133,7 @@ namespace {
 class PassRegistrar {
   /// PassInfoMap - Keep track of the passinfo object for each registered llvm
   /// pass.
-  std::map<TypeInfo, PassInfo*> PassInfoMap;
+  std::map<intptr_t, PassInfo*> PassInfoMap;
   
   /// AnalysisGroupInfo - Keep track of information for each analysis group.
   struct AnalysisGroupInfo {
@@ -147,19 +147,19 @@ class PassRegistrar {
 
 public:
   
-  const PassInfo *GetPassInfo(const std::type_info &TI) const {
-    std::map<TypeInfo, PassInfo*>::const_iterator I = PassInfoMap.find(TI);
+  const PassInfo *GetPassInfo(intptr_t TI) const {
+    std::map<intptr_t, PassInfo*>::const_iterator I = PassInfoMap.find(TI);
     return I != PassInfoMap.end() ? I->second : 0;
   }
   
   void RegisterPass(PassInfo &PI) {
     bool Inserted =
-      PassInfoMap.insert(std::make_pair(TypeInfo(PI.getTypeInfo()),&PI)).second;
+      PassInfoMap.insert(std::make_pair(PI.getTypeInfo(),&PI)).second;
     assert(Inserted && "Pass registered multiple times!");
   }
   
   void UnregisterPass(PassInfo &PI) {
-    std::map<TypeInfo, PassInfo*>::iterator I =
+    std::map<intptr_t, PassInfo*>::iterator I =
       PassInfoMap.find(PI.getTypeInfo());
     assert(I != PassInfoMap.end() && "Pass registered but not in map!");
     
@@ -168,7 +168,7 @@ public:
   }
   
   void EnumerateWith(PassRegistrationListener *L) {
-    for (std::map<TypeInfo, PassInfo*>::const_iterator I = PassInfoMap.begin(),
+    for (std::map<intptr_t, PassInfo*>::const_iterator I = PassInfoMap.begin(),
          E = PassInfoMap.end(); I != E; ++I)
       L->passEnumerate(I->second);
   }
@@ -210,11 +210,10 @@ static PassRegistrar *getPassRegistrar() {
 // getPassInfo - Return the PassInfo data structure that corresponds to this
 // pass...
 const PassInfo *Pass::getPassInfo() const {
-  if (PassInfoCache) return PassInfoCache;
-  return lookupPassInfo(typeid(*this));
+  return lookupPassInfo(PassID);
 }
 
-const PassInfo *Pass::lookupPassInfo(const std::type_info &TI) {
+const PassInfo *Pass::lookupPassInfo(intptr_t TI) {
   return getPassRegistrar()->GetPassInfo(TI);
 }
 
@@ -238,12 +237,12 @@ void RegisterPassBase::unregisterPass() {
 
 // RegisterAGBase implementation
 //
-RegisterAGBase::RegisterAGBase(const std::type_info &Interface,
-                               const std::type_info *Pass, bool isDefault)
-  : RegisterPassBase(Interface),
+RegisterAGBase::RegisterAGBase(intptr_t InterfaceID,
+                               intptr_t PassID, bool isDefault)
+  : RegisterPassBase(InterfaceID),
     ImplementationInfo(0), isDefaultImplementation(isDefault) {
 
-  InterfaceInfo = const_cast<PassInfo*>(Pass::lookupPassInfo(Interface));
+  InterfaceInfo = const_cast<PassInfo*>(Pass::lookupPassInfo(InterfaceID));
   if (InterfaceInfo == 0) {
     // First reference to Interface, register it now.
     registerPass();
@@ -252,8 +251,8 @@ RegisterAGBase::RegisterAGBase(const std::type_info &Interface,
   assert(PIObj.isAnalysisGroup() &&
          "Trying to join an analysis group that is a normal pass!");
 
-  if (Pass) {
-    ImplementationInfo = Pass::lookupPassInfo(*Pass);
+  if (PassID) {
+    ImplementationInfo = Pass::lookupPassInfo(PassID);
     assert(ImplementationInfo &&
            "Must register pass before adding to AnalysisGroup!");
 
index 6fadc84200642643563c5a6d44aabd2d14365e92..694827bc5be3e589364c947bba3835925e68f96d 100644 (file)
@@ -63,7 +63,9 @@ class VISIBILITY_HIDDEN BBPassManager : public PMDataManager,
                                         public FunctionPass {
 
 public:
-  BBPassManager(int Depth) : PMDataManager(Depth) { }
+  static const int ID;
+  BBPassManager(int Depth) 
+    : PMDataManager(Depth), FunctionPass((intptr_t)&ID) {}
 
   /// Execute all of the passes scheduled for execution.  Keep track of
   /// whether any of the passes modifies the function, and if so, return true.
@@ -104,6 +106,7 @@ public:
   }
 };
 
+const int BBPassManager::ID = 0;
 }
 
 namespace llvm {
@@ -116,9 +119,10 @@ class FunctionPassManagerImpl : public Pass,
                                 public PMDataManager,
                                 public PMTopLevelManager {
 public:
-
-  FunctionPassManagerImpl(int Depth) : PMDataManager(Depth),
-                                       PMTopLevelManager(TLM_Function) { }
+  static const int ID;
+  FunctionPassManagerImpl(int Depth) : 
+    Pass((intptr_t)&ID), PMDataManager(Depth), 
+    PMTopLevelManager(TLM_Function) { }
 
   /// 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
@@ -167,9 +171,9 @@ public:
     FPPassManager *FP = static_cast<FPPassManager *>(PassManagers[N]);
     return FP;
   }
-
 };
 
+const int FunctionPassManagerImpl::ID = 0;
 //===----------------------------------------------------------------------===//
 // MPPassManager
 //
@@ -179,7 +183,8 @@ public:
 class MPPassManager : public Pass, public PMDataManager {
  
 public:
-  MPPassManager(int Depth) : PMDataManager(Depth) { }
+  static const int ID;
+  MPPassManager(int Depth) : Pass((intptr_t)&ID), PMDataManager(Depth) { }
 
   // Delete on the fly managers.
   virtual ~MPPassManager() {
@@ -242,17 +247,19 @@ public:
   std::map<Pass *, FunctionPassManagerImpl *> OnTheFlyManagers;
 };
 
+const int MPPassManager::ID = 0;
 //===----------------------------------------------------------------------===//
 // PassManagerImpl
 //
+
 /// PassManagerImpl manages MPPassManagers
 class PassManagerImpl : public Pass,
                         public PMDataManager,
                         public PMTopLevelManager {
 
 public:
-
-  PassManagerImpl(int Depth) : PMDataManager(Depth),
+  static const int ID;
+  PassManagerImpl(int Depth) : Pass((intptr_t)&ID), PMDataManager(Depth),
                                PMTopLevelManager(TLM_Pass) { }
 
   /// add - Add a pass to the queue of passes to run.  This passes ownership of
@@ -297,6 +304,7 @@ public:
 
 };
 
+const int PassManagerImpl::ID = 0;
 } // End of llvm namespace
 
 namespace {
@@ -1100,6 +1108,7 @@ bool FunctionPassManagerImpl::run(Function &F) {
 //===----------------------------------------------------------------------===//
 // FPPassManager implementation
 
+const int FPPassManager::ID = 0;
 /// Print passes managed by this manager
 void FPPassManager::dumpPassStructure(unsigned Offset) {
   llvm::cerr << std::string(Offset*2, ' ') << "FunctionPass Manager\n";
index 8e632e2f8da0fa6f689da3066119b72b33b86542..94027f858fe52137027f880f2d3336ca35fb9dce 100644 (file)
@@ -69,6 +69,7 @@ namespace {  // Anonymous namespace for class
 
   struct VISIBILITY_HIDDEN
      Verifier : public FunctionPass, InstVisitor<Verifier> {
+    static const int ID; // Pass ID, replacement for typeid
     bool Broken;          // Is this module found to be broken?
     bool RealPass;        // Are we not being run by a PassManager?
     VerifierFailureAction action;
@@ -84,18 +85,22 @@ namespace {  // Anonymous namespace for class
     SmallPtrSet<Instruction*, 16> InstsInThisBlock;
 
     Verifier()
-        : Broken(false), RealPass(true), action(AbortProcessAction),
-          EF(0), msgs( std::ios::app | std::ios::out ) {}
+      : FunctionPass((intptr_t)&ID), 
+      Broken(false), RealPass(true), action(AbortProcessAction),
+      EF(0), msgs( std::ios::app | std::ios::out ) {}
     Verifier( VerifierFailureAction ctn )
-        : Broken(false), RealPass(true), action(ctn), EF(0),
-          msgs( std::ios::app | std::ios::out ) {}
+      : FunctionPass((intptr_t)&ID), 
+      Broken(false), RealPass(true), action(ctn), EF(0),
+      msgs( std::ios::app | std::ios::out ) {}
     Verifier(bool AB )
-        : Broken(false), RealPass(true),
-          action( AB ? AbortProcessAction : PrintMessageAction), EF(0),
-          msgs( std::ios::app | std::ios::out ) {}
+      : FunctionPass((intptr_t)&ID), 
+      Broken(false), RealPass(true),
+      action( AB ? AbortProcessAction : PrintMessageAction), EF(0),
+      msgs( std::ios::app | std::ios::out ) {}
     Verifier(ETForest &ef)
-      : Broken(false), RealPass(false), action(PrintMessageAction),
-        EF(&ef), msgs( std::ios::app | std::ios::out ) {}
+      : FunctionPass((intptr_t)&ID), 
+      Broken(false), RealPass(false), action(PrintMessageAction),
+      EF(&ef), msgs( std::ios::app | std::ios::out ) {}
 
 
     bool doInitialization(Module &M) {
@@ -261,6 +266,7 @@ namespace {  // Anonymous namespace for class
     }
   };
 
+  const int Verifier::ID = 0;
   RegisterPass<Verifier> X("verify", "Module Verifier");
 } // End anonymous namespace
 
index 1ff06f88b1c1c536735cbbc22c899d13f7859e0c..e4eb32f07a5da1306f60299d9ce7830b3d2a3ac8 100644 (file)
@@ -305,7 +305,11 @@ namespace {
   /// BlocksToNotExtract list.
   class BlockExtractorPass : public ModulePass {
     bool runOnModule(Module &M);
+  public:
+    static const int ID; // Pass ID, replacement for typeid
+    BlockExtractorPass() : ModulePass((intptr_t)&ID) {}
   };
+  const int BlockExtractorPass::ID = 0;
   RegisterPass<BlockExtractorPass>
   XX("extract-bbs", "Extract Basic Blocks From Module (for bugpoint use)");
 }
index 5147a9070707ba44ce22d3d2d4b2723f186e6809..a3fc149612573832cd9aeadff4c3f7fb35db375e 100644 (file)
@@ -25,6 +25,10 @@ namespace {
   /// CrashOnCalls - This pass is used to test bugpoint.  It intentionally
   /// crashes on any call instructions.
   class CrashOnCalls : public BasicBlockPass {
+  public:
+    static const int ID; // Pass ID, replacement for typeid
+    CrashOnCalls() : BasicBlockPass((intptr_t)&ID) {}
+  private:
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
     }
@@ -38,6 +42,7 @@ namespace {
     }
   };
 
+  const int CrashOnCalls::ID = 0;
   RegisterPass<CrashOnCalls>
   X("bugpoint-crashcalls",
     "BugPoint Test Pass - Intentionally crash on CallInsts");
@@ -47,6 +52,10 @@ namespace {
   /// DeleteCalls - This pass is used to test bugpoint.  It intentionally
   /// deletes some call instructions, "misoptimizing" the program.
   class DeleteCalls : public BasicBlockPass {
+  public:
+    static const int ID; // Pass ID, replacement for typeid
+    DeleteCalls() : BasicBlockPass((intptr_t)&ID) {}
+  private:
     bool runOnBasicBlock(BasicBlock &BB) {
       for (BasicBlock::iterator I = BB.begin(), E = BB.end(); I != E; ++I)
         if (CallInst *CI = dyn_cast<CallInst>(I)) {
@@ -58,7 +67,8 @@ namespace {
       return false;
     }
   };
-
+  const int DeleteCalls::ID = 0;
   RegisterPass<DeleteCalls>
   Y("bugpoint-deletecalls",
     "BugPoint Test Pass - Intentionally 'misoptimize' CallInsts");
index 3223b820303d8704527b0f332c2ba507005871ea..a13695daef442c673e9c82444e1c0d00df86fe56 100644 (file)
@@ -30,6 +30,8 @@ namespace {
   /// useful when looking for standard library functions we should constant fold
   /// or handle in alias analyses.
   struct ExternalFunctionsPassedConstants : public ModulePass {
+    static const int ID; // Pass ID, replacement for typeid
+    ExternalFunctionsPassedConstants() : ModulePass((intptr_t)&ID) {}
     virtual bool runOnModule(Module &M) {
       for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
         if (I->isDeclaration()) {
@@ -61,10 +63,14 @@ namespace {
     }
   };
 
+  const int ExternalFunctionsPassedConstants::ID = 0;
   RegisterPass<ExternalFunctionsPassedConstants>
   P1("externalfnconstants", "Print external fn callsites passed constants");
   
   struct CallGraphPrinter : public ModulePass {
+    static const int ID; // Pass ID, replacement for typeid
+    CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
+
     virtual void getAnalysisUsage(AnalysisUsage &AU) const {
       AU.setPreservesAll();
       AU.addRequiredTransitive<CallGraph>();
@@ -76,6 +82,7 @@ namespace {
     }
   };
   
+  const int CallGraphPrinter::ID = 0;
   RegisterPass<CallGraphPrinter>
     P2("callgraph", "Print a call graph");
 }
index 5e8a859443cb502b9df527af1d32bcd3f4aeb1b5..cb0b6643ae384247fe878b47cd3ec99cfa1cc516 100644 (file)
@@ -60,6 +60,9 @@ namespace llvm {
 
 namespace {
   struct CallGraphPrinter : public ModulePass {
+    static const int ID; // Pass ID, replacement for typeid
+    CallGraphPrinter() : ModulePass((intptr_t)&ID) {}
+
     virtual bool runOnModule(Module &M) {
       WriteGraphToFile(std::cerr, "callgraph", &getAnalysis<CallGraph>());
       return false;
@@ -74,6 +77,7 @@ namespace {
     }
   };
 
+  const int CallGraphPrinter::ID = 0;
   RegisterPass<CallGraphPrinter> P2("print-callgraph",
                                     "Print Call Graph to 'dot' file");
 }
index 904442d11f88069904fc1b624f458c8ab271fcff..689307ca66b705dac7af6f6b8447811331c08344 100644 (file)
@@ -35,6 +35,8 @@ using namespace llvm;
 
 namespace {
   struct CFGSCC : public FunctionPass {
+    static const int ID;  // Pass identification, replacement for typeid
+    CFGSCC() : FunctionPass((intptr_t)&ID) {}
     bool runOnFunction(Function& func);
 
     void print(std::ostream &O, const Module* = 0) const { }
@@ -45,6 +47,9 @@ namespace {
   };
 
   struct CallGraphSCC : public ModulePass {
+    static const int ID;  // Pass identification, replacement for typeid
+    CallGraphSCC() : ModulePass((intptr_t)&ID) {}
+
     // run - Print out SCCs in the call graph for the specified module.
     bool runOnModule(Module &M);
 
@@ -57,9 +62,11 @@ namespace {
     }
   };
 
+  const int CFGSCC::ID = 0;
   RegisterPass<CFGSCC>
   Y("cfgscc", "Print SCCs of each function CFG");
 
+  const int CallGraphSCC::ID = 0;
   RegisterPass<CallGraphSCC>
   Z("callscc", "Print SCCs of the Call Graph");
 }
index d30d412f05e3b287db60e4ac313e41a9e21937a5..680bb5f49f10aee1e24b1f9fedac354871982e55 100644 (file)
@@ -98,8 +98,10 @@ AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization"));
 namespace {
 
 struct ModulePassPrinter : public ModulePass {
+  static const int ID;
   const PassInfo *PassToPrint;
-  ModulePassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
+  ModulePassPrinter(const PassInfo *PI) : ModulePass((intptr_t)&ID),
+                                          PassToPrint(PI) {}
 
   virtual bool runOnModule(Module &M) {
     if (!Quiet) {
@@ -119,12 +121,15 @@ struct ModulePassPrinter : public ModulePass {
   }
 };
 
+const int ModulePassPrinter::ID = 0;
 struct FunctionPassPrinter : public FunctionPass {
   const PassInfo *PassToPrint;
-  FunctionPassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
+  static const int ID;
+  FunctionPassPrinter(const PassInfo *PI) : FunctionPass((intptr_t)&ID),
+                                            PassToPrint(PI) {}
 
   virtual bool runOnFunction(Function &F) {
-    if (!Quiet) {
+    if (!Quiet) { 
       cout << "Printing analysis '" << PassToPrint->getPassName()
            << "' for function '" << F.getName() << "':\n";
     }
@@ -141,9 +146,12 @@ struct FunctionPassPrinter : public FunctionPass {
   }
 };
 
+const int FunctionPassPrinter::ID = 0;
 struct BasicBlockPassPrinter : public BasicBlockPass {
   const PassInfo *PassToPrint;
-  BasicBlockPassPrinter(const PassInfo *PI) : PassToPrint(PI) {}
+  static const int ID;
+  BasicBlockPassPrinter(const PassInfo *PI) 
+    : BasicBlockPass((intptr_t)&ID), PassToPrint(PI) {}
 
   virtual bool runOnBasicBlock(BasicBlock &BB) {
     if (!Quiet) {
@@ -164,6 +172,7 @@ struct BasicBlockPassPrinter : public BasicBlockPass {
   }
 };
 
+const int BasicBlockPassPrinter::ID = 0;
 inline void addPass(PassManager &PM, Pass *P) {
   // Add the pass to the pass manager...
   PM.add(P);