LRA: Handle winning MEM operands to avoid asm rejections
Fixes an issue where LRA incorrectly classified memory operands, leading to assembly rejections.
This commit addresses a regression in the Live Register Allocation (LRA) pass where a winning operand that was already a memory location (MEM) was not correctly handled. Previously, it would only fall back to memory if OFFMEMOK was set and the operand was a register. This change ensures that MEM operands are correctly classified, preventing LRA from rejecting valid assembly code.
In Details
The LRA pass's handling of winning operands was flawed when the operand was already a MEM. The previous fix only enabled the fallback to memory when OFFMEMOK was set and the operand was a register. This commit corrects lra-constraints.cc by treating winning MEM operands similarly to OFFMEMOK ones, resolving issues where operands inherited incorrect classes and led to LRA rejecting valid assembly due to mode conflicts.
- LRA
- Live Register Allocation, a phase in the compiler that assigns program variables to physical machine registers.
- MEM
- Represents a memory operand in GCC's internal RTL (Register Transfer Language).
- OFFMEMOK
- A flag or condition in LRA that indicates whether an operand can be temporarily stored in memory if no suitable register is available.
- RTL
- Register Transfer Language, an intermediate representation used by GCC that describes operations on registers and memory.