Whether an argument is required (in contrast with being an
optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
This commit is contained in:
@@ -242,8 +242,8 @@ void CodeGenFunction::GenerateVarArgsThunk(
|
||||
QualType ResultType = FPT->getResultType();
|
||||
|
||||
// Get the original function
|
||||
llvm::Type *Ty =
|
||||
CGM.getTypes().GetFunctionType(FnInfo, /*IsVariadic*/true);
|
||||
assert(FnInfo.isVariadic());
|
||||
llvm::Type *Ty = CGM.getTypes().GetFunctionType(FnInfo);
|
||||
llvm::Value *Callee = CGM.GetAddrOfFunction(GD, Ty, /*ForVTable=*/true);
|
||||
llvm::Function *BaseFn = cast<llvm::Function>(Callee);
|
||||
|
||||
@@ -351,13 +351,13 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn,
|
||||
|
||||
// Get our callee.
|
||||
llvm::Type *Ty =
|
||||
CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(GD),
|
||||
FPT->isVariadic());
|
||||
CGM.getTypes().GetFunctionType(CGM.getTypes().arrangeGlobalDeclaration(GD));
|
||||
llvm::Value *Callee = CGM.GetAddrOfFunction(GD, Ty, /*ForVTable=*/true);
|
||||
|
||||
#ifndef NDEBUG
|
||||
const CGFunctionInfo &CallFnInfo =
|
||||
CGM.getTypes().getFunctionInfo(ResultType, CallArgs, FPT->getExtInfo());
|
||||
CGM.getTypes().arrangeFunctionCall(ResultType, CallArgs, FPT->getExtInfo(),
|
||||
RequiredArgs::forPrototypePlus(FPT, 1));
|
||||
assert(CallFnInfo.getRegParm() == FnInfo.getRegParm() &&
|
||||
CallFnInfo.isNoReturn() == FnInfo.isNoReturn() &&
|
||||
CallFnInfo.getCallingConvention() == FnInfo.getCallingConvention());
|
||||
@@ -398,7 +398,7 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn,
|
||||
void CodeGenVTables::EmitThunk(GlobalDecl GD, const ThunkInfo &Thunk,
|
||||
bool UseAvailableExternallyLinkage)
|
||||
{
|
||||
const CGFunctionInfo &FnInfo = CGM.getTypes().getFunctionInfo(GD);
|
||||
const CGFunctionInfo &FnInfo = CGM.getTypes().arrangeGlobalDeclaration(GD);
|
||||
|
||||
// FIXME: re-use FnInfo in this computation.
|
||||
llvm::Constant *Entry = CGM.GetAddrOfThunk(GD, Thunk);
|
||||
|
||||
Reference in New Issue
Block a user