This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [MIPS] Implement static stack checking


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	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)
> 
> ?

 For the record that can be easily rewritten to support the MIPS16 mode, 
e.g.:

	move	$1,r2
1:
	d/addiu	r1,interval
	li	r2,0
	sw/sd	r2,0(r1)
	move	r2,$1
	cmp	r1,r2
	btnez	1b

with $2 and $3 used as temporaries (in addition to $1) as these are I 
believe available in MIPS16 prologues ($1 obviously is).  The juggling 
with $1 can be avoided if the probe used need not be zero (need it?).  
The range of <interval> supported by the machine instruction encodings 
available is the same as for the standard MIPS or microMIPS mode.

 If we care about MIPS16 support, that is.

  Maciej


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]