Re: [MIPS] Implement static stack checking

2012-10-24 Thread Richard Sandiford
Eric Botcazou writes: >> But why do we want the loop at all if the rounded size is zero? >> It's a compile-time constant after all. > > Yes, this never occurs in practice because of the value set for > PROBE_INTERVAL > and STACK_CHECK_PROTECT. This can only occur in the dynamic case handled in

Re: [MIPS] Implement static stack checking

2012-10-24 Thread Eric Botcazou
> But why do we want the loop at all if the rounded size is zero? > It's a compile-time constant after all. Yes, this never occurs in practice because of the value set for PROBE_INTERVAL and STACK_CHECK_PROTECT. This can only occur in the dynamic case handled in explow.c:probe_stack_range. All

Re: [MIPS] Implement static stack checking

2012-10-23 Thread Maciej W. Rozycki
On Mon, 22 Oct 2012, Richard Sandiford wrote: > > The loop probes at FIRST + N * PROBE_INTERVAL for values of N from 1 until > > it > > is equal to ROUNDED_SIZE, inclusive, so FIRST + SIZE is always probed. > > Doh! But in that case, rather than: > > 1: > beq r1,r2,2f > addiu

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Richard Sandiford
Sorry, one more thing (obviously a bad night) Eric Botcazou writes: > + if (TARGET_64BIT && TARGET_LONG64) > + emit_insn (gen_probe_stack_rangedi (r3, r3, r12)); > + else > + emit_insn (gen_probe_stack_rangesi (r3, r3, r12)); Please use: emit_insn (PMODE_INSN (gen_probe_st

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Richard Sandiford
Eric Botcazou writes: >> Doh! But in that case, rather than: >> >> 1: >> beq r1,r2,2f >> addiu r1,r1,interval >> b 1b >> sw $0,0(r1) >> 2: >> >> why not just: >> >> 1: >> addiu r1,r1,interval >> bne r1,r2,1b >> sw $0,0(r1) >> >> ?

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Eric Botcazou
> Doh! But in that case, rather than: > > 1: > beq r1,r2,2f > addiu r1,r1,interval > b 1b > sw $0,0(r1) > 2: > > why not just: > > 1: > addiu r1,r1,interval > bne r1,r2,1b > sw $0,0(r1) > > ? The latter will always probe on

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Richard Sandiford
Eric Botcazou writes: >> I Might Be Wrong, but it looks like this won't probe at FIRST + SIZE >> in the case where SIZE == ROUNDED_SIZE, because the loop exits on that >> value without probing it. Should the last line be unconditional, >> or does the loop need to be a do-while instead? (I suppos

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Eric Botcazou
> This function doesn't work with MIPS16 mode. Maybe just: > > if (TARGET_MIPS16) > sorry ("MIPS16 stack probes"); > > (We can't test TARGET_MIPS16 in something like STACK_CHECK_STATIC_BUILTIN > because MIPS16ness is a per-function property.) I put if (TARGET_MIPS16) sorry ("-fstac

Re: [MIPS] Implement static stack checking

2012-10-22 Thread Richard Sandiford
Eric Botcazou writes: > This implements static stack checking for MIPS, i.e. checking of the static > part of the frame in the prologue when -fstack-check is specified. This is > very similar to the PowerPC and SPARC implementations and makes it possible > to > pass the full ACATS testsuite w

[MIPS] Implement static stack checking

2012-10-21 Thread Eric Botcazou
This implements static stack checking for MIPS, i.e. checking of the static part of the frame in the prologue when -fstack-check is specified. This is very similar to the PowerPC and SPARC implementations and makes it possible to pass the full ACATS testsuite with -fstack-check. Tested on mips