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/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index bf97963..7c8ccb6 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -102,7 +102,7 @@
   std::set<Value *> Pointers;
   std::set<CallSite> CallSites;
 
-  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)
     if (isa<PointerType>(I->getType()))    // Add all pointer arguments
       Pointers.insert(I);
 
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp
index a94e083..ac2abb3 100644
--- a/lib/Analysis/DataStructure/DataStructure.cpp
+++ b/lib/Analysis/DataStructure/DataStructure.cpp
@@ -1270,7 +1270,7 @@
 void DSGraph::getFunctionArgumentsForCall(Function *F,
                                        std::vector<DSNodeHandle> &Args) const {
   Args.push_back(getReturnNodeFor(*F));
-  for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI)
+  for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI)
     if (isPointerType(AI->getType())) {
       Args.push_back(getNodeForValue(AI));
       assert(!Args.back().isNull() && "Pointer argument w/o scalarmap entry!?");
@@ -1405,7 +1405,7 @@
 DSCallSite DSGraph::getCallSiteForArguments(Function &F) const {
   std::vector<DSNodeHandle> Args;
 
-  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)
     if (isPointerType(I->getType()))
       Args.push_back(getNodeForValue(I));
 
@@ -1482,7 +1482,7 @@
     for (ReturnNodesTy::iterator FI = ReturnNodes.begin(), E =ReturnNodes.end();
          FI != E; ++FI) {
       Function &F = *FI->first;
-      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)
         if (isPointerType(I->getType()))
           markIncompleteNode(getNodeForValue(I).getNode());
       markIncompleteNode(FI->second.getNode());
@@ -2038,7 +2038,7 @@
          E = ReturnNodes.end();
        RI != E; ++RI) {
     Function &F = *RI->first;
-    for (Function::aiterator AI = F.abegin(); AI != F.aend(); ++AI)
+    for (Function::arg_iterator AI = F.arg_begin(); AI != F.arg_end(); ++AI)
       if (isPointerType(AI->getType()))
         assert(!getNodeForValue(AI).isNull() &&
                "Pointer argument must be in the scalar map!");
diff --git a/lib/Analysis/DataStructure/DataStructureOpt.cpp b/lib/Analysis/DataStructure/DataStructureOpt.cpp
index 1d8373a..c75784b 100644
--- a/lib/Analysis/DataStructure/DataStructureOpt.cpp
+++ b/lib/Analysis/DataStructure/DataStructureOpt.cpp
@@ -59,7 +59,7 @@
   const DSGraph::ScalarMapTy &SM = GG.getScalarMap();
   bool Changed = false;
 
-  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()) { // Loop over all of the non-external globals...
       // Look up the node corresponding to this global, if it exists.
       DSNode *GNode = 0;
diff --git a/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
index 4ada4dc..ef1e01a 100644
--- a/lib/Analysis/DataStructure/EquivClassGraphs.cpp
+++ b/lib/Analysis/DataStructure/EquivClassGraphs.cpp
@@ -215,7 +215,7 @@
       // Record the argument nodes for use in merging later below.
       std::vector<DSNodeHandle> ArgNodes;  
 
-      for (Function::aiterator AI1 = LF->abegin(); AI1 != LF->aend(); ++AI1)
+      for (Function::arg_iterator AI1 = LF->arg_begin(); AI1 != LF->arg_end(); ++AI1)
         if (DS::isPointerType(AI1->getType()))
           ArgNodes.push_back(MergedG.getNodeForValue(AI1));
       
@@ -254,7 +254,7 @@
 
         // Merge the function arguments with all argument nodes found so far.
         // If there are extra function args, add them to the vector of argNodes
-        Function::aiterator AI2 = F->abegin(), AI2end = F->aend();
+        Function::arg_iterator AI2 = F->arg_begin(), AI2end = F->arg_end();
         for (unsigned arg=0, numArgs = ArgNodes.size();
              arg != numArgs && AI2 != AI2end; ++AI2, ++arg)
           if (DS::isPointerType(AI2->getType()))
diff --git a/lib/Analysis/DataStructure/Local.cpp b/lib/Analysis/DataStructure/Local.cpp
index 20f45a7..e2e40f7 100644
--- a/lib/Analysis/DataStructure/Local.cpp
+++ b/lib/Analysis/DataStructure/Local.cpp
@@ -82,7 +82,7 @@
         FunctionCalls(&fc) {
 
       // Create scalar nodes for all pointer arguments...
-      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)
         if (isPointerType(I->getType()))
           getValueDest(*I);
 
@@ -1076,7 +1076,7 @@
     GraphBuilder GGB(*GlobalsGraph);
     
     // Add initializers for all of the globals to the globals graph...
-    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())
         GGB.mergeInGlobalInitializer(I);
   }
