diff options
author | Chris Lattner <sabre@nondot.org> | 2002-02-26 21:46:54 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-02-26 21:46:54 +0000 |
commit | bd0ef77cde9c9e82f2b4ad33e4982c46274d6540 (patch) | |
tree | 0903b61112c9e6d336c8b623e235ede2f937f13c /lib/Transforms/Scalar/IndVarSimplify.cpp | |
parent | 3b2541424f771ae11c30675ce06da7b380780028 (diff) |
Change over to use new style pass mechanism, now passes only expose small
creation functions in their public header file, unless they can help it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1816 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r-- | lib/Transforms/Scalar/IndVarSimplify.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 692fcacb7e..fcf49e171a 100644 --- a/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -13,6 +13,7 @@ #include "llvm/Type.h" #include "llvm/BasicBlock.h" #include "llvm/ConstantVals.h" +#include "llvm/Pass.h" #include "llvm/Support/CFG.h" #include "Support/STLExtras.h" @@ -186,19 +187,29 @@ static bool TransformLoop(cfg::LoopInfo *Loops, cfg::Loop *Loop) { return Changed; } -bool InductionVariableSimplify::doit(Method *M, cfg::LoopInfo &Loops) { +static bool doit(Method *M, cfg::LoopInfo &Loops) { // Induction Variables live in the header nodes of the loops of the method... return reduce_apply_bool(Loops.getTopLevelLoops().begin(), Loops.getTopLevelLoops().end(), std::bind1st(std::ptr_fun(TransformLoop), &Loops)); } -bool InductionVariableSimplify::runOnMethod(Method *M) { - return doit(M, getAnalysis<cfg::LoopInfo>()); + +namespace { + struct InductionVariableSimplify : public MethodPass { + virtual bool runOnMethod(Method *M) { + return doit(M, getAnalysis<cfg::LoopInfo>()); + } + + virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required, + Pass::AnalysisSet &Destroyed, + Pass::AnalysisSet &Provided) { + Required.push_back(cfg::LoopInfo::ID); + } + }; } -void InductionVariableSimplify::getAnalysisUsageInfo(Pass::AnalysisSet &Req, - Pass::AnalysisSet &Dest, - Pass::AnalysisSet &Prov) { - Req.push_back(cfg::LoopInfo::ID); +Pass *createIndVarSimplifyPass() { + return new InductionVariableSimplify(); } + |