Hi!

Great to see this.  Just a few comments...

On Thu, Nov 10, 2016 at 02:25:47PM +0000, Kyrill Tkachov wrote:
> +/* Implement TARGET_SHRINK_WRAP_GET_SEPARATE_COMPONENTS.  */
> +
> +static sbitmap
> +aarch64_get_separate_components (void)
> +{
> +  /* Calls to alloca further extend the stack frame and it can be messy to
> +     figure out the location of the stack slots for each register.
> +     For now be conservative.  */
> +  if (cfun->calls_alloca)
> +    return NULL;

The generic code already disallows functions with alloca (in
try_shrink_wrapping_separate).

> +static void
> +aarch64_emit_prologue_components (sbitmap components)
> +{
> +  rtx ptr_reg = gen_rtx_REG (Pmode, frame_pointer_needed
> +                          ? HARD_FRAME_POINTER_REGNUM
> +                          : STACK_POINTER_REGNUM);
> +
> +  for (unsigned regno = R0_REGNUM; regno <= V31_REGNUM; regno++)
> +    if (bitmap_bit_p (components, regno))
> +      {
> +     rtx reg = gen_rtx_REG (Pmode, regno);
> +     HOST_WIDE_INT offset = cfun->machine->frame.reg_offset[regno];
> +     if (!frame_pointer_needed)
> +     offset += cfun->machine->frame.frame_size
> +               - cfun->machine->frame.hard_fp_offset;
> +     rtx addr = plus_constant (Pmode, ptr_reg, offset);
> +     rtx mem = gen_frame_mem (Pmode, addr);
> +
> +     RTX_FRAME_RELATED_P (emit_move_insn (mem, reg)) = 1;
> +      }
> +}

I think you should emit the CFI notes here directly, just like for the
epilogue components.


Segher

Reply via email to