https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125266
--- Comment #8 from Richard Sandiford <rsandifo at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #7)
> While working on PR 124798, I use function ABI to pass the call clobbered
> info to RA to avoid saving and restoring registers unnecessarily.
Yeah, that seems like the right thing to do. But it means that:
(a) The reinit_regs calls shouldn't be needed any more.
(b) This part of ix86_conditional_register_usage:
/* If there are no caller-saved registers, preserve all registers.
except fixed_regs and registers used for function return value
since aggregate_value_p checks call_used_regs[regno] on return
value. */
if (cfun
&& (cfun->machine->call_saved_registers
== TYPE_NO_CALLER_SAVED_REGISTERS))
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (!fixed_regs[i] && !ix86_function_value_regno_p (i))
call_used_regs[i] = 0;
should be removed, and should instead be reflected in the
function_abi entry.
These days, as far as target-independent code is concerned, call_used_regs just
exists as a way for the target to communicate the *default* call-used set to
init_regs_1, for initialising the default ABI. Other target-independent code
does not use call_used_regs & co. Instead it queries the function_abi
structures.
Thus call_used_regs is not expected to (and should not) change based on the
current function's ABI. It should always describe the default ABI. Any
variations from the default ABI should be described in the function_abi
instead.