Tighten up the AnalysisUsage of lots of passes, primarily to correctly indicate wheth...
[oota-llvm.git] / lib / Transforms / IPO / ConstantMerge.cpp
index d78d185e8afdf23b45b26cf1ba56ad1f9940c853..a635b8d21bed9982cbbc69fca5fe179a743b62c8 100644 (file)
@@ -9,7 +9,7 @@
 // and elminate duplicates when it is initialized.
 //
 // The DynamicConstantMerge method is a superset of the ConstantMerge algorithm
-// that checks for each method to see if constants have been added to the
+// that checks for each function to see if constants have been added to the
 // constant pool since it was last run... if so, it processes them.
 //
 //===----------------------------------------------------------------------===//
@@ -17,7 +17,7 @@
 #include "llvm/Transforms/ConstantMerge.h"
 #include "llvm/GlobalVariable.h"
 #include "llvm/Module.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/Pass.h"
 
 // mergeDuplicateConstants - Workhorse for the pass.  This eliminates duplicate
@@ -58,8 +58,8 @@ bool mergeDuplicateConstants(Module *M, unsigned &ConstantNo,
 }
 
 namespace {
-  // FIXME: ConstantMerge should not be a methodPass!!!
-  class ConstantMerge : public MethodPass {
+  // FIXME: ConstantMerge should not be a FunctionPass!!!
+  class ConstantMerge : public FunctionPass {
   protected:
     std::map<Constant*, GlobalVariable*> Constants;
     unsigned LastConstantSeen;
@@ -73,7 +73,7 @@ namespace {
       return ::mergeDuplicateConstants(M, LastConstantSeen, Constants);
     }
     
-    bool runOnMethod(Method*) { return false; }
+    bool runOnFunction(Function *) { return false; }
     
     // doFinalization - Clean up internal state for this module
     //
@@ -82,14 +82,18 @@ namespace {
       Constants.clear();
       return false;
     }
+
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.setPreservesAll();
+    }
   };
   
   struct DynamicConstantMerge : public ConstantMerge {
-    // doPerMethodWork - Check to see if any globals have been added to the 
+    // runOnFunction - Check to see if any globals have been added to the 
     // global list for the module.  If so, eliminate them.
     //
-    bool runOnMethod(Method *M) {
-      return ::mergeDuplicateConstants(M->getParent(), LastConstantSeen,
+    bool runOnFunction(Function *F) {
+      return ::mergeDuplicateConstants(F->getParent(), LastConstantSeen,
                                        Constants);
     }
   };