Hi All,

I'm looking for permission to backport this patch to the GCC-8 branch
to fix PR86486.

OK for backport?

Thanks,
Tamar

> -----Original Message-----
> From: Jeff Law <l...@redhat.com>
> Sent: Wednesday, July 11, 2018 19:53
> To: Tamar Christina <tamar.christ...@arm.com>; gcc-patches@gcc.gnu.org
> Cc: nd <n...@arm.com>; rguent...@suse.de; i...@airs.com
> Subject: Re: [PATCH][GCC][mid-end] Add a hook to support telling the mid-
> end when to probe the stack [patch (2/6)]
> 
> On 07/11/2018 05:21 AM, Tamar Christina wrote:
> > Hi All,
> >
> > This patch adds a hook to tell the mid-end about the probing
> > requirements of the target.  On AArch64 we allow a specific range for
> > which no probing needs to be done.  This same range is also the amount
> > that will have to be probed up when a probe is needed after dropping the
> stack.
> >
> > Defining this probe comes with the extra requirement that the outgoing
> > arguments size of any function that uses alloca and stack clash be at
> > the very least 8 bytes.  With this invariant we can skip doing the
> > zero checks for alloca and save some code.
> >
> > A simplified version of the AArch64 stack frame is:
> >
> >    +-----------------------+
> >    |                       |
> >    |                       |
> >    |                       |
> >    +-----------------------+
> >    |LR                     |
> >    +-----------------------+
> >    |FP                     |
> >    +-----------------------+
> >    |dynamic allocations    | -\      probe range hook effects these
> >    +-----------------------+   --\   and ensures that outgoing stack
> >    |padding                |      -- args is always > 8 when alloca.
> >    +-----------------------+  ---/   Which means it's always safe to probe
> >    |outgoing stack args    |-/       at SP
> >    +-----------------------+
> >
> >
> > This allows us to generate better code than without the hook without
> > affecting other targets.
> >
> > With this patch I am also removing the
> > stack_clash_protection_final_dynamic_probe
> > hook which was added specifically for AArch64 but that is no longer needed.
> >
> > Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu
> and no issues.
> > Both targets were tested with stack clash on and off by default.
> >
> > Ok for trunk?
> >
> > Thanks,
> > Tamar
> >
> > gcc/
> > 2018-07-11  Tamar Christina  <tamar.christ...@arm.com>
> >
> >     PR target/86486
> >     * explow.c (anti_adjust_stack_and_probe_stack_clash): Support
> custom
> >     probe ranges.
> >     * target.def (stack_clash_protection_alloca_probe_range): New.
> >     (stack_clash_protection_final_dynamic_probe): Remove.
> >     * targhooks.h (default_stack_clash_protection_alloca_probe_range)
> New.
> >     (default_stack_clash_protection_final_dynamic_probe): Remove.
> >     * targhooks.c: Likewise.
> >     * doc/tm.texi.in
> (TARGET_STACK_CLASH_PROTECTION_ALLOCA_PROBE_RANGE): New.
> >     (TARGET_STACK_CLASH_PROTECTION_FINAL_DYNAMIC_PROBE):
> Remove.
> >     * doc/tm.texi: Regenerate.
> >
> The control flow is a bit convoluted here, but after a few false starts where 
> I
> thought this was wrong, I think it's OK.
> 
> Jeff
> 
> 
> 
> 
> 
> 
> 
> 
> 

Reply via email to