Do not use typeinfo to identify pass in pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index 7761e93..561b71d 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -34,6 +34,9 @@
 
 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 @@
     }
   };
 
+  const int BreakCriticalEdges::ID = 0;
   RegisterPass<BreakCriticalEdges> X("break-crit-edges",
                                     "Break critical edges in CFG");
 }
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp
index 0c223c5..e46e35b 100644
--- a/lib/Transforms/Utils/LCSSA.cpp
+++ b/lib/Transforms/Utils/LCSSA.cpp
@@ -47,6 +47,9 @@
 
 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 @@
     }
   };
   
+  const int LCSSA::ID = 0;
   RegisterPass<LCSSA> X("lcssa", "Loop-Closed SSA Form Pass");
 }
 
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index d27bc8c..cea0bca 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/LoopSimplify.cpp
@@ -54,6 +54,9 @@
 
 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 @@
                                          std::vector<BasicBlock*> &PredBlocks);
   };
 
+  const int LoopSimplify::ID = 0;
   RegisterPass<LoopSimplify>
   X("loopsimplify", "Canonicalize natural loops", true);
 }
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index cb2f885..0ecc775 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -36,8 +36,10 @@
     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 @@
     bool runOnBasicBlock(BasicBlock &BB);
   };
 
+  const int LowerAllocations::ID = 0;
   RegisterPass<LowerAllocations>
   X("lowerallocs", "Lower allocations from instructions to calls");
 }
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index e0332d2..3f8d06f 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -75,7 +75,9 @@
     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 @@
     bool insertExpensiveEHSupport(Function &F);
   };
 
+  const int LowerInvoke::ID = 0;
   RegisterPass<LowerInvoke>
   X("lowerinvoke", "Lower invoke and unwind, for unwindless code generators");
 }
diff --git a/lib/Transforms/Utils/LowerSelect.cpp b/lib/Transforms/Utils/LowerSelect.cpp
index 120c3b1..fda26c9 100644
--- a/lib/Transforms/Utils/LowerSelect.cpp
+++ b/lib/Transforms/Utils/LowerSelect.cpp
@@ -33,7 +33,9 @@
   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 @@
     bool runOnFunction(Function &F);
   };
 
+  const int LowerSelect::ID = 0;
   RegisterPass<LowerSelect>
   X("lowerselect", "Lower select instructions to branches");
 }
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index 61fa85c..482ada9 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -30,6 +30,9 @@
   /// 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 @@
     }
   };
 
+  const int LowerSwitch::ID = 0;
   RegisterPass<LowerSwitch>
   X("lowerswitch", "Lower SwitchInst's to branches");
 }
diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp
index 7d69fd2..37bc318 100644
--- a/lib/Transforms/Utils/Mem2Reg.cpp
+++ b/lib/Transforms/Utils/Mem2Reg.cpp
@@ -27,6 +27,9 @@
 
 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 @@
     }
   };
 
+  const int PromotePass::ID = 0;
   RegisterPass<PromotePass> X("mem2reg", "Promote Memory to Register");
 }  // end of anonymous namespace
 
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 07512b9..f7dd113 100644
--- a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
+++ b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
@@ -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");