mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 21:18:19 +00:00
Get rid of the Pass+Context magic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76702 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -576,6 +576,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
AttributesVec.push_back(AttributeWithIndex::get(~0, attrs));
|
||||
|
||||
const Type *RetTy = FTy->getReturnType();
|
||||
LLVMContext &Context = RetTy->getContext();
|
||||
|
||||
// Work around LLVM bug PR56: the CWriter cannot emit varargs functions which
|
||||
// have zero fixed arguments.
|
||||
@@ -586,7 +587,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
}
|
||||
|
||||
// Construct the new function type using the new arguments.
|
||||
FunctionType *NFTy = Context->getFunctionType(RetTy, Params, FTy->isVarArg());
|
||||
FunctionType *NFTy = Context.getFunctionType(RetTy, Params, FTy->isVarArg());
|
||||
|
||||
// Create the new function body and insert it into the module...
|
||||
Function *NF = Function::Create(NFTy, F->getLinkage(), F->getName());
|
||||
@@ -637,9 +638,9 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
// Emit a GEP and load for each element of the struct.
|
||||
const Type *AgTy = cast<PointerType>(I->getType())->getElementType();
|
||||
const StructType *STy = cast<StructType>(AgTy);
|
||||
Value *Idxs[2] = { Context->getConstantInt(Type::Int32Ty, 0), 0 };
|
||||
Value *Idxs[2] = { Context.getConstantInt(Type::Int32Ty, 0), 0 };
|
||||
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
||||
Idxs[1] = Context->getConstantInt(Type::Int32Ty, i);
|
||||
Idxs[1] = Context.getConstantInt(Type::Int32Ty, i);
|
||||
Value *Idx = GetElementPtrInst::Create(*AI, Idxs, Idxs+2,
|
||||
(*AI)->getName()+"."+utostr(i),
|
||||
Call);
|
||||
@@ -664,7 +665,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
// Use i32 to index structs, and i64 for others (pointers/arrays).
|
||||
// This satisfies GEP constraints.
|
||||
const Type *IdxTy = (isa<StructType>(ElTy) ? Type::Int32Ty : Type::Int64Ty);
|
||||
Ops.push_back(Context->getConstantInt(IdxTy, *II));
|
||||
Ops.push_back(Context.getConstantInt(IdxTy, *II));
|
||||
// Keep track of the type we're currently indexing
|
||||
ElTy = cast<CompositeType>(ElTy)->getTypeAtIndex(*II);
|
||||
}
|
||||
@@ -680,7 +681,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
}
|
||||
|
||||
if (ExtraArgHack)
|
||||
Args.push_back(Context->getNullValue(Type::Int32Ty));
|
||||
Args.push_back(Context.getNullValue(Type::Int32Ty));
|
||||
|
||||
// Push any varargs arguments on the list
|
||||
for (; AI != CS.arg_end(); ++AI, ++ArgIndex) {
|
||||
@@ -757,10 +758,10 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
const Type *AgTy = cast<PointerType>(I->getType())->getElementType();
|
||||
Value *TheAlloca = new AllocaInst(AgTy, 0, "", InsertPt);
|
||||
const StructType *STy = cast<StructType>(AgTy);
|
||||
Value *Idxs[2] = { Context->getConstantInt(Type::Int32Ty, 0), 0 };
|
||||
Value *Idxs[2] = { Context.getConstantInt(Type::Int32Ty, 0), 0 };
|
||||
|
||||
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
|
||||
Idxs[1] = Context->getConstantInt(Type::Int32Ty, i);
|
||||
Idxs[1] = Context.getConstantInt(Type::Int32Ty, i);
|
||||
std::string Name = TheAlloca->getName()+"."+utostr(i);
|
||||
Value *Idx = GetElementPtrInst::Create(TheAlloca, Idxs, Idxs+2,
|
||||
Name, InsertPt);
|
||||
@@ -843,7 +844,7 @@ Function *ArgPromotion::DoPromotion(Function *F,
|
||||
|
||||
// Notify the alias analysis implementation that we inserted a new argument.
|
||||
if (ExtraArgHack)
|
||||
AA.copyValue(Context->getNullValue(Type::Int32Ty), NF->arg_begin());
|
||||
AA.copyValue(Context.getNullValue(Type::Int32Ty), NF->arg_begin());
|
||||
|
||||
|
||||
// Tell the alias analysis that the old function is about to disappear.
|
||||
|
||||
Reference in New Issue
Block a user