This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [AArch64][2/4] PR63596, honor tree-stdarg analysis result to improve VAARG codegen
- From: James Greenhalgh <james dot greenhalgh at arm dot com>
- To: Jiong Wang <jiong dot wang at foss dot arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, <nd at arm dot com>
- Date: Thu, 26 May 2016 15:06:49 +0100
- Subject: Re: [AArch64][2/4] PR63596, honor tree-stdarg analysis result to improve VAARG codegen
- Authentication-results: sourceware.org; auth=none
- Nodisclaimer: True
- References: <572CA45D dot 6060706 at foss dot arm dot com> <572CA702 dot 9020808 at foss dot arm dot com> <572CB18C dot 7000308 at foss dot arm dot com>
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:23
On Fri, May 06, 2016 at 04:00:28PM +0100, Jiong Wang wrote:
> This patch fixes PR63596.
>
> There is no need to push/pop all arguments registers. We only need to
> push and pop those registers used. These use info is calculated by a
> dedicated vaarg optimization tree pass "tree-stdarg", the backend should
> honor it's analysis result.
>
> For a simple testcase where vaarg declared but actually not used:
>
> int
> f (int a, ...)
> {
> return a;
> }
>
> before this patch, we are generating:
>
> f:
> sub sp, sp, #192
> stp x1, x2, [sp, 136]
> stp x3, x4, [sp, 152]
> stp x5, x6, [sp, 168]
> str x7, [sp, 184]
> str q0, [sp]
> str q1, [sp, 16]
> str q2, [sp, 32]
> str q3, [sp, 48]
> str q4, [sp, 64]
> str q5, [sp, 80]
> str q6, [sp, 96]
> str q7, [sp, 112]
> add sp, sp, 192
> ret
>
> after this patch, it's optimized into:
>
> f:
> ret
Can't argue with that! Nice!
> OK for trunk?
OK.
Thanks,
James