This is the mail archive of the gcc@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]

Re: Need advice on bounds checking approaches


Greg McGary <gkm@eng.ascend.com> writes:

> For i386, it makes sense the use the `bound' instruction.

I should qualify that: `bound' is optimal for space, but
it might run faster to decompose into register compares.
I haven't analyzed it yet.

> For MIPS, I'll want to generate a `break' instruction.

I now see that since ISA II, mips has had conditional trap insns, so
we should use those.

> > I can't think of any support on ppc for this that isn't already
> > represented in the machine description through the TRAP RTXs.
> 
> Conditional traps aren't widely available (only i960, m68k, powerpc,
> sparc), so that approach doesn't help all that much for portability.
> Is there something more that I'm missing?

Add PA, C[34]x and MIPS to that list.  Others can be simulated with
conditional branches around unconditional traps.  We still need CSE to
optimize away redundant conditional traps.  An advantage to emitting
separate conditional traps for low and high bounds checks is that the
separate lower-bound check can be more easily be moved out of a loop
for monotonically increasing pointer livs.

Greg

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