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
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp
index 43ed725..f20de1c 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 @@
 
 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 @@
 // 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 @@
   
   return Changed;
 }
+
+namespace {
+  struct HoistPHIConstants : public MethodPass {
+    virtual bool runOnMethod(Method *M) { return doHoistPHIConstants(M); }
+  };
+}
+
+Pass *createHoistPHIConstantsPass() { return new HoistPHIConstants(); }