Keep exception receiver instructions together
Fixes assembler errors on Alpha by ensuring paired exception-handling instructions are not separated by dead code elimination.
A bug in GCC’s Alpha backend caused the assembler to reject code by leaving behind an ldah instruction while removing its paired lda instruction. This happened because the exception_receiver and builtin_setjmp_receiver used different instruction types, making one deletable by dead code elimination while the other was not. This commit modifies the second instruction of the pair to use a new UNSPECV_LDGP2 volatile type, ensuring both are treated as a unit and preventing the assembler error.
In Details
This commit addresses PR124495 on the Alpha target. The exception_receiver and builtin_setjmp_receiver builtins rely on a ldah/lda pair that share a !gpdisp relocation sequence number. The ldah was an unspec_volatile(*ldgp_er_1) while the lda was a plain unspec(*ldgp_er_2). This asymmetry allowed dead code elimination (DCE) in the peephole2 pass to remove the lda if the landing pad didn't use $29, leaving the ldah orphaned and causing an assembler error. The fix introduces UNSPECV_LDGP2 and *ldgp_er_2_v as unspec_volatile variants for the second instruction, ma…
- Alpha
- A 64-bit RISC instruction set architecture developed by Digital Equipment Corporation.
- gpdisp
- A relocation type specific to the Alpha architecture, related to Global Pointer displacement, used for accessing global data.
- unspec_volatile
- A GCC internal representation for an operation that has side effects and should not be optimized away, often used for inline assembly or specific hardware instructions.
- dead code elimination
- An optimization pass in a compiler that removes code that does not affect the program's output.
- peephole optimization
- A compiler optimization technique that examines a small sequence of target machine instructions (a 'peephole') and replaces it with a more efficient sequence.