This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][AArch64] Separate shrink wrapping hooks implementation
- From: Kyrill Tkachov <kyrylo dot tkachov at foss dot arm dot com>
- To: Segher Boessenkool <segher at kernel dot crashing dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Marcus Shawcroft <marcus dot shawcroft at arm dot com>, Richard Earnshaw <Richard dot Earnshaw at arm dot com>, James Greenhalgh <james dot greenhalgh at arm dot com>
- Date: Thu, 10 Nov 2016 16:45:00 +0000
- Subject: Re: [PATCH][AArch64] Separate shrink wrapping hooks implementation
- Authentication-results: sourceware.org; auth=none
- References: <5824836B.5030302@foss.arm.com> <20161110162605.GC21932@gate.crashing.org>
On 10/11/16 16:26, Segher Boessenkool wrote:
Hi!
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).
Ok, I'll remove this.
+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.
The prologue code in expand_prologue doesn't attach any explicit notes,
so I didn't want to deviate from that. Looking at the powerpc implementation,
would that be a REG_CFA_OFFSET with the (SET (mem) (reg)) expression for saving
the reg?
Thanks,
Kyrill
Segher