summaryrefslogtreecommitdiff
path: root/lib/Transforms
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 /lib/Transforms
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
Diffstat (limited to 'lib/Transforms')
-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
60 files changed, 260 insertions, 18 deletions
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");