i386: Emit 'lea' instruction directly to avoid ICE.
The i386 backend now directly emits a 'lea' instruction in certain cases to avoid an internal compiler error.
The i386 backend could encounter an internal compiler error (ICE) when combining certain address calculations, especially involving subregisters. This commit fixes the ICE by directly emitting a ‘lea’ instruction, ensuring the address calculation is handled correctly. This resolves a codegen issue that could lead to incorrect or non-compiling code.
In Details
The i386 backend's i386.md defines instruction patterns. The *add<mode>_1<nf_name> pattern was failing to correctly handle cases with subregisters due to a check in ix86_validate_address_register. The fix avoids returning "#" (which prevents further processing) and instead emits the lea instruction directly. This bypasses the problematic logic and prevents the ICE. TARGET_APX_NDD is a macro to detect the new hybrid APX architecture from Intel.
For Context
Compilers use instruction patterns to translate operations into assembly code. In the i386 backend, the lea (load effective address) instruction is used to calculate memory addresses. This commit addresses a bug where the compiler failed to correctly generate a lea instruction in specific scenarios, leading to a compiler crash. The fix makes the compiler directly generate the lea instruction, preventing the crash and ensuring correct code generation.