This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about clobbering registers in prologue/epilogue code
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Steve Ellcey <sellcey at mips dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Tue, 24 Sep 2013 21:45:00 +0100
- Subject: Re: Question about clobbering registers in prologue/epilogue code
- Authentication-results: sourceware.org; auth=none
- References: <1379628376 dot 5770 dot 440 dot camel at ubuntu-sellcey> <877gec574u dot fsf at talisman dot default> <1380053003 dot 5988 dot 19 dot camel at ubuntu-sellcey>
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