Register renamer handles memory addresses with segments
Fixes register renaming for memory addresses containing explicit segment components.
The register rename pass in GCC has been updated to correctly handle memory addresses that include explicit segment information. Prior to this change, the pass could misidentify register components in segmented addresses, potentially corrupting 64-bit addresses on targets with 32-bit registers by placing address parts in non-contiguous registers. The fix in regrename.cc ensures that arbitrary UNSPECs used as segments are properly recursed into.
In Details
The scan_rtx_address function in regrename.cc now recursively processes UNSPEC elements within MEM address expressions that represent explicit segments. This ensures that register renaming correctly identifies and assigns registers for memory accesses involving segmented addressing, preventing incorrect register allocation on architectures where 32-bit registers must accommodate 64-bit addresses (e.g., using non-contiguous register pairs).
- Register Rename
- A compiler optimization pass that renames registers to eliminate false dependencies, improve liveness analysis, and facilitate other optimizations. It helps manage register allocation by ensuring each value has a unique register throughout its lifetime.
- MEM
- An RTL construct representing a memory operand, specifying an address and its associated data.
- UNSPEC
- An RTL construct representing an operation not directly supported by standard RTL, often used for target-specific or internal compiler operations.
- RTL
- Register Transfer Language, an intermediate representation used by GCC. It is more hardware-oriented than GIMPLE and closer to assembly code.