From 35aa5cecf25162f4a88cdf1dbfe3f8fc3ed1a91c Mon Sep 17 00:00:00 2001 From: Roman Levenstein Date: Wed, 16 Mar 2016 18:00:46 +0000 Subject: 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 --- clang/lib/CodeGen/CGCall.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'clang/lib/CodeGen/CGCall.cpp') 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()) return IsWindows ? CC_X86_64SysV : CC_C; + if (D->hasAttr()) + return CC_PreserveMost; + + if (D->hasAttr()) + return CC_PreserveAll; + return CC_C; } -- cgit v1.2.3