GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
xtensa

XTENSA: Exclude A0 from RL_REGS when Windowed ABI is active

Xtensa target excludes A0 register from preferred reload set when using Windowed ABI.

On Xtensa targets using the Windowed Register ABI, the A0 register is reserved for return addresses and cannot be used for general purposes. This commit modifies the xtensa_conditional_register_usage function to exclude the A0 register from the RL_REGS register class, which represents preferred reload registers. This ensures that the compiler does not attempt to use A0 for reloads, preventing potential conflicts with its dedicated role for return addresses.

In Details

For Xtensa targets configured with TARGET_WINDOWED_ABI, register A0 is strictly used for return addresses and is managed by the ABI. The RL_REGS hard-reg-set, used by LRA for preferred reload candidates, must not include A0 to avoid conflicts. This patch modifies xtensa_conditional_register_usage to clear the bit for A0 in the RL_REGS set when TARGET_WINDOWED_ABI is enabled, ensuring correct register allocation and ABI compliance.

For Context
RL_REGS
A GCC internal hard-reg-set that identifies registers preferred by the allocator for reload operations.
Windowed Register ABI
A calling convention on some Xtensa processors that uses a cache of registers that rotate, which affects register usage and management, particularly for return addresses.
A0 register
A specific register on the Xtensa architecture, often used for return addresses when the Windowed ABI is enabled.
xtensa_conditional_register_usage
A target-specific GCC function for Xtensa that defines register usage based on various target configuration options.
hard-reg-set
A set data structure used within GCC's register allocator to represent collections of physical (hard) registers.
Filed Under: xtensaregister allocationABI