* Rename MethodPass class to FunctionPass
  - Rename runOnMethod to runOnFunction
* Transform getAnalysisUsageInfo into getAnalysisUsage
  - Method is now const
  - It now takes one AnalysisUsage object to fill in instead of 3 vectors
    to fill in
  - Pass's now specify which other passes they _preserve_ not which ones
    they modify (be conservative!)
  - A pass can specify that it preserves all analyses (because it never
    modifies the underlying program)
* s/Method/Function/g in other random places as well


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2333 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/HoistPHIConstants.cpp b/lib/Transforms/HoistPHIConstants.cpp
index 26cf5ca..f6e6109 100644
--- a/lib/Transforms/HoistPHIConstants.cpp
+++ b/lib/Transforms/HoistPHIConstants.cpp
@@ -74,8 +74,8 @@
 }
 
 namespace {
-  struct HoistPHIConstants : public MethodPass {
-    virtual bool runOnMethod(Function *F) { return doHoistPHIConstants(F); }
+  struct HoistPHIConstants : public FunctionPass {
+    virtual bool runOnFunction(Function *F) { return doHoistPHIConstants(F); }
   };
 }
 
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index ef51105..ee28b13 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -58,8 +58,8 @@
 }
 
 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 @@
       return ::mergeDuplicateConstants(M, LastConstantSeen, Constants);
     }
     
-    bool runOnMethod(Function *) { return false; }
+    bool runOnFunction(Function *) { return false; }
     
     // doFinalization - Clean up internal state for this module
     //
@@ -85,10 +85,10 @@
   };
   
   struct DynamicConstantMerge : public ConstantMerge {
-    // runOnMethod - 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(Function *F) {
+    bool runOnFunction(Function *F) {
       return ::mergeDuplicateConstants(F->getParent(), LastConstantSeen,
                                        Constants);
     }
diff --git a/lib/Transforms/IPO/DeadTypeElimination.cpp b/lib/Transforms/IPO/DeadTypeElimination.cpp
index 4f2e24d..3ba6057 100644
--- a/lib/Transforms/IPO/DeadTypeElimination.cpp
+++ b/lib/Transforms/IPO/DeadTypeElimination.cpp
@@ -35,7 +35,7 @@
 static const Type *PtrSByte = 0;    // 'sbyte*' type
 
 namespace {
-  struct CleanupGCCOutput : public MethodPass {
+  struct CleanupGCCOutput : public FunctionPass {
     // doPassInitialization - For this pass, it removes global symbol table
     // entries for primitive types.  These are never used for linking in GCC and
     // they make the output uglier to look at, so we nuke them.
@@ -46,18 +46,15 @@
     
     // runOnFunction - This method simplifies the specified function hopefully.
     //
-    bool runOnMethod(Function *F);
+    bool runOnFunction(Function *F);
     
     // doPassFinalization - Strip out type names that are unused by the program
     bool doFinalization(Module *M);
     
-    // getAnalysisUsageInfo - This function needs FindUsedTypes to do its job...
+    // getAnalysisUsage - This function needs FindUsedTypes to do its job...
     //
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                      Pass::AnalysisSet &Destroyed,
-                                      Pass::AnalysisSet &Provided) {
-      // FIXME: Invalidates the CFG
-      Required.push_back(FindUsedTypes::ID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(FindUsedTypes::ID);
     }
   };
 }
@@ -246,7 +243,7 @@
 }
 
 
-// runOnMethod - Loop through the function and fix problems with the PHI nodes
+// runOnFunction - Loop through the function and fix problems with the PHI nodes
 // in the current function.  The problem is that PHI nodes might exist with
 // multiple entries for the same predecessor.  GCC sometimes generates code that
 // looks like this:
@@ -262,7 +259,7 @@
 //  bb8: %reg119 = phi uint [ 0, %bbX ], [ 1, %bb7 ]
 //
 //
-bool CleanupGCCOutput::runOnMethod(Function *M) {
+bool CleanupGCCOutput::runOnFunction(Function *M) {
   bool Changed = false;
   // Don't use iterators because invalidation gets messy...
   for (unsigned MI = 0; MI < M->size(); ++MI) {
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index ae9bd39..cd9c35f 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -1,6 +1,7 @@
 //===-- GlobalDCE.cpp - DCE unreachable internal functions ----------------===//
 //
 // This transform is designed to eliminate unreachable internal globals
+// FIXME: GlobalDCE should update the callgraph, not destroy it!
 //
 //===----------------------------------------------------------------------===//
 
@@ -55,16 +56,12 @@
       return RemoveUnreachableFunctions(M, getAnalysis<CallGraph>());
     }
 
-    // getAnalysisUsageInfo - This function works on the call graph of a module.
+    // getAnalysisUsage - This function works on the call graph of a module.
     // It is capable of updating the call graph to reflect the new state of the
     // module.
     //
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                      Pass::AnalysisSet &Destroyed,
-                                      Pass::AnalysisSet &Provided) {
-      Required.push_back(CallGraph::ID);
-      // FIXME: This should update the callgraph, not destroy it!
-      Destroyed.push_back(CallGraph::ID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(CallGraph::ID);
     }
   };
 }
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 7f96278..fcb1e4f 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -53,7 +53,7 @@
   }
 }
 
