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]

Re: PATCH: pseudo conditional traps for ix86


In article <200008280704.AAA07356@kayak.mcgary.org> you write:
>+
>+;;; ix86 doesn't have conditional trap instructions, but we fake them
>+;;; for the sake of bounds checking.  By emitting bounds checks as
>+;;; conditional traps rather than as conditional jumps around
>+;;; unconditional traps we avoid introducing spurious basic-block
>+;;; boundaries and facilitate elimination of redundant checks.  In
>+;;; honor of the too-inflexible-for-BPs `bound' instruction, we use
>+;;; interrupt 5.

Why not use "into"?

The x86 _does_ have a conditional trap instruction, it's just not very
commonly used and thus easily overlooked.

Sure, it has strange behaviour - it looks at the overflow flag and
nothing else - but it's still saner than doing an "int $5" and having
jumps around it etc.  And quite often you probably _can_ use the
overflow flag directly. 

You could make it do an "into" when it can use the overflow flag, and
use a conditional "int $4" when it cannot.

		Linus

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