Question about clobbering registers in prologue/epilogue code

Richard Sandiford rdsandiford@googlemail.com
Tue Sep 24 20:45:00 GMT 2013


Steve Ellcey <sellcey@mips.com> writes:
> On Fri, 2013-09-20 at 07:39 +0100, Richard Sandiford wrote:
>> Well, it's really backend code that works out what registers need
>> to be saved and restored, although it's based on generic information.
>> So it should just be a case of making mips_save_reg_p return true for
>> all FP registers in an fp64_compat function.  The prologue would then
>> need to restore any incoming float arguments after the mode switch.
>> 
>> Thanks,
>> Richard
>
> Thanks for the ideas Richard, I have played around with this some more
> and one of the things I am having trouble with is trying to determine if
> any floating point registers were used for arguments.  I could just save
> and restore $f12 and $f14 every time, but ideally I would only want to
> do that if they were actually used for arguments.  I can't seem to
> figure out how to determine that.  It looks like I can determine if $f0
> is used for a return value by using mips_return_mode_in_fpr_p but I
> can't find something equivalent for argument registers.  Any ideas?

The live-in set for the entry block says which float registers contain
arguments, but that probably isn't enough, since you need to cope with
double arguments that are passed in a register pair but are presumably used
as a single register.  So you probably need to iterate over the arguments
of the current function using the cumulative_args functions.  It looks like
the microblaze prologue does something similar.

Thanks,
Richard



More information about the Gcc mailing list