-// InlineMethod - This function forcibly inlines the called function into the
+// InlineFunction - This function forcibly inlines the called function into the
 // basic block of the caller.  This returns false if it is not possible to
 // inline this call.  The program is still in a well defined state if this 
 // occurs though.
@@ -63,8 +63,8 @@
 // exists in the instruction stream.  Similiarly this will inline a recursive
 // function by one level.
 //
-bool InlineMethod(BasicBlock::iterator CIIt) {
-  assert(isa<CallInst>(*CIIt) && "InlineMethod only works on CallInst nodes!");
+bool InlineFunction(BasicBlock::iterator CIIt) {
+  assert(isa<CallInst>(*CIIt) && "InlineFunction only works on CallInst nodes");
   assert((*CIIt)->getParent() && "Instruction not embedded in basic block!");
   assert((*CIIt)->getParent()->getParent() && "Instruction not in function!");
 
@@ -209,7 +209,7 @@
   return true;
 }
 
-bool InlineMethod(CallInst *CI) {
+bool InlineFunction(CallInst *CI) {
   assert(CI->getParent() && "CallInst not embeded in BasicBlock!");
   BasicBlock *PBB = CI->getParent();
 
@@ -217,12 +217,12 @@
 
   assert(CallIt != PBB->end() && 
 	 "CallInst has parent that doesn't contain CallInst?!?");
-  return InlineMethod(CallIt);
+  return InlineFunction(CallIt);
 }
 
 static inline bool ShouldInlineFunction(const CallInst *CI, const Function *F) {
   assert(CI->getParent() && CI->getParent()->getParent() && 
-	 "Call not embedded into a method!");
+	 "Call not embedded into a function!");
 
   // Don't inline a recursive call.
   if (CI->getParent()->getParent() == F) return false;
@@ -244,7 +244,7 @@
       // Check to see if we should inline this function
       Function *F = CI->getCalledFunction();
       if (F && ShouldInlineFunction(CI, F))
-	return InlineMethod(I);
+	return InlineFunction(I);
     }
   }
   return false;
