The “WAM registers” arg0..arg2
are for passing parameters
from the JIT code to the runtime system. These “WAM registers” must
be preserved by the machine code that implements the IR instructions
(i.e. the generated machine code must not used any of
arg0..arg2
as scratchpad registers).
The “WAM registers” arg3..arg5
are scratchpad registers of the
runtime system and may also be freely used by the machine code that
implements the IR instructions.
For x86_64, the exact offsets of ac0
and ac1
are ABI
dependent (Windows vs. non-Windows).
For PPC64, the CTR
register is used by context(_)
instructions,
in predicate-to-predicate calls, and for jumping to continuations.
The link register is used in call
and ccall
instructions.
Otherwise, CTR
can be used freely, and so can the link
register. Additionally R0
and arg3..arg5
can be used
freely by the machine code that implements the IR instructions.
WAM | x86 | x86_64 | PPC64 |
---|---|---|---|
sp | %esp | %rsp | r1 |
toc | — | — | r2 |
val | %eax | %rax | r3 |
arg0 | 0(%esp) | %rax | r3 |
arg1 | 4(%esp) | %r10 | r4 |
arg2 | 8(%esp) | %r11 | r5 |
arg3 | — | — | r6 |
arg4 | — | — | r7 |
arg5 | — | — | r8 |
s | %edx | %rdx | r9 |
ac0 | 28(%esp) | OFF(%rsp) | r9 |
ac1 | 32(%esp) | OFF(%rsp) | r10 |
ab | W_LOCAL_UNCOND(w) | NODE_LOCAL_TOP(b) | r11 |
hb | W_GLOBAL_UNCOND(w) | NODE_GLOBAL_TOP(b) | r12 |
b | W_NODE(w) | r8 | r14 |
a | %ebp | %rbp | r15 |
h | %esi | %rsi | r16 |
tr | W_TRAIL_TOP(w) | r9 | r17 |
e | %edi | %rdi | r18 |
cp | %ecx | %rcx | r19 |
w | %ebx | %rbx | r20 |
w_insn | W_INSN(w) | W_INSN(w) | r21 |
w_heap_warn_soft | W_HEAP_WARN_SOFT(w) | W_HEAP_WARN_SOFT(w) | W_HEAP_WARN_SOFT(w) |
w_next_node | W_NEXT_NODE(w) | W_NEXT_NODE(w) | W_NEXT_NODE(w) |
w_numstack_end | W_NUMSTACK_END(w) | W_NUMSTACK_END(w) | W_NUMSTACK_END(w) |
w_stack_start | W_STACK_START(w) | W_STACK_START(w) | W_STACK_START(w) |
w_stack_warn | W_STACK_WARN(w) | W_STACK_WARN(w) | W_STACK_WARN(w) |
w_fli_stack_start | W_FLI_STACK_START(w) | W_FLI_STACK_START(w) | W_FLI_STACK_START(w) |
x(0) | W_TERM0(w) | %r12 | r22 |
x(1) | W_TERM1(w) | %r13 | r23 |
x(2) | W_TERM2(w) | %r14 | r24 |
x(3) | W_TERM3(w) | %r15 | r25 |
x(4) | W_TERM4(w) | W_TERM4(w) | r26 |
x(5) | W_TERM5(w) | W_TERM5(w) | r27 |
x(6) | W_TERM6(w) | W_TERM6(w) | r28 |
x(7) | W_TERM7(w) | W_TERM7(w) | r29 |
x(8) | W_TERM8(w) | W_TERM8(w) | r30 |
x(9) | W_TERM9(w) | W_TERM9(w) | r31 |