Hi Eric,
Thanks for the examples.  I am able to map these instructions in your
examples back to RTX in your patch.

On 07/10/15 10:09, Eric Botcazou wrote:
Yes, it will generate either individual probes or a probing loop before the
frame is established when -fstack-check is passed.  For aarch64, a probe is a
store based on x9 of the form:

        str xzr, [x9, #offset]

with preceding instructions to compute x9 from sp, typically:

        sub x9, sp, #16384


If I read aarch64_emit_probe_stack_range correctly, these two
instructions are generated when (size <= PROBE_INTERVAL).  If
size <= 4 * PROBE_INTERVAL, more instructions are generated,

        sub x9, sp, #16384
        str xzr, [x9]

        sub x9, x9, #PROBE_INTERVAL
        str xzr, [x9]
        ... /* At most two instances of these two insn. */

        either
        sub x9, x9, #PROBE_INTERVAL
        str xzr, [x9, #offset]
        or
        str xzr, [x9, -16]

A probing loop uses both x9 and x10:

        sub     x9, sp, #12288
        sub     x10, sp, #36864
LPSRL0:
        sub     x9, x9, 4096
        str     xzr, [x9]
        cmp     x9, x10
        b.ne    LPSRL0


The probing loop is used when size > 4 * PROBE_INTERVAL

with an optional last probe:

        str     xzr, [x10,#-16]

and there can be an optional instruction before the probe,

        sub x10, x10, #PROBE_INTERVAL

Let me know if my understanding above is wrong.

When I read the examples and your patch, I happen to see a
nit in ChangeLog entry,

2015-10-06  Tristan Gingold  <ging...@adacore.com>
            Eric Botcazou  <ebotca...@adacore.com>

        PR middle-end/65958
        * config/aarch64/aarch64-protos.h (aarch64_output_probe_stack-range):
        Declare.

s/aarch64_output_probe_stack-range/aarch64_output_probe_stack_range

--
Yao (齐尧)

Reply via email to