This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] register CALL_INSN_FUNCTION_USAGE in find_all_hard_reg_sets


Jakub Jelinek <jakub@redhat.com> writes:
> On Wed, Apr 16, 2014 at 11:46:14AM +0200, Tom de Vries wrote:
>> >...why do we need two different mechanisms to deal with these two?
>> >IMO the set recorded for the callee should contain what the callee
>> >instructions clobber and nothing else.  CALL_INSN_FUNCTION_USAGE
>> >should contain everything clobbered by a call outside the callee,
>> >whether that's in the calling function itself, in a PLT, in a MIPS16
>> >stub, or whatever.
>
> Always putting all call clobbered registers to C_I_F_U explicitly
> can be a serious memory hog on some architectures, e.g. doesn't
> ia64 have ~ 160 call clobbered hard registers, times number of calls in a
> function (sometimes tens of thousands)?

That isn't what we're doing though.  The problem Tom's trying to solve
is that call sequences themselves can sometimes use call-clobbered
registers internally, on the assumption that they cannot possibly hold
a live value.  These uses aren't always exposed in the rtl, at least not
until after reload (which is later than Tom needs the information).
So it isn't always correct to assume that a call only clobbers the
registers that are clobbered by the call target.

E.g. $gp is call-clobbered on MIPS o32, so we need to restore it after
a call if the GOT base is still needed.  This is doing using post-reload
split of the call insn.  And on MIPS16 we need a temporary register to
do that, since it isn't possible to load directly into $gp.  The temporary
register we use is the call-clobbered $6.

Tom's original approach was to have a hook that told the target-independent
code that $6 might be clobbered in this way.  My argument was that we
should reuse CALL_INSN_FUNCTION_USAGE instead, since it already holds
other such special uses and clobbers.  The difference is that the special
registers we need to know about here are call-clobbered, whereas until now
it has only been necessary to mention call-saved ones (or, in the case of
USEs, registers set up before the call and not otherwise used by the call).

Thanks,
Richard


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]