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 v2] aarch64: Add split-stack initial support


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.


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