[llvm] [clang] New calling convention preserve_none (PR #76868)

via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 25 18:26:28 PST 2024


================
@@ -1056,6 +1056,23 @@ def CC_Intel_OCL_BI : CallingConv<[
   CCDelegateTo<CC_X86_32_C>
 ]>;
 
+def CC_X86_64_Preserve_None : CallingConv<[
+  // We don't preserve general registers, so all of them can be used to pass
+  // arguments except
+  //   - RBP        frame pointer
+  //   - R10        'nest' parameter
+  //   - RBX        base pointer
+  //   - R16 - R31  these are not available everywhere
+  CCIfType<[i32], CCAssignToReg<[EDI, ESI, EDX, ECX, R8D, R9D,
+	                         R11D, R12D, R13D, R14D, R15D, EAX]>>,
+
+  CCIfType<[i64], CCAssignToReg<[RDI, RSI, RDX, RCX, R8, R9,
+                                 R11, R12, R13, R14, R15, RAX]>>,
+
+  // Otherwise it's the same as the regular C calling convention.
+  CCDelegateTo<CC_X86_64_C>
----------------
weiguozhi wrote:

@jyknight could you help to review the code that checks the combination of swift attributes and preserve_none in https://github.com/llvm/llvm-project/pull/76868/commits/dc1bc55634045adb5b0ab465b16dcf73f1e77144

https://github.com/llvm/llvm-project/pull/76868


More information about the cfe-commits mailing list