From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg McGary To: Joern Rennecke Cc: gcc@gcc.gnu.org Subject: Re: Need advice on bounds checking approaches Date: Fri, 24 Mar 2000 12:28:00 -0000 Message-id: References: <200003242007.UAA14155@phal.cygnus.co.uk> X-SW-Source: 2000-03/msg00647.html Joern Rennecke writes: > > Question: with the above plan, is there a way to provide a default > > expansion of the "check_bounds" pattern into primitive RTL > > (comparisons, conditional branches and call to abort) for those > > targets that don't define an insn for "check_bounds"? > > You can use HAVE_check_bounds to test if a "check_bounds" pattern has been > defined in the md file. If it is defined, you can use gen_check_bounds > to generate this pattern. The expander might fail (e.g. because the > target can implement the bounds checking insn only for a particular > cpu_, in which case you get a zero return value from gen_check_bounds. I am aware of HAVE_check_bounds. Unfortunately, it doesn't do what I want. If HAVE_check_bounds, I could generate "check_bounds", and if ! HAVE_check_bounds, I could generate the primitive RTL (compares + conditional branches + abort). If ! HAVE_check_bounds, then I lose the ability to conveniently optimize away redundant checks, and my basic blocks get sliced up by the presence of extra branches. What I want is to always generate check_bounds insns, always optimize away redundant checks the same way, and then provide a default *expansion* if the MD doesn't define one. Is that feasible, or am I dreaming? Greg