lra: Pass INVALID_REGNUM to dependent filter.
Local Register Allocation (LRA) now passes an invalid register number to dependent filters when the reference operand is not yet determined.
This patch refines the Local Register Allocation (LRA) process by ensuring that dependent filters are properly invoked even when the reference operand’s register is not yet assigned. Previously, undefined reference operands led to filters being lenient, potentially causing early, incorrect register assignments that LRA could not fix later. The change allows filters to reject inputs more effectively in such scenarios and documents that INVALID_REGNUM can be passed to these filters.
In Details
In LRA's get_dependent_filter, when the reference operand for a dependent constraint has not yet been assigned a real register, INVALID_REGNUM is now passed to the filter. This contrasts with the previous behavior of allowing all operands. This change provides filters an opportunity to perform early rejection, preventing hard-coded registers from being fixed prematurely and later invalidated. The documentation in doc/md.texi is updated to reflect this.
- LRA
- Local Register Allocation. The phase in GCC that assigns physical machine registers to virtual registers within a function or a small code region, optimizing register usage.
- Dependent filter
- A mechanism within LRA that constrains register choices based on the assignment of related operands. This patch modifies how these filters behave when their reference operand is not yet known.
- INVALID_REGNUM
- A symbolic constant (often -1) used in GCC to represent an invalid or unassigned physical register number. It's employed in LRA to signal that a register has not yet been determined.
- Subreg
- A subregister. On architectures where registers have substructure (e.g., a 64-bit register can be accessed as two 32-bit registers), a subreg refers to a portion of a larger register.