[cfe-commits] r81582 - in /cfe/trunk/lib/CodeGen: CGCall.cpp CGExpr.cpp CodeGenModule.cpp
Daniel Dunbar
daniel at zuster.org
Fri Sep 11 15:25:01 PDT 2009
Author: ddunbar
Date: Fri Sep 11 17:25:00 2009
New Revision: 81582
URL: http://llvm.org/viewvc/llvm-project?rev=81582&view=rev
Log:
Set the calling convention based on the CGFunctionInfo.
Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp
cfe/trunk/lib/CodeGen/CGExpr.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=81582&r1=81581&r2=81582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Fri Sep 11 17:25:00 2009
@@ -851,9 +851,9 @@
}
CS.setAttributes(Attrs);
- if (const llvm::Function *F =
- dyn_cast<llvm::Function>(Callee->stripPointerCasts()))
- CS.setCallingConv(F->getCallingConv());
+ llvm::CallingConv::ID CC =
+ static_cast<llvm::CallingConv::ID>(CallInfo.getCallingConvention());
+ CS.setCallingConv(CC);
// If the call doesn't return, finish the basic block and clear the
// insertion point; this allows the rest of IRgen to discard
Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=81582&r1=81581&r2=81582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Fri Sep 11 17:25:00 2009
@@ -1386,6 +1386,13 @@
CallArgList Args;
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);
}
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=81582&r1=81581&r2=81582&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Fri Sep 11 17:25:00 2009
@@ -343,12 +343,9 @@
F->setAttributes(llvm::AttrListPtr::get(AttributeList.begin(),
AttributeList.size()));
- // Set the appropriate calling convention for the Function.
- if (D->hasAttr<FastCallAttr>())
- F->setCallingConv(llvm::CallingConv::X86_FastCall);
-
- if (D->hasAttr<StdCallAttr>())
- F->setCallingConv(llvm::CallingConv::X86_StdCall);
+ llvm::CallingConv::ID CC =
+ static_cast<llvm::CallingConv::ID>(Info.getCallingConvention());
+ F->setCallingConv(CC);
}
void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D,
More information about the cfe-commits
mailing list