@@ -270,11 +270,11 @@
 }
 
 namespace {
-  struct FunctionInlining : public MethodPass {
-    virtual bool runOnMethod(Function *F) {
+  struct FunctionInlining : public FunctionPass {
+    virtual bool runOnFunction(Function *F) {
       return doFunctionInlining(F);
     }
   };
 }
 
-Pass *createMethodInliningPass() { return new FunctionInlining(); }
+Pass *createFunctionInliningPass() { return new FunctionInlining(); }
diff --git a/lib/Transforms/IPO/MutateStructTypes.cpp b/lib/Transforms/IPO/MutateStructTypes.cpp
index b5dd937..2a6d184 100644
--- a/lib/Transforms/IPO/MutateStructTypes.cpp
+++ b/lib/Transforms/IPO/MutateStructTypes.cpp
@@ -28,12 +28,6 @@
 using std::map;
 using std::vector;
 
-//FIXME: These headers are only included because the analyses are killed!!!
-#include "llvm/Analysis/CallGraph.h"
-#include "llvm/Analysis/FindUsedTypes.h"
-#include "llvm/Analysis/FindUnsafePointerTypes.h"
-//FIXME end
-
 // To enable debugging, uncomment this...
 //#define DEBUG_MST(x) x
 
@@ -273,7 +267,7 @@
       if (Meth->hasName())
         Meth->setName("OLD."+Meth->getName());
 
-      // Insert the new function into the method list... to be filled in later..
+      // Insert the new function into the function list... to be filled in later
       M->getFunctionList().push_back(NewMeth);
       
       // Keep track of the association...
@@ -325,10 +319,10 @@
 
 
 
-// transformMethod - This transforms the instructions of the function to use the
-// new types.
+// transformFunction - This transforms the instructions of the function to use
+// the new types.
 //
-void MutateStructTypes::transformMethod(Function *m) {
+void MutateStructTypes::transformFunction(Function *m) {
   const Function *M = m;
   map<const GlobalValue*, GlobalValue*>::iterator GMI = GlobalMap.find(M);
   if (GMI == GlobalMap.end())
@@ -518,19 +512,9 @@
   processGlobals(M);
 
   for_each(M->begin(), M->end(),
-           bind_obj(this, &MutateStructTypes::transformMethod));
+           bind_obj(this, &MutateStructTypes::transformFunction));
 
   removeDeadGlobals(M);
   return true;
 }
 
-// getAnalysisUsageInfo - This function needs the results of the
-// FindUsedTypes and FindUnsafePointerTypes analysis passes...
-//
-void MutateStructTypes::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                             Pass::AnalysisSet &Destroyed,
-                                             Pass::AnalysisSet &Provided) {
-  Destroyed.push_back(FindUsedTypes::ID);
-  Destroyed.push_back(FindUnsafePointerTypes::ID);
-  Destroyed.push_back(CallGraph::ID);
-}
diff --git a/lib/Transforms/IPO/OldPoolAllocate.cpp b/lib/Transforms/IPO/OldPoolAllocate.cpp
index 43683e4..bd67fe1 100644
--- a/lib/Transforms/IPO/OldPoolAllocate.cpp
+++ b/lib/Transforms/IPO/OldPoolAllocate.cpp
@@ -234,12 +234,11 @@
 
     bool run(Module *M);
 
-    // getAnalysisUsageInfo - This function requires data structure information
+    // getAnalysisUsage - This function requires data structure information
     // to be able to see what is pool allocatable.
     //
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                      Pass::AnalysisSet &,Pass::AnalysisSet &) {
-      Required.push_back(DataStructure::ID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(DataStructure::ID);
     }
 
   public:
diff --git a/lib/Transforms/IPO/SimpleStructMutation.cpp b/lib/Transforms/IPO/SimpleStructMutation.cpp
index 5c64aa3..33e0289 100644
--- a/lib/Transforms/IPO/SimpleStructMutation.cpp
+++ b/lib/Transforms/IPO/SimpleStructMutation.cpp
@@ -1,4 +1,4 @@
-//===- SimpleStructMutation.cpp - Swap structure elements around ---*- C++ -*--=//
+//===- SimpleStructMutation.cpp - Swap structure elements around -*- C++ -*--=//
 //
 // This pass does a simple transformation that swaps all of the elements of the
 // struct types in the program around.
@@ -31,15 +31,13 @@
       return Changed;
     }
     
-    // getAnalysisUsageInfo - This function needs the results of the
+    // getAnalysisUsage - This function needs the results of the
     // FindUsedTypes and FindUnsafePointerTypes analysis passes...
     //
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                      Pass::AnalysisSet &Destroyed,
-                                      Pass::AnalysisSet &Provided) {
-      Required.push_back(FindUsedTypes::ID);
-      Required.push_back(FindUnsafePointerTypes::ID);
-      MutateStructTypes::getAnalysisUsageInfo(Required, Destroyed, Provided);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(FindUsedTypes::ID);
+      AU.addRequired(FindUnsafePointerTypes::ID);
+      MutateStructTypes::getAnalysisUsage(AU);
     }
     
   private:
