diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-09-12 00:59:20 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-09-12 00:59:20 +0000 |
commit | ca6408c3176783f0b29da4679a08512aa05f0c73 (patch) | |
tree | 018521391d4c5cd7bbc4d6ce0958cd2ce502f0bd /lib/CodeGen/CGCall.cpp | |
parent | 7814e6d6645d587891293d59ecf6576defcfac92 (diff) |
Change CodeGenModule::ConstructTypeAttributes to return the calling convention
to use, and allow the ABI implementation to override the calling convention.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81593 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index fcaa49e129..c63dab16a1 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -156,7 +156,8 @@ const CGFunctionInfo &CodeGenTypes::getFunctionInfo(QualType ResTy, CGFunctionInfo::CGFunctionInfo(unsigned _CallingConvention, QualType ResTy, const llvm::SmallVector<QualType, 16> &ArgTys) - : CallingConvention(_CallingConvention) + : CallingConvention(_CallingConvention), + EffectiveCallingConvention(_CallingConvention) { NumArgs = ArgTys.size(); Args = new ArgInfo[1 + NumArgs]; @@ -404,10 +405,13 @@ CodeGenTypes::GetFunctionType(const CGFunctionInfo &FI, bool IsVariadic) { void CodeGenModule::ConstructAttributeList(const CGFunctionInfo &FI, const Decl *TargetDecl, - AttributeListType &PAL) { + AttributeListType &PAL, + unsigned &CallingConv) { unsigned FuncAttrs = 0; unsigned RetAttrs = 0; + CallingConv = FI.getEffectiveCallingConvention(); + // FIXME: handle sseregparm someday... if (TargetDecl) { if (TargetDecl->hasAttr<NoThrowAttr>()) @@ -835,8 +839,9 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, llvm::BasicBlock *InvokeDest = getInvokeDest(); + unsigned CallingConv; CodeGen::AttributeListType AttributeList; - CGM.ConstructAttributeList(CallInfo, TargetDecl, AttributeList); + CGM.ConstructAttributeList(CallInfo, TargetDecl, AttributeList, CallingConv); llvm::AttrListPtr Attrs = llvm::AttrListPtr::get(AttributeList.begin(), AttributeList.end()); @@ -851,9 +856,7 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo, } CS.setAttributes(Attrs); - llvm::CallingConv::ID CC = - static_cast<llvm::CallingConv::ID>(CallInfo.getCallingConvention()); - CS.setCallingConv(CC); + CS.setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv)); // If the call doesn't return, finish the basic block and clear the // insertion point; this allows the rest of IRgen to discard |