Commit 10230017 by Richard Biener Committed by Richard Biener

genmatch.c (add_operator): Allow CONSTRUCTOR.

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.

From-SVN: r217541
parent 899c78ae
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> 2014-11-14 Jakub Jelinek <jakub@redhat.com>
* configure.ac (--with-diagnostics-color): New configure * configure.ac (--with-diagnostics-color): New configure
...@@ -310,7 +310,9 @@ add_operator (enum tree_code code, const char *id, ...@@ -310,7 +310,9 @@ add_operator (enum tree_code code, const char *id,
/* For {REAL,IMAG}PART_EXPR and VIEW_CONVERT_EXPR. */ /* For {REAL,IMAG}PART_EXPR and VIEW_CONVERT_EXPR. */
&& strcmp (tcc, "tcc_reference") != 0 && strcmp (tcc, "tcc_reference") != 0
/* To have INTEGER_CST and friends as "predicate operators". */ /* 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; return;
operator_id *op = new operator_id (code, id, nargs, tcc); operator_id *op = new operator_id (code, id, nargs, tcc);
id_base **slot = operators->find_slot_with_hash (op, op->hashval, INSERT); id_base **slot = operators->find_slot_with_hash (op, op->hashval, INSERT);
...@@ -2013,7 +2015,8 @@ dt_node::gen_kids (FILE *f, bool gimple) ...@@ -2013,7 +2015,8 @@ dt_node::gen_kids (FILE *f, bool gimple)
dt_operand *op = as_a<dt_operand *> (kids[i]); dt_operand *op = as_a<dt_operand *> (kids[i]);
if (expr *e = dyn_cast <expr *> (op->op)) 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); generic_exprs.safe_push (op);
else if (e->operation->kind == id_base::FN) else if (e->operation->kind == id_base::FN)
{ {
...@@ -3030,6 +3033,14 @@ parser::parse_op () ...@@ -3030,6 +3033,14 @@ parser::parse_op ()
expression. */ expression. */
op = new expr (opr); 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)) else if (predicate_id *p = dyn_cast <predicate_id *> (opr))
op = new predicate (p); op = new predicate (p);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment