Skip to main content

spilltmp_reg

Function spilltmp_reg 

Source
pub fn spilltmp_reg() -> Reg
Available on crate feature arm64 only.
Expand description

Get a reference to the first temporary, sometimes “spill temporary”, register. This register is used to compute the address of a spill slot when a direct offset addressing mode from FP is not sufficient (+/- 2^11 words). We exclude this register from regalloc and reserve it for this purpose for simplicity; otherwise we need a multi-stage analysis where we first determine how many spill slots we have, then perhaps remove the reg from the pool and recompute regalloc.

We use x16 for this (aka IP0 in the AArch64 ABI) because it’s a scratch register but is slightly special (used for linker veneers). We’re free to use it as long as we don’t expect it to live through call instructions.