GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
hppa

Fix LRA spill failures on PA-RISC involving %r1 register

PA-RISC LRA spill failures involving the %r1 register are fixed by refining register usage in call patterns and PIC label loads.

This commit resolves Local Register Allocation (LRA) spill failures on the PA-RISC architecture that involve the %r1 register. Redundant clobbers on %r1 in call patterns were removed, and PIC label address patterns were merged and fixed. Fallback alternatives using general registers and frame marker slots were added, along with post-reload peephole optimizations to rewrite reloads back to %r1. The TARGET_PREFERRED_RELOAD_CLASS is updated to prefer %r1 for certain loads, and register move costs are adjusted to allow LRA to use floating-point registers as an alternate spill area.

In Details

This patch addresses two issues with LRA on PA-RISC related to the %r1 register (which is special-cased as R1_REGS and also part of the general a class). First, explicit (clobber (reg 1)) in call patterns was redundant because the ABI already designates %r1 as call-used. Second, patterns using only R1_REGS (like PIC label loads) sometimes failed to find a spill slot when %r1 was contended. The fix involves removing redundant clobbers, merging and correcting PIC label address patterns with fallbacks to general registers, adding fallbacks to PIC HIGH patterns, and introducing post…

For Context
LRA
Local Register Allocation: A phase in the compiler's backend that optimizes register usage within a function or a limited scope.
PA-RISC
Hewlett-Packard's Precision Architecture RISC instruction set architecture.
%r1
Register 1 on the PA-RISC architecture, often used for specific purposes like parameter passing or as a scratch register.
PIC
Position-Independent Code: Code that can be loaded and executed at any memory address without modification. Often used in shared libraries.
ABI
Application Binary Interface: Defines how low-level code is structured, including function call conventions, data types, and register usage.
Peephole optimization
A compiler optimization technique that examines a short sequence of instructions (a 'peephole') and replaces it with an equivalent, more efficient sequence.
Filed Under: hpparegister-allocation