This is the mail archive of the
mailing list for the GCC project.
Re: Fix pattern validation in genrecog
- From: Jeff Law <law at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, richard dot sandiford at arm dot com
- Date: Mon, 11 May 2015 13:39:05 -0600
- Subject: Re: Fix pattern validation in genrecog
- Authentication-results: sourceware.org; auth=none
- References: <87twvjtrf4 dot fsf at e105548-lin dot cambridge dot arm dot com>
On 05/11/2015 03:05 AM, Richard Sandiford wrote:
Thomas pointed out that, while I'd kept the code to validate patterns
for things like missing modes, the code wasn't being used. Fixed with
the patch below.
I ended up reinstating the original code to create a single rtx
pattern for a define_peephole2 sequence, so that it could be
passed to validate_pattern as before. One of the reasons I got
rid of the code originally was because I didn't like the idea of
a sequence of define_peephole2 instructions being put into a
PARALLEL -- there's nothing parallel about them, and it would be
easy to confuse the result with a "real" parallel in a define_insn
or define_split match. I therefore changed it to use SEQUENCE instead.
(Not that it matters: nothing actually looks at the code.)
I also threw in a check for zero-length define_peephole2s while there.
This is enforced syntactically for other define_*s, but it's possible
to write a define_peephole2 that just asks for scratch registers and
doesn't actually match anything.
Tested on x86_64-linux-gnu. OK to install?
* genrecog.c (match_pattern_1): Expect the pattern to be a SEQUENCE
(get_peephole2_pattern): New function.
(main): Use it. Call validate_pattern.