summaryrefslogtreecommitdiff
path: root/gcc/genmatch.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-03 13:20:22 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2015-08-03 13:20:22 +0000
commit5ba71b38f40aa1224af57211e8f2be3a77d37b07 (patch)
tree9ad2a7a272f9a8e1bf4621f0014ca59e6e05cc40 /gcc/genmatch.c
parent605922af1deb447d85c56f66cf39ff08db156fad (diff)
downloadgcc-5ba71b38f40aa1224af57211e8f2be3a77d37b07.tar.gz
2015-08-03 Richard Biener <rguenther@suse.de>
* genmatch.c (dt_simplify::gen): Create captures array with an initializer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226503 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genmatch.c')
-rw-r--r--gcc/genmatch.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index a1bc410c39b..f854794c635 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -3023,16 +3023,15 @@ dt_simplify::gen (FILE *f, int indent, bool gimple)
output_line_directive (f,
s->result ? s->result->location : s->match->location);
if (s->capture_max >= 0)
- fprintf_indent (f, indent, "tree captures[%u] ATTRIBUTE_UNUSED = {};\n",
- s->capture_max + 1);
+ {
+ char opname[20];
+ fprintf_indent (f, indent, "tree captures[%u] ATTRIBUTE_UNUSED = { %s",
+ s->capture_max + 1, indexes[0]->get_name (opname));
- for (int i = 0; i <= s->capture_max; ++i)
- if (indexes[i])
- {
- char opname[20];
- fprintf_indent (f, indent, "captures[%u] = %s;\n",
- i, indexes[i]->get_name (opname));
- }
+ for (int i = 1; i <= s->capture_max; ++i)
+ fprintf (f, ", %s", indexes[i]->get_name (opname));
+ fprintf (f, " };\n");
+ }
/* If we have a split-out function for the actual transform, call it. */
if (info && info->fname)