Need advice on bounds checking approaches
Greg McGary
gkm@eng.ascend.com
Mon Mar 27 14:21:00 GMT 2000
Geoff Keating <geoffk@cygnus.com> writes:
> Greg McGary <gkm@eng.ascend.com> writes:
>
> > We can do without a special pass. CSE seems the best place to
> > eliminate redundant checks, so we'd just need a little bit of code to
> > handle the new check_bounds_rtx. We can just forget about doing
> > default translation of check_bounds_rtx into primitive RTL, and
> > require that targets supporting bounds checking handle it in the
> > machine description. So far, all of the targets I want to support
> > initially (i960, PowerPC, i386, MIPS) will benefit from special
> > handling in the MD file anyway.
> >
> > Does that sound reasonable?
>
> Why would these targets need special handling in the MD file?
I didn't say "need", I said "benefit from".
For i960, this sequence is optimal:
cmpo ptr, bas
concmp ext, ptr
faultle.f
For i386, it makes sense the use the `bound' instruction.
For MIPS, I'll want to generate a `break' instruction.
For PowerPC, I'll want to use conditional trap instructions.
> 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?
More information about the Gcc
mailing list