1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

X86: pass swift_async context in R14 on Win64

Pass swift_async context in a callee-saved register rather than as a
regular parameter.  This is similar to the Swift `self` and `error`
parameters.
This commit is contained in:
Saleem Abdulrasool 2021-06-13 18:22:59 -07:00
parent 25efb3e5da
commit a4fccf0a10
2 changed files with 21 additions and 0 deletions

View File

@ -627,6 +627,10 @@ def CC_X86_Win64_C : CallingConv<[
// Pass SwiftSelf in a callee saved register.
CCIfSwiftSelf<CCIfType<[i64], CCAssignToReg<[R13]>>>,
// Pass SwiftAsync in an otherwise callee saved register so that calls to
// normal functions don't need to save it somewhere.
CCIfSwiftAsync<CCIfType<[i64], CCAssignToReg<[R14]>>>,
// The 'CFGuardTarget' parameter, if any, is passed in RAX.
CCIfCFGuardTarget<CCAssignToReg<[RAX]>>,

View File

@ -0,0 +1,17 @@
; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - | FileCheck %s
; RUN: llc -mtriple x86_64-unknown-windows-msvc %s -o - -fast-isel | FileCheck %s
define i8* @argument(i8* swiftasync %in) {
ret i8* %in
}
; CHECK-LABEL: argument:
; CHECK: movq %r14, %rax
define void @call(i8* %in) {
call i8* @argument(i8* swiftasync %in)
ret void
}
; CHECK-LABEL: call:
; CHECK: movq %rcx, %r14