[PING^2][PATCH] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for MIPS

Richard Sandiford rdsandiford@googlemail.com
Fri Jan 10 08:47:00 GMT 2014

Tom de Vries <Tom_deVries@mentor.com> writes:
>>  Why not just collect the usage information at
>> the end of final rather than at the beginning, so that all splits during
>> final have been done?
> If we have a call to a leaf function, the final rtl representation does not 
> contain calls. The problem does not lie in the final pass where the callee is 
> analyzed, but in the caller, where information is used, and where the unsplit 
> call is missing the clobber of r6.

Ah, so when you're using this hook in final, you're actually adding in
the set of registers that will be clobbered by a future caller's CALL_INSN,
as well as the registers that are clobbered by the callee itself?
That seems a bit error-prone, since we don't know at this stage what
the future caller will look like.  (Things like the target attribute
make this harder to predict.)

I think it would be cleaner to just calculate the callee-clobbered
registers during final and leave the caller to say what it clobbers.

FWIW, I still think it'd be better to collect the set at the end of final
(after any final splits) rather than at the beginning.

>> For other cases (where the usage isn't explicit
>> at the rtl level), why not record the usage in CALL_INSN_FUNCTION_USAGE
>> instead?
> Right, we could add the r6 clobber that way. But to keep things simple, I've 
> used the hook instead.

Why's it simpler though?  That's the kind of thing CALL_INSN_FUNCTION_USAGE
is there for.


More information about the Gcc-patches mailing list