Add new optional getPassName() virtual function that a Pass can override
[oota-llvm.git] / lib / Transforms / LevelRaise.cpp
index 51d863d10df9cef5388340ff51046cb0f1b96b4b..f9f9abeace97d5a19d81be3e78fb5fee93ae554c 100644 (file)
@@ -11,7 +11,7 @@
 #include "llvm/Function.h"
 #include "llvm/iOther.h"
 #include "llvm/iMemory.h"
-#include "llvm/ConstantVals.h"
+#include "llvm/Constants.h"
 #include "llvm/Pass.h"
 #include "llvm/ConstantHandling.h"
 #include "llvm/Transforms/Scalar/DCE.h"
@@ -440,7 +440,7 @@ static bool DoRaisePass(Function *F) {
 }
 
 
-// RaisePointerReferences::doit - Raise a method representation to a higher
+// RaisePointerReferences::doit - Raise a function representation to a higher
 // level.
 //
 static bool doRPR(Function *F) {
@@ -458,7 +458,7 @@ static bool doRPR(Function *F) {
     cerr << "Looping: \n" << F;
 #endif
 
-    // Iterate over the method, refining it, until it converges on a stable
+    // Iterate over the function, refining it, until it converges on a stable
     // state
     LocalChange = false;
     while (DoRaisePass(F)) LocalChange = true;
@@ -470,8 +470,14 @@ static bool doRPR(Function *F) {
 }
 
 namespace {
-  struct RaisePointerReferences : public MethodPass {
-    virtual bool runOnMethod(Function *F) { return doRPR(F); }
+  struct RaisePointerReferences : public FunctionPass {
+    const char *getPassName() const { return "Raise Pointer References"; }
+
+    virtual bool runOnFunction(Function *F) { return doRPR(F); }
+
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.preservesCFG();
+    }
   };
 }