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]
Other format: [Raw text]

Re: Fix pattern validation in genrecog


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?

Thanks,
Richard


gcc/
	* genrecog.c (match_pattern_1): Expect the pattern to be a SEQUENCE
	for define_peephole2s.
	(get_peephole2_pattern): New function.
	(main): Use it.  Call validate_pattern.
OK.
jeff


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