From Swift 5, the calling convention register allocation for 64-bit architectures is largely based on existing standards, with the addition of the context and error return registers discussed in the ABI stability manifesto:
Register Purpose | ARM64 | x86_64 |
---|---|---|
Context register (self) | x20 | r13 |
Error return register | x21 | r12 |
Struct return pointer | x8 | rax |
Float call arguments | v0 … v7 | xmm0 … xmm7 |
Integer call arguments | x0 … x7 | rdi, rsi, rdx, rcx, r8, r9 |
Float return | v0 … v3 | xmm0 … xmm3 |
Integer return | x0 … x3 | rax, rdx, rcx, r8 |