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/HoistPHIConstants.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/HoistPHIConstants.cpp')
-rw-r--r-- | lib/Transforms/HoistPHIConstants.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp index 43ed725d94..f20de1cfc2 100644 --- a/lib/Transforms/HoistPHIConstants.cpp +++ b/lib/Transforms/HoistPHIConstants.cpp @@ -11,6 +11,7 @@ #include "llvm/iOther.h" #include "llvm/BasicBlock.h" #include "llvm/Method.h" +#include "llvm/Pass.h" #include <map> #include <vector> @@ -19,12 +20,6 @@ typedef std::map<BBConstTy, CastInst *> CachedCopyMap; static Value *NormalizePhiOperand(PHINode *PN, Value *CPV, BasicBlock *Pred, CachedCopyMap &CopyCache) { - - /* NOTE: CahedCopyMap was disabled to insert phi elimination code - for all phi args -- Ruchira - */ - - // Check if we've already inserted a copy for this constant in Pred // Note that `copyCache[Pred]' will create an empty vector the first time // @@ -47,7 +42,7 @@ static Value *NormalizePhiOperand(PHINode *PN, Value *CPV, // Entry point for normalizing constant args in PHIs //--------------------------------------------------------------------------- -bool HoistPHIConstants::doHoistPHIConstants(Method *M) { +static bool doHoistPHIConstants(Method *M) { CachedCopyMap Cache; bool Changed = false; @@ -77,3 +72,11 @@ bool HoistPHIConstants::doHoistPHIConstants(Method *M) { return Changed; } + +namespace { + struct HoistPHIConstants : public MethodPass { + virtual bool runOnMethod(Method *M) { return doHoistPHIConstants(M); } + }; +} + +Pass *createHoistPHIConstantsPass() { return new HoistPHIConstants(); } |