This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20597 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/Alpha/AlphaAsmPrinter.cpp b/lib/Target/Alpha/AlphaAsmPrinter.cpp
index 8031d17..500f8b1 100644
--- a/lib/Target/Alpha/AlphaAsmPrinter.cpp
+++ b/lib/Target/Alpha/AlphaAsmPrinter.cpp
@@ -241,7 +241,7 @@
   const TargetData &TD = TM.getTargetData();
   std::string CurSection;
   
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << "\n\n";
       std::string name = Mang->getValueName(I);
diff --git a/lib/Target/Alpha/AlphaISelPattern.cpp b/lib/Target/Alpha/AlphaISelPattern.cpp
index 5db6afe..99bb9b9 100644
--- a/lib/Target/Alpha/AlphaISelPattern.cpp
+++ b/lib/Target/Alpha/AlphaISelPattern.cpp
@@ -146,7 +146,7 @@
 
   int count = 0;
 
-  for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I)
+  for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I)
   {
     SDOperand newroot, argt;
     if (count  < 6) {
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 111468f..d010509 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -851,9 +851,9 @@
   printModuleTypes(M.getSymbolTable());
 
   // Global variable declarations...
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n/* External Global Variable Declarations */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
       if (I->hasExternalLinkage()) {
         Out << "extern ";
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
@@ -878,9 +878,9 @@
   }
 
   // Output the global variable declarations
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n\n/* Global Variable Declarations */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
       if (!I->isExternal()) {
         if (I->hasInternalLinkage())
           Out << "static ";
@@ -897,9 +897,9 @@
   }
 
   // Output the global variable definitions and contents...
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n\n/* Global Variable Definitions and Initialization */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
       if (!I->isExternal()) {
         if (I->hasInternalLinkage())
           Out << "static ";
@@ -1075,12 +1075,12 @@
   FunctionInnards << Mang->getValueName(F) << '(';
     
   if (!F->isExternal()) {
-    if (!F->aempty()) {
+    if (!F->arg_empty()) {
       std::string ArgName;
-      if (F->abegin()->hasName() || !Prototype)
-        ArgName = Mang->getValueName(F->abegin());
-      printType(FunctionInnards, F->afront().getType(), ArgName);
-      for (Function::const_aiterator I = ++F->abegin(), E = F->aend();
+      if (F->arg_begin()->hasName() || !Prototype)
+        ArgName = Mang->getValueName(F->arg_begin());
+      printType(FunctionInnards, F->arg_front().getType(), ArgName);
+      for (Function::const_arg_iterator I = ++F->arg_begin(), E = F->arg_end();
            I != E; ++I) {
         FunctionInnards << ", ";
         if (I->hasName() || !Prototype)
@@ -1466,13 +1466,13 @@
         
         Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
         // Output the last argument to the enclosing function...
-        if (I.getParent()->getParent()->aempty()) {
+        if (I.getParent()->getParent()->arg_empty()) {
           std::cerr << "The C backend does not currently support zero "
                     << "argument varargs functions, such as '"
                     << I.getParent()->getParent()->getName() << "'!\n";
           abort();
         }
-        writeOperand(&I.getParent()->getParent()->aback());
+        writeOperand(&I.getParent()->getParent()->arg_back());
         Out << ')';
         return;
       case Intrinsic::vaend:
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index 111468f..d010509 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -851,9 +851,9 @@
   printModuleTypes(M.getSymbolTable());
 
   // Global variable declarations...
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n/* External Global Variable Declarations */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
       if (I->hasExternalLinkage()) {
         Out << "extern ";
         printType(Out, I->getType()->getElementType(), Mang->getValueName(I));
@@ -878,9 +878,9 @@
   }
 
   // Output the global variable declarations
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n\n/* Global Variable Declarations */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
       if (!I->isExternal()) {
         if (I->hasInternalLinkage())
           Out << "static ";
@@ -897,9 +897,9 @@
   }
 
   // Output the global variable definitions and contents...
-  if (!M.gempty()) {
+  if (!M.global_empty()) {
     Out << "\n\n/* Global Variable Definitions and Initialization */\n";
-    for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+    for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
       if (!I->isExternal()) {
         if (I->hasInternalLinkage())
           Out << "static ";
@@ -1075,12 +1075,12 @@
   FunctionInnards << Mang->getValueName(F) << '(';
     
   if (!F->isExternal()) {
-    if (!F->aempty()) {
+    if (!F->arg_empty()) {
       std::string ArgName;
-      if (F->abegin()->hasName() || !Prototype)
-        ArgName = Mang->getValueName(F->abegin());
-      printType(FunctionInnards, F->afront().getType(), ArgName);
-      for (Function::const_aiterator I = ++F->abegin(), E = F->aend();
+      if (F->arg_begin()->hasName() || !Prototype)
+        ArgName = Mang->getValueName(F->arg_begin());
+      printType(FunctionInnards, F->arg_front().getType(), ArgName);
+      for (Function::const_arg_iterator I = ++F->arg_begin(), E = F->arg_end();
            I != E; ++I) {
         FunctionInnards << ", ";
         if (I->hasName() || !Prototype)
@@ -1466,13 +1466,13 @@
         
         Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
         // Output the last argument to the enclosing function...
-        if (I.getParent()->getParent()->aempty()) {
+        if (I.getParent()->getParent()->arg_empty()) {
           std::cerr << "The C backend does not currently support zero "
                     << "argument varargs functions, such as '"
                     << I.getParent()->getParent()->getName() << "'!\n";
           abort();
         }
-        writeOperand(&I.getParent()->getParent()->aback());
+        writeOperand(&I.getParent()->getParent()->arg_back());
         Out << ')';
         return;
       case Intrinsic::vaend:
diff --git a/lib/Target/PowerPC/PPC32ISelSimple.cpp b/lib/Target/PowerPC/PPC32ISelSimple.cpp
index 38e51ab..e68d6c5 100644
--- a/lib/Target/PowerPC/PPC32ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC32ISelSimple.cpp
@@ -734,7 +734,7 @@
     
   MachineFrameInfo *MFI = F->getFrameInfo();
  
-  for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
+  for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) {
     bool ArgLive = !I->use_empty();
     unsigned Reg = ArgLive ? getReg(*I) : 0;
     int FI;          // Frame object index
diff --git a/lib/Target/PowerPC/PPC64ISelSimple.cpp b/lib/Target/PowerPC/PPC64ISelSimple.cpp
index a4d545b..9fe3422 100644
--- a/lib/Target/PowerPC/PPC64ISelSimple.cpp
+++ b/lib/Target/PowerPC/PPC64ISelSimple.cpp
@@ -590,7 +590,7 @@
     
   MachineFrameInfo *MFI = F->getFrameInfo();
  
-  for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
+  for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) {
     bool ArgLive = !I->use_empty();
     unsigned Reg = ArgLive ? getReg(*I) : 0;
     int FI;          // Frame object index
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 48eddb9..a50a437 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -459,7 +459,7 @@
   std::string CurSection;
 
   // Print out module-level global variables here.
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << '\n';
       std::string name = Mang->getValueName(I);
@@ -646,7 +646,7 @@
     << "\t.csect .text[PR]\n";
 
   // Print out module-level global variables
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
     if (!I->hasInitializer())
       continue;
  
@@ -664,8 +664,8 @@
   }
 
   // Output labels for globals
-  if (M.gbegin() != M.gend()) O << "\t.toc\n";
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+  if (M.global_begin() != M.global_end()) O << "\t.toc\n";
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
     const GlobalVariable *GV = I;
     // Do not output labels for unused variables
     if (GV->isExternal() && GV->use_begin() == GV->use_end())
@@ -687,7 +687,7 @@
 bool AIXAsmPrinter::doFinalization(Module &M) {
   const TargetData &TD = TM.getTargetData();
   // Print out module-level global variables
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I) {
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) {
     if (I->hasInitializer() || I->hasExternalLinkage())
       continue;
 
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp
index 432aa2c..7121053 100644
--- a/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -580,7 +580,7 @@
   std::string CurSection;
 
   // Print out module-level global variables here.
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << "\n\n";
       std::string name = Mang->getValueName(I);
diff --git a/lib/Target/Sparc/SparcV8ISelSimple.cpp b/lib/Target/Sparc/SparcV8ISelSimple.cpp
index 9de3a88..6332368 100644
--- a/lib/Target/Sparc/SparcV8ISelSimple.cpp
+++ b/lib/Target/Sparc/SparcV8ISelSimple.cpp
@@ -335,7 +335,7 @@
 
   // Add IMPLICIT_DEFs of input regs.
   unsigned ArgNo = 0;
-  for (Function::aiterator I = LF->abegin(), E = LF->aend();
+  for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end();
        I != E && ArgNo < 6; ++I, ++ArgNo) {
     switch (getClassB(I->getType())) {
     case cByte:
@@ -382,7 +382,7 @@
   }
 
   // Copy args out of their incoming hard regs or stack slots into virtual regs.
-  for (Function::aiterator I = LF->abegin(), E = LF->aend(); I != E; ++I) {
+  for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end(); I != E; ++I) {
     Argument &A = *I;
     unsigned ArgReg = getReg (A);
     if (getClassB (A.getType ()) < cLong) {
diff --git a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp
index 432aa2c..7121053 100644
--- a/lib/Target/SparcV8/SparcV8AsmPrinter.cpp
+++ b/lib/Target/SparcV8/SparcV8AsmPrinter.cpp
@@ -580,7 +580,7 @@
   std::string CurSection;
 
   // Print out module-level global variables here.
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << "\n\n";
       std::string name = Mang->getValueName(I);
diff --git a/lib/Target/SparcV8/SparcV8ISelSimple.cpp b/lib/Target/SparcV8/SparcV8ISelSimple.cpp
index 9de3a88..6332368 100644
--- a/lib/Target/SparcV8/SparcV8ISelSimple.cpp
+++ b/lib/Target/SparcV8/SparcV8ISelSimple.cpp
@@ -335,7 +335,7 @@
 
   // Add IMPLICIT_DEFs of input regs.
   unsigned ArgNo = 0;
-  for (Function::aiterator I = LF->abegin(), E = LF->aend();
+  for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end();
        I != E && ArgNo < 6; ++I, ++ArgNo) {
     switch (getClassB(I->getType())) {
     case cByte:
@@ -382,7 +382,7 @@
   }
 
   // Copy args out of their incoming hard regs or stack slots into virtual regs.
-  for (Function::aiterator I = LF->abegin(), E = LF->aend(); I != E; ++I) {
+  for (Function::arg_iterator I = LF->arg_begin(), E = LF->arg_end(); I != E; ++I) {
     Argument &A = *I;
     unsigned ArgReg = getReg (A);
     if (getClassB (A.getType ()) < cLong) {
diff --git a/lib/Target/SparcV9/InternalGlobalMapper.cpp b/lib/Target/SparcV9/InternalGlobalMapper.cpp
index 8df3dc3..280c836 100644
--- a/lib/Target/SparcV9/InternalGlobalMapper.cpp
+++ b/lib/Target/SparcV9/InternalGlobalMapper.cpp
@@ -52,7 +52,7 @@
   GVVectorTy gvvector;
 
   // Populate the vector with internal global values and their names.
-  for (Module::giterator i = M.gbegin (), e = M.gend (); i != e; ++i)
+  for (Module::global_iterator i = M.global_begin (), e = M.global_end (); i != e; ++i)
     maybeAddInternalValueToVector (gvvector, *i);
   // Add an extra global for _llvm_internalGlobals itself (null,
   // because it's not internal)
diff --git a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
index 190e0c5..6da3e0f 100644
--- a/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
+++ b/lib/Target/SparcV9/RegAlloc/LiveRangeInfo.cpp
@@ -150,7 +150,7 @@
 
   // first find the live ranges for all incoming args of the function since
   // those LRs start from the start of the function
-  for (Function::const_aiterator AI = Meth->abegin(); AI != Meth->aend(); ++AI)
+  for (Function::const_arg_iterator AI = Meth->arg_begin(); AI != Meth->arg_end(); ++AI)
     createNewLiveRange(AI, /*isCC*/ false);
 
   // Now suggest hardware registers for these function args 
diff --git a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
index 6a1710e..adb7d28 100644
--- a/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
+++ b/lib/Target/SparcV9/RegAlloc/PhyRegAlloc.cpp
@@ -317,7 +317,7 @@
   // get the InSet of root BB
   const ValueSet &InSet = LVI->getInSetOfBB(&Fn->front());  
 
-  for (Function::const_aiterator AI = Fn->abegin(); AI != Fn->aend(); ++AI) {
+  for (Function::const_arg_iterator AI = Fn->arg_begin(); AI != Fn->arg_end(); ++AI) {
     // add interferences between args and LVars at start 
     addInterference(AI, &InSet, false);
     
@@ -1148,7 +1148,7 @@
   std::vector<AllocInfo> &state = FnAllocState[Fn];
   unsigned ArgNum = 0;
   // Arguments encoded as instruction # -1
-  for (Function::const_aiterator i=Fn->abegin (), e=Fn->aend (); i != e; ++i) {
+  for (Function::const_arg_iterator i=Fn->arg_begin (), e=Fn->arg_end (); i != e; ++i) {
     const Argument *Arg = &*i;
     saveStateForValue (state, Arg, -1, ArgNum);
     ++ArgNum;
diff --git a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
index d6c401a..c410a4b 100644
--- a/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
+++ b/lib/Target/SparcV9/SparcV9AsmPrinter.cpp
@@ -768,7 +768,7 @@
 
 void SparcV9AsmPrinter::emitGlobals(const Module &M) {
   // Output global variables...
-  for (Module::const_giterator GI = M.gbegin(), GE = M.gend(); GI != GE; ++GI)
+  for (Module::const_global_iterator GI = M.global_begin(), GE = M.global_end(); GI != GE; ++GI)
     if (! GI->isExternal()) {
       assert(GI->hasInitializer());
       if (GI->isConstant())
diff --git a/lib/Target/SparcV9/SparcV9RegInfo.cpp b/lib/Target/SparcV9/SparcV9RegInfo.cpp
index 948276b..8a82718 100644
--- a/lib/Target/SparcV9/SparcV9RegInfo.cpp
+++ b/lib/Target/SparcV9/SparcV9RegInfo.cpp
@@ -374,7 +374,7 @@
   // Count the arguments, *ignoring* whether they are int or FP args.
   // Use this common arg numbering to pick the right int or fp register.
   unsigned argNo=0;
-  for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend();
+  for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end();
       I != E; ++I, ++argNo) {
     LiveRange *LR = LRI.getLiveRangeForValue(I);
     assert(LR && "No live range found for method arg");
@@ -410,7 +410,7 @@
   // for each argument
   // for each argument.  count INT and FP arguments separately.
   unsigned argNo=0, intArgNo=0, fpArgNo=0;
-  for(Function::const_aiterator I = Meth->abegin(), E = Meth->aend();
+  for(Function::const_arg_iterator I = Meth->arg_begin(), E = Meth->arg_end();
       I != E; ++I, ++argNo) {
     // get the LR of arg
     LiveRange *LR = LRI.getLiveRangeForValue(I);
diff --git a/lib/Target/X86/X86AsmPrinter.cpp b/lib/Target/X86/X86AsmPrinter.cpp
index c792632..24e92ed 100644
--- a/lib/Target/X86/X86AsmPrinter.cpp
+++ b/lib/Target/X86/X86AsmPrinter.cpp
@@ -123,7 +123,7 @@
   std::string CurSection;
 
   // Print out module-level global variables here.
-  for (Module::const_giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+  for (Module::const_global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
     if (I->hasInitializer()) {   // External global require no code
       O << "\n\n";
       std::string name = Mang->getValueName(I);
diff --git a/lib/Target/X86/X86ISelPattern.cpp b/lib/Target/X86/X86ISelPattern.cpp
index e673bb5..9b68ad8 100644
--- a/lib/Target/X86/X86ISelPattern.cpp
+++ b/lib/Target/X86/X86ISelPattern.cpp
@@ -117,7 +117,7 @@
   MachineFrameInfo *MFI = MF.getFrameInfo();
   
   unsigned ArgOffset = 0;   // Frame mechanisms handle retaddr slot
-  for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I) {
+  for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I) {
     MVT::ValueType ObjectVT = getValueType(I->getType());
     unsigned ArgIncrement = 4;
     unsigned ObjSize;
diff --git a/lib/Target/X86/X86ISelSimple.cpp b/lib/Target/X86/X86ISelSimple.cpp
index 9c9dac3..a406589 100644
--- a/lib/Target/X86/X86ISelSimple.cpp
+++ b/lib/Target/X86/X86ISelSimple.cpp
@@ -618,7 +618,7 @@
   unsigned ArgOffset = 0;   // Frame mechanisms handle retaddr slot
   MachineFrameInfo *MFI = F->getFrameInfo();
 
-  for (Function::aiterator I = Fn.abegin(), E = Fn.aend(); I != E; ++I) {
+  for (Function::arg_iterator I = Fn.arg_begin(), E = Fn.arg_end(); I != E; ++I) {
     bool ArgLive = !I->use_empty();
     unsigned Reg = ArgLive ? getReg(*I) : 0;
     int FI;          // Frame object index