diff --git a/lib/Analysis/DataStructure/Steensgaard.cpp b/lib/Analysis/DataStructure/Steensgaard.cpp
index eee9b0b..dd07ee6 100644
--- a/lib/Analysis/DataStructure/Steensgaard.cpp
+++ b/lib/Analysis/DataStructure/Steensgaard.cpp
@@ -94,7 +94,7 @@
 
   // Loop over all pointer arguments, resolving them to their provided pointers
   unsigned PtrArgIdx = 0;
-  for (Function::aiterator AI = F->abegin(), AE = F->aend();
+  for (Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end();
        AI != AE && PtrArgIdx < Call.getNumPtrArgs(); ++AI) {
     DSGraph::ScalarMapTy::iterator I = ValMap.find(AI);
     if (I != ValMap.end())    // If its a pointer argument...
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index b8553e6..12d4cf5 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -433,7 +433,7 @@
   ++NumObjects;
 
   // Add all the globals first.
-  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) {
     ObjectNodes[I] = NumObjects++;
     ValueNodes[I] = NumObjects++;
   }
@@ -449,7 +449,7 @@
       VarargNodes[F] = NumObjects++;
 
     // Add nodes for all of the incoming pointer arguments.
-    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)
       if (isa<PointerType>(I->getType()))
         ValueNodes[I] = NumObjects++;
 
@@ -550,7 +550,7 @@
 }
 
 void Andersens::AddConstraintsForNonInternalLinkage(Function *F) {
-  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)
     if (isa<PointerType>(I->getType()))
       // If this is an argument of an externally accessible function, the
       // incoming pointer might point to anything.
@@ -571,7 +571,7 @@
   GraphNodes[NullPtr].addPointerTo(&GraphNodes[NullObject]);
 
   // Next, add any constraints on global variables and their initializers.
-  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) {
     // Associate the address of the global object as pointing to the memory for
     // the global: &G = <G memory>
     Node *Object = getObject(I);
@@ -599,7 +599,7 @@
       getVarargNode(F)->setValue(F);
 
     // Set up incoming argument nodes.
-    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)
       if (isa<PointerType>(I->getType()))
         getNodeValue(*I);
 
@@ -620,7 +620,7 @@
 
       // Any pointers that are passed into the function have the universal set
       // stored into them.
-      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)
         if (isa<PointerType>(I->getType())) {
           // Pointers passed into external functions could have anything stored
           // through them.
@@ -772,7 +772,7 @@
                                      getReturnNode(F)));
   }
   
-  Function::aiterator AI = F->abegin(), AE = F->aend();
+  Function::arg_iterator AI = F->arg_begin(), AE = F->arg_end();
   CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end();
   for (; AI != AE && ArgI != ArgE; ++AI, ++ArgI)
     if (isa<PointerType>(AI->getType())) {
diff --git a/lib/Analysis/IPA/FindUsedTypes.cpp b/lib/Analysis/IPA/FindUsedTypes.cpp
index cb6b05c..e37a40a 100644
--- a/lib/Analysis/IPA/FindUsedTypes.cpp
+++ b/lib/Analysis/IPA/FindUsedTypes.cpp
@@ -62,7 +62,7 @@
   UsedTypes.clear();  // reset if run multiple times...
 
   // Loop over global variables, incorporating their types
-  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) {
     IncorporateType(I->getType());
     if (I->hasInitializer())
       IncorporateValue(I->getInitializer());
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 4a97a8f..6bf2698 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -159,7 +159,7 @@
       Readers.clear(); Writers.clear();
     }
 
-  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->hasInternalLinkage()) {
       if (!AnalyzeUsesOfGlobal(I, Readers, Writers)) {
         // Remember that we are tracking this global, and the mod/ref fns