[PATCH] D17866: Swift Calling Convention: add swiftself attribute

Manman Ren via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 16:17:54 PST 2016

manmanren added a comment.

Hi Reid,

Thanks for reviewing!

In http://reviews.llvm.org/D17866#372537, @rnk wrote:

> Is this the special "context" argument that John mentioned? R10 is not a CSR on x86_64.

Yes, this is the "context/self" argument. This patch does not actually use a CSR because of the complications in the backend to use a CSR to pass an argument.
We are trying to improve this by improving the backend to handle this.


Comment at: lib/Target/AArch64/AArch64CallingConvention.td:129
@@ -128,1 +128,3 @@
+  // An SwiftSelf is passed in X9.
+  CCIfSwiftSelf<CCIfType<[i64], CCAssignToRegWithShadow<[X9], [W9]>>>,
rnk wrote:
> "A SwitfSelf" maybe?
Will do :]

Comment at: test/CodeGen/X86/swiftself.ll:1
@@ +1,2 @@
+; RUN: llc -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
+; RUN: llc -O0 -verify-machineinstrs < %s -mtriple=x86_64-unknown-unknown | FileCheck --check-prefix=CHECK-O0 %s
rnk wrote:
> It seems you have no special rules for passing a 32-bit swiftself. That makes sense, I don't imagine you care about x86_32 swift performance. Can you add a RUN line that shows it being spilled to the stack as usual, though? I assume you'll want the ABI for it to be stable.
You are right. I will make sure it works as designed on 32-bit.


More information about the llvm-commits mailing list