Register Allocation on the SPARC
The SPARC design includes 32 integer registers and 32 floating point registers. Integer registers are accessed via a window mechanism that reveals eight new registers on each subprogram call. These are managed by the register allocator.
If we use the save-restore mechanism on sub program calls then we can use any of the register that are not dedicated. With preferential colouring input and output parameters are cared for.
Floating parameters and local variables should be given floating point registers because floating operations must use those registers.
This brings us to consider register classes. With the SPARC we have two classes: integer registers and floating-point registers. So we can allocate a register based on its mode.
Integer parameters are passed in the ‘out’ registers (which become ‘in’ registers after entry) and floating parameters are passed in the floating registers or on the stack.
Integer results are passed in ‘out’ registers. Floating results are passed in floating registers.