Change CodeGenModule::ConstructTypeAttributes to return the calling convention

to use, and allow the ABI implementation to override the calling convention.

llvm-svn: 81593
This commit is contained in:
Daniel Dunbar
2009-09-12 00:59:20 +00:00
parent 37a4e48529
commit 0ef3479cb7
4 changed files with 42 additions and 16 deletions

View File

@@ -337,15 +337,12 @@ void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
void CodeGenModule::SetLLVMFunctionAttributes(const Decl *D,
const CGFunctionInfo &Info,
llvm::Function *F) {
unsigned CallingConv;
AttributeListType AttributeList;
ConstructAttributeList(Info, D, AttributeList);
ConstructAttributeList(Info, D, AttributeList, CallingConv);
F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
AttributeList.size()));
llvm::CallingConv::ID CC =
static_cast<llvm::CallingConv::ID>(Info.getCallingConvention());
F->setCallingConv(CC);
AttributeList.size()));
F->setCallingConv(static_cast<llvm::CallingConv::ID>(CallingConv));
}
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
@@ -1101,8 +1098,8 @@ static void ReplaceUsesOfNonProtoTypeWithRealFunction(llvm::GlobalValue *Old,
ArgList.clear();
if (NewCall->getType() != llvm::Type::getVoidTy(Old->getContext()))
NewCall->takeName(CI);
NewCall->setCallingConv(CI->getCallingConv());
NewCall->setAttributes(CI->getAttributes());
NewCall->setCallingConv(CI->getCallingConv());
// Finally, remove the old call, replacing any uses with the new one.
if (!CI->use_empty())