This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch i386]: Expand sibling-tail-calls via accumulator register
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Kai Tietz <ktietz at redhat dot com>
- Cc: Jeff Law <law at redhat dot com>, "H.J. Lu" <hjl dot tools at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Richard Henderson <rth at redhat dot com>
- Date: Mon, 26 May 2014 21:35:43 +0200
- Subject: Re: [patch i386]: Expand sibling-tail-calls via accumulator register
- Authentication-results: sourceware.org; auth=none
- References: <356718653 dot 5712706 dot 1400794422397 dot JavaMail dot zimbra at redhat dot com> <CAMe9rOrCiRSTA+4jiGeQLub4P--KX8XzkYiwAVWZUxzunhvkPQ at mail dot gmail dot com> <537F8DC7 dot 3090906 at redhat dot com> <777706000 dot 8424762 dot 1401128436051 dot JavaMail dot zimbra at redhat dot com> <20140526183208 dot GG10386 at tucnak dot redhat dot com> <1487116948 dot 8449887 dot 1401132170121 dot JavaMail dot zimbra at redhat dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, May 26, 2014 at 03:22:50PM -0400, Kai Tietz wrote:
> > In any case, I still can't understand how limiting the choices of the
> > register allocator can improve code rather than making it worse.
> > If the accumulator is available there, why doesn't the RA choose it
> > if it is beneficial? And why aren't other registers similarly suitable for
> > that? Say r10, r11...
>
> I don't see it as limiting. The intend of this is more to have fixed
> patterns on epilogue. And in fact is accumulator that register which can
> be used as scratch-register for all i386-targets. Beside for
> varardic-functions, which anyway aren't any good candidates for
> sibling-call-optimization (on x86_64 due ABI). Well, for x86_64 ABI we
> might could consider to use R11_REG instead of AX_REG. Is there any
> advantage in special-case for x86_64 ABI? The R10-register isn't a good
> choice due it might be used as drap-register and therefore can't be loaded
> before epilogue gets destroyed.
It is limiting. If r11/rax and often also r10 can be chosen, telling the RA
it can only choose rax is a limitation.
Can you show some testcase where your patch is actually beneficial? We
should analyze why the RA made that choice.
Jakub