[llvm-commits] CVS: llvm/lib/Transforms/Utils/CloneFunction.cpp CloneModule.cpp CodeExtractor.cpp InlineFunction.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 14 20:55:02 PST 2005



Changes in directory llvm/lib/Transforms/Utils:

CloneFunction.cpp updated: 1.23 -> 1.24
CloneModule.cpp updated: 1.10 -> 1.11
CodeExtractor.cpp updated: 1.36 -> 1.37
InlineFunction.cpp updated: 1.29 -> 1.30
---
Log message:

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!



---
Diffs of the changes:  (+15 -15)

 CloneFunction.cpp  |    8 ++++----
 CloneModule.cpp    |    8 ++++----
 CodeExtractor.cpp  |    8 ++++----
 InlineFunction.cpp |    6 +++---
 4 files changed, 15 insertions(+), 15 deletions(-)


Index: llvm/lib/Transforms/Utils/CloneFunction.cpp
diff -u llvm/lib/Transforms/Utils/CloneFunction.cpp:1.23 llvm/lib/Transforms/Utils/CloneFunction.cpp:1.24
--- llvm/lib/Transforms/Utils/CloneFunction.cpp:1.23	Thu Jul 29 12:24:20 2004
+++ llvm/lib/Transforms/Utils/CloneFunction.cpp	Mon Mar 14 22:54:21 2005
@@ -49,7 +49,7 @@
   assert(NameSuffix && "NameSuffix cannot be null!");
   
 #ifndef NDEBUG
