XTENSA: Simplify xtensa_valid_move() by removing obsolete check
Xtensa target code removes an old workaround for the Reload pass, as LRA now handles constraints correctly.
The xtensa_valid_move function has been simplified by removing a workaround that prevented non-register sources from being directly assigned to the stack pointer. This check was originally necessary because the older Reload pass was less strict with operand constraints. With the adoption of the Later Register Allocator (LRA), which adheres strictly to constraints, this workaround is no longer needed, and the function can be safely simplified. A new test case ensures the correct behavior.
In Details
The xtensa_valid_move function, used by the movsi_internal MD pattern, contained a check to prevent non-register sources (like memory) from being directly assigned to the stack pointer. This was a workaround for the pre-LRA Reload pass's laxity. Since LRA enforces constraints rigorously, this check is now redundant as LRA correctly handles necessary reloads into scratch registers when direct assignment is impossible. The change simplifies target-specific legalization code.
- LRA
- Later Register Allocator, GCC's modern register allocation pass that replaced the older Reload pass.
- Reload pass
- An older GCC pass responsible for instruction selection and register allocation, which has been largely superseded by LRA.
- xtensa_valid_move
- A target-specific function in GCC for the Xtensa architecture that validates move operations, particularly concerning stack pointer assignments.
- MD insn pattern
- A Machine Description (MD) file pattern that describes a specific machine instruction, including its operands and constraints.
- Windowed Register ABI
- A calling convention on some Xtensa processors that uses a cache of registers that rotate, which affects register usage and management.
- MOVSP instruction
- A machine instruction used on some architectures, including Xtensa, to move data to or from the stack pointer.