summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-05-01 21:15:47 +0000
committerDevang Patel <dpatel@apple.com>2007-05-01 21:15:47 +0000
commit794fd75c67a2cdc128d67342c6d88a504d186896 (patch)
tree6b805aa4a576e9de6cbf096d2fb85063b3fb8fca
parente50fb9ac174b791047ffa8648443ab94b2097cd9 (diff)
downloadllvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.gz
llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.bz2
llvm-794fd75c67a2cdc128d67342c6d88a504d186896.tar.xz
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
-rw-r--r--include/llvm/Analysis/AliasAnalysis.h1
-rw-r--r--include/llvm/Analysis/CallGraph.h1
-rw-r--r--include/llvm/Analysis/Dominators.h27
-rw-r--r--include/llvm/Analysis/FindUsedTypes.h3
-rw-r--r--include/llvm/Analysis/IntervalPartition.h4
-rw-r--r--include/llvm/Analysis/LoopInfo.h3
-rw-r--r--include/llvm/Analysis/LoopPass.h3
-rw-r--r--include/llvm/Analysis/PostDominators.h12
-rw-r--r--include/llvm/Analysis/ProfileInfo.h1
-rw-r--r--include/llvm/Analysis/ScalarEvolution.h3
-rw-r--r--include/llvm/Analysis/ValueNumbering.h1
-rw-r--r--include/llvm/Assembly/PrintModulePass.h11
-rw-r--r--include/llvm/Bytecode/WriteBytecodePass.h6
-rw-r--r--include/llvm/CallGraphSCCPass.h2
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h2
-rw-r--r--include/llvm/CodeGen/LiveIntervalAnalysis.h3
-rw-r--r--include/llvm/CodeGen/LiveVariables.h3
-rw-r--r--include/llvm/CodeGen/MachineFunctionPass.h2
-rw-r--r--include/llvm/CodeGen/MachineModuleInfo.h2
-rw-r--r--include/llvm/CodeGen/SelectionDAGISel.h4
-rw-r--r--include/llvm/Pass.h16
-rw-r--r--include/llvm/PassManagers.h4
-rw-r--r--include/llvm/PassSupport.h26
-rw-r--r--include/llvm/Target/TargetData.h9
-rw-r--r--include/llvm/Transforms/RSProfiling.h3
-rw-r--r--include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h4
-rw-r--r--lib/Analysis/AliasAnalysis.cpp1
-rw-r--r--lib/Analysis/AliasAnalysisCounter.cpp4
-rw-r--r--lib/Analysis/AliasAnalysisEvaluator.cpp4
-rw-r--r--lib/Analysis/AliasDebugger.cpp4
-rw-r--r--lib/Analysis/AliasSetTracker.cpp4
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp6
-rw-r--r--lib/Analysis/CFGPrinter.cpp6
-rw-r--r--lib/Analysis/IPA/Andersens.cpp6
-rw-r--r--lib/Analysis/IPA/CallGraph.cpp6
-rw-r--r--lib/Analysis/IPA/CallGraphSCCPass.cpp5
-rw-r--r--lib/Analysis/IPA/FindUsedTypes.cpp1
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp4
-rw-r--r--lib/Analysis/InstCount.cpp4
-rw-r--r--lib/Analysis/IntervalPartition.cpp4
-rw-r--r--lib/Analysis/LoadValueNumbering.cpp3
-rw-r--r--lib/Analysis/LoopInfo.cpp1
-rw-r--r--lib/Analysis/LoopPass.cpp5
-rw-r--r--lib/Analysis/PostDominators.cpp3
-rw-r--r--lib/Analysis/ProfileInfo.cpp7
-rw-r--r--lib/Analysis/ProfileInfoLoaderPass.cpp4
-rw-r--r--lib/Analysis/ScalarEvolution.cpp1
-rw-r--r--lib/Analysis/ValueNumbering.cpp5
-rw-r--r--lib/Bytecode/Writer/Writer.cpp1
-rw-r--r--lib/CodeGen/AsmPrinter.cpp3
-rw-r--r--lib/CodeGen/BranchFolding.cpp4
-rw-r--r--lib/CodeGen/ELFWriter.cpp4
-rw-r--r--lib/CodeGen/ELFWriter.h2
-rw-r--r--lib/CodeGen/LiveIntervalAnalysis.cpp1
-rw-r--r--lib/CodeGen/LiveVariables.cpp1
-rw-r--r--lib/CodeGen/MachOWriter.cpp4
-rw-r--r--lib/CodeGen/MachOWriter.h1
-rw-r--r--lib/CodeGen/MachineFunction.cpp11
-rw-r--r--lib/CodeGen/MachineModuleInfo.cpp9
-rw-r--r--lib/CodeGen/PHIElimination.cpp4
-rw-r--r--lib/CodeGen/PrologEpilogInserter.cpp4
-rw-r--r--lib/CodeGen/RegAllocLinearScan.cpp4
-rw-r--r--lib/CodeGen/RegAllocLocal.cpp5
-rw-r--r--lib/CodeGen/RegAllocSimple.cpp6
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp2
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp4
-rw-r--r--lib/CodeGen/UnreachableBlockElim.cpp4
-rw-r--r--lib/Target/ARM/ARMConstantIslandPass.cpp4
-rw-r--r--lib/Target/ARM/ARMLoadStoreOptimizer.cpp4
-rw-r--r--lib/Target/Alpha/AlphaBranchSelector.cpp3
-rw-r--r--lib/Target/Alpha/AlphaCodeEmitter.cpp6
-rw-r--r--lib/Target/Alpha/AlphaLLRP.cpp5
-rw-r--r--lib/Target/CBackend/CBackend.cpp14
-rw-r--r--lib/Target/IA64/IA64Bundling.cpp5
-rw-r--r--lib/Target/MSIL/MSILWriter.cpp2
-rw-r--r--lib/Target/MSIL/MSILWriter.h7
-rw-r--r--lib/Target/PowerPC/PPCBranchSelector.cpp4
-rw-r--r--lib/Target/PowerPC/PPCCodeEmitter.cpp4
-rw-r--r--lib/Target/Sparc/DelaySlotFiller.cpp5
-rw-r--r--lib/Target/Sparc/FPMover.cpp7
-rw-r--r--lib/Target/TargetData.cpp4
-rw-r--r--lib/Target/X86/X86CodeEmitter.cpp8
-rw-r--r--lib/Target/X86/X86FloatingPoint.cpp4
-rw-r--r--lib/Transforms/Hello/Hello.cpp9
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp4
-rw-r--r--lib/Transforms/IPO/ConstantMerge.cpp4
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp5
-rw-r--r--lib/Transforms/IPO/DeadTypeElimination.cpp4
-rw-r--r--lib/Transforms/IPO/ExtractFunction.cpp6
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp4
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp3
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp4
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp4
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
-rw-r--r--lib/Transforms/IPO/Inliner.cpp4
-rw-r--r--lib/Transforms/IPO/Inliner.h1
-rw-r--r--lib/Transforms/IPO/Internalize.cpp6
-rw-r--r--lib/Transforms/IPO/LoopExtractor.cpp15
-rw-r--r--lib/Transforms/IPO/LowerSetJmp.cpp4
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp5
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp5
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp4
-rw-r--r--lib/Transforms/IPO/StripDeadPrototypes.cpp5
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp6
-rw-r--r--lib/Transforms/Instrumentation/BlockProfiling.cpp7
-rw-r--r--lib/Transforms/Instrumentation/EdgeProfiling.cpp4
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp7
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.h1
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp4
-rw-r--r--lib/Transforms/Scalar/BasicBlockPlacement.cpp4
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp6
-rw-r--r--lib/Transforms/Scalar/CondPropagate.cpp5
-rw-r--r--lib/Transforms/Scalar/ConstantProp.cpp4
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp5
-rw-r--r--lib/Transforms/Scalar/DCE.cpp7
-rw-r--r--lib/Transforms/Scalar/DeadStoreElimination.cpp3
-rw-r--r--lib/Transforms/Scalar/GCSE.cpp4
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp7
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp4
-rw-r--r--lib/Transforms/Scalar/LICM.cpp4
-rw-r--r--lib/Transforms/Scalar/LoopRotation.cpp5
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp5
-rw-r--r--lib/Transforms/Scalar/LoopUnroll.cpp4
-rw-r--r--lib/Transforms/Scalar/LoopUnswitch.cpp4
-rw-r--r--lib/Transforms/Scalar/LowerGC.cpp5
-rw-r--r--lib/Transforms/Scalar/LowerPacked.cpp4
-rw-r--r--lib/Transforms/Scalar/PredicateSimplifier.cpp4
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp4
-rw-r--r--lib/Transforms/Scalar/Reg2Mem.cpp3
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp7
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp4
-rw-r--r--lib/Transforms/Scalar/SimplifyCFG.cpp4
-rw-r--r--lib/Transforms/Scalar/TailDuplication.cpp5
-rw-r--r--lib/Transforms/Scalar/TailRecursionElimination.cpp4
-rw-r--r--lib/Transforms/Utils/BreakCriticalEdges.cpp4
-rw-r--r--lib/Transforms/Utils/LCSSA.cpp4
-rw-r--r--lib/Transforms/Utils/LoopSimplify.cpp4
-rw-r--r--lib/Transforms/Utils/LowerAllocations.cpp5
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp5
-rw-r--r--lib/Transforms/Utils/LowerSelect.cpp5
-rw-r--r--lib/Transforms/Utils/LowerSwitch.cpp4
-rw-r--r--lib/Transforms/Utils/Mem2Reg.cpp4
-rw-r--r--lib/Transforms/Utils/UnifyFunctionExitNodes.cpp1
-rw-r--r--lib/VMCore/AsmWriter.cpp2
-rw-r--r--lib/VMCore/Dominators.cpp3
-rw-r--r--lib/VMCore/Pass.cpp29
-rw-r--r--lib/VMCore/PassManager.cpp25
-rw-r--r--lib/VMCore/Verifier.cpp24
-rw-r--r--tools/bugpoint/ExtractFunction.cpp4
-rw-r--r--tools/bugpoint/TestPasses.cpp12
-rw-r--r--tools/opt/AnalysisWrappers.cpp7
-rw-r--r--tools/opt/GraphPrinters.cpp4
-rw-r--r--tools/opt/PrintSCC.cpp7
-rw-r--r--tools/opt/opt.cpp17
154 files changed, 687 insertions, 129 deletions
diff --git a/include/llvm/Analysis/AliasAnalysis.h b/include/llvm/Analysis/AliasAnalysis.h
index f91403acb9..d61c886e7c 100644
--- a/include/llvm/Analysis/AliasAnalysis.h
+++ b/include/llvm/Analysis/AliasAnalysis.h
@@ -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
diff --git a/include/llvm/Analysis/CallGraph.h b/include/llvm/Analysis/CallGraph.h
index 24effd8d49..cd27e318cd 100644
--- a/include/llvm/Analysis/CallGraph.h
+++ b/include/llvm/Analysis/CallGraph.h
@@ -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...
//
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 45eed7fcda..b172b792fc 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -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!");
diff --git a/include/llvm/Analysis/FindUsedTypes.h b/include/llvm/Analysis/FindUsedTypes.h
index 008e30c93e..de892f1b9c 100644
--- a/include/llvm/Analysis/FindUsedTypes.h
+++ b/include/llvm/Analysis/FindUsedTypes.h
@@ -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.
///
diff --git a/include/llvm/Analysis/IntervalPartition.h b/include/llvm/Analysis/IntervalPartition.h
index bd998e81de..07f054b131 100644
--- a/include/llvm/Analysis/IntervalPartition.h
+++ b/include/llvm/Analysis/IntervalPartition.h
@@ -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);
diff --git a/include/llvm/Analysis/LoopInfo.h b/include/llvm/Analysis/LoopInfo.h
index 62f19e3c29..8e38c07a47 100644
--- a/include/llvm/Analysis/LoopInfo.h
+++ b/include/llvm/Analysis/LoopInfo.h
@@ -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
diff --git a/include/llvm/Analysis/LoopPass.h b/include/llvm/Analysis/LoopPass.h
index 4163a09d33..24e61435ff 100644
--- a/include/llvm/Analysis/LoopPass.h
+++ b/include/llvm/Analysis/LoopPass.h
@@ -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
diff --git a/include/llvm/Analysis/PostDominators.h b/include/llvm/Analysis/PostDominators.h
index 359f19daf8..793c7f4889 100644
--- a/include/llvm/Analysis/PostDominators.h
+++ b/include/llvm/Analysis/PostDominators.h
@@ -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();
diff --git a/include/llvm/Analysis/ProfileInfo.h b/include/llvm/Analysis/ProfileInfo.h
index 88b2ea1c8c..dc17ac1664 100644
--- a/include/llvm/Analysis/ProfileInfo.h
+++ b/include/llvm/Analysis/ProfileInfo.h
@@ -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
//===------------------------------------------------------------------===//
diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h
index 27d7e04a3e..6b05714358 100644
--- a/include/llvm/Analysis/ScalarEvolution.h
+++ b/include/llvm/Analysis/ScalarEvolution.h
@@ -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.
diff --git a/include/llvm/Analysis/ValueNumbering.h b/include/llvm/Analysis/ValueNumbering.h
index f708f48382..9d1aeb564d 100644
--- a/include/llvm/Analysis/ValueNumbering.h
+++ b/include/llvm/Analysis/ValueNumbering.h
@@ -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
diff --git a/include/llvm/Assembly/PrintModulePass.h b/include/llvm/Assembly/PrintModulePass.h
index cc9bca9288..4da55484ee 100644
--- a/include/llvm/Assembly/PrintModulePass.h
+++ b/include/llvm/Assembly/PrintModulePass.h
@@ -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;
diff --git a/include/llvm/Bytecode/WriteBytecodePass.h b/include/llvm/Bytecode/WriteBytecodePass.h
index b0155e4ddf..5c21ccded5 100644
--- a/include/llvm/Bytecode/WriteBytecodePass.h
+++ b/include/llvm/Bytecode/WriteBytecodePass.h
@@ -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;
diff --git a/include/llvm/CallGraphSCCPass.h b/include/llvm/CallGraphSCCPass.h
index af5cb849a3..90894c280c 100644
--- a/include/llvm/CallGraphSCCPass.h
+++ b/include/llvm/CallGraphSCCPass.h
@@ -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) {
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index 024001e9d6..3a5418d937 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -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
diff --git a/include/llvm/CodeGen/LiveIntervalAnalysis.h b/include/llvm/CodeGen/LiveIntervalAnalysis.h
index a42471d631..3ea0272425 100644
--- a/include/llvm/CodeGen/LiveIntervalAnalysis.h
+++ b/include/llvm/CodeGen/LiveIntervalAnalysis.h
@@ -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;
diff --git a/include/llvm/CodeGen/LiveVariables.h b/include/llvm/CodeGen/LiveVariables.h
index ebbe610ed0..ce377cd2cf 100644
--- a/include/llvm/CodeGen/LiveVariables.h
+++ b/include/llvm/CodeGen/LiveVariables.h
@@ -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
diff --git a/include/llvm/CodeGen/MachineFunctionPass.h b/include/llvm/CodeGen/MachineFunctionPass.h
index 77af52a347..7429e7b96c 100644
--- a/include/llvm/CodeGen/MachineFunctionPass.h
+++ b/include/llvm/CodeGen/MachineFunctionPass.h
@@ -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.
///
diff --git a/include/llvm/CodeGen/MachineModuleInfo.h b/include/llvm/CodeGen/MachineModuleInfo.h
index 28201dcfdc..c23916def9 100644
--- a/include/llvm/CodeGen/MachineModuleInfo.h
+++ b/include/llvm/CodeGen/MachineModuleInfo.h
@@ -1022,6 +1022,8 @@ private:
std::vector<GlobalVariable *> TypeInfos;
public:
+ static const int ID; // Pass identifcation, replacement for typeid
+
MachineModuleInfo();
~MachineModuleInfo();
diff --git a/include/llvm/CodeGen/SelectionDAGISel.h b/include/llvm/CodeGen/SelectionDAGISel.h
index 9d5b059759..f363daf9e4 100644
--- a/include/llvm/CodeGen/SelectionDAGISel.h
+++ b/include/llvm/CodeGen/SelectionDAGISel.h
@@ -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; }
diff --git a/include/llvm/Pass.h b/include/llvm/Pass.h
index 1ab6ff9a72..d678df6430 100644
--- a/include/llvm/Pass.h
+++ b/include/llvm/Pass.h
@@ -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.
///
diff --git a/include/llvm/PassManagers.h b/include/llvm/PassManagers.h
index 29912b140d..81e89a7ff5 100644
--- a/include/llvm/PassManagers.h
+++ b/include/llvm/PassManagers.h
@@ -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.
diff --git a/include/llvm/PassSupport.h b/include/llvm/PassSupport.h
index 7c3c4a9d66..f594d45f15 100644
--- a/include/llvm/PassSupport.h
+++ b/include/llvm/PassSupport.h
@@ -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);
}
};
diff --git a/include/llvm/Target/TargetData.h b/include/llvm/Target/TargetData.h
index 4e330e862d..bfc41b1640 100644
--- a/include/llvm/Target/TargetData.h
+++ b/include/llvm/Target/TargetData.h
@@ -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
diff --git a/include/llvm/Transforms/RSProfiling.h b/include/llvm/Transforms/RSProfiling.h
index 2df2932f29..900d147f7d 100644
--- a/include/llvm/Transforms/RSProfiling.h
+++ b/include/llvm/Transforms/RSProfiling.h
@@ -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;
diff --git a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
index 526851ba44..c120acce6b 100644
--- a/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
+++ b/include/llvm/Transforms/Utils/UnifyFunctionExitNodes.h
@@ -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;
diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp
index c7b68fab68..7499db562b 100644
--- a/lib/Analysis/AliasAnalysis.cpp
+++ b/lib/Analysis/AliasAnalysis.cpp
@@ -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");
}
diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp
index fcd5edc768..ee1980fc4c 100644
--- a/lib/Analysis/AliasAnalysisCounter.cpp
+++ b/lib/Analysis/AliasAnalysisCounter.cpp
@@ -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);
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index 73ea423c45..f2631cb8ba 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -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");
}
diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp
index 3f7f1cccae..a4df97a196 100644
--- a/lib/Analysis/AliasDebugger.cpp
+++ b/lib/Analysis/AliasDebugger.cpp
@@ -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);
}
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp
index 9564326685..90c90fe58f 100644
--- a/lib/Analysis/AliasSetTracker.cpp
+++ b/lib/Analysis/AliasSetTracker.cpp
@@ -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");
}
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 1ca1a35b9f..b1369a2920 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -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)");
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index a57a0685a7..6154460375 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -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)");
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 0a281c8945..cd90a6f22b 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -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);
diff --git a/lib/Analysis/IPA/CallGraph.cpp b/lib/Analysis/IPA/CallGraph.cpp
index bb96bb2d65..43e70bb218 100644
--- a/lib/Analysis/IPA/CallGraph.cpp
+++ b/lib/Analysis/IPA/CallGraph.cpp
@@ -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);
diff --git a/lib/Analysis/IPA/CallGraphSCCPass.cpp b/lib/Analysis/IPA/CallGraphSCCPass.cpp
index 0640b63e6b..2c5aeaa4c2 100644
--- a/lib/Analysis/IPA/CallGraphSCCPass.cpp
+++ b/lib/Analysis/IPA/CallGraphSCCPass.cpp
@@ -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) {
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index 1208dd1ccc..d35f7beed1 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -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");
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 8d41751b88..ea8b1d8487 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -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);
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index e075fee9f6..23c891b5ed 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -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");
}
diff --git a/lib/Analysis/IntervalPartition.cpp b/lib/Analysis/IntervalPartition.cpp
index 2385a7d247..b380a5190d 100644
--- a/lib/Analysis/IntervalPartition.cpp
+++ b/lib/Analysis/IntervalPartition.cpp
@@ -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!");
diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp
index 16687b0419..fdb5545c2b 100644
--- a/lib/Analysis/LoadValueNumbering.cpp
+++ b/lib/Analysis/LoadValueNumbering.cpp
@@ -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");
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index ab71b883a1..fd66d29584 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -27,6 +27,7 @@
#include <ostream>
using namespace llvm;
+const int LoopInfo::ID = 0;
static RegisterPass<LoopInfo>
X("loops", "Natural Loop Construction", true);
diff --git a/lib/Analysis/LoopPass.cpp b/lib/Analysis/LoopPass.cpp
index fc431035c0..eeb27ac1b3 100644
--- a/lib/Analysis/LoopPass.cpp
+++ b/lib/Analysis/LoopPass.cpp
@@ -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;
diff --git a/lib/Analysis/PostDominators.cpp b/lib/Analysis/PostDominators.cpp
index add25fdf42..a328a89414 100644
--- a/lib/Analysis/PostDominators.cpp
+++ b/lib/Analysis/PostDominators.cpp
@@ -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);
diff --git a/lib/Analysis/ProfileInfo.cpp b/lib/Analysis/ProfileInfo.cpp
index 6eead0fd6e..27da816208 100644
--- a/lib/Analysis/ProfileInfo.cpp
+++ b/lib/Analysis/ProfileInfo.cpp
@@ -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");
diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp
index 9a597a27e4..9697de8cdd 100644
--- a/lib/Analysis/ProfileInfoLoaderPass.cpp
+++ b/lib/Analysis/ProfileInfoLoaderPass.cpp
@@ -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");
diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp
index 473eadcd87..5dae7f0bf1 100644
--- a/lib/Analysis/ScalarEvolution.cpp
+++ b/lib/Analysis/ScalarEvolution.cpp
@@ -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");
}
diff --git a/lib/Analysis/ValueNumbering.cpp b/lib/Analysis/ValueNumbering.cpp
index 963ccb90f3..2ecbce55c2 100644
--- a/lib/Analysis/ValueNumbering.cpp
+++ b/lib/Analysis/ValueNumbering.cpp
@@ -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)");
diff --git a/lib/Bytecode/Writer/Writer.cpp b/lib/Bytecode/Writer/Writer.cpp
index b4a2691600..3e09a92e9f 100644
--- a/lib/Bytecode/Writer/Writer.cpp
+++ b/lib/Bytecode/Writer/Writer.cpp
@@ -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");
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp
index aa71ee0b6d..4ce379c3e4 100644
--- a/lib/CodeGen/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter.cpp
@@ -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 {
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index 33f96df302..394fe7b81b 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -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(); }
diff --git a/lib/CodeGen/ELFWriter.cpp b/lib/CodeGen/ELFWriter.cpp
index ffc0a929f3..ce534092ba 100644
--- a/lib/CodeGen/ELFWriter.cpp
+++ b/lib/CodeGen/ELFWriter.cpp
@@ -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;
diff --git a/lib/CodeGen/ELFWriter.h b/lib/CodeGen/ELFWriter.h
index e64a9c946b..8b577a0a78 100644
--- a/lib/CodeGen/ELFWriter.h
+++ b/lib/CodeGen/ELFWriter.h
@@ -30,6 +30,8 @@ namespace llvm {
class ELFWriter : public MachineFunctionPass {
friend class ELFCodeEmitter;
public:
+ static const int ID;
+
MachineCodeEmitter &getMachineCodeEmitter() const {
return *(MachineCodeEmitter*)MCE;
}
diff --git a/lib/CodeGen/LiveIntervalAnalysis.cpp b/lib/CodeGen/LiveIntervalAnalysis.cpp
index c542033548..cc6c23f59f 100644
--- a/lib/CodeGen/LiveIntervalAnalysis.cpp
+++ b/lib/CodeGen/LiveIntervalAnalysis.cpp
@@ -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>
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp
index 4816cc1257..3ea60bcf15 100644
--- a/lib/CodeGen/LiveVariables.cpp
+++ b/lib/CodeGen/LiveVariables.cpp
@@ -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 {
diff --git a/lib/CodeGen/MachOWriter.cpp b/lib/CodeGen/MachOWriter.cpp
index 5164103d27..f8dccc1895 100644
--- a/lib/CodeGen/MachOWriter.cpp
+++ b/lib/CodeGen/MachOWriter.cpp
@@ -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();
diff --git a/lib/CodeGen/MachOWriter.h b/lib/CodeGen/MachOWriter.h
index 0792ac8a7d..d4c146d3bf 100644
--- a/lib/CodeGen/MachOWriter.h
+++ b/lib/CodeGen/MachOWriter.h
@@ -84,6 +84,7 @@ namespace llvm {
class MachOWriter : public MachineFunctionPass {
friend class MachOCodeEmitter;
public:
+ static const int ID;
MachineCodeEmitter &getMachineCodeEmitter() const {
return *(MachineCodeEmitter*)MCE;
}
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index 29eee3612f..9b43e655bc 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -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
diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp
index d37021e0a3..6421396faa 100644
--- a/lib/CodeGen/MachineModuleInfo.cpp
+++ b/lib/CodeGen/MachineModuleInfo.cpp
@@ -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>();
diff --git a/lib/CodeGen/PHIElimination.cpp b/lib/CodeGen/PHIElimination.cpp
index 0b77fe2669..f26819d9e2 100644
--- a/lib/CodeGen/PHIElimination.cpp
+++ b/lib/CodeGen/PHIElimination.cpp
@@ -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");
}
diff --git a/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp
index 98c2085ccd..927f7d1226 100644
--- a/lib/CodeGen/PrologEpilogInserter.cpp
+++ b/lib/CodeGen/PrologEpilogInserter.cpp
@@ -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;
}
diff --git a/lib/CodeGen/RegAllocLinearScan.cpp b/lib/CodeGen/RegAllocLinearScan.cpp
index 8ad347bb7d..b45d983eeb 100644
--- a/lib/CodeGen/RegAllocLinearScan.cpp
+++ b/lib/CodeGen/RegAllocLinearScan.cpp
@@ -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() {
diff --git a/lib/CodeGen/RegAllocLocal.cpp b/lib/CodeGen/RegAllocLocal.cpp
index d3d5796e85..4494552c9f 100644
--- a/lib/CodeGen/RegAllocLocal.cpp
+++ b/lib/CodeGen/RegAllocLocal.cpp
@@ -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
diff --git a/lib/CodeGen/RegAllocSimple.cpp b/lib/CodeGen/RegAllocSimple.cpp
index 576d2b421c..771c68b1ac 100644
--- a/lib/CodeGen/RegAllocSimple.cpp
+++ b/lib/CodeGen/RegAllocSimple.cpp
@@ -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
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 7f710040fe..c83eb5bb3d 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -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;
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index b14a95e406..455993c45d 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -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");
}
diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp
index 951deb60d9..f66a7713d7 100644
--- a/lib/CodeGen/UnreachableBlockElim.cpp
+++ b/lib/CodeGen/UnreachableBlockElim.cpp
@@ -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");
}
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp
index 9237228a91..0850d22994 100644
--- a/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -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
diff --git a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
index 3f8f35016d..143fa1bbda 100644
--- a/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
+++ b/lib/Target/ARM/ARMLoadStoreOptimizer.cpp
@@ -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
diff --git a/lib/Target/Alpha/AlphaBranchSelector.cpp b/lib/Target/Alpha/AlphaBranchSelector.cpp
index 65bacb8a74..f0f70adffe 100644
--- a/lib/Target/Alpha/AlphaBranchSelector.cpp
+++ b/lib/Target/Alpha/AlphaBranchSelector.cpp
@@ -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
diff --git a/lib/Target/Alpha/AlphaCodeEmitter.cpp b/lib/Target/Alpha/AlphaCodeEmitter.cpp
index 15aef8532d..006e57176e 100644
--- a/lib/Target/Alpha/AlphaCodeEmitter.cpp
+++ b/lib/Target/Alpha/AlphaCodeEmitter.cpp
@@ -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
diff --git a/lib/Target/Alpha/AlphaLLRP.cpp b/lib/Target/Alpha/AlphaLLRP.cpp
index 6d2d243e3d..c5a20e7a0c 100644
--- a/lib/Target/Alpha/AlphaLLRP.cpp
+++ b/lib/Target/Alpha/AlphaLLRP.cpp
@@ -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) {
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index ac7251f898..e29edff13b 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -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.
diff --git a/lib/Target/IA64/IA64Bundling.cpp b/lib/Target/IA64/IA64Bundling.cpp
index 08e4ba8d37..89732aed5f 100644
--- a/lib/Target/IA64/IA64Bundling.cpp
+++ b/lib/Target/IA64/IA64Bundling.cpp
@@ -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
diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp
index 55eb03c7d0..86bea59db4 100644
--- a/lib/Target/MSIL/MSILWriter.cpp
+++ b/lib/Target/MSIL/MSILWriter.cpp
@@ -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;
diff --git a/lib/Target/MSIL/MSILWriter.h b/lib/Target/MSIL/MSILWriter.h
index 7fa039e3d9..15a463d73d 100644
--- a/lib/Target/MSIL/MSILWriter.h
+++ b/lib/Target/MSIL/MSILWriter.h
@@ -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;
}
diff --git a/lib/Target/PowerPC/PPCBranchSelector.cpp b/lib/Target/PowerPC/PPCBranchSelector.cpp
index 2cd8325ce3..a4f0caee8a 100644
--- a/lib/Target/PowerPC/PPCBranchSelector.cpp
+++ b/lib/Target/PowerPC/PPCBranchSelector.cpp
@@ -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
diff --git a/lib/Target/PowerPC/PPCCodeEmitter.cpp b/lib/Target/PowerPC/PPCCodeEmitter.cpp
index 6e3d68d047..acca7a30eb 100644
--- a/lib/Target/PowerPC/PPCCodeEmitter.cpp
+++ b/lib/Target/PowerPC/PPCCodeEmitter.cpp
@@ -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
diff --git a/lib/Target/Sparc/DelaySlotFiller.cpp b/lib/Target/Sparc/DelaySlotFiller.cpp
index 898b23ab50..313eab9319 100644
--- a/lib/Target/Sparc/DelaySlotFiller.cpp
+++ b/lib/Target/Sparc/DelaySlotFiller.cpp
@@ -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
diff --git a/lib/Target/Sparc/FPMover.cpp b/lib/Target/Sparc/FPMover.cpp
index f7e6506de4..5596586f0c 100644
--- a/lib/Target/Sparc/FPMover.cpp
+++ b/lib/Target/Sparc/FPMover.cpp
@@ -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
diff --git a/lib/Target/TargetData.cpp b/lib/Target/TargetData.cpp
index 2cbb903b96..d1842fe7de 100644
--- a/lib/Target/TargetData.cpp
+++ b/lib/Target/TargetData.cpp
@@ -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());
}
diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp
index 7371aada07..db80d9f892 100644
--- a/lib/Target/X86/X86CodeEmitter.cpp
+++ b/lib/Target/X86/X86CodeEmitter.cpp
@@ -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
diff --git a/lib/Target/X86/X86FloatingPoint.cpp b/lib/Target/X86/X86FloatingPoint.cpp
index 2439d19234..4667b91ba6 100644
--- a/lib/Target/X86/X86FloatingPoint.cpp
+++ b/lib/Target/X86/X86FloatingPoint.cpp
@@ -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(); }
diff --git a/lib/Transforms/Hello/Hello.cpp b/lib/Transforms/Hello/Hello.cpp
index df8866279f..d9af9df18b 100644
--- a/lib/Transforms/Hello/Hello.cpp
+++ b/lib/Transforms/Hello/Hello.cpp
@@ -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)");
}
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index e1fe118686..6310e5dc0f 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index 400b5e2031..5c226438c2 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index d0dbc8b428..162d078514 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -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)");
}
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index a72a48cc63..8ecd4b7688 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index afaf38d280..7a4765533e 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index 56879e2b13..00b16a839e 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 9ac3654870..cfa8998b2f 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index af4fb69c82..9ef775660a 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp
index eeddad71a9..20d11178bf 100644
--- a/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -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
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 64de9c395e..8f9a1f64d9 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 5990b65837..82611cbc8f 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -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
diff --git a/lib/Transforms/IPO/Inliner.h b/lib/Transforms/IPO/Inliner.h
index a59f80b86d..321a65f488 100644
--- a/lib/Transforms/IPO/Inliner.h
+++ b/lib/Transforms/IPO/Inliner.h
@@ -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
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index 46d80e592f..17de131590 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -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);
diff --git a/lib/Transforms/IPO/LoopExtractor.cpp b/lib/Transforms/IPO/LoopExtractor.cpp
index c5f4fca12a..0ea544daa6 100644
--- a/lib/Transforms/IPO/LoopExtractor.cpp
+++ b/lib/Transforms/IPO/LoopExtractor.cpp
@@ -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)");
}
diff --git a/lib/Transforms/IPO/LowerSetJmp.cpp b/lib/Transforms/IPO/LowerSetJmp.cpp
index 3f32c0c76d..010bc592af 100644
--- a/lib/Transforms/IPO/LowerSetJmp.cpp
+++ b/lib/Transforms/IPO/LowerSetJmp.cpp
@@ -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
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index 6040379d58..ee37992d16 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -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");
}
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index ce6db5624a..f7f40377f0 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -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
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index 5900a0254f..f5a8fee387 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -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");
diff --git a/lib/Transforms/IPO/StripDeadPrototypes.cpp b/lib/Transforms/IPO/StripDeadPrototypes.cpp
index 7d03ae68ab..d1467f9b58 100644
--- a/lib/Transforms/IPO/StripDeadPrototypes.cpp
+++ b/lib/Transforms/IPO/StripDeadPrototypes.cpp
@@ -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");
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 2a5e830929..3330f7afae 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -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");
}
diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp
index fb7268e57b..a44899e1b9 100644
--- a/lib/Transforms/Instrumentation/BlockProfiling.cpp
+++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp
@@ -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);
diff --git a/lib/Transforms/Instrumentation/EdgeProfiling.cpp b/lib/Transforms/Instrumentation/EdgeProfiling.cpp
index e45d2bfd15..ff7d4270ba 100644
--- a/lib/Transforms/Instrumentation/EdgeProfiling.cpp
+++ b/lib/Transforms/Instrumentation/EdgeProfiling.cpp
@@ -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");
}
diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp
index f97b2bcd3e..ad9a841cb0 100644
--- a/lib/Transforms/Instrumentation/RSProfiling.cpp
+++ b/lib/Transforms/Instrumentation/RSProfiling.cpp
@@ -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");
}
diff --git a/lib/Transforms/Instrumentation/RSProfiling.h b/lib/Transforms/Instrumentation/RSProfiling.h
index 747773a87c..3f7d92f17a 100644
--- a/lib/Transforms/Instrumentation/RSProfiling.h
+++ b/lib/Transforms/Instrumentation/RSProfiling.h
@@ -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);
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 3946f5707c..75e9d2f61b 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -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
diff --git a/lib/Transforms/Scalar/BasicBlockPlacement.cpp b/lib/Transforms/Scalar/BasicBlockPlacement.cpp
index 14de1f1f47..a560d559bd 100644
--- a/lib/Transforms/Scalar/BasicBlockPlacement.cpp
+++ b/lib/Transforms/Scalar/BasicBlockPlacement.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 7a3eac78c5..738db8027a 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -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");
diff --git a/lib/Transforms/Scalar/CondPropagate.cpp b/lib/Transforms/Scalar/CondPropagate.cpp
index 90a4f3048f..4f41b1badf 100644
--- a/lib/Transforms/Scalar/CondPropagate.cpp
+++ b/lib/Transforms/Scalar/CondPropagate.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index 226d1deb41..32f5879911 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index d42dd9a7e2..540f62c674 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 998d87cf1b..1bfa73d91f 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 9ebb9b4974..709d1689f8 100644
--- a/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index f4727d4e30..bf84c937ac 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index aad6cc9a5e..313f811051 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index b3496c3439..c1bc47d543 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp
index f367973fdd..6a16243eba 100644
--- a/lib/Transforms/Scalar/LICM.cpp
+++ b/lib/Transforms/Scalar/LICM.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LoopRotation.cpp b/lib/Transforms/Scalar/LoopRotation.cpp
index b9db3f6f90..8abd96eb06 100644
--- a/lib/Transforms/Scalar/LoopRotation.cpp
+++ b/lib/Transforms/Scalar/LoopRotation.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 6bece9cfb7..5f9562b6b3 100644
--- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LoopUnroll.cpp b/lib/Transforms/Scalar/LoopUnroll.cpp
index 63696025cb..0cdef0f8a3 100644
--- a/lib/Transforms/Scalar/LoopUnroll.cpp
+++ b/lib/Transforms/Scalar/LoopUnroll.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp
index 77dfb908fa..ce459e708a 100644
--- a/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp
index c10849e297..93e7e85ab3 100644
--- a/lib/Transforms/Scalar/LowerGC.cpp
+++ b/lib/Transforms/Scalar/LowerGC.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/LowerPacked.cpp b/lib/Transforms/Scalar/LowerPacked.cpp
index 10a5e60a86..11949dbc67 100644
--- a/lib/Transforms/Scalar/LowerPacked.cpp
+++ b/lib/Transforms/Scalar/LowerPacked.cpp
@@ -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");
diff --git a/lib/Transforms/Scalar/PredicateSimplifier.cpp b/lib/Transforms/Scalar/PredicateSimplifier.cpp
index 289f9c9655..ce2741bdce 100644
--- a/lib/Transforms/Scalar/PredicateSimplifier.cpp
+++ b/lib/Transforms/Scalar/PredicateSimplifier.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index 8030a76ece..a07b0febeb 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp
index e013cedb0d..6abe4dc39e 100644
--- a/lib/Transforms/Scalar/Reg2Mem.cpp
+++ b/lib/Transforms/Scalar/Reg2Mem.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 16e7a8e269..4ead2757b4 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -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
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index 71007d29fe..da5488be76 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/SimplifyCFG.cpp b/lib/Transforms/Scalar/SimplifyCFG.cpp
index 872232fb3e..4a4bcb6eac 100644
--- a/lib/Transforms/Scalar/SimplifyCFG.cpp
+++ b/lib/Transforms/Scalar/SimplifyCFG.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp
index 398da0aa9b..dcd57ce212 100644
--- a/lib/Transforms/Scalar/TailDuplication.cpp
+++ b/lib/Transforms/Scalar/TailDuplication.cpp
@@ -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");
}
diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp
index cd3b79aab6..c75b93015c 100644
--- a/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/BreakCriticalEdges.cpp b/lib/Transforms/Utils/BreakCriticalEdges.cpp
index 7761e9361e..561b71dd2c 100644
--- a/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/LCSSA.cpp b/lib/Transforms/Utils/LCSSA.cpp
index 0c223c5302..e46e35b3ca 100644
--- a/lib/Transforms/Utils/LCSSA.cpp
+++ b/lib/Transforms/Utils/LCSSA.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/LoopSimplify.cpp b/lib/Transforms/Utils/LoopSimplify.cpp
index d27bc8c7ad..cea0bca939 100644
--- a/lib/Transforms/Utils/LoopSimplify.cpp
+++ b/lib/Transforms/Utils/LoopSimplify.cpp
@@ -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);
}
diff --git a/lib/Transforms/Utils/LowerAllocations.cpp b/lib/Transforms/Utils/LowerAllocations.cpp
index cb2f88558e..0ecc775c35 100644
--- a/lib/Transforms/Utils/LowerAllocations.cpp
+++ b/lib/Transforms/Utils/LowerAllocations.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index e0332d28f7..3f8d06f31a 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/LowerSelect.cpp b/lib/Transforms/Utils/LowerSelect.cpp
index 120c3b19c7..fda26c9e1f 100644
--- a/lib/Transforms/Utils/LowerSelect.cpp
+++ b/lib/Transforms/Utils/LowerSelect.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/LowerSwitch.cpp b/lib/Transforms/Utils/LowerSwitch.cpp
index 61fa85c5eb..482ada9b6a 100644
--- a/lib/Transforms/Utils/LowerSwitch.cpp
+++ b/lib/Transforms/Utils/LowerSwitch.cpp
@@ -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");
}
diff --git a/lib/Transforms/Utils/Mem2Reg.cpp b/lib/Transforms/Utils/Mem2Reg.cpp
index 7d69fd2500..37bc318545 100644
--- a/lib/Transforms/Utils/Mem2Reg.cpp
+++ b/lib/Transforms/Utils/Mem2Reg.cpp
@@ -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
diff --git a/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp b/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
index 07512b94f4..f7dd1139ca 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");
diff --git a/lib/VMCore/AsmWriter.cpp b/lib/VMCore/AsmWriter.cpp
index 3a065b0cdf..53828f618e 100644
--- a/lib/VMCore/AsmWriter.cpp
+++ b/lib/VMCore/AsmWriter.cpp
@@ -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");
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp
index 9ed4c44fa5..905b56ee63 100644
--- a/lib/VMCore/Dominators.cpp
+++ b/lib/VMCore/Dominators.cpp
@@ -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);
diff --git a/lib/VMCore/Pass.cpp b/lib/VMCore/Pass.cpp
index e6b31b302a..2f581c51ab 100644
--- a/lib/VMCore/Pass.cpp
+++ b/lib/VMCore/Pass.cpp
@@ -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!");
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index 6fadc84200..694827bc5b 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -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";
diff --git a/lib/VMCore/Verifier.cpp b/lib/VMCore/Verifier.cpp
index 8e632e2f8d..94027f858f 100644
--- a/lib/VMCore/Verifier.cpp
+++ b/lib/VMCore/Verifier.cpp
@@ -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
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index 1ff06f88b1..e4eb32f07a 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -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)");
}
diff --git a/tools/bugpoint/TestPasses.cpp b/tools/bugpoint/TestPasses.cpp
index 5147a90707..a3fc149612 100644
--- a/tools/bugpoint/TestPasses.cpp
+++ b/tools/bugpoint/TestPasses.cpp
@@ -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");
diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp
index 3223b82030..a13695daef 100644
--- a/tools/opt/AnalysisWrappers.cpp
+++ b/tools/opt/AnalysisWrappers.cpp
@@ -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");
}
diff --git a/tools/opt/GraphPrinters.cpp b/tools/opt/GraphPrinters.cpp
index 5e8a859443..cb0b6643ae 100644
--- a/tools/opt/GraphPrinters.cpp
+++ b/tools/opt/GraphPrinters.cpp
@@ -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");
}
diff --git a/tools/opt/PrintSCC.cpp b/tools/opt/PrintSCC.cpp
index 904442d11f..689307ca66 100644
--- a/tools/opt/PrintSCC.cpp
+++ b/tools/opt/PrintSCC.cpp
@@ -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");
}
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp
index d30d412f05..680bb5f49f 100644
--- a/tools/opt/opt.cpp
+++ b/tools/opt/opt.cpp
@@ -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);