https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86486

--- Comment #3 from Tamar Christina <tnfchris at gcc dot gnu.org> ---
Author: tnfchris
Date: Mon Oct  1 12:58:21 2018
New Revision: 264750

URL: https://gcc.gnu.org/viewcvs?rev=264750&root=gcc&view=rev
Log:
Add a hook to support telling the mid-end when to probe the stack.

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.

gcc/

        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.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/doc/tm.texi
    trunk/gcc/doc/tm.texi.in
    trunk/gcc/explow.c
    trunk/gcc/target.def
    trunk/gcc/targhooks.c
    trunk/gcc/targhooks.h

Reply via email to