GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
i386

i386: Split out call_saved_registers_type detection

Refactors i386 register type detection into a reusable function to simplify upcoming ABI changes and improve maintainability.

The i386 backend now extracts call-saved register type detection into a dedicated subroutine. This functionality was previously duplicated in functions setting up the function type and checking for callee-saved registers. The refactoring anticipates future changes to function ABI handling and consolidates the logic, improving code clarity and reducing potential inconsistencies.

In Details

The i386 backend's ix86_set_func_type and ix86_type_no_callee_saved_registers_p both needed to determine the call-saved register set for a function type. This commit factors out the common logic into ix86_fntype_call_saved_registers. The implementation ensures that the detection logic is applied only after the cfun->machine->func_type has been initialized, avoiding redundant computations.

For Context
call-saved registers
Registers whose values must be preserved by a function across calls. The caller is responsible for saving them before a call, and restoring them afterward, if the caller needs their values later. The callee is free to modify them.
function ABI
Application Binary Interface. Defines how functions are called, how arguments are passed, how return values are handled, and which registers are preserved. This affects the binary output of the compiler and interoperability between different compiled code.
Filed Under: i386refactorABI