[llvm] r281138 - We also need to pass swifterror in R12 under swiftcc not only under ccc
Arnold Schwaighofer via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 10 07:16:55 PDT 2016
Author: arnolds
Date: Sat Sep 10 09:16:55 2016
New Revision: 281138
URL: http://llvm.org/viewvc/llvm-project?rev=281138&view=rev
Log:
We also need to pass swifterror in R12 under swiftcc not only under ccc
rdar://28190687
Modified:
llvm/trunk/lib/Target/X86/X86CallingConv.td
llvm/trunk/test/CodeGen/X86/swifterror.ll
Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=281138&r1=281137&r2=281138&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Sat Sep 10 09:16:55 2016
@@ -196,6 +196,9 @@ def RetCC_X86_64_WebKit_JS : CallingConv
]>;
def RetCC_X86_64_Swift : CallingConv<[
+
+ CCIfSwiftError<CCIfType<[i64], CCAssignToReg<[R12]>>>,
+
// For integers, ECX, R8D can be used as extra return registers.
CCIfType<[i1], CCPromoteToType<i8>>,
CCIfType<[i8] , CCAssignToReg<[AL, DL, CL, R8B]>>,
Modified: llvm/trunk/test/CodeGen/X86/swifterror.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/swifterror.ll?rev=281138&r1=281137&r2=281138&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/swifterror.ll (original)
+++ llvm/trunk/test/CodeGen/X86/swifterror.ll Sat Sep 10 09:16:55 2016
@@ -376,3 +376,25 @@ entry:
ret void
}
+
+; This tests the basic usage of a swifterror parameter with swiftcc.
+define swiftcc float @foo_swiftcc(%swift_error** swifterror %error_ptr_ref) {
+; CHECK-APPLE-LABEL: foo_swiftcc:
+; CHECK-APPLE: movl $16, %edi
+; CHECK-APPLE: malloc
+; CHECK-APPLE: movb $1, 8(%rax)
+; CHECK-APPLE: movq %rax, %r12
+
+; CHECK-O0-LABEL: foo_swiftcc:
+; CHECK-O0: movl $16
+; CHECK-O0: malloc
+; CHECK-O0: movb $1, 8(%rax)
+; CHECK-O0: movq %{{.*}}, %r12
+entry:
+ %call = call i8* @malloc(i64 16)
+ %call.0 = bitcast i8* %call to %swift_error*
+ store %swift_error* %call.0, %swift_error** %error_ptr_ref
+ %tmp = getelementptr inbounds i8, i8* %call, i64 8
+ store i8 1, i8* %tmp
+ ret float 1.0
+}
More information about the llvm-commits
mailing list