diff --git a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
index aa2cfdd..860119e 100644
--- a/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
+++ b/lib/Transforms/Instrumentation/ProfilePaths/ProfilePaths.cpp
@@ -37,17 +37,15 @@
 
 using std::vector;
 
-class ProfilePaths: public MethodPass {
+class ProfilePaths: public FunctionPass {
  public:
-  bool runOnMethod(Function *M);
+  bool runOnFunction(Function *F);
 
   // Before this pass, make sure that there is only one 
   // entry and only one exit node for the function in the CFG of the function
   //
-  void ProfilePaths::getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
-					  Pass::AnalysisSet &Destroyed,
-					  Pass::AnalysisSet &Provided) {
-    Requires.push_back(UnifyMethodExitNodes::ID);
+  void ProfilePaths::getAnalysisUsage(AnalysisUsage &AU) const {
+    AU.addRequired(UnifyMethodExitNodes::ID);
   }
 };
 
@@ -68,7 +66,7 @@
 }
 
 //Per function pass for inserting counters and trigger code
-bool ProfilePaths::runOnMethod(Function *M){
+bool ProfilePaths::runOnFunction(Function *M){
   //Transform the cfg s.t. we have just one exit node
   BasicBlock *ExitNode = 
     getAnalysis<UnifyMethodExitNodes>().getExitNode();  
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index 12fc84b..d05d33d 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -23,7 +23,7 @@
 using std::string;
 
 namespace {
-  class InsertTraceCode : public MethodPass {
+  class InsertTraceCode : public FunctionPass {
     bool TraceBasicBlockExits, TraceFunctionExits;
     Function *PrintfFunc;
   public:
@@ -46,14 +46,14 @@
     
     // runOnFunction - This method does the work.
     //
-    bool runOnMethod(Function *F) {
+    bool runOnFunction(Function *F) {
       return doit(F, TraceBasicBlockExits, TraceFunctionExits, PrintfFunc);
     }
   };
 } // end anonymous namespace
 
 
-Pass *createTraceValuesPassForMethod() {       // Just trace functions
+Pass *createTraceValuesPassForFunction() {     // Just trace functions
   return new InsertTraceCode(false, true);
 }
 
diff --git a/lib/Transforms/LevelRaise.cpp b/lib/Transforms/LevelRaise.cpp
index 51d863d..f556ced 100644
--- a/lib/Transforms/LevelRaise.cpp
+++ b/lib/Transforms/LevelRaise.cpp
@@ -440,7 +440,7 @@
 }
 
 
-// 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 @@
     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,8 @@
 }
 
 namespace {
-  struct RaisePointerReferences : public MethodPass {
-    virtual bool runOnMethod(Function *F) { return doRPR(F); }
+  struct RaisePointerReferences : public FunctionPass {
+    virtual bool runOnFunction(Function *F) { return doRPR(F); }
   };
 }
 
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index c129b5c..71069c6 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -29,7 +29,7 @@
 // It's public interface consists of a constructor and a doADCE() method.
 //
 class ADCE {
-  Function *M;                          // The method that we are working on...
+  Function *M;                          // The function that we are working on
   std::vector<Instruction*> WorkList;   // Instructions that just became live
   std::set<Instruction*>    LiveSet;    // The set of live instructions
   bool MadeChanges;
@@ -38,11 +38,11 @@
   // The public interface for this class
   //
 public:
-  // ADCE Ctor - Save the method to operate on...
-  inline ADCE(Function *m) : M(m), MadeChanges(false) {}
+  // ADCE Ctor - Save the function to operate on...
+  inline ADCE(Function *f) : M(f), MadeChanges(false) {}
 
   // doADCE() - Run the Agressive Dead Code Elimination algorithm, returning
-  // true if the method was modified.
+  // true if the function was modified.
   bool doADCE(cfg::DominanceFrontier &CDG);
 
   //===--------------------------------------------------------------------===//
@@ -75,14 +75,14 @@
 
 
 // doADCE() - Run the Agressive Dead Code Elimination algorithm, returning
-// true if the method was modified.
+// true if the function was modified.
 //
 bool ADCE::doADCE(cfg::DominanceFrontier &CDG) {
 #ifdef DEBUG_ADCE
   cerr << "Function: " << M;
 #endif
 
-  // Iterate over all of the instructions in the method, eliminating trivially
+  // Iterate over all of the instructions in the function, eliminating trivially
   // dead instructions, and marking instructions live that are known to be 
   // needed.  Perform the walk in depth first order so that we avoid marking any
   // instructions live in basic blocks that are unreachable.  These blocks will
@@ -173,7 +173,7 @@
   if (EntryBlock && EntryBlock != M->front()) {
     if (isa<PHINode>(EntryBlock->front())) {
       // Cannot make the first block be a block with a PHI node in it! Instead,
-      // strip the first basic block of the method to contain no instructions,
+      // strip the first basic block of the function to contain no instructions,
       // then add a simple branch to the "real" entry node...
       //
       BasicBlock *E = M->front();
@@ -191,9 +191,9 @@
 
 
     } else {
-      // We need to move the new entry block to be the first bb of the method.
+      // We need to move the new entry block to be the first bb of the function
       Function::iterator EBI = find(M->begin(), M->end(), EntryBlock);
-      std::swap(*EBI, *M->begin());// Exchange old location with start of method
+      std::swap(*EBI, *M->begin());  // Exchange old location with start of fn
       MadeChanges = true;
     }
   }
@@ -289,19 +289,17 @@
 }
 
 namespace {
-  struct AgressiveDCE : public MethodPass {
+  struct AgressiveDCE : public FunctionPass {
     // doADCE - Execute the Agressive Dead Code Elimination Algorithm
     //
-    virtual bool runOnMethod(Function *M) {
-      return ADCE(M).doADCE(
+    virtual bool runOnFunction(Function *F) {
+      return ADCE(F).doADCE(
    getAnalysis<cfg::DominanceFrontier>(cfg::DominanceFrontier::PostDomID));
     }
-    // getAnalysisUsageInfo - We require post dominance frontiers (aka Control
+    // getAnalysisUsage - We require post dominance frontiers (aka Control
     // Dependence Graph)
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
-                                      Pass::AnalysisSet &Destroyed,
-                                      Pass::AnalysisSet &Provided) {
-      Requires.push_back(cfg::DominanceFrontier::PostDomID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(cfg::DominanceFrontier::PostDomID);
     }
   };
 }
diff --git a/lib/Transforms/Scalar/ConstantProp.cpp b/lib/Transforms/Scalar/ConstantProp.cpp
index 26d5c7d..a8cd02f 100644
--- a/lib/Transforms/Scalar/ConstantProp.cpp
+++ b/lib/Transforms/Scalar/ConstantProp.cpp
@@ -211,8 +211,8 @@
 }
 
 namespace {
-  struct ConstantPropogation : public MethodPass {
-    inline bool runOnMethod(Function *F) {
+  struct ConstantPropogation : public FunctionPass {
+    inline bool runOnFunction(Function *F) {
       bool Modified = false;
 
       // Fold constants until we make no progress...
diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp
index 6169730..0d6f293 100644
--- a/lib/Transforms/Scalar/DCE.cpp
+++ b/lib/Transforms/Scalar/DCE.cpp
@@ -9,7 +9,7 @@
 //     predecessor only has one successor.
 //   * Eliminates PHI nodes for basic blocks with a single predecessor
 //   * Eliminates a basic block that only contains an unconditional branch
-//   * Eliminates method prototypes that are not referenced
+//   * Eliminates function prototypes that are not referenced
 //
 // TODO: This should REALLY be worklist driven instead of iterative.  Right now,
 // we scan linearly through values, removing unused ones as we go.  The problem
@@ -163,13 +163,13 @@
 // iterator that designates the first element remaining after the block that
 // was deleted.
 //
-// WARNING:  The entry node of a method may not be simplified.
+// WARNING:  The entry node of a function may not be simplified.
 //
 bool SimplifyCFG(Function::iterator &BBIt) {
   BasicBlock *BB = *BBIt;
   Function *M = BB->getParent();
 
-  assert(BB && BB->getParent() && "Block not embedded in method!");
+  assert(BB && BB->getParent() && "Block not embedded in function!");
   assert(BB->getTerminator() && "Degenerate basic block encountered!");
   assert(BB->getParent()->front() != BB && "Can't Simplify entry block!");
 
@@ -258,7 +258,7 @@
 	Pred->getInstList().push_back(Def);              // Add to end...
       }
       
-      // Remove basic block from the method... and advance iterator to the
+      // Remove basic block from the function... and advance iterator to the
       // next valid block...
       BB = M->getBasicBlocks().remove(BBIt);
 
@@ -303,7 +303,7 @@
 }
 
 // Remove unused global values - This removes unused global values of no
-// possible value.  This currently includes unused method prototypes and
+// possible value.  This currently includes unused function prototypes and
 // unitialized global variables.
 //
 static bool RemoveUnusedGlobalValues(Module *Mod) {
@@ -313,7 +313,7 @@
     Function *Meth = *MI;
     if (Meth->isExternal() && Meth->use_size() == 0) {
       // No references to prototype?
-      //cerr << "Removing method proto: " << Meth->getName() << endl;
+      //cerr << "Removing function proto: " << Meth->getName() << endl;
       delete Mod->getFunctionList().remove(MI);  // Remove prototype
       // Remove moves iterator to point to the next one automatically
       Changed = true;
@@ -339,7 +339,7 @@
 }
 
 namespace {
-  struct DeadCodeElimination : public MethodPass {
+  struct DeadCodeElimination : public FunctionPass {
 
     // Pass Interface...
     virtual bool doInitialization(Module *M) {
@@ -349,7 +349,7 @@
     // It is possible that we may require multiple passes over the code to fully
     // eliminate dead code.  Iterate until we are done.
     //
-    virtual bool runOnMethod(Function *F) {
+    virtual bool runOnFunction(Function *F) {
       bool Changed = false;
       while (DoDCEPass(F)) Changed = true;
       return Changed;
diff --git a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
index 390cd95..0ec72c6 100644
--- a/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
+++ b/lib/Transforms/Scalar/DecomposeMultiDimRefs.cpp
@@ -1,4 +1,4 @@
-//===- llvm/Transforms/DecomposeMultiDimRefs.cpp - Lower array refs to 1D -----=//
+//===- llvm/Transforms/DecomposeMultiDimRefs.cpp - Lower array refs to 1D ---=//
 //
 // DecomposeMultiDimRefs - 
 // Convert multi-dimensional references consisting of any combination
@@ -7,7 +7,7 @@
 // has at most one index (except structure references,
 // which need an extra leading index of [0]).
 //
-//===---------------------------------------------------------------------===//
+//===----------------------------------------------------------------------===//
 
 #include "llvm/Transforms/Scalar/DecomposeMultiDimRefs.h"
 #include "llvm/ConstantVals.h"
@@ -171,9 +171,13 @@
 
 
 namespace {
-  struct DecomposeMultiDimRefsPass : public MethodPass {
-    virtual bool runOnMethod(Function *F) { return doDecomposeMultiDimRefs(F); }
+  struct DecomposeMultiDimRefsPass : public FunctionPass {
+    virtual bool runOnFunction(Function *F) {
+      return doDecomposeMultiDimRefs(F);
+    }
   };
 }
 
-Pass *createDecomposeMultiDimRefsPass() { return new DecomposeMultiDimRefsPass(); }
+Pass *createDecomposeMultiDimRefsPass() {
+  return new DecomposeMultiDimRefsPass();
+}
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index a388025..40ee5c7 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -188,7 +188,7 @@
 }
 
 static bool doit(Function *M, cfg::LoopInfo &Loops) {
-  // Induction Variables live in the header nodes of the loops of the method...
+  // Induction Variables live in the header nodes of the loops of the function
   return reduce_apply_bool(Loops.getTopLevelLoops().begin(),
                            Loops.getTopLevelLoops().end(),
                            std::bind1st(std::ptr_fun(TransformLoop), &Loops));
@@ -196,15 +196,13 @@
 
 
 namespace {
-  struct InductionVariableSimplify : public MethodPass {
-    virtual bool runOnMethod(Function *F) {
+  struct InductionVariableSimplify : public FunctionPass {
+    virtual bool runOnFunction(Function *F) {
       return doit(F, getAnalysis<cfg::LoopInfo>());
     }
     
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Required,
-                                      Pass::AnalysisSet &Destroyed,
-                                      Pass::AnalysisSet &Provided) {
-      Required.push_back(cfg::LoopInfo::ID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(cfg::LoopInfo::ID);
     }
   };
 }
diff --git a/lib/Transforms/Scalar/InductionVars.cpp b/lib/Transforms/Scalar/InductionVars.cpp
index 9931a6b..8e559a3 100644
--- a/lib/Transforms/Scalar/InductionVars.cpp
+++ b/lib/Transforms/Scalar/InductionVars.cpp
@@ -183,7 +183,7 @@
   Function *M = Header->getParent();
 
   if (M->hasSymbolTable()) {
-    // Only name the induction variable if the method isn't stripped.
+    // Only name the induction variable if the function isn't stripped.
     PHIName = "ind_var";
     AddName = "ind_var_next";
   }
@@ -353,7 +353,7 @@
 //
 static bool ProcessIntervalPartition(cfg::IntervalPartition &IP) {
   // This currently just prints out information about the interval structure
-  // of the method...
+  // of the function...
 #if 0
   static unsigned N = 0;
   cerr << "\n***********Interval Partition #" << (++N) << "************\n\n";
@@ -398,17 +398,14 @@
 }
 
 
-bool InductionVariableCannonicalize::runOnMethod(Function *F) {
+bool InductionVariableCannonicalize::runOnFunction(Function *F) {
   return doIt(F, getAnalysis<cfg::IntervalPartition>());
 }
 
-// getAnalysisUsageInfo - This function works on the call graph of a module.
+// getAnalysisUsage - This function works on the call graph of a module.
 // It is capable of updating the call graph to reflect the new state of the
 // module.
 //
-void InductionVariableCannonicalize::getAnalysisUsageInfo(
-                                           Pass::AnalysisSet &Required,
-                                           Pass::AnalysisSet &Destroyed,
-                                           Pass::AnalysisSet &Provided) {
-  Required.push_back(cfg::IntervalPartition::ID);
+void InductionVariableCannonicalize::getAnalysisUsage(AnalysisUsage &AU) const {
+  AU.addRequired(cfg::IntervalPartition::ID);
 }
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index c2fa84c..dea0244 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -27,7 +27,7 @@
 
 
 namespace {
-  class InstCombiner : public MethodPass,
+  class InstCombiner : public FunctionPass,
                        public InstVisitor<InstCombiner, Instruction*> {
     // Worklist of all of the instructions that need to be simplified.
     std::vector<Instruction*> WorkList;
@@ -44,7 +44,7 @@
   public:
 
 
-    virtual bool runOnMethod(Function *F);
+    virtual bool runOnFunction(Function *F);
 
     // Visitation implementation - Implement instruction combining for different
     // instruction types.  The semantics are as follows:
@@ -205,7 +205,7 @@
 }
 
 
-bool InstCombiner::runOnMethod(Function *F) {
+bool InstCombiner::runOnFunction(Function *F) {
   bool Changed = false;
 
   WorkList.insert(WorkList.end(), inst_begin(F), inst_end(F));
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 51a827d..e723fc8 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -34,9 +34,7 @@
 using std::cerr;
 
 // InstVal class - This class represents the different lattice values that an 
-// instruction may occupy.  It is a simple class with value semantics.  The
-// potential constant value that is pointed to is owned by the constant pool
-// for the method being optimized.
+// instruction may occupy.  It is a simple class with value semantics.
 //
 class InstVal {
   enum { 
@@ -83,7 +81,7 @@
 // SCCP Class
 //
 // This class does all of the work of Sparse Conditional Constant Propogation.
-// It's public interface consists of a constructor and a doSCCP() method.
+// It's public interface consists of a constructor and a doSCCP() function.
 //
 class SCCP : public InstVisitor<SCCP> {
   Function *M;                           // The function that we are working on
@@ -99,11 +97,11 @@
   //
 public:
 
-  // SCCP Ctor - Save the method to operate on...
+  // SCCP Ctor - Save the function to operate on...
   inline SCCP(Function *f) : M(f) {}
 
   // doSCCP() - Run the Sparse Conditional Constant Propogation algorithm, and 
-  // return true if the method was modified.
+  // return true if the function was modified.
   bool doSCCP();
 
   //===--------------------------------------------------------------------===//
@@ -212,10 +210,10 @@
 
 
 // doSCCP() - Run the Sparse Conditional Constant Propogation algorithm, and 
-// return true if the method was modified.
+// return true if the function was modified.
 //
 bool SCCP::doSCCP() {
-  // Mark the first block of the method as being executable...
+  // Mark the first block of the function as being executable...
   markExecutable(M->front());
 
   // Process the work lists until their are empty!
@@ -264,7 +262,7 @@
 #endif
 
 
-  // Iterate over all of the instructions in a method, replacing them with
+  // Iterate over all of the instructions in a function, replacing them with
   // constants if we have found them to be of constant values.
   //
   bool MadeChanges = false;
@@ -467,8 +465,8 @@
   // SCCPPass - Use Sparse Conditional Constant Propogation
   // to prove whether a value is constant and whether blocks are used.
   //
-  struct SCCPPass : public MethodPass {
-    inline bool runOnMethod(Function *F) {
+  struct SCCPPass : public FunctionPass {
+    inline bool runOnFunction(Function *F) {
       SCCP S(F);
       return S.doSCCP();
     }
diff --git a/lib/Transforms/Scalar/SymbolStripping.cpp b/lib/Transforms/Scalar/SymbolStripping.cpp
index a026fd6..36b465e 100644
--- a/lib/Transforms/Scalar/SymbolStripping.cpp
+++ b/lib/Transforms/Scalar/SymbolStripping.cpp
@@ -60,8 +60,8 @@
 }
 
 namespace {
-  struct SymbolStripping : public MethodPass {
-    virtual bool runOnMethod(Function *F) {
+  struct SymbolStripping : public FunctionPass {
+    virtual bool runOnFunction(Function *F) {
       return doSymbolStripping(F);
     }
   };
diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index 6f220f8..8726ed4 100644
--- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -309,22 +309,20 @@
 
 
 namespace {
-  struct PromotePass : public MethodPass {
+  struct PromotePass : public FunctionPass {
 
-    // runOnMethod - To run this pass, first we calculate the alloca
+    // runOnFunction - To run this pass, first we calculate the alloca
     // instructions that are safe for promotion, then we promote each one.
     //
-    virtual bool runOnMethod(Function *F) {
+    virtual bool runOnFunction(Function *F) {
       return (bool)PromoteInstance(F, getAnalysis<DominanceFrontier>());
     }
     
 
-    // getAnalysisUsageInfo - We need dominance frontiers
+    // getAnalysisUsage - We need dominance frontiers
     //
-    virtual void getAnalysisUsageInfo(Pass::AnalysisSet &Requires,
-				      Pass::AnalysisSet &Destroyed,
-				      Pass::AnalysisSet &Provided) {
-      Requires.push_back(DominanceFrontier::ID);
+    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
+      AU.addRequired(DominanceFrontier::ID);
     }
   };
 }