-  for (Function::const_aiterator I = OldFunc->abegin(), E = OldFunc->aend();
+  for (Function::const_arg_iterator I = OldFunc->arg_begin(), E = OldFunc->arg_end();
        I != E; ++I)
     assert(ValueMap.count(I) && "No mapping from source argument specified!");
 #endif
@@ -95,7 +95,7 @@
   // The user might be deleting arguments to the function by specifying them in
   // the ValueMap.  If so, we need to not add the arguments to the arg ty vector
   //
-  for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (ValueMap.count(I) == 0)  // Haven't mapped the argument to anything yet?
       ArgTypes.push_back(I->getType());
 
@@ -107,8 +107,8 @@
   Function *NewF = new Function(FTy, F->getLinkage(), F->getName());
   
   // Loop over the arguments, copying the names of the mapped arguments over...
-  Function::aiterator DestI = NewF->abegin();
-  for (Function::const_aiterator I = F->abegin(), E = F->aend(); I != E; ++I)
+  Function::arg_iterator DestI = NewF->arg_begin();
+  for (Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I)
     if (ValueMap.count(I) == 0) {   // Is this argument preserved?
       DestI->setName(I->getName()); // Copy the name over...
       ValueMap[I] = DestI++;        // Add mapping to ValueMap


Index: llvm/lib/Transforms/Utils/CloneModule.cpp
diff -u llvm/lib/Transforms/Utils/CloneModule.cpp:1.10 llvm/lib/Transforms/Utils/CloneModule.cpp:1.11
--- llvm/lib/Transforms/Utils/CloneModule.cpp:1.10	Tue May 25 03:51:47 2004
+++ llvm/lib/Transforms/Utils/CloneModule.cpp	Mon Mar 14 22:54:21 2005
@@ -47,7 +47,7 @@
   // new module.  Here we add them to the ValueMap and to the new Module.  We
   // don't worry about attributes or initializers, they will come later.
   //
-  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)
     ValueMap[I] = new GlobalVariable(I->getType()->getElementType(), false,
                                      GlobalValue::ExternalLinkage, 0,
                                      I->getName(), New);
@@ -61,7 +61,7 @@
   // have been created, loop through and copy the global variable referrers
   // over...  We also set the attributes on the global now.
   //
-  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) {
     GlobalVariable *GV = cast<GlobalVariable>(ValueMap[I]);
     if (I->hasInitializer())
       GV->setInitializer(cast<Constant>(MapValue(I->getInitializer(),
@@ -74,8 +74,8 @@
   for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
     Function *F = cast<Function>(ValueMap[I]);
     if (!I->isExternal()) {
-      Function::aiterator DestI = F->abegin();
-      for (Function::const_aiterator J = I->abegin(); J != I->aend(); ++J) {
+      Function::arg_iterator DestI = F->arg_begin();
+      for (Function::const_arg_iterator J = I->arg_begin(); J != I->arg_end(); ++J) {
         DestI->setName(J->getName());
         ValueMap[J] = DestI++;
       }


Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.36 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.37
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.36	Fri Jan 28 18:38:26 2005
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp	Mon Mar 14 22:54:21 2005
@@ -295,7 +295,7 @@
   newFunction->getBasicBlockList().push_back(newRootNode);
 
   // Create an iterator to name all of the arguments we inserted.
-  Function::aiterator AI = newFunction->abegin();
+  Function::arg_iterator AI = newFunction->arg_begin();
 
   // Rewrite all users of the inputs in the extracted region to use the
   // arguments (or appropriate addressing into struct) instead.
@@ -322,7 +322,7 @@
 
   // Set names for input and output arguments.
   if (!AggregateArgs) {
-    AI = newFunction->abegin();
+    AI = newFunction->arg_begin();
     for (unsigned i = 0, e = inputs.size(); i != e; ++i, ++AI)
       AI->setName(inputs[i]->getName());
     for (unsigned i = 0, e = outputs.size(); i != e; ++i, ++AI)
@@ -406,7 +406,7 @@
                                 NumExitBlocks > 1 ? "targetBlock" : "");
   codeReplacer->getInstList().push_back(call);
 
-  Function::aiterator OutputArgBegin = newFunction->abegin();
+  Function::arg_iterator OutputArgBegin = newFunction->arg_begin();
   unsigned FirstOut = inputs.size();
   if (!AggregateArgs)
     std::advance(OutputArgBegin, inputs.size());
@@ -483,7 +483,7 @@
                              OldTarget);
 
           // Restore values just before we exit
-          Function::aiterator OAI = OutputArgBegin;
+          Function::arg_iterator OAI = OutputArgBegin;
           for (unsigned out = 0, e = outputs.size(); out != e; ++out) {
             // For an invoke, the normal destination is the only one that is
             // dominated by the result of the invocation


Index: llvm/lib/Transforms/Utils/InlineFunction.cpp
diff -u llvm/lib/Transforms/Utils/InlineFunction.cpp:1.29 llvm/lib/Transforms/Utils/InlineFunction.cpp:1.30
--- llvm/lib/Transforms/Utils/InlineFunction.cpp:1.29	Sat Dec 11 10:59:54 2004
+++ llvm/lib/Transforms/Utils/InlineFunction.cpp	Mon Mar 14 22:54:21 2005
@@ -60,13 +60,13 @@
   { // Scope to destroy ValueMap after cloning.
     // Calculate the vector of arguments to pass into the function cloner...
     std::map<const Value*, Value*> ValueMap;
-    assert(std::distance(CalledFunc->abegin(), CalledFunc->aend()) == 
+    assert(std::distance(CalledFunc->arg_begin(), CalledFunc->arg_end()) == 
            std::distance(CS.arg_begin(), CS.arg_end()) &&
            "No varargs calls can be inlined!");
     
     CallSite::arg_iterator AI = CS.arg_begin();
-    for (Function::const_aiterator I = CalledFunc->abegin(),
-           E = CalledFunc->aend(); I != E; ++I, ++AI)
+    for (Function::const_arg_iterator I = CalledFunc->arg_begin(),
+           E = CalledFunc->arg_end(); I != E; ++I, ++AI)
       ValueMap[I] = *AI;
     
     // Clone the entire body of the callee into the caller.  






More information about the llvm-commits mailing list