Skip to content

Commit f8fea88

Browse files
committed
Version II
1 parent 47538d5 commit f8fea88

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

docs/ABI/RegisterAllocation.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
## 64 bit Architecture Register Allocations
2+
3+
From Swift 5, the calling convention register allocation for 64 architectures is largely based on [existing](https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html) [standards](https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/LowLevelABI/140-x86-64_Function_Calling_Conventions/x86_64.html) with the addition of the context and error return registers discussed in the ABI manifesto:
4+
5+
| Register Purpose | ARM64 | x86_64 |
6+
| ------------- |:-------------:| ----- |
7+
| Context register (self) | x20 | r13 |
8+
| Error return register | x21 | r12 |
9+
| Struct return pointer | x8 | rax |
10+
| Float call arguments | d0 - d7 | xmm0 - xmm7 |
11+
| Integer call arguments | x0 - x7 | rdi, rsi, rdx, rcx, r8, r9 |
12+
| Float return | d0, d1 | xmm0, xmm1 |
13+
| Integer return | x1, x2 | rax, rbx |

docs/ABIStabilityManifesto.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -337,21 +337,7 @@ Having the call context register be callee-saved is advantageous. It keeps the r
337337

338338
Throwing functions communicate error values to their callers through the *error* register on some platforms. The error register holds a pointer to the error value if an error occurred, otherwise 0. The caller of a throwing function is expected to quickly check for 0 before continuing on with non-error code, otherwise branching to code to handle or propagate the error. Using a callee-saved register for the error register enables free conversion from non-throwing to throwing functions, which is required to honor the subtyping relationship.
339339

340-
### Register Allocations
341-
342-
From Swift 5, the register allocation for 64 architectures is as follows:
343-
344-
| Register Purpose | ARM64 | x86_64 |
345-
| ------------- |:-------------:| ----- |
346-
| Context register (self) | x20 | r13 |
347-
| Error return register | x21 | r12 |
348-
| Struct return pointer | x8 | rax |
349-
| Float call arguments | d0 - d7 | xmm0 - xmm7 |
350-
| Integer call arguments | x0 - x7 | rdi, rsi, rdx, rcx, r8, r9 |
351-
| Float return | d0, d1 | xmm0, xmm1 |
352-
| Integer return | x1, x2 | rax, rbx |
353-
354-
For more detail consult the specifications linked at the end of this document.
340+
The specific registers used in these roles is documented in [this document](ABI/RegisterAllocation.md).
355341

356342
### <a name="function-signature-lowering"></a>Function Signature Lowering
357343

0 commit comments

Comments
 (0)