Codegen support for fastcall & stdcall CC.

Patch by Ilya Okonsky!

llvm-svn: 59080
This commit is contained in:
Anton Korobeynikov 2008-11-11 20:21:14 +00:00
parent 7ae7d91ee0
commit fdf389b9e4
2 changed files with 21 additions and 1 deletions

View File

@ -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

View File

@ -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;
}