This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v2] aarch64: Add split-stack initial support
- From: Jiong Wang <jiong dot wang at foss dot arm dot com>
- To: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>, Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 25 Jan 2017 12:10:07 +0000
- Subject: Re: [PATCH v2] aarch64: Add split-stack initial support
- Authentication-results: sourceware.org; auth=none
- References: <AM5PR0802MB261081EB50235D83C6462C4483DF0@AM5PR0802MB2610.eurprd08.prod.outlook.com> <85ebdf7a-a361-595d-6167-32c3dbd8f2b2@linaro.org> <8ee569de-c3d2-b37a-6463-ad151803531b@linaro.org> <AM5PR0802MB2610617CF37190BF4F18670383BF0@AM5PR0802MB2610.eurprd08.prod.outlook.com> <73b35310-87fe-7a11-241d-eacbcd08c6b0@linaro.org> <AM5PR0802MB26101A250CA612CA783386CB836E0@AM5PR0802MB2610.eurprd08.prod.outlook.com> <08ac897f-3aa0-56e2-609f-e4a84aad44bd@linaro.org>
On 24/01/17 18:05, Adhemerval Zanella wrote:
On 03/01/2017 13:13, Wilco Dijkstra wrote:
+ /* If function uses stacked arguments save the old stack value so morestack
+ can return it. */
+ reg11 = gen_rtx_REG (Pmode, R11_REGNUM);
+ if (cfun->machine->frame.saved_regs_size
+ || cfun->machine->frame.saved_varargs_size)
+ emit_move_insn (reg11, stack_pointer_rtx);
This doesn't look right - we could have many arguments even without varargs or
saved regs. This would need to check varargs as well as ctrl->args.size (I believe
that is the size of the arguments on the stack). It's fine to omit this optimization
in the first version - we already emit 2-3 extra instructions for the check anyway.
I will check for a better solution.
Hi Adhemerval
My only concern on this this patch is the initialization of R11 (internal arg
pointer). The current implementation looks to me is generating wrong code for a
testcase simply return the sum of ten int param, I see the function body is
using R11 while there is no initialization of it in split prologue, so if the
execution flow is *not* through __morestack, then R11 is not initialized.
As Wilco suggested, I feel using crtl->args.size instead of
cfun->machine->frame.saved_regs_size might be the correct approach after
checking assign_parms in function.c.