summaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-15 04:54:21 +0000
committerChris Lattner <sabre@nondot.org>2005-03-15 04:54:21 +0000
commite4d5c441e04bdc00ccf1804744af670655123b07 (patch)
treebe1bff1314e39651d7120d2d887b79b10dc2f24d /lib/Transforms
parent89cc2656ba070434dceeabe95cba0a95b988325b (diff)
downloadllvm-e4d5c441e04bdc00ccf1804744af670655123b07.tar.gz
llvm-e4d5c441e04bdc00ccf1804744af670655123b07.tar.bz2
llvm-e4d5c441e04bdc00ccf1804744af670655123b07.tar.xz
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
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/ArgumentPromotion.cpp14
-rw-r--r--lib/Transforms/IPO/ConstantMerge.cpp2
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp16
-rw-r--r--lib/Transforms/IPO/ExtractFunction.cpp2
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp4
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp4
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp8
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp8
-rw-r--r--lib/Transforms/IPO/InlineSimple.cpp2
-rw-r--r--lib/Transforms/IPO/Internalize.cpp2
-rw-r--r--lib/Transforms/IPO/StripSymbols.cpp2
-rw-r--r--lib/Transforms/Instrumentation/ProfilingUtils.cpp8
-rw-r--r--lib/Transforms/Instrumentation/TraceValues.cpp2
-rw-r--r--lib/Transforms/Scalar/CorrelatedExprs.cpp2
-rw-r--r--lib/Transforms/Scalar/GCSE.cpp2
-rw-r--r--lib/Transforms/Scalar/Reassociate.cpp2
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp10
-rw-r--r--lib/Transforms/Scalar/TailRecursionElimination.cpp4
-rw-r--r--lib/Transforms/Utils/CloneFunction.cpp8
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp8
-rw-r--r--lib/Transforms/Utils/CodeExtractor.cpp8
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp6
22 files changed, 62 insertions, 62 deletions
diff --git a/lib/Transforms/IPO/ArgumentPromotion.cpp b/lib/Transforms/IPO/ArgumentPromotion.cpp
index a582f3b018..87a8f02601 100644
--- a/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -106,7 +106,7 @@ bool ArgPromotion::PromoteArguments(CallGraphNode *CGN) {
// First check: see if there are any pointer arguments! If not, quick exit.
std::vector<Argument*> PointerArgs;
- 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()))
PointerArgs.push_back(I);
if (PointerArgs.empty()) return false;
@@ -163,7 +163,7 @@ static bool IsAlwaysValidPointer(Value *V) {
static bool AllCalleesPassInValidPointerForArgument(Argument *Arg) {
Function *Callee = Arg->getParent();
- unsigned ArgNo = std::distance(Callee->abegin(), Function::aiterator(Arg));
+ unsigned ArgNo = std::distance(Callee->arg_begin(), Function::arg_iterator(Arg));
// Look at all call sites of the function. At this pointer we know we only
// have direct callees.
@@ -347,7 +347,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
// what the new GEP/Load instructions we are inserting look like.
std::map<std::vector<Value*>, LoadInst*> OriginalLoads;
- 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 (!ArgsToPromote.count(I)) {
Params.push_back(I->getType());
} else if (I->use_empty()) {
@@ -411,7 +411,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Loop over the operands, inserting GEP and loads in the caller as
// appropriate.
CallSite::arg_iterator AI = CS.arg_begin();
- for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI)
+ for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI)
if (!ArgsToPromote.count(I))
Args.push_back(*AI); // Unmodified argument
else if (!I->use_empty()) {
@@ -470,7 +470,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Loop over the argument list, transfering uses of the old arguments over to
// the new arguments, also transfering over the names as well.
//
- for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin();
+ for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin();
I != E; ++I)
if (!ArgsToPromote.count(I)) {
// If this is an unmodified argument, move the name and users over to the
@@ -502,7 +502,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
std::vector<Value*> Operands(GEP->op_begin()+1, GEP->op_end());
unsigned ArgNo = 0;
- Function::aiterator TheArg = I2;
+ Function::arg_iterator TheArg = I2;
for (ScalarizeTable::iterator It = ArgIndices.begin();
*It != Operands; ++It, ++TheArg) {
assert(It != ArgIndices.end() && "GEP not handled??");
@@ -539,7 +539,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
// Notify the alias analysis implementation that we inserted a new argument.
if (ExtraArgHack)
- AA.copyValue(Constant::getNullValue(Type::IntTy), NF->abegin());
+ AA.copyValue(Constant::getNullValue(Type::IntTy), NF->arg_begin());
// Tell the alias analysis that the old function is about to disappear.
diff --git a/lib/Transforms/IPO/ConstantMerge.cpp b/lib/Transforms/IPO/ConstantMerge.cpp
index 27e1955ab2..0140228b63 100644
--- a/lib/Transforms/IPO/ConstantMerge.cpp
+++ b/lib/Transforms/IPO/ConstantMerge.cpp
@@ -56,7 +56,7 @@ bool ConstantMerge::runOnModule(Module &M) {
// because doing so may cause initializers of other globals to be rewritten,
// invalidating the Constant* pointers in CMap.
//
- for (Module::giterator GV = M.gbegin(), E = M.gend(); GV != E; ++GV)
+ for (Module::global_iterator GV = M.global_begin(), E = M.global_end(); GV != E; ++GV)
// Only process constants with initializers
if (GV->isConstant() && GV->hasInitializer()) {
Constant *Init = GV->getInitializer();
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index e4b7a3ee61..e226dc3311 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -210,7 +210,7 @@ void DAE::SurveyFunction(Function &F) {
if (FunctionIntrinsicallyLive) {
DEBUG(std::cerr << " Intrinsically live fn: " << F.getName() << "\n");
- 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)
LiveArguments.insert(AI);
LiveRetVal.insert(&F);
return;
@@ -230,7 +230,7 @@ void DAE::SurveyFunction(Function &F) {
// if there are any arguments we assume that are dead.
//
bool AnyMaybeLiveArgs = false;
- 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)
switch (getArgumentLiveness(*AI)) {
case Live:
DEBUG(std::cerr << " Arg live by use: " << AI->getName() << "\n");
@@ -284,7 +284,7 @@ bool DAE::isMaybeLiveArgumentNowLive(Argument *Arg) {
// Loop over all of the arguments (because Arg may be passed into the call
// multiple times) and check to see if any are now alive...
CallSite::arg_iterator CSAI = CS.arg_begin();
- for (Function::aiterator AI = Callee->abegin(), E = Callee->aend();
+ for (Function::arg_iterator AI = Callee->arg_begin(), E = Callee->arg_end();
AI != E; ++AI, ++CSAI)
// If this is the argument we are looking for, check to see if it's alive
if (*CSAI == Arg && LiveArguments.count(AI))
@@ -309,7 +309,7 @@ void DAE::MarkArgumentLive(Argument *Arg) {
// passed in to provide a value for this argument live as necessary.
//
Function *Fn = Arg->getParent();
- unsigned ArgNo = std::distance(Fn->abegin(), Function::aiterator(Arg));
+ unsigned ArgNo = std::distance(Fn->arg_begin(), Function::arg_iterator(Arg));
std::multimap<Function*, CallSite>::iterator I = CallSites.lower_bound(Fn);
for (; I != CallSites.end() && I->first == Fn; ++I) {
@@ -373,7 +373,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
const FunctionType *FTy = F->getFunctionType();
std::vector<const Type*> Params;
- 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 (!DeadArguments.count(I))
Params.push_back(I->getType());
@@ -410,7 +410,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
// Loop over the operands, deleting dead ones...
CallSite::arg_iterator AI = CS.arg_begin();
- for (Function::aiterator I = F->abegin(), E = F->aend(); I != E; ++I, ++AI)
+ for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(); I != E; ++I, ++AI)
if (!DeadArguments.count(I)) // Remove operands for dead arguments
Args.push_back(*AI);
@@ -455,7 +455,7 @@ void DAE::RemoveDeadArgumentsFromFunction(Function *F) {
// the new arguments, also transfering over the names as well. While we're at
// it, remove the dead arguments from the DeadArguments list.
//
- for (Function::aiterator I = F->abegin(), E = F->aend(), I2 = NF->abegin();
+ for (Function::arg_iterator I = F->arg_begin(), E = F->arg_end(), I2 = NF->arg_begin();
I != E; ++I)
if (!DeadArguments.count(I)) {
// If this is a live argument, move the name and users over to the new
@@ -519,7 +519,7 @@ bool DAE::runOnModule(Module &M) {
// live, then the return value of the called instruction is now live.
//
CallSite::arg_iterator AI = CS.arg_begin(); // ActualIterator
- for (Function::aiterator FI = Callee->abegin(), E = Callee->aend();
+ for (Function::arg_iterator FI = Callee->arg_begin(), E = Callee->arg_end();
FI != E; ++AI, ++FI) {
// If this argument is another call...
CallSite ArgCS = CallSite::get(*AI);
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index 1b92fd1df8..482964e86f 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -52,7 +52,7 @@ namespace {
Named->setLinkage(GlobalValue::ExternalLinkage);
// Mark all global variables internal
- 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()) {
I->setInitializer(0); // Make all variables external
I->setLinkage(GlobalValue::ExternalLinkage);
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 090755b25c..dba44a0dc1 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -311,7 +311,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
Globals[F->getName()].push_back(F);
}
- for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
+ for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ) {
GlobalVariable *GV = I++;
if (GV->use_empty() && GV->isExternal()) {
M.getGlobalList().erase(GV);
@@ -343,7 +343,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
++I;
}
- for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; )
+ for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; )
if (I->isExternal() && I->use_empty()) {
GlobalVariable *GV = I;
++I;
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index cdf994aeb4..b7fa5dc7b9 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -60,7 +60,7 @@ bool GlobalDCE::runOnModule(Module &M) {
GlobalIsNeeded(I);
}
- 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) {
Changed |= RemoveUnusedGlobalValue(*I);
// Externally visible & appending globals are needed, if they have an
// initializer.
@@ -76,7 +76,7 @@ bool GlobalDCE::runOnModule(Module &M) {
// The first pass is to drop initializers of global variables which are dead.
std::vector<GlobalVariable*> DeadGlobalVars; // Keep track of dead globals
- 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 (!AliveGlobals.count(I)) {
DeadGlobalVars.push_back(I); // Keep track of dead globals
I->setInitializer(0);
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 754adc3949..7b6f649a0a 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -51,7 +51,7 @@ namespace {
bool runOnModule(Module &M);
private:
- bool ProcessInternalGlobal(GlobalVariable *GV, Module::giterator &GVI);
+ bool ProcessInternalGlobal(GlobalVariable *GV, Module::global_iterator &GVI);
};
RegisterOpt<GlobalOpt> X("globalopt", "Global Variable Optimizer");
@@ -792,7 +792,7 @@ static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V,
// OptimizeOnceStoredGlobal - Try to optimize globals based on the knowledge
// that only one value (besides its initializer) is ever stored to the global.
static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal,
- Module::giterator &GVI, TargetData &TD) {
+ Module::global_iterator &GVI, TargetData &TD) {
if (CastInst *CI = dyn_cast<CastInst>(StoredOnceVal))
StoredOnceVal = CI->getOperand(0);
else if (GetElementPtrInst *GEPI =dyn_cast<GetElementPtrInst>(StoredOnceVal)){
@@ -915,7 +915,7 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) {
/// ProcessInternalGlobal - Analyze the specified global variable and optimize
/// it if possible. If we make a change, return true.
bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
- Module::giterator &GVI) {
+ Module::global_iterator &GVI) {
std::set<PHINode*> PHIUsers;
GlobalStatus GS;
PHIUsers.clear();
@@ -1063,7 +1063,7 @@ bool GlobalOpt::runOnModule(Module &M) {
LocalChange = true;
while (LocalChange) {
LocalChange = false;
- for (Module::giterator GVI = M.gbegin(), E = M.gend(); GVI != E;) {
+ for (Module::global_iterator GVI = M.global_begin(), E = M.global_end(); GVI != E;) {
GlobalVariable *GV = GVI++;
if (!GV->isConstant() && GV->hasInternalLinkage() &&
GV->hasInitializer())
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index 65d507798b..16839edff7 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -69,10 +69,10 @@ bool IPCP::runOnModule(Module &M) {
/// constant in for an argument, propagate that constant in as the argument.
///
bool IPCP::PropagateConstantsIntoArguments(Function &F) {
- if (F.aempty() || F.use_empty()) return false; // No arguments? Early exit.
+ if (F.arg_empty() || F.use_empty()) return false; // No arguments? Early exit.
std::vector<std::pair<Constant*, bool> > ArgumentConstants;
- ArgumentConstants.resize(F.asize());
+ ArgumentConstants.resize(F.arg_size());
unsigned NumNonconstant = 0;
@@ -87,7 +87,7 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {
// Check out all of the potentially constant arguments
CallSite::arg_iterator AI = CS.arg_begin();
- Function::aiterator Arg = F.abegin();
+ Function::arg_iterator Arg = F.arg_begin();
for (unsigned i = 0, e = ArgumentConstants.size(); i != e;
++i, ++AI, ++Arg) {
if (*AI == &F) return false; // Passes the function into itself
@@ -115,7 +115,7 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {
// If we got to this point, there is a constant argument!
assert(NumNonconstant != ArgumentConstants.size());
- Function::aiterator AI = F.abegin();
+ Function::arg_iterator AI = F.arg_begin();
bool MadeChange = false;
for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI)
// Do we have a constant argument!?
diff --git a/lib/Transforms/IPO/InlineSimple.cpp b/lib/Transforms/IPO/InlineSimple.cpp
index 5916f10402..4355c6c4a1 100644
--- a/lib/Transforms/IPO/InlineSimple.cpp
+++ b/lib/Transforms/IPO/InlineSimple.cpp
@@ -167,7 +167,7 @@ void FunctionInfo::analyzeFunction(Function *F) {
// Check out all of the arguments to the function, figuring out how much
// code can be eliminated if one of the arguments is a constant.
- 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)
ArgumentWeights.push_back(ArgInfo(CountCodeReductionForConstant(I),
CountCodeReductionForAlloca(I)));
}
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index 5e436aa215..5a254fa687 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -93,7 +93,7 @@ namespace {
}
// Mark all global variables with initializers as internal as well...
- 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() && !I->hasInternalLinkage() &&
!ExternalNames.count(I->getName())) {
// Special case handling of the global ctor and dtor list. When we
diff --git a/lib/Transforms/IPO/StripSymbols.cpp b/lib/Transforms/IPO/StripSymbols.cpp
index 03ea55b414..80fe394f61 100644
--- a/lib/Transforms/IPO/StripSymbols.cpp
+++ b/lib/Transforms/IPO/StripSymbols.cpp
@@ -75,7 +75,7 @@ bool StripSymbols::runOnModule(Module &M) {
// If we're not just stripping debug info, strip all symbols from the
// functions and the names from any internal globals.
if (!OnlyDebugInfo) {
- 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())
I->setName(""); // Internal symbols can't participate in linkage
diff --git a/lib/Transforms/Instrumentation/ProfilingUtils.cpp b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
index 1c0c4ada32..5ce0142716 100644
--- a/lib/Transforms/Instrumentation/ProfilingUtils.cpp
+++ b/lib/Transforms/Instrumentation/ProfilingUtils.cpp
@@ -55,11 +55,11 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
Instruction *InitCall = new CallInst(InitFn, Args, "newargc", InsertPos);
// If argc or argv are not available in main, just pass null values in.
- Function::aiterator AI;
- switch (MainFn->asize()) {
+ Function::arg_iterator AI;
+ switch (MainFn->arg_size()) {
default:
case 2:
- AI = MainFn->abegin(); ++AI;
+ AI = MainFn->arg_begin(); ++AI;
if (AI->getType() != ArgVTy) {
InitCall->setOperand(2, new CastInst(AI, ArgVTy, "argv.cast", InitCall));
} else {
@@ -67,7 +67,7 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName,
}
case 1:
- AI = MainFn->abegin();
+ AI = MainFn->arg_begin();
// If the program looked at argc, have it look at the return value of the
// init call instead.
if (AI->getType() != Type::IntTy) {
diff --git a/lib/Transforms/Instrumentation/TraceValues.cpp b/lib/Transforms/Instrumentation/TraceValues.cpp
index f645f1b451..5be8637a20 100644
--- a/lib/Transforms/Instrumentation/TraceValues.cpp
+++ b/lib/Transforms/Instrumentation/TraceValues.cpp
@@ -367,7 +367,7 @@ static inline void InsertCodeToShowFunctionEntry(Function &F, Function *Printf,
// Now print all the incoming arguments
unsigned ArgNo = 0;
- for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++ArgNo){
+ for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++ArgNo){
InsertVerbosePrintInst(I, &BB, InsertPos,
" Arg #" + utostr(ArgNo) + ": ", Printf,
HashPtrToSeqNum);
diff --git a/lib/Transforms/Scalar/CorrelatedExprs.cpp b/lib/Transforms/Scalar/CorrelatedExprs.cpp
index 6f11506794..da8c500e21 100644
--- a/lib/Transforms/Scalar/CorrelatedExprs.cpp
+++ b/lib/Transforms/Scalar/CorrelatedExprs.cpp
@@ -757,7 +757,7 @@ void CEE::BuildRankMap(Function &F) {
unsigned Rank = 1; // Skip rank zero.
// Number the 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)
RankMap[I] = Rank++;
// Number the instructions in reverse post order...
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp
index 533a9e8b23..dbabe2686b 100644
--- a/lib/Transforms/Scalar/GCSE.cpp
+++ b/lib/Transforms/Scalar/GCSE.cpp
@@ -73,7 +73,7 @@ bool GCSE::runOnFunction(Function &F) {
// Check for value numbers of arguments. If the value numbering
// implementation can prove that an incoming argument is a constant or global
// value address, substitute it, making the argument dead.
- 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 (!AI->use_empty()) {
VN.getEqualNumberNodes(AI, EqualValues);
if (!EqualValues.empty()) {
diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp
index c74cf51ccc..1972b9d5c3 100644
--- a/lib/Transforms/Scalar/Reassociate.cpp
+++ b/lib/Transforms/Scalar/Reassociate.cpp
@@ -66,7 +66,7 @@ void Reassociate::BuildRankMap(Function &F) {
unsigned i = 2;
// Assign distinct ranks to function 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)
ValueRankMap[I] = ++i;
ReversePostOrderTraversal<Function*> RPOT(&F);
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index c769b54991..cc05412843 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -865,7 +865,7 @@ void SCCPSolver::visitCallSite(CallSite CS) {
MarkBlockExecutable(F->begin());
CallSite::arg_iterator CAI = CS.arg_begin();
- for (Function::aiterator AI = F->abegin(), E = F->aend();
+ for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
AI != E; ++AI, ++CAI) {
LatticeVal &IV = ValueState[AI];
if (!IV.isOverdefined())
@@ -1044,7 +1044,7 @@ bool SCCP::runOnFunction(Function &F) {
// Mark all arguments to the function as being overdefined.
hash_map<Value*, LatticeVal> &Values = Solver.getValueMapping();
- 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)
Values[AI].markOverdefined();
// Solve for constants.
@@ -1173,7 +1173,7 @@ bool IPSCCP::runOnModule(Module &M) {
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
if (!F->isExternal())
Solver.MarkBlockExecutable(F->begin());
- 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)
Values[AI].markOverdefined();
} else {
Solver.AddTrackedFunction(F);
@@ -1182,7 +1182,7 @@ bool IPSCCP::runOnModule(Module &M) {
// Loop over global variables. We inform the solver about any internal global
// variables that do not have their 'addresses taken'. If they don't have
// their addresses taken, we can propagate constants through them.
- for (Module::giterator G = M.gbegin(), E = M.gend(); G != E; ++G)
+ for (Module::global_iterator G = M.global_begin(), E = M.global_end(); G != E; ++G)
if (!G->isConstant() && G->hasInternalLinkage() && !AddressIsTaken(G))
Solver.TrackValueOfGlobalVariable(G);
@@ -1204,7 +1204,7 @@ bool IPSCCP::runOnModule(Module &M) {
//
std::set<BasicBlock*> &ExecutableBBs = Solver.getExecutableBlocks();
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++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 (!AI->use_empty()) {
LatticeVal &IV = Values[AI];
if (IV.isConstant() || IV.isUndefined()) {
diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp
index 758628ca64..bf098eb59b 100644
--- a/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -161,7 +161,7 @@ static bool isDynamicConstant(Value *V, CallInst *CI) {
// Figure out which argument number this is...
unsigned ArgNo = 0;
Function *F = CI->getParent()->getParent();
- for (Function::aiterator AI = F->abegin(); &*AI != Arg; ++AI)
+ for (Function::arg_iterator AI = F->arg_begin(); &*AI != Arg; ++AI)
++ArgNo;
// If we are passing this argument into call as the corresponding
@@ -298,7 +298,7 @@ bool TailCallElim::ProcessReturningBlock(ReturnInst *Ret, BasicBlock *&OldEntry,
// For now, we initialize each PHI to only have the real arguments
// which are passed in.
Instruction *InsertPos = OldEntry->begin();
- 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) {
PHINode *PN = new PHINode(I->getType(), I->getName()+".tr", InsertPos);
I->replaceAllUsesWith(PN); // Everyone use the PHI node now!
PN->addIncoming(I, NewEntry);
diff --git a/lib/Transforms/Utils/CloneFunction.cpp b/lib/Transforms/Utils/CloneFunction.cpp
index 9bd8bf135f..6440851b9d 100644
--- a/lib/Transforms/Utils/CloneFunction.cpp
+++ b/lib/Transforms/Utils/CloneFunction.cpp
@@ -49,7 +49,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc,
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 @@ Function *llvm::CloneFunction(const Function *F,
// 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 *llvm::CloneFunction(const Function *F,
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
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index d98848aa7c..66e005e82c 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -47,7 +47,7 @@ Module *llvm::CloneModule(const Module *M) {
// 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 @@ Module *llvm::CloneModule(const Module *M) {
// 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 @@ Module *llvm::CloneModule(const Module *M) {
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++;
}
diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp
index 5a04001005..cf9cafb04a 100644
--- a/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/lib/Transforms/Utils/CodeExtractor.cpp
@@ -295,7 +295,7 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
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 @@ Function *CodeExtractor::constructFunction(const Values &inputs,
// 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 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
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 @@ emitCallAndSwitchStatement(Function *newFunction, BasicBlock *codeReplacer,
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
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 1384022be7..6bfdda230e 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -60,13 +60,13 @@ bool llvm::InlineFunction(CallSite CS) {
{ // 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.