Change references to the Method class to be references to the Function
class.  The Method class is obsolete (renamed) and all references to it
are being converted over to Function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2144 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/InstrSched/SchedGraph.cpp b/lib/CodeGen/InstrSched/SchedGraph.cpp
index e67ba93..daf4a49 100644
--- a/lib/CodeGen/InstrSched/SchedGraph.cpp
+++ b/lib/CodeGen/InstrSched/SchedGraph.cpp
@@ -20,7 +20,7 @@
 #include "llvm/Target/MachineRegInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/iOther.h"
 #include "Support/StringExtras.h"
 #include "Support/STLExtras.h"
@@ -955,9 +955,9 @@
 // 
 
 /*ctor*/
-SchedGraphSet::SchedGraphSet(const Method* _method,
+SchedGraphSet::SchedGraphSet(const Function* _function,
 			     const TargetMachine& target) :
-  method(_method)
+  method(_function)
 {
   buildGraphsForMethod(method, target);
 }
@@ -975,23 +975,23 @@
 void
 SchedGraphSet::dump() const
 {
-  cerr << "======== Sched graphs for method `" << method->getName()
+  cerr << "======== Sched graphs for function `" << method->getName()
        << "' ========\n\n";
   
   for (const_iterator I=begin(); I != end(); ++I)
     (*I)->dump();
   
-  cerr << "\n====== End graphs for method `" << method->getName()
+  cerr << "\n====== End graphs for function `" << method->getName()
        << "' ========\n\n";
 }
 
 
 void
-SchedGraphSet::buildGraphsForMethod(const Method *method,
+SchedGraphSet::buildGraphsForMethod(const Function *F,
 				    const TargetMachine& target)
 {
-  for (Method::const_iterator BI = method->begin(); BI != method->end(); ++BI)
-    this->addGraph(new SchedGraph(*BI, target));
+  for (Function::const_iterator BI = F->begin(); BI != F->end(); ++BI)
+    addGraph(new SchedGraph(*BI, target));
 }
 
 
diff --git a/lib/CodeGen/InstrSelection/InstrSelection.cpp b/lib/CodeGen/InstrSelection/InstrSelection.cpp
index 3efc527..1eb507a 100644
--- a/lib/CodeGen/InstrSelection/InstrSelection.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelection.cpp
@@ -23,7 +23,7 @@
 #include "llvm/Target/MachineRegInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/iPHINode.h"
 #include "Support/CommandLine.h"
 #include <iostream>
@@ -60,7 +60,7 @@
                                           short* nts,
                                           TargetMachine &target);
 
-static void InsertCode4AllPhisInMeth(Method *method, TargetMachine &target);
+static void InsertCode4AllPhisInMeth(Function *F, TargetMachine &target);
 
 
 
@@ -73,25 +73,23 @@
 //---------------------------------------------------------------------------
 
 bool
-SelectInstructionsForMethod(Method* method, TargetMachine &target)
+SelectInstructionsForMethod(Function *F, TargetMachine &target)
 {
   bool failed = false;
   
   //
   // Build the instruction trees to be given as inputs to BURG.
   // 
-  InstrForest instrForest(method);
+  InstrForest instrForest(F);
   
   if (SelectDebugLevel >= Select_DebugInstTrees)
     {
-      cerr << "\n\n*** Input to instruction selection for method "
-	   << (method->hasName()? method->getName() : "")
-	   << "\n\n";
-      method->dump();
+      cerr << "\n\n*** Input to instruction selection for function "
+	   << F->getName() << "\n\n";
+      F->dump();
       
-      cerr << "\n\n*** Instruction trees for method "
-	   << (method->hasName()? method->getName() : "")
-	   << "\n\n";
+      cerr << "\n\n*** Instruction trees for function "
+	   << F->getName() << "\n\n";
       instrForest.dump();
     }
   
@@ -125,7 +123,7 @@
   //
   // Record instructions in the vector for each basic block
   // 
-  for (Method::iterator BI = method->begin(); BI != method->end(); ++BI)
+  for (Function::iterator BI = F->begin(), BE = F->end(); BI != BE; ++BI)
     {
       MachineCodeForBasicBlock& bbMvec = (*BI)->getMachineInstrVec();
       for (BasicBlock::iterator II = (*BI)->begin(); II != (*BI)->end(); ++II)
@@ -137,13 +135,13 @@
     }
 
   // Insert phi elimination code -- added by Ruchira
-  InsertCode4AllPhisInMeth(method, target);
+  InsertCode4AllPhisInMeth(F, target);
 
   
   if (SelectDebugLevel >= Select_PrintMachineCode)
     {
       cerr << "\n*** Machine instructions after INSTRUCTION SELECTION\n";
-      MachineCodeForMethod::get(method).dump();
+      MachineCodeForMethod::get(F).dump();
     }
   
   return false;
@@ -190,11 +188,11 @@
 //-------------------------------------------------------------------------
 
 void
-InsertCode4AllPhisInMeth(Method *method, TargetMachine &target)
+InsertCode4AllPhisInMeth(Function *F, TargetMachine &target)
 {
-  // for all basic blocks in method
+  // for all basic blocks in function
   //
-  for (Method::iterator BI = method->begin(); BI != method->end(); ++BI) {
+  for (Function::iterator BI = F->begin(); BI != F->end(); ++BI) {
 
     BasicBlock *BB = *BI;
     const BasicBlock::InstListType &InstList = BB->getInstList();
@@ -236,9 +234,7 @@
       else break;   // since PHI nodes can only be at the top
       
     }  // for each Phi Instr in BB
-
-  } // for all BBs in method
-
+  } // for all BBs in function
 }
 
 
diff --git a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
index ff43f04..24efdf1 100644
--- a/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
+++ b/lib/CodeGen/InstrSelection/InstrSelectionSupport.cpp
@@ -20,7 +20,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineRegInfo.h"
 #include "llvm/ConstantVals.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/Type.h"
 #include "llvm/iMemory.h"
@@ -30,7 +30,7 @@
 
 
 static TmpInstruction*
-InsertCodeToLoadConstant(Method* method,
+InsertCodeToLoadConstant(Function *F,
                          Value* opValue,
                          Instruction* vmInstr,
                          vector<MachineInstr*>& loadConstVec,
@@ -43,7 +43,7 @@
   MachineCodeForInstruction &MCFI = MachineCodeForInstruction::get(vmInstr);
   MCFI.addTemp(tmpReg);
   
-  target.getInstrInfo().CreateCodeToLoadConst(method, opValue, tmpReg,
+  target.getInstrInfo().CreateCodeToLoadConst(F, opValue, tmpReg,
                                               loadConstVec, tempVec);
   
   // Register the new tmp values created for this m/c instruction sequence
@@ -344,7 +344,7 @@
   const MachineInstrDescriptor& instrDesc =
     target.getInstrInfo().getDescriptor(minstr->getOpCode());
   
-  Method* method = vmInstr->getParent()->getParent();
+  Function *F = vmInstr->getParent()->getParent();
   
   for (unsigned op=0; op < minstr->getNumOperands(); op++)
     {
@@ -381,8 +381,9 @@
       
       if (constantThatMustBeLoaded || isa<GlobalValue>(opValue))
         { // opValue is a constant that must be explicitly loaded into a reg.
-          TmpInstruction* tmpReg = InsertCodeToLoadConstant(method, opValue, vmInstr,
-                                                            loadConstVec, target);
+          TmpInstruction* tmpReg = InsertCodeToLoadConstant(F, opValue, vmInstr,
+                                                            loadConstVec,
+                                                            target);
           minstr->SetMachineOperandVal(op, MachineOperand::MO_VirtualRegister,
                                        tmpReg);
         }
@@ -404,7 +405,7 @@
       {
         Value* oldVal = minstr->getImplicitRef(i);
         TmpInstruction* tmpReg =
-          InsertCodeToLoadConstant(method, oldVal, vmInstr, loadConstVec, target);
+          InsertCodeToLoadConstant(F, oldVal, vmInstr, loadConstVec, target);
         minstr->setImplicitRef(i, tmpReg);
       }
   
diff --git a/lib/CodeGen/MachineFunction.cpp b/lib/CodeGen/MachineFunction.cpp
index ef27dba..bb52ef2 100644
--- a/lib/CodeGen/MachineFunction.cpp
+++ b/lib/CodeGen/MachineFunction.cpp
@@ -1,9 +1,9 @@
-//===-- MachineCodeForMethod.cpp --------------------------------------------=//
+//===-- MachineCodeForFunction.cpp ------------------------------------------=//
 // 
 // Purpose:
-//   Collect native machine code information for a method.
+//   Collect native machine code information for a function.
 //   This allows target-specific information about the generated code
-//   to be stored with each method.
+//   to be stored with each function.
 //===----------------------------------------------------------------------===//
 
 #include "llvm/CodeGen/MachineCodeForMethod.h"
@@ -11,7 +11,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineFrameInfo.h"
 #include "llvm/Target/MachineCacheInfo.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
 #include "llvm/iOther.h"
 #include <limits.h>
@@ -20,57 +20,55 @@
 const int INVALID_FRAME_OFFSET = INT_MAX; // std::numeric_limits<int>::max();
 
 static AnnotationID MCFM_AID(
-                 AnnotationManager::getID("CodeGen::MachineCodeForMethod"));
+                 AnnotationManager::getID("CodeGen::MachineCodeForFunction"));
 
 // The next two methods are used to construct and to retrieve
-// the MachineCodeForMethod object for the given method.
-// construct() -- Allocates and initializes for a given method and target
+// the MachineCodeForFunction object for the given function.
+// construct() -- Allocates and initializes for a given function and target
 // get()       -- Returns a handle to the object.
 //                This should not be called before "construct()"
-//                for a given Method.
+//                for a given Function.
 // 
 MachineCodeForMethod&
-MachineCodeForMethod::construct(const Method *M, const TargetMachine &Tar)
+MachineCodeForMethod::construct(const Function *M, const TargetMachine &Tar)
 {
   assert(M->getAnnotation(MCFM_AID) == 0 &&
-         "Object already exists for this method!");
+         "Object already exists for this function!");
   MachineCodeForMethod* mcInfo = new MachineCodeForMethod(M, Tar);
   M->addAnnotation(mcInfo);
   return *mcInfo;
 }
 
 void
-MachineCodeForMethod::destruct(const Method *M)
+MachineCodeForMethod::destruct(const Function *M)
 {
   bool Deleted = M->deleteAnnotation(MCFM_AID);
-  assert(Deleted && "Machine code did not exist for method!");
+  assert(Deleted && "Machine code did not exist for function!");
 }
 
 MachineCodeForMethod&
-MachineCodeForMethod::get(const Method* method)
+MachineCodeForMethod::get(const Function *F)
 {
-  MachineCodeForMethod* mc = (MachineCodeForMethod*)
-    method->getAnnotation(MCFM_AID);
+  MachineCodeForMethod *mc = (MachineCodeForMethod*)F->getAnnotation(MCFM_AID);
   assert(mc && "Call construct() method first to allocate the object");
   return *mc;
 }
 
 static unsigned
-ComputeMaxOptionalArgsSize(const TargetMachine& target, const Method* method)
+ComputeMaxOptionalArgsSize(const TargetMachine& target, const Function *F)
 {
   const MachineFrameInfo& frameInfo = target.getFrameInfo();
   
   unsigned int maxSize = 0;
   
-  for (Method::const_iterator MI=method->begin(), ME=method->end();
-       MI != ME; ++MI)
+  for (Function::const_iterator MI = F->begin(), ME = F->end(); MI != ME; ++MI)
     {
       const BasicBlock *BB = *MI;
-      for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I != E; ++I)
+      for (BasicBlock::const_iterator I = BB->begin(), E = BB->end(); I!=E; ++I)
         if (CallInst *callInst = dyn_cast<CallInst>(*I))
           {
             unsigned int numOperands = callInst->getNumOperands() - 1;
-            int numExtra = (int) numOperands - frameInfo.getNumFixedOutgoingArgs();
+            int numExtra = (int)numOperands-frameInfo.getNumFixedOutgoingArgs();
             if (numExtra <= 0)
               continue;
             
@@ -82,7 +80,9 @@
               }
             else
               {
-                assert(0 && "UNTESTED CODE: Size per stack argument is not fixed on this architecture: use actual arg sizes to compute MaxOptionalArgsSize");
+                assert(0 && "UNTESTED CODE: Size per stack argument is not "
+                       "fixed on this architecture: use actual arg sizes to "
+                       "compute MaxOptionalArgsSize");
                 sizeForThisCall = 0;
                 for (unsigned i=0; i < numOperands; ++i)
                   sizeForThisCall += target.findOptimalStorageSize(callInst->
@@ -118,10 +118,10 @@
 
 
 /*ctor*/
-MachineCodeForMethod::MachineCodeForMethod(const Method* _M,
+MachineCodeForMethod::MachineCodeForMethod(const Function *F,
                                            const TargetMachine& target)
   : Annotation(MCFM_AID),
-    method(_M), compiledAsLeaf(false), staticStackSize(0),
+    method(F), compiledAsLeaf(false), staticStackSize(0),
     automaticVarsSize(0), regSpillsSize(0),
     currentOptionalArgsSize(0), maxOptionalArgsSize(0),
     currentTmpValuesSize(0), maxTmpValuesSize(0)
@@ -307,7 +307,7 @@
   std::cerr << "\n" << method->getReturnType()
             << " \"" << method->getName() << "\"\n";
   
-  for (Method::const_iterator BI = method->begin(); BI != method->end(); ++BI)
+  for (Function::const_iterator BI = method->begin(); BI != method->end(); ++BI)
     {
       BasicBlock* bb = *BI;
       std::cerr << "\n" << bb->getName() << " (" << bb << ")" << ":\n";
@@ -316,5 +316,5 @@
       for (unsigned i=0; i < mvec.size(); i++)
 	std::cerr << "\t" << *mvec[i];
     } 
-  std::cerr << "\nEnd method \"" << method->getName() << "\"\n\n";
+  std::cerr << "\nEnd function \"" << method->getName() << "\"\n\n";
 }
diff --git a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
index 3295176..fb29af2 100644
--- a/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/CodeGen/RegAlloc/LiveRangeInfo.cpp
@@ -2,15 +2,15 @@
 #include "llvm/CodeGen/RegClass.h"
 #include "llvm/CodeGen/MachineInstr.h"
 #include "llvm/Target/TargetMachine.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/BasicBlock.h"
 #include "Support/SetOperations.h"
 #include <iostream>
 using std::cerr;
 
-LiveRangeInfo::LiveRangeInfo(const Method *M, const TargetMachine &tm,
+LiveRangeInfo::LiveRangeInfo(const Function *F, const TargetMachine &tm,
 			     std::vector<RegClass *> &RCL)
-  : Meth(M), TM(tm), RegClassList(RCL), MRI(tm.getRegInfo()) { }
+  : Meth(F), TM(tm), RegClassList(RCL), MRI(tm.getRegInfo()) { }
 
 
 LiveRangeInfo::~LiveRangeInfo() {
@@ -48,7 +48,7 @@
     //assert(( L1->getTypeID() == L2->getTypeID()) && "Merge:Different types");
 
     L1->insert(*L2It);                  // add the var in L2 to L1
-    LiveRangeMap[*L2It] = L1;         // now the elements in L2 should map 
+    LiveRangeMap[*L2It] = L1;           // now the elements in L2 should map 
                                         //to L1    
   }
 
@@ -73,24 +73,22 @@
 
 
 //---------------------------------------------------------------------------
-// Method for constructing all live ranges in a method. It creates live 
+// Method for constructing all live ranges in a function. It creates live 
 // ranges for all values defined in the instruction stream. Also, it
-// creates live ranges for all incoming arguments of the method.
+// creates live ranges for all incoming arguments of the function.
 //---------------------------------------------------------------------------
 void LiveRangeInfo::constructLiveRanges() {  
 
   if (DEBUG_RA) 
     cerr << "Consturcting Live Ranges ...\n";
 
-  // first find the live ranges for all incoming args of the method since
-  // those LRs start from the start of the method
+  // first find the live ranges for all incoming args of the function since
+  // those LRs start from the start of the function
       
-                                                 // get the argument list
-  const Method::ArgumentListType& ArgList = Meth->getArgumentList();           
-                                                 // get an iterator to arg list
-  Method::ArgumentListType::const_iterator ArgIt = ArgList.begin(); 
+  // get the argument list
+  const Function::ArgumentListType& ArgList = Meth->getArgumentList();
 
-             
+  Function::ArgumentListType::const_iterator ArgIt = ArgList.begin();
   for( ; ArgIt != ArgList.end() ; ++ArgIt) {     // for each argument
     LiveRange * ArgRange = new LiveRange();      // creates a new LR and 
     const Value *Val = (const Value *) *ArgIt;
@@ -111,15 +109,14 @@
     }
   }
 
-  // Now suggest hardware registers for these method args 
+  // Now suggest hardware registers for these function args 
   MRI.suggestRegs4MethodArgs(Meth, *this);
 
 
-
   // Now find speical LLVM instructions (CALL, RET) and LRs in machine
   // instructions.
   //
-  for (Method::const_iterator BBI = Meth->begin(); BBI != Meth->end(); ++BBI) {
+  for (Function::const_iterator BBI = Meth->begin(); BBI != Meth->end(); ++BBI){
     // Now find all LRs for machine the instructions. A new LR will be created 
     // only for defs in the machine instr since, we assume that all Values are
     // defined before they are used. However, there can be multiple defs for
@@ -207,7 +204,7 @@
 
     } // for all machine instructions in the BB
 
-  } // for all BBs in method
+  } // for all BBs in function
   
 
   // Now we have to suggest clors for call and return arg live ranges.
@@ -225,16 +222,14 @@
 //---------------------------------------------------------------------------
 // If some live ranges must be colored with specific hardware registers
 // (e.g., for outgoing call args), suggesting of colors for such live
-// ranges is done using target specific method. Those methods are called
+// ranges is done using target specific function. Those functions are called
 // from this function. The target specific methods must:
 //    1) suggest colors for call and return args. 
 //    2) create new LRs for implicit defs in machine instructions
 //---------------------------------------------------------------------------
 void LiveRangeInfo::suggestRegs4CallRets()
 {
-
   CallRetInstrListType::const_iterator It =  CallRetInstrList.begin();
-
   for( ; It !=  CallRetInstrList.end(); ++It ) {
 
     const MachineInstr *MInst = *It;
@@ -259,7 +254,7 @@
 
 
 /* Algorithm:
-   for each BB in method
+   for each BB in function
      for each machine instruction (inst)
        for each definition (def) in inst
          for each operand (op) of inst that is a use
@@ -273,12 +268,11 @@
 //---------------------------------------------------------------------------
 void LiveRangeInfo::coalesceLRs()  
 {
-  if( DEBUG_RA) 
+  if(DEBUG_RA) 
     cerr << "\nCoalscing LRs ...\n";
 
-  Method::const_iterator BBI = Meth->begin();  // random iterator for BBs   
-
-  for( ; BBI != Meth->end(); ++BBI) {          // traverse BBs in random order
+  for(Function::const_iterator BBI = Meth->begin(), BBE = Meth->end();
+      BBI != BBE; ++BBI) {
 
     // get the iterator for machine instructions
     const MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec();
diff --git a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
index 49667e0..c9d775e 100644
--- a/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/CodeGen/RegAlloc/PhyRegAlloc.cpp
@@ -19,7 +19,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/MachineFrameInfo.h"
 #include "llvm/BasicBlock.h"
-#include "llvm/Method.h"
+#include "llvm/Function.h"
 #include "llvm/Type.h"
 #include <iostream>
 #include <math.h>
@@ -45,12 +45,12 @@
   public:
     inline RegisterAllocator(TargetMachine &T) : Target(T) {}
     
-    bool runOnMethod(Method *M) {
+    bool runOnMethod(Function *F) {
       if (DEBUG_RA)
-        cerr << "\n******************** Method "<< M->getName()
+        cerr << "\n******************** Method "<< F->getName()
              << " ********************\n";
       
-      PhyRegAlloc PRA(M, Target, &getAnalysis<MethodLiveVarInfo>(),
+      PhyRegAlloc PRA(F, Target, &getAnalysis<MethodLiveVarInfo>(),
                       &getAnalysis<cfg::LoopInfo>());
       PRA.allocateRegisters();
       
@@ -75,22 +75,22 @@
 //----------------------------------------------------------------------------
 // Constructor: Init local composite objects and create register classes.
 //----------------------------------------------------------------------------
-PhyRegAlloc::PhyRegAlloc(Method *M, 
+PhyRegAlloc::PhyRegAlloc(Function *F, 
 			 const TargetMachine& tm, 
 			 MethodLiveVarInfo *Lvi,
                          cfg::LoopInfo *LDC) 
-                       :  TM(tm), Meth(M),
-                          mcInfo(MachineCodeForMethod::get(M)),
-                          LVI(Lvi), LRI(M, tm, RegClassList), 
-			  MRI( tm.getRegInfo() ),
+                       :  TM(tm), Meth(F),
+                          mcInfo(MachineCodeForMethod::get(F)),
+                          LVI(Lvi), LRI(F, tm, RegClassList), 
+			  MRI(tm.getRegInfo()),
                           NumOfRegClasses(MRI.getNumOfRegClasses()),
 			  LoopDepthCalc(LDC) {
 
   // create each RegisterClass and put in RegClassList
   //
   for(unsigned int rc=0; rc < NumOfRegClasses; rc++)  
-    RegClassList.push_back( new RegClass(M, MRI.getMachineRegClass(rc), 
-					 &ResColList) );
+    RegClassList.push_back(new RegClass(F, MRI.getMachineRegClass(rc),
+                                        &ResColList));
 }
 
 
@@ -278,13 +278,12 @@
   if(DEBUG_RA) cerr << "Creating interference graphs ...\n";
 
   unsigned BBLoopDepthCost;
-  Method::const_iterator BBI = Meth->begin();  // random iterator for BBs   
-
-  for( ; BBI != Meth->end(); ++BBI) {          // traverse BBs in random order
+  for (Function::const_iterator BBI = Meth->begin(), BBE = Meth->end();
+       BBI != BBE; ++BBI) {
 
     // find the 10^(loop_depth) of this BB 
     //
-    BBLoopDepthCost = (unsigned) pow( 10.0, LoopDepthCalc->getLoopDepth(*BBI));
+    BBLoopDepthCost = (unsigned) pow(10.0, LoopDepthCalc->getLoopDepth(*BBI));
 
     // get the iterator for machine instructions
     //
@@ -346,12 +345,11 @@
 
 
     } // for all machine instructions in BB
-    
-  } // for all BBs in method
+  } // for all BBs in function
 
 
-  // add interferences for method arguments. Since there are no explict 
-  // defs in method for args, we have to add them manually
+  // add interferences for function arguments. Since there are no explict 
+  // defs in the function for args, we have to add them manually
   //  
   addInterferencesForArgs();          
 
@@ -405,17 +403,17 @@
 
 
 //----------------------------------------------------------------------------
-// This method will add interferences for incoming arguments to a method.
+// This method will add interferences for incoming arguments to a function.
 //----------------------------------------------------------------------------
 void PhyRegAlloc::addInterferencesForArgs() {
   // get the InSet of root BB
   const ValueSet &InSet = LVI->getInSetOfBB(Meth->front());  
 
   // get the argument list
-  const Method::ArgumentListType& ArgList = Meth->getArgumentList();  
+  const Function::ArgumentListType &ArgList = Meth->getArgumentList();  
 
   // get an iterator to arg list
-  Method::ArgumentListType::const_iterator ArgIt = ArgList.begin();          
+  Function::ArgumentListType::const_iterator ArgIt = ArgList.begin();          
 
 
   for( ; ArgIt != ArgList.end() ; ++ArgIt) {  // for each argument
@@ -441,10 +439,8 @@
 void PhyRegAlloc::updateMachineCode()
 {
 
-  Method::const_iterator BBI = Meth->begin();  // random iterator for BBs   
-
-  for( ; BBI != Meth->end(); ++BBI) {          // traverse BBs in random order
-
+  for (Function::const_iterator BBI = Meth->begin(), BBE = Meth->end();
+       BBI != BBE; ++BBI) {
     // get the iterator for machine instructions
     //
     MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec();
@@ -955,14 +951,12 @@
 void PhyRegAlloc::printMachineCode()
 {
 
-  cerr << "\n;************** Method " << Meth->getName()
+  cerr << "\n;************** Function " << Meth->getName()
        << " *****************\n";
 
-  Method::const_iterator BBI = Meth->begin();  // random iterator for BBs   
-
-  for( ; BBI != Meth->end(); ++BBI) {          // traverse BBs in random order
-
-    cerr << "\n"; printLabel( *BBI); cerr << ": ";
+  for (Function::const_iterator BBI = Meth->begin(), BBE = Meth->end();
+       BBI != BBE; ++BBI) {
+    cerr << "\n"; printLabel(*BBI); cerr << ": ";
 
     // get the iterator for machine instructions
     MachineCodeForBasicBlock& MIVec = (*BBI)->getMachineInstrVec();
@@ -970,18 +964,12 @@
 
     // iterate over all the machine instructions in BB
     for( ; MInstIterator != MIVec.end(); ++MInstIterator) {  
-      
       MachineInstr *const MInst = *MInstIterator; 
 
-
       cerr << "\n\t";
       cerr << TargetInstrDescriptors[MInst->getOpCode()].opCodeString;
-      
-
-      //for(MachineInstr::val_const_op_iterator OpI(MInst);!OpI.done();++OpI) {
 
       for(unsigned OpNum=0; OpNum < MInst->getNumOperands(); ++OpNum) {
-
 	MachineOperand& Op = MInst->getOperand(OpNum);
 
 	if( Op.getOperandType() ==  MachineOperand::MO_VirtualRegister || 
@@ -1074,7 +1062,6 @@
     // So reset it before we call each such method
     //mcInfo.popAllTempValues(TM);  
 
-
     
     if (TM.getInstrInfo().isCall(OpCode))
       MRI.colorCallArgs(CRMI, LRI, AI, *this);