forked from OSchip/llvm-project
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! llvm-svn: 20597
This commit is contained in:
parent
5ce25cdc6d
commit
531f9e92d4
|
@ -102,7 +102,7 @@ bool AAEval::runOnFunction(Function &F) {
|
|||
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);
|
||||
|
||||
|
|
|
@ -1270,7 +1270,7 @@ static bool PathExistsToClonedNode(const DSCallSite &CS,
|
|||
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 @@ void DSGraph::mergeInGraph(const DSCallSite &CS, Function &F,
|
|||
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 @@ void DSGraph::markIncompleteNodes(unsigned Flags) {
|
|||
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 @@ void DSGraph::AssertGraphOK() const {
|
|||
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!");
|
||||
|
|
|
@ -59,7 +59,7 @@ bool DSOpt::OptimizeGlobals(Module &M) {
|
|||
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;
|
||||
|
|
|
@ -215,7 +215,7 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
|
|||
// 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 @@ void EquivClassGraphs::buildIndirectFunctionSets(Module &M) {
|
|||
|
||||
// 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()))
|
||||
|
|
|
@ -82,7 +82,7 @@ namespace {
|
|||
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 @@ bool LocalDataStructures::runOnModule(Module &M) {
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ void Steens::ResolveFunctionCall(Function *F, const DSCallSite &Call,
|
|||
|
||||
// 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...
|
||||
|
|
|
@ -433,7 +433,7 @@ void Andersens::IdentifyObjects(Module &M) {
|
|||
++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 @@ void Andersens::IdentifyObjects(Module &M) {
|
|||
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::AddGlobalInitializerConstraints(Node *N, Constant *C) {
|
|||
}
|
||||
|
||||
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 @@ void Andersens::CollectConstraints(Module &M) {
|
|||
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 @@ void Andersens::CollectConstraints(Module &M) {
|
|||
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 @@ void Andersens::CollectConstraints(Module &M) {
|
|||
|
||||
// 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 @@ void Andersens::AddConstraintsForCall(CallSite CS, Function *F) {
|
|||
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())) {
|
||||
|
|
|
@ -62,7 +62,7 @@ bool FindUsedTypes::runOnModule(Module &m) {
|
|||
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());
|
||||
|
|
|
@ -159,7 +159,7 @@ void GlobalsModRef::AnalyzeGlobals(Module &M) {
|
|||
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
|
||||
|
|
|
@ -759,7 +759,7 @@ Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
|
|||
// Check to see if they called va_start but not va_arg..
|
||||
if (!ObsoleteVarArgs)
|
||||
if (Function *F = Result->getNamedFunction("llvm.va_start"))
|
||||
if (F->asize() == 1) {
|
||||
if (F->arg_size() == 1) {
|
||||
std::cerr << "WARNING: this file uses obsolete features. "
|
||||
<< "Assemble and disassemble to update it.\n";
|
||||
ObsoleteVarArgs = true;
|
||||
|
@ -769,7 +769,7 @@ Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
|
|||
// If the user is making use of obsolete varargs intrinsics, adjust them for
|
||||
// the user.
|
||||
if (Function *F = Result->getNamedFunction("llvm.va_start")) {
|
||||
assert(F->asize() == 1 && "Obsolete va_start takes 1 argument!");
|
||||
assert(F->arg_size() == 1 && "Obsolete va_start takes 1 argument!");
|
||||
|
||||
const Type *RetTy = F->getFunctionType()->getParamType(0);
|
||||
RetTy = cast<PointerType>(RetTy)->getElementType();
|
||||
|
@ -785,7 +785,7 @@ Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
|
|||
}
|
||||
|
||||
if (Function *F = Result->getNamedFunction("llvm.va_end")) {
|
||||
assert(F->asize() == 1 && "Obsolete va_end takes 1 argument!");
|
||||
assert(F->arg_size() == 1 && "Obsolete va_end takes 1 argument!");
|
||||
const Type *ArgTy = F->getFunctionType()->getParamType(0);
|
||||
ArgTy = cast<PointerType>(ArgTy)->getElementType();
|
||||
Function *NF = Result->getOrInsertFunction("llvm.va_end", Type::VoidTy,
|
||||
|
@ -801,7 +801,7 @@ Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) {
|
|||
}
|
||||
|
||||
if (Function *F = Result->getNamedFunction("llvm.va_copy")) {
|
||||
assert(F->asize() == 2 && "Obsolete va_copy takes 2 argument!");
|
||||
assert(F->arg_size() == 2 && "Obsolete va_copy takes 2 argument!");
|
||||
const Type *ArgTy = F->getFunctionType()->getParamType(0);
|
||||
ArgTy = cast<PointerType>(ArgTy)->getElementType();
|
||||
Function *NF = Result->getOrInsertFunction("llvm.va_copy", ArgTy,
|
||||
|
@ -1623,7 +1623,7 @@ FunctionHeaderH : TypesV Name '(' ArgList ')' {
|
|||
|
||||
// Make sure to strip off any argument names so we can't get conflicts.
|
||||
if (Fn->isExternal())
|
||||
for (Function::aiterator AI = Fn->abegin(), AE = Fn->aend();
|
||||
for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end();
|
||||
AI != AE; ++AI)
|
||||
AI->setName("");
|
||||
|
||||
|
@ -1643,7 +1643,7 @@ FunctionHeaderH : TypesV Name '(' ArgList ')' {
|
|||
delete $4->back().first;
|
||||
$4->pop_back(); // Delete the last entry
|
||||
}
|
||||
Function::aiterator ArgIt = Fn->abegin();
|
||||
Function::arg_iterator ArgIt = Fn->arg_begin();
|
||||
for (std::vector<std::pair<PATypeHolder*, char*> >::iterator I =$4->begin();
|
||||
I != $4->end(); ++I, ++ArgIt) {
|
||||
delete I->first; // Delete the typeholder...
|
||||
|
|
|
@ -536,7 +536,7 @@ unsigned BytecodeReader::insertValue(Value *Val, unsigned type,
|
|||
/// Insert the arguments of a function as new values in the reader.
|
||||
void BytecodeReader::insertArguments(Function* F) {
|
||||
const FunctionType *FT = F->getFunctionType();
|
||||
Function::aiterator AI = F->abegin();
|
||||
Function::arg_iterator AI = F->arg_begin();
|
||||
for (FunctionType::param_iterator It = FT->param_begin();
|
||||
It != FT->param_end(); ++It, ++AI)
|
||||
insertValue(AI, getTypeSlot(AI->getType()), FunctionValues);
|
||||
|
|
|
@ -171,7 +171,7 @@ static ModuleProvider *CheckVarargs(ModuleProvider *MP) {
|
|||
// If the user is making use of obsolete varargs intrinsics, adjust them for
|
||||
// the user.
|
||||
if (Function *F = M->getNamedFunction("llvm.va_start")) {
|
||||
assert(F->asize() == 1 && "Obsolete va_start takes 1 argument!");
|
||||
assert(F->arg_size() == 1 && "Obsolete va_start takes 1 argument!");
|
||||
|
||||
const Type *RetTy = F->getFunctionType()->getParamType(0);
|
||||
RetTy = cast<PointerType>(RetTy)->getElementType();
|
||||
|
@ -187,7 +187,7 @@ static ModuleProvider *CheckVarargs(ModuleProvider *MP) {
|
|||
}
|
||||
|
||||
if (Function *F = M->getNamedFunction("llvm.va_end")) {
|
||||
assert(F->asize() == 1 && "Obsolete va_end takes 1 argument!");
|
||||
assert(F->arg_size() == 1 && "Obsolete va_end takes 1 argument!");
|
||||
const Type *ArgTy = F->getFunctionType()->getParamType(0);
|
||||
ArgTy = cast<PointerType>(ArgTy)->getElementType();
|
||||
Function *NF = M->getOrInsertFunction("llvm.va_end", Type::VoidTy,
|
||||
|
@ -203,7 +203,7 @@ static ModuleProvider *CheckVarargs(ModuleProvider *MP) {
|
|||
}
|
||||
|
||||
if (Function *F = M->getNamedFunction("llvm.va_copy")) {
|
||||
assert(F->asize() == 2 && "Obsolete va_copy takes 2 argument!");
|
||||
assert(F->arg_size() == 2 && "Obsolete va_copy takes 2 argument!");
|
||||
const Type *ArgTy = F->getFunctionType()->getParamType(0);
|
||||
ArgTy = cast<PointerType>(ArgTy)->getElementType();
|
||||
Function *NF = M->getOrInsertFunction("llvm.va_copy", ArgTy,
|
||||
|
@ -330,7 +330,7 @@ bool llvm::GetBytecodeDependentLibraries(const std::string &fname,
|
|||
|
||||
static void getSymbols(Module*M, std::vector<std::string>& symbols) {
|
||||
// Loop over global variables
|
||||
for (Module::giterator GI = M->gbegin(), GE=M->gend(); GI != GE; ++GI)
|
||||
for (Module::global_iterator GI = M->global_begin(), GE=M->global_end(); GI != GE; ++GI)
|
||||
if (!GI->isExternal() && !GI->hasInternalLinkage())
|
||||
if (!GI->getName().empty())
|
||||
symbols.push_back(GI->getName());
|
||||
|
|
|
@ -121,7 +121,7 @@ void SlotCalculator::processModule() {
|
|||
|
||||
// Add all of the global variables to the value table...
|
||||
//
|
||||
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
||||
for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end();
|
||||
I != E; ++I)
|
||||
getOrCreateSlot(I);
|
||||
|
||||
|
@ -134,7 +134,7 @@ void SlotCalculator::processModule() {
|
|||
|
||||
// Add all of the module level constants used as initializers
|
||||
//
|
||||
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
||||
for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end();
|
||||
I != E; ++I)
|
||||
if (I->hasInitializer())
|
||||
getOrCreateSlot(I->getInitializer());
|
||||
|
@ -285,7 +285,7 @@ void SlotCalculator::incorporateFunction(const Function *F) {
|
|||
ModuleTypeLevel = Types.size();
|
||||
|
||||
// Iterate over function arguments, adding them to the value table...
|
||||
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)
|
||||
getOrCreateSlot(I);
|
||||
|
||||
if ( !ModuleContainsAllFunctionConstants ) {
|
||||
|
@ -461,7 +461,7 @@ void SlotCalculator::buildCompactionTable(const Function *F) {
|
|||
}
|
||||
|
||||
// Next, include any types used by function arguments.
|
||||
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)
|
||||
getOrCreateCompactionTableSlot(I->getType());
|
||||
|
||||
// Next, find all of the types and values that are referred to by the
|
||||
|
|
|
@ -894,7 +894,7 @@ void BytecodeWriter::outputModuleInfoBlock(const Module *M) {
|
|||
BytecodeBlock ModuleInfoBlock(BytecodeFormat::ModuleGlobalInfoBlockID, *this);
|
||||
|
||||
// Output the types for the global variables in the module...
|
||||
for (Module::const_giterator I = M->gbegin(), End = M->gend(); I != End;++I) {
|
||||
for (Module::const_global_iterator I = M->global_begin(), End = M->global_end(); I != End;++I) {
|
||||
int Slot = Table.getSlot(I->getType());
|
||||
assert(Slot != -1 && "Module global vars is broken!");
|
||||
|
||||
|
|
|
@ -87,28 +87,28 @@ void DefaultIntrinsicLowering::AddPrototypes(Module &M) {
|
|||
switch (I->getIntrinsicID()) {
|
||||
default: break;
|
||||
case Intrinsic::setjmp:
|
||||
EnsureFunctionExists(M, "setjmp", I->abegin(), I->aend(), Type::IntTy);
|
||||
EnsureFunctionExists(M, "setjmp", I->arg_begin(), I->arg_end(), Type::IntTy);
|
||||
break;
|
||||
case Intrinsic::longjmp:
|
||||
EnsureFunctionExists(M, "longjmp", I->abegin(), I->aend(),Type::VoidTy);
|
||||
EnsureFunctionExists(M, "longjmp", I->arg_begin(), I->arg_end(),Type::VoidTy);
|
||||
break;
|
||||
case Intrinsic::siglongjmp:
|
||||
EnsureFunctionExists(M, "abort", I->aend(), I->aend(), Type::VoidTy);
|
||||
EnsureFunctionExists(M, "abort", I->arg_end(), I->arg_end(), Type::VoidTy);
|
||||
break;
|
||||
case Intrinsic::memcpy:
|
||||
EnsureFunctionExists(M, "memcpy", I->abegin(), --I->aend(),
|
||||
I->abegin()->getType());
|
||||
EnsureFunctionExists(M, "memcpy", I->arg_begin(), --I->arg_end(),
|
||||
I->arg_begin()->getType());
|
||||
break;
|
||||
case Intrinsic::memmove:
|
||||
EnsureFunctionExists(M, "memmove", I->abegin(), --I->aend(),
|
||||
I->abegin()->getType());
|
||||
EnsureFunctionExists(M, "memmove", I->arg_begin(), --I->arg_end(),
|
||||
I->arg_begin()->getType());
|
||||
break;
|
||||
case Intrinsic::memset:
|
||||
EnsureFunctionExists(M, "memset", I->abegin(), --I->aend(),
|
||||
I->abegin()->getType());
|
||||
EnsureFunctionExists(M, "memset", I->arg_begin(), --I->arg_end(),
|
||||
I->arg_begin()->getType());
|
||||
break;
|
||||
case Intrinsic::isunordered:
|
||||
EnsureFunctionExists(M, "isunordered", I->abegin(), I->aend(), Type::BoolTy);
|
||||
EnsureFunctionExists(M, "isunordered", I->arg_begin(), I->arg_end(), Type::BoolTy);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli,
|
|||
// Initialize the mapping of values to registers. This is only set up for
|
||||
// instruction values that are used outside of the block that defines
|
||||
// them.
|
||||
for (Function::aiterator AI = Fn.abegin(), E = Fn.aend(); AI != E; ++AI)
|
||||
for (Function::arg_iterator AI = Fn.arg_begin(), E = Fn.arg_end(); AI != E; ++AI)
|
||||
InitializeRegForValue(AI);
|
||||
|
||||
Function::iterator BB = Fn.begin(), E = Fn.end();
|
||||
|
@ -881,7 +881,7 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL,
|
|||
// anything special.
|
||||
if (OldRoot != SDL.DAG.getRoot()) {
|
||||
unsigned a = 0;
|
||||
for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI,++a)
|
||||
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI,++a)
|
||||
if (!AI->use_empty()) {
|
||||
SDL.setValue(AI, Args[a]);
|
||||
SDOperand Copy =
|
||||
|
@ -892,7 +892,7 @@ LowerArguments(BasicBlock *BB, SelectionDAGLowering &SDL,
|
|||
// Otherwise, if any argument is only accessed in a single basic block,
|
||||
// emit that argument only to that basic block.
|
||||
unsigned a = 0;
|
||||
for (Function::aiterator AI = F.abegin(), E = F.aend(); AI != E; ++AI,++a)
|
||||
for (Function::arg_iterator AI = F.arg_begin(), E = F.arg_end(); AI != E; ++AI,++a)
|
||||
if (!AI->use_empty()) {
|
||||
if (BasicBlock *BBU = IsOnlyUsedInOneBasicBlock(AI)) {
|
||||
FuncInfo.BlockLocalArguments.insert(std::make_pair(BBU,
|
||||
|
|
|
@ -494,7 +494,7 @@ void ExecutionEngine::emitGlobals() {
|
|||
|
||||
// Loop over all of the global variables in the program, allocating the memory
|
||||
// to hold them.
|
||||
for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend();
|
||||
for (Module::const_global_iterator I = getModule().global_begin(), E = getModule().global_end();
|
||||
I != E; ++I)
|
||||
if (!I->isExternal()) {
|
||||
// Get the type of the global...
|
||||
|
@ -518,7 +518,7 @@ void ExecutionEngine::emitGlobals() {
|
|||
|
||||
// Now that all of the globals are set up in memory, loop through them all and
|
||||
// initialize their contents.
|
||||
for (Module::const_giterator I = getModule().gbegin(), E = getModule().gend();
|
||||
for (Module::const_global_iterator I = getModule().global_begin(), E = getModule().global_end();
|
||||
I != E; ++I)
|
||||
if (!I->isExternal())
|
||||
EmitGlobalVariable(I);
|
||||
|
|
|
@ -1065,13 +1065,13 @@ void Interpreter::callFunction(Function *F,
|
|||
StackFrame.CurInst = StackFrame.CurBB->begin();
|
||||
|
||||
// Run through the function arguments and initialize their values...
|
||||
assert((ArgVals.size() == F->asize() ||
|
||||
(ArgVals.size() > F->asize() && F->getFunctionType()->isVarArg())) &&
|
||||
assert((ArgVals.size() == F->arg_size() ||
|
||||
(ArgVals.size() > F->arg_size() && F->getFunctionType()->isVarArg())) &&
|
||||
"Invalid number of values passed to function invocation!");
|
||||
|
||||
// Handle non-varargs arguments...
|
||||
unsigned i = 0;
|
||||
for (Function::aiterator AI = F->abegin(), E = F->aend(); AI != E; ++AI, ++i)
|
||||
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end(); AI != E; ++AI, ++i)
|
||||
SetValue(AI, ArgVals[i], StackFrame);
|
||||
|
||||
// Handle varargs arguments...
|
||||
|
|
|
@ -33,7 +33,7 @@ GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
|
|||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||
DefinedSymbols.insert(I->getName());
|
||||
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->hasName() && !I->isExternal() && !I->hasInternalLinkage())
|
||||
DefinedSymbols.insert(I->getName());
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ GetAllUndefinedSymbols(Module *M, std::set<std::string> &UndefinedSymbols) {
|
|||
else if (!I->hasInternalLinkage())
|
||||
DefinedSymbols.insert(I->getName());
|
||||
}
|
||||
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->hasName()) {
|
||||
if (I->isExternal())
|
||||
UndefinedSymbols.insert(I->getName());
|
||||
|
|
|
@ -425,7 +425,7 @@ static bool LinkGlobals(Module *Dest, Module *Src,
|
|||
SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable();
|
||||
|
||||
// Loop over all of the globals in the src module, mapping them over as we go
|
||||
for (Module::giterator I = Src->gbegin(), E = Src->gend(); I != E; ++I) {
|
||||
for (Module::global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I) {
|
||||
GlobalVariable *SGV = I;
|
||||
GlobalVariable *DGV = 0;
|
||||
// Check to see if may have to link the global.
|
||||
|
@ -533,7 +533,7 @@ static bool LinkGlobalInits(Module *Dest, const Module *Src,
|
|||
std::string *Err) {
|
||||
|
||||
// Loop over all of the globals in the src module, mapping them over as we go
|
||||
for (Module::const_giterator I = Src->gbegin(), E = Src->gend(); I != E; ++I){
|
||||
for (Module::const_global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I){
|
||||
const GlobalVariable *SGV = I;
|
||||
|
||||
if (SGV->hasInitializer()) { // Only process initialized GV's
|
||||
|
@ -656,8 +656,8 @@ static bool LinkFunctionBody(Function *Dest, Function *Src,
|
|||
assert(Src && Dest && Dest->isExternal() && !Src->isExternal());
|
||||
|
||||
// Go through and convert function arguments over, remembering the mapping.
|
||||
Function::aiterator DI = Dest->abegin();
|
||||
for (Function::aiterator I = Src->abegin(), E = Src->aend();
|
||||
Function::arg_iterator DI = Dest->arg_begin();
|
||||
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end();
|
||||
I != E; ++I, ++DI) {
|
||||
DI->setName(I->getName()); // Copy the name information over...
|
||||
|
||||
|
@ -681,7 +681,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src,
|
|||
*OI = RemapOperand(*OI, GlobalMap);
|
||||
|
||||
// There is no need to map the arguments anymore.
|
||||
for (Function::aiterator I = Src->abegin(), E = Src->aend(); I != E; ++I)
|
||||
for (Function::arg_iterator I = Src->arg_begin(), E = Src->arg_end(); I != E; ++I)
|
||||
GlobalMap.erase(I);
|
||||
|
||||
return false;
|
||||
|
@ -854,7 +854,7 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
|
|||
// it's functionality here.
|
||||
std::map<std::string, GlobalValue*> GlobalsByName;
|
||||
|
||||
for (Module::giterator I = Dest->gbegin(), E = Dest->gend(); I != E; ++I) {
|
||||
for (Module::global_iterator I = Dest->global_begin(), E = Dest->global_end(); I != E; ++I) {
|
||||
// Add all of the appending globals already in the Dest module to
|
||||
// AppendingVars.
|
||||
if (I->hasAppendingLinkage())
|
||||
|
|
|
@ -241,7 +241,7 @@ bool AlphaAsmPrinter::doFinalization(Module &M) {
|
|||
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);
|
||||
|
|
|
@ -146,7 +146,7 @@ AlphaTargetLowering::LowerArguments(Function &F, SelectionDAG &DAG)
|
|||
|
||||
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) {
|
||||
|
|
|
@ -851,9 +851,9 @@ bool CWriter::doInitialization(Module &M) {
|
|||
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 @@ bool CWriter::doInitialization(Module &M) {
|
|||
}
|
||||
|
||||
// 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 @@ bool CWriter::doInitialization(Module &M) {
|
|||
}
|
||||
|
||||
// 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 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
|||
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 @@ void CWriter::visitCallInst(CallInst &I) {
|
|||
|
||||
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:
|
||||
|
|
|
@ -734,7 +734,7 @@ void PPC32ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||
|
||||
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
|
||||
|
|
|
@ -590,7 +590,7 @@ void PPC64ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||
|
||||
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
|
||||
|
|
|
@ -459,7 +459,7 @@ bool DarwinAsmPrinter::doFinalization(Module &M) {
|
|||
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 @@ bool AIXAsmPrinter::doInitialization(Module &M) {
|
|||
<< "\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 @@ bool AIXAsmPrinter::doInitialization(Module &M) {
|
|||
}
|
||||
|
||||
// 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::doInitialization(Module &M) {
|
|||
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;
|
||||
|
||||
|
|
|
@ -580,7 +580,7 @@ bool V8Printer::doFinalization(Module &M) {
|
|||
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);
|
||||
|
|
|
@ -335,7 +335,7 @@ void V8ISel::LoadArgumentsToVirtualRegs (Function *LF) {
|
|||
|
||||
// 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 @@ void V8ISel::LoadArgumentsToVirtualRegs (Function *LF) {
|
|||
}
|
||||
|
||||
// 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) {
|
||||
|
|
|
@ -52,7 +52,7 @@ bool InternalGlobalMapper::runOnModule(Module &M) {
|
|||
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)
|
||||
|
|
|
@ -150,7 +150,7 @@ void LiveRangeInfo::constructLiveRanges() {
|
|||
|
||||
// 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
|
||||
|
|
|
@ -317,7 +317,7 @@ void PhyRegAlloc::addInterferencesForArgs() {
|
|||
// 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 @@ void PhyRegAlloc::saveState () {
|
|||
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;
|
||||
|
|
|
@ -768,7 +768,7 @@ void SparcV9AsmPrinter::printGlobalVariable(const GlobalVariable* GV) {
|
|||
|
||||
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())
|
||||
|
|
|
@ -374,7 +374,7 @@ void SparcV9RegInfo::suggestRegs4MethodArgs(const Function *Meth,
|
|||
// 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 @@ void SparcV9RegInfo::colorMethodArgs(const Function *Meth,
|
|||
// 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);
|
||||
|
|
|
@ -123,7 +123,7 @@ bool X86SharedAsmPrinter::doFinalization(Module &M) {
|
|||
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);
|
||||
|
|
|
@ -117,7 +117,7 @@ X86TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
|
|||
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;
|
||||
|
|
|
@ -618,7 +618,7 @@ void X86ISel::LoadArgumentsToVirtualRegs(Function &Fn) {
|
|||
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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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!?
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -801,7 +801,7 @@ void AssemblyWriter::printModule(const Module *M) {
|
|||
// Loop over the symbol table, emitting all named constants.
|
||||
printSymbolTable(M->getSymbolTable());
|
||||
|
||||
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)
|
||||
printGlobal(I);
|
||||
|
||||
Out << "\nimplementation ; Functions:\n";
|
||||
|
@ -926,7 +926,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
|||
// Loop over the arguments, printing them...
|
||||
const FunctionType *FT = F->getFunctionType();
|
||||
|
||||
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)
|
||||
printArgument(I);
|
||||
|
||||
// Finish printing arguments...
|
||||
|
@ -956,7 +956,7 @@ void AssemblyWriter::printFunction(const Function *F) {
|
|||
///
|
||||
void AssemblyWriter::printArgument(const Argument *Arg) {
|
||||
// Insert commas as we go... the first arg doesn't get a comma
|
||||
if (Arg != &Arg->getParent()->afront()) Out << ", ";
|
||||
if (Arg != &Arg->getParent()->arg_front()) Out << ", ";
|
||||
|
||||
// Output type...
|
||||
printType(Arg->getType());
|
||||
|
@ -1361,7 +1361,7 @@ void SlotMachine::processModule() {
|
|||
SC_DEBUG("begin processModule!\n");
|
||||
|
||||
// Add all of the global variables to the value table...
|
||||
for (Module::const_giterator I = TheModule->gbegin(), E = TheModule->gend();
|
||||
for (Module::const_global_iterator I = TheModule->global_begin(), E = TheModule->global_end();
|
||||
I != E; ++I)
|
||||
createSlot(I);
|
||||
|
||||
|
@ -1379,8 +1379,8 @@ void SlotMachine::processFunction() {
|
|||
SC_DEBUG("begin processFunction!\n");
|
||||
|
||||
// Add all the function arguments
|
||||
for(Function::const_aiterator AI = TheFunction->abegin(),
|
||||
AE = TheFunction->aend(); AI != AE; ++AI)
|
||||
for(Function::const_arg_iterator AI = TheFunction->arg_begin(),
|
||||
AE = TheFunction->arg_end(); AI != AE; ++AI)
|
||||
createSlot(AI);
|
||||
|
||||
SC_DEBUG("Inserting Instructions:\n");
|
||||
|
|
|
@ -121,6 +121,6 @@ Mangler::Mangler(Module &m, const char *prefix)
|
|||
std::map<std::string, GlobalValue*> Names;
|
||||
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
|
||||
InsertName(I, 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)
|
||||
InsertName(I, Names);
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ void Module::dropAllReferences() {
|
|||
for(Module::iterator I = begin(), E = end(); I != E; ++I)
|
||||
I->dropAllReferences();
|
||||
|
||||
for(Module::giterator I = gbegin(), E = gend(); I != E; ++I)
|
||||
for(Module::global_iterator I = global_begin(), E = global_end(); I != E; ++I)
|
||||
I->dropAllReferences();
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ namespace { // Anonymous namespace for class
|
|||
if (I->isExternal()) visitFunction(*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)
|
||||
visitGlobalVariable(*I);
|
||||
|
||||
// If the module is broken, abort at this time.
|
||||
|
@ -307,7 +307,7 @@ void Verifier::visitFunction(Function &F) {
|
|||
|
||||
// Check that the argument values match the function type for this function...
|
||||
unsigned i = 0;
|
||||
for (Function::aiterator I = F.abegin(), E = F.aend(); I != E; ++I, ++i) {
|
||||
for (Function::arg_iterator I = F.arg_begin(), E = F.arg_end(); I != E; ++I, ++i) {
|
||||
Assert2(I->getType() == FT->getParamType(i),
|
||||
"Argument value does not match function argument type!",
|
||||
I, FT->getParamType(i));
|
||||
|
|
Loading…
Reference in New Issue