On 11/03/2017 04:14 AM, Richard Biener wrote:
On Fri, Nov 3, 2017 at 9:38 AM, Uros Bizjak <ubiz...@gmail.com> wrote:
* config/i386/i386.c (ix86_emit_restore_reg_using_pop): Prototype.
(ix86_adjust_stack_and_probe_stack_clash): Use a push/pop sequence
to probe at the start of a noreturn function.
* gcc.target/i386/stack-check-12.c: New test
- emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
- -GET_MODE_SIZE (word_mode)));
+ rtx_insn *insn = emit_insn (gen_push (gen_rtx_REG (word_mode, 0)));
Please use AX_REG instead of 0.
+ RTX_FRAME_RELATED_P (insn) = 1;
+ ix86_emit_restore_reg_using_pop (gen_rtx_REG (word_mode, 0));
Also here.
emit_insn (gen_blockage ());
BTW: Could we use an unused register here, if available? %eax is used
to pass first argument in regparm functions on 32bit targets.
Can you push %[er]sp? What about partial reg stalls when using other
registers (if the last set was a movb to it)? I guess [er]sp is safe here
as was [re]ax due to the ABI?
The whole point here is to touch the stack, but leave other machine
state as-is. So the register we use isn't terribly important (with the
possible exception of %esp). After the push/pop sequence the register
we use still has the same value & the stack pointer still points to the
same location as before the push/pop.
Jeff