[PING^2][PATCH] -fuse-caller-save - Implement TARGET_FN_OTHER_HARD_REG_USAGE hook for MIPS
Tom de Vries
Tom_deVries@mentor.com
Mon Jan 13 15:04:00 GMT 2014
On 10-01-14 09:47, Richard Sandiford wrote:
> 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?
Right. The first part is not the intended usage of the hook, but it was the
simplest fix.
> 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.
>
Agree. I've rewritten the patch as such.
> 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.
>
Hmm. I was not aware that splits can happen during final. I'll try to update
that patch as well.
>>> 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.
>
It was simpler to implement. But you're right, using CALL_INSN_FUNCTION_USAGE
was simple as well.
build and reg-tested on MIPS. OK for stage1? (You've alread OK-ed the test-case
part).
Thanks,
- Tom
> Thanks,
> Richard
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fuse-caller-save-mips-hook.patch
Type: text/x-patch
Size: 5521 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140113/fb06152f/attachment.bin>
More information about the Gcc-patches
mailing list