diff options
author | Roman Levenstein <rlevenstein@apple.com> | 2016-03-16 18:00:46 +0000 |
---|---|---|
committer | Roman Levenstein <rlevenstein@apple.com> | 2016-03-16 18:00:46 +0000 |
commit | 35aa5cecf25162f4a88cdf1dbfe3f8fc3ed1a91c (patch) | |
tree | cd10e5f88885e6322f34eff7c85816a107616cbc /clang/lib/CodeGen | |
parent | be37e62e0ceb6ba6777b8bd50924a4cc4cfa3f7d (diff) | |
download | bcm5719-llvm-35aa5cecf25162f4a88cdf1dbfe3f8fc3ed1a91c.tar.gz bcm5719-llvm-35aa5cecf25162f4a88cdf1dbfe3f8fc3ed1a91c.zip |
Add attributes for preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end
Till now, preserve_mostcc/preserve_allcc calling convention attributes were only
available at the LLVM IR level. This patch adds attributes for
preserve_mostcc/preserve_allcc calling conventions to the C/C++ front-end.
The code was mostly written by Juergen Ributzka.
I just added support for the AArch64 target and tests.
Differential Revision: http://reviews.llvm.org/D18025
llvm-svn: 263647
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index 7fb301c8c36..5e10f26ceb6 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -57,6 +57,8 @@ static unsigned ClangCallConvToLLVMCallConv(CallingConv CC) { case CC_X86VectorCall: return llvm::CallingConv::X86_VectorCall; case CC_SpirFunction: return llvm::CallingConv::SPIR_FUNC; case CC_SpirKernel: return llvm::CallingConv::SPIR_KERNEL; + case CC_PreserveMost: return llvm::CallingConv::PreserveMost; + case CC_PreserveAll: return llvm::CallingConv::PreserveAll; } } @@ -187,6 +189,12 @@ static CallingConv getCallingConventionForDecl(const Decl *D, bool IsWindows) { if (D->hasAttr<SysVABIAttr>()) return IsWindows ? CC_X86_64SysV : CC_C; + if (D->hasAttr<PreserveMostAttr>()) + return CC_PreserveMost; + + if (D->hasAttr<PreserveAllAttr>()) + return CC_PreserveAll; + return CC_C; } |