forked from OSchip/llvm-project
We also need to pass swifterror in R12 under swiftcc not only under ccc
rdar://28190687 llvm-svn: 281138
This commit is contained in:
parent
b66e5eb612
commit
112ff66505
|
@ -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]>>,
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue