diff options
author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-11-11 20:21:14 +0000 |
---|---|---|
committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-11-11 20:21:14 +0000 |
commit | f1c9c09e2e2220e4bbfb7e9d8adf9bf2c2406b80 (patch) | |
tree | 0e7a74311cc2760b85eb03f663176ddd25eb7ff6 | |
parent | e219b8a9c02198b1938dfa9ed91ef9cf0e6ce4f3 (diff) |
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
-rw-r--r-- | lib/CodeGen/CodeGenModule.cpp | 5 | ||||
-rw-r--r-- | test/CodeGen/stdcall-fastcall.c | 17 |
2 files changed, 21 insertions, 1 deletions
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<FastCallAttr>()) - F->setCallingConv(llvm::CallingConv::Fast); + F->setCallingConv(llvm::CallingConv::X86_FastCall); + + if (D->getAttr<StdCallAttr>()) + 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; +} + |