summaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/IPO')
-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
11 files changed, 32 insertions, 32 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