There is the following code in aarch64_layout_frame:

else if (crtl->outgoing_args_size.is_constant (&const_outgoing_args_size)
         && frame.saved_regs_size.is_constant (&const_saved_regs_size)
         && const_outgoing_args_size + const_saved_regs_size < 512
         && (!saves_below_hard_fp_p || const_outgoing_args_size == 0)
                                                                    // 1)
         && !(cfun->calls_alloca                             
              && frame.hard_fp_offset.is_constant (&const_fp_offset)
              && const_fp_offset < max_push_offset))
  {
    /* Frame with small outgoing arguments:

       sub sp, sp, frame_size
       stp reg1, reg2, [sp, outgoing_args_size]
       stp reg3, reg4, [sp, outgoing_args_size + 16]  */
    frame.initial_adjust = frame.frame_size;
    frame.callee_offset = const_outgoing_args_size;
  }
......
else if (frame.hard_fp_offset.is_constant (&const_fp_offset)
         && const_fp_offset < max_push_offset)
  {
                                                                    // 2)
    /* Frame with large outgoing arguments or SVE saves, but with
       a small local area:

       stp reg1, reg2, [sp, -hard_fp_offset]!
       stp reg3, reg4, [sp, 16]
       [sub sp, sp, below_hard_fp_saved_regs_size]
       [save SVE registers relative to SP]
       sub sp, sp, outgoing_args_size  */


As described in 2), "Frame with large outgoing arguments or SVE saves,
but with a small local area".

But due to the condition at 1), the following code (small outgoing with
a small local area) also uses the insns in 2), which is slightly different
from the description:

//aarch64-linux-gnu-gcc   main.c -O0 -S main.s -g -w -fomit-frame-pointer

#include <stdio.h>
#include <alloca.h>
#define REP9(X) X,X,X,X,X,X,X,X,X

int alloc_size;

int main(void)
{
        outgoing (REP9(1));
        char * y = alloca(alloc_size);
        return 0;
}


Could the condition in 1) be removed, or am I missing something?

Thanks,
Dan.

Reply via email to