diff options
author | Richard Biener <rguenther@suse.de> | 2015-10-09 11:47:31 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-10-09 11:47:31 +0000 |
commit | eee7b6c4a21d2592072600172c0133e903607b83 (patch) | |
tree | 81a81f16a67ae4ce487035cc32f0dfeee9d84b1e /gcc/genmatch.c | |
parent | 0c063d603240a6a6f52cba0bf6a62d3ca14c8d16 (diff) | |
download | gcc-eee7b6c4a21d2592072600172c0133e903607b83.zip gcc-eee7b6c4a21d2592072600172c0133e903607b83.tar.gz gcc-eee7b6c4a21d2592072600172c0133e903607b83.tar.bz2 |
genmatch.c (print_operand): Fix formatting.
2015-10-09 Richard Biener <rguenther@suse.de>
* genmatch.c (print_operand): Fix formatting.
(dt_node::append_simplify): Warn for multiple simplifiers
that match the same pattern.
* match.pd (log (exp @0)): Remove duplicates.
From-SVN: r228648
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r-- | gcc/genmatch.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c index 102a635..b05760e 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -710,13 +710,9 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false) { if (capture *c = dyn_cast<capture *> (o)) { - fprintf (f, "@%u", c->where); if (c->what && flattened == false) - { - putc (':', f); - print_operand (c->what, f, flattened); - putc (' ', f); - } + print_operand (c->what, f, flattened); + fprintf (f, "@%u", c->where); } else if (predicate *p = dyn_cast<predicate *> (o)) @@ -727,18 +723,22 @@ print_operand (operand *o, FILE *f = stderr, bool flattened = false) else if (expr *e = dyn_cast<expr *> (o)) { - fprintf (f, "(%s", e->operation->id); - - if (flattened == false) + if (e->ops.length () == 0) + fprintf (f, "%s", e->operation->id); + else { - putc (' ', f); - for (unsigned i = 0; i < e->ops.length (); ++i) + fprintf (f, "(%s", e->operation->id); + + if (flattened == false) { - print_operand (e->ops[i], f, flattened); - putc (' ', f); + for (unsigned i = 0; i < e->ops.length (); ++i) + { + putc (' ', f); + print_operand (e->ops[i], f, flattened); + } } + putc (')', f); } - putc (')', f); } else @@ -1563,6 +1563,14 @@ dt_node::append_simplify (simplify *s, unsigned pattern_no, dt_operand **indexes) { dt_simplify *n = new dt_simplify (s, pattern_no, indexes); + for (unsigned i = 0; i < kids.length (); ++i) + if (dt_simplify *s2 = dyn_cast <dt_simplify *> (kids[i])) + { + warning_at (s->match->location, "duplicate pattern"); + warning_at (s2->s->match->location, "previous pattern defined here"); + print_operand (s->match, stderr); + fprintf (stderr, "\n"); + } return append_node (n); } |