aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-08-03 10:30:49 +0200
committerRichard Biener <rguenther@suse.de>2020-08-03 12:56:34 +0200
commitf2ec836aa1d6e2ed4fe286ffa661050888f652d1 (patch)
treece4297a0fb73ecf105ea9ebc714671719cdc7a59 /gcc
parent2b1c2a4bd9fb555dccde5d67d6da64547064e0e6 (diff)
downloadgcc-f2ec836aa1d6e2ed4fe286ffa661050888f652d1.zip
gcc-f2ec836aa1d6e2ed4fe286ffa661050888f652d1.tar.gz
gcc-f2ec836aa1d6e2ed4fe286ffa661050888f652d1.tar.bz2
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 <rguenther@suse.de> * 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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/doc/match-and-simplify.texi3
-rw-r--r--gcc/genmatch.c11
2 files changed, 10 insertions, 4 deletions
diff --git a/gcc/doc/match-and-simplify.texi b/gcc/doc/match-and-simplify.texi
index 41980ac..8752bd2 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 88459d9..109dce2 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<c_expr *> active_ifs;
vec<vec<user_id *> > active_fors;
hash_set<user_id *> *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");