From: Anton Korobeynikov Date: Tue, 11 Nov 2008 20:21:14 +0000 (+0000) Subject: Codegen support for fastcall & stdcall CC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f1c9c09e2e2220e4bbfb7e9d8adf9bf2c2406b80;p=clang Codegen support for fastcall & stdcall CC. Patch by Ilya Okonsky! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59080 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 3555ccd53a..c4877a6745 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -252,7 +252,10 @@ void CodeGenModule::SetFunctionAttributes(const Decl *D, // Set the appropriate calling convention for the Function. if (D->getAttr()) - F->setCallingConv(llvm::CallingConv::Fast); + F->setCallingConv(llvm::CallingConv::X86_FastCall); + + if (D->getAttr()) + F->setCallingConv(llvm::CallingConv::X86_StdCall); } /// SetFunctionAttributesForDefinition - Set function attributes diff --git a/test/CodeGen/stdcall-fastcall.c b/test/CodeGen/stdcall-fastcall.c new file mode 100644 index 0000000000..a599405d27 --- /dev/null +++ b/test/CodeGen/stdcall-fastcall.c @@ -0,0 +1,17 @@ +// RUN: clang -emit-llvm < %s | grep 'fastcallcc' | count 4 +// RUN: clang -emit-llvm < %s | grep 'stdcallcc' | count 4 + +void __attribute__((fastcall)) f1(void); +void __attribute__((stdcall)) f2(void); +void __attribute__((fastcall)) f3(void) { + f1(); +} +void __attribute__((stdcall)) f4(void) { + f2(); +} + +int main(void) { + f3(); f4(); + return 0; +} +