Fix register allocator issues on PA-RISC.
Register allocator on PA-RISC fixed to handle spills with soft frame pointers and type-punned subregs.
This commit addresses issues with the LRA (Local Register Allocation) register allocator on the PA-RISC backend, which is now the default. It resolves problems related to handling spills when using a soft frame pointer, where invalid offsets caused instruction recognition failures. Additionally, it improves the handling of type-punned subregisters by updating the reload mechanism. These fixes are necessary for building several Debian packages.
In Details
The PA-RISC backend's default LRA register allocator had issues handling spills with soft frame pointers (sfp) and type-punned subregs. Spills with sfp were not recognized due to invalid offsets (limited to 5-bit before reload), and type-punned subregs in reload were mishandled. This change modifies pa_legitimate_address_p to allow 14-bit offsets during reload when LRA is active, and introduces pa_spill_class and pa_legitimize_address_displacement to guide reload for spills. It also updates pa_secondary_reload to correctly handle 32/64-bit float/integer type puns.
- LRA
- Local Register Allocation, a phase in the compiler that assigns program variables to hardware registers to optimize performance. It's the default allocator for GCC on PA-RISC.
- spill
- An operation by the register allocator to save the value of a register to memory when there are no available registers for temporary storage.
- soft frame pointer (sfp)
- A mechanism in some architectures where a register acts as a frame pointer but is managed in software rather than being directly supported by hardware instructions. This can complicate register allocation.
- type punning
- A technique that allows a value of one data type to be accessed as if it were a value of a different data type, typically through the use of unions or pointer casting. This can be complex for compilers to handle correctly during register allocation.
- subreg
- A part of a larger hardware register. Compilers often need to manage access to these smaller portions of registers.