diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-14 08:37:41 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-11-14 08:37:41 +0000 |
commit | 7c430700aab09021e49c01db2bc8341d8fbebe82 (patch) | |
tree | 404570d7f13d6b5d75f9d23557a8a39fbaa8fc18 | |
parent | 809ccc6ca489412356cbebf2134adf1475e8b5f4 (diff) | |
download | gcc-7c430700aab09021e49c01db2bc8341d8fbebe82.tar.gz |
2014-11-14 Richard Biener <rguenther@suse.de>
* genmatch.c (add_operator): Allow CONSTRUCTOR.
(dt_node::gen_kids): Handle CONSTRUCTOR not as GENERIC.
(parser::parse_op): Allow to iterate over predicates.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217541 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/genmatch.c | 15 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 682f6fd1e33..07c321ac733 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-14 Richard Biener <rguenther@suse.de> + + * genmatch.c (add_operator): Allow CONSTRUCTOR. + (dt_node::gen_kids): Handle CONSTRUCTOR not as GENERIC. + (parser::parse_op): Allow to iterate over predicates. + 2014-11-14 Jakub Jelinek <jakub@redhat.com> * configure.ac (--with-diagnostics-color): New configure diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 6a2f8942a27..fdd02a5358a 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -310,7 +310,9 @@ add_operator (enum tree_code code, const char *id, /* For {REAL,IMAG}PART_EXPR and VIEW_CONVERT_EXPR. */ && strcmp (tcc, "tcc_reference") != 0 /* To have INTEGER_CST and friends as "predicate operators". */ - && strcmp (tcc, "tcc_constant") != 0) + && strcmp (tcc, "tcc_constant") != 0 + /* And allow CONSTRUCTOR for vector initializers. */ + && !(code == CONSTRUCTOR)) return; operator_id *op = new operator_id (code, id, nargs, tcc); id_base **slot = operators->find_slot_with_hash (op, op->hashval, INSERT); @@ -2013,7 +2015,8 @@ dt_node::gen_kids (FILE *f, bool gimple) dt_operand *op = as_a<dt_operand *> (kids[i]); if (expr *e = dyn_cast <expr *> (op->op)) { - if (e->ops.length () == 0) + if (e->ops.length () == 0 + && (!gimple || !(*e->operation == CONSTRUCTOR))) generic_exprs.safe_push (op); else if (e->operation->kind == id_base::FN) { @@ -3030,6 +3033,14 @@ parser::parse_op () expression. */ op = new expr (opr); } + else if (user_id *code = dyn_cast <user_id *> (opr)) + { + if (code->nargs != 0) + fatal_at (token, "using an operator with operands as predicate"); + /* Parse the zero-operand operator "predicates" as + expression. */ + op = new expr (opr); + } else if (predicate_id *p = dyn_cast <predicate_id *> (opr)) op = new predicate (p); else |