SPARC: Fix internal error from invalid floating-point register allocation
Corrects SPARC backend to properly handle floating-point register allocation for 12-byte structures, resolving an internal compiler error.
This commit resolves an internal compiler error on SPARC targets related to floating-point register allocation. The error occurred when the backend created an invalid floating-point register to pass a 12-byte structure in slot 15. The fix adjusts the register allocation logic to correctly account for the field’s offset within the slot, ensuring valid register assignments and preventing the internal error.
In Details
The SPARC backend's compute_fp_layout function erroneously created a floating-point hard register for a 12-byte structure passed in slot 15. This commit modifies compute_fp_layout to consider the field's offset within the slot, preventing the recog internal error caused by invalid register constraints. A new test gcc.target/sparc/20261124-1.c is added.
- SPARC
- A RISC instruction set architecture developed by Sun Microsystems. GCC supports compiling for various SPARC processors.
- backend
- The part of the compiler responsible for generating machine code for a specific target architecture. It takes the intermediate representation and translates it into instructions the CPU can execute.
- internal error
- An error condition detected by the compiler that indicates a bug within the compiler itself, rather than an error in the user's source code. These typically manifest as messages like 'internal compiler error' or 'fatal error'.
- register allocation
- The process by which the compiler assigns program variables and intermediate values to the limited number of physical registers available on the target CPU. Efficient register allocation is crucial for performance.