mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 19:56:05 +00:00
Set the calling convention based on the CGFunctionInfo.
llvm-svn: 81582
This commit is contained in:
parent
7feafc70d9
commit
bbaeca4fef
@ -851,9 +851,9 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CS.setAttributes(Attrs);
|
CS.setAttributes(Attrs);
|
||||||
if (const llvm::Function *F =
|
llvm::CallingConv::ID CC =
|
||||||
dyn_cast<llvm::Function>(Callee->stripPointerCasts()))
|
static_cast<llvm::CallingConv::ID>(CallInfo.getCallingConvention());
|
||||||
CS.setCallingConv(F->getCallingConv());
|
CS.setCallingConv(CC);
|
||||||
|
|
||||||
// If the call doesn't return, finish the basic block and clear the
|
// If the call doesn't return, finish the basic block and clear the
|
||||||
// insertion point; this allows the rest of IRgen to discard
|
// insertion point; this allows the rest of IRgen to discard
|
||||||
|
@ -1386,6 +1386,13 @@ RValue CodeGenFunction::EmitCall(llvm::Value *Callee, QualType CalleeType,
|
|||||||
CallArgList Args;
|
CallArgList Args;
|
||||||
EmitCallArgs(Args, FnType->getAsFunctionProtoType(), ArgBeg, ArgEnd);
|
EmitCallArgs(Args, FnType->getAsFunctionProtoType(), ArgBeg, ArgEnd);
|
||||||
|
|
||||||
return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args),
|
// FIXME: We should not need to do this, it should be part of the function
|
||||||
|
// type.
|
||||||
|
unsigned CallingConvention = 0;
|
||||||
|
if (const llvm::Function *F =
|
||||||
|
dyn_cast<llvm::Function>(Callee->stripPointerCasts()))
|
||||||
|
CallingConvention = F->getCallingConv();
|
||||||
|
return EmitCall(CGM.getTypes().getFunctionInfo(ResultType, Args,
|
||||||
|
CallingConvention),
|
||||||
Callee, Args, TargetDecl);
|
Callee, Args, TargetDecl);
|
||||||
}
|
}
|
||||||
|
@ -343,12 +343,9 @@ void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D,
|
|||||||
F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
|
F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
|
||||||
AttributeList.size()));
|
AttributeList.size()));
|
||||||
|
|
||||||
// Set the appropriate calling convention for the Function.
|
llvm::CallingConv::ID CC =
|
||||||
if (D->hasAttr<FastCallAttr>())
|
static_cast<llvm::CallingConv::ID>(Info.getCallingConvention());
|
||||||
F->setCallingConv(llvm::CallingConv::X86_FastCall);
|
F->setCallingConv(CC);
|
||||||
|
|
||||||
if (D->hasAttr<StdCallAttr>())
|
|
||||||
F->setCallingConv(llvm::CallingConv::X86_StdCall);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user