From: Richard Biener Date: Mon, 3 Aug 2020 08:30:49 +0000 (+0200) Subject: mark match.pd ! not implemented on GENERIC X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2ec836aa1d6e2ed4fe286ffa661050888f652d1;p=gcc.git mark match.pd ! not implemented on GENERIC This makes us error when the ! operator modifier is encountered when not targeting GIMPLE. 2020-08-03 Richard Biener * genmatch.c (parser::gimple): New. (parser::parser): Initialize gimple flag member. (parser::parse_expr): Error on ! operator modifier when not targeting GIMPLE. (main): Pass down gimple flag to parser ctor. * doc/match-and-simplify.texi: Amend accordingly. --- diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi index 41980acbfe9..8752bd2afe1 100644 --- a/gcc/doc/match-and-simplify.texi +++ b/gcc/doc/match-and-simplify.texi @@ -374,7 +374,8 @@ for example which moves the outer @code{plus} operation to the inner arms of the @code{vec_cond} expression but only if the actual plus -operations both simplify. +operations both simplify. Note this is currently only supported +for code generation targeting @code{GIMPLE}. As intermediate conversions are often optional there is a way to avoid the need to repeat patterns both with and without such diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 88459d9686e..109dce2d469 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -3946,7 +3946,7 @@ write_header (FILE *f, const char *head) class parser { public: - parser (cpp_reader *); + parser (cpp_reader *, bool gimple); private: const cpp_token *next (); @@ -3983,6 +3983,7 @@ private: void finish_match_operand (operand *); cpp_reader *r; + bool gimple; vec active_ifs; vec > active_fors; hash_set *oper_lists_set; @@ -4249,6 +4250,9 @@ parser::parse_expr () && token->type == CPP_NOT && !(token->flags & PREV_WHITE)) { + if (!gimple) + fatal_at (token, "forcing simplification to a leaf is not supported " + "for GENERIC"); eat_token (CPP_NOT); e->force_leaf = true; } @@ -5042,9 +5046,10 @@ parser::finish_match_operand (operand *op) /* Main entry of the parser. Repeatedly parse outer control structures. */ -parser::parser (cpp_reader *r_) +parser::parser (cpp_reader *r_, bool gimple_) { r = r_; + gimple = gimple_; active_ifs = vNULL; active_fors = vNULL; simplifiers = vNULL; @@ -5151,7 +5156,7 @@ main (int argc, char **argv) #include "internal-fn.def" /* Parse ahead! */ - parser p (r); + parser p (r, gimple); if (gimple) write_header (stdout, "gimple-match-head.c");