GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
x86 Performance Win

Implement TARGET_FNTYPE_ABI to avoid callee-saved register spills

x86 now uses TARGET_FNTYPE_ABI to prevent unnecessary spills of callee-saved registers when calling functions with no_caller_saved_registers.

This commit introduces the TARGET_FNTYPE_ABI mechanism for x86, preventing unnecessary spills of callee-saved registers when calling functions marked with no_caller_saved_registers. This change refactors call expansion logic, removing explicit ABI-switching clobbers and correctly handling TLS calls and function ABIs, improving code generation efficiency and correctness.

In Details

This commit implements TARGET_FNTYPE_ABI for x86 targets, addressing PR target/124798 and PR target/125436. Following the CALL_INSN_ABI_ID patch, ix86_expand_call no longer adds explicit call and ABI-switch clobbers. Instead, it relies on TARGET_FNTYPE_ABI to manage function ABIs. The ix86_tls_get_addr_abi hook is introduced to correctly determine the GNU TLS ABI for register clobbering. Additionally, ix86_place_single_tls_call sets CALL_INSN_ABI_ID for TLS calls, and ix86_set_current_function avoids unnecessary reinit_regs calls.

For Context
Callee-saved registers
Registers that a called function must preserve the value of, for the calling function. The caller assumes these registers will maintain their value across a function call.
Caller-saved registers
Registers that a calling function must save before making a call if it needs their values preserved afterwards. The called function is free to modify these registers.
ABI
Application Binary Interface. Defines how low-level code constructs (like function calls, data structures, and system calls) are represented and interact at the binary level.
TLS
Thread-Local Storage. A mechanism that allows variables to have unique instances for each thread of execution.
Filed Under: x86abioptimization