Regalloc2 design document states the following:
The environment also provides exactly one scratch register per class. This register must not be in the preferred or non-preferred vectors, and is used whenever a set of moves that need to occur logically in parallel have a cycle (for a simple example, consider a swap
r0, r1 := r1, r0
).
With some more work, we could potentially remove the need for the scratch register by requiring support for an additional edit type from the client ("swap"), but we have not pursued this.
But the rust docs states the following:
If a scratch register is not provided then the register allocator will automatically allocate one as needed, spilling a value to the stack if necessary.
https://docs.rs/regalloc2/latest/regalloc2/struct.MachineEnv.html
Which one of these do i refer too?
The latter is accurate; the design doc is out of date
Last updated: Dec 23 2024 at 12:05 UTC