[cfe-commits] r59080 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/stdcall-fastcall.c
Anton Korobeynikov
asl at math.spbu.ru
Tue Nov 11 12:21:15 PST 2008
Author: asl
Date: Tue Nov 11 14:21:14 2008
New Revision: 59080
URL: http://llvm.org/viewvc/llvm-project?rev=59080&view=rev
Log:
Codegen support for fastcall & stdcall CC.
Patch by Ilya Okonsky!
Added:
cfe/trunk/test/CodeGen/stdcall-fastcall.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=59080&r1=59079&r2=59080&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Nov 11 14:21:14 2008
@@ -252,7 +252,10 @@
// 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
Added: cfe/trunk/test/CodeGen/stdcall-fastcall.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/stdcall-fastcall.c?rev=59080&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/stdcall-fastcall.c (added)
+++ cfe/trunk/test/CodeGen/stdcall-fastcall.c Tue Nov 11 14:21:14 2008
@@ -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;
+}
+
More information about the cfe-commits
mailing list