Since we allow arbitrary IDs in captures the capture array is dense and thus we don't need to clear it before initializing. We can also emit more compact source by simply using an initializer.
- tree captures[3] ATTRIBUTE_UNUSED = {}; - captures[0] = o20; - captures[1] = op1; - captures[2] = op2; + tree captures[3] ATTRIBUTE_UNUSED = { o20, op1, op2 }; this has a surprinsingly big effect on code-size at -O0 as well (on the positive side). Boostrap & regtest running on x86_64-unknown-linux-gnu. Richard. 2015-08-03 Richard Biener <rguent...@suse.de> * genmatch.c (dt_simplify::gen): Create captures array with an initializer. Index: gcc/genmatch.c =================================================================== --- gcc/genmatch.c (revision 226490) +++ gcc/genmatch.c (working copy) @@ -3023,16 +3195,15 @@ dt_simplify::gen (FILE *f, int indent, b 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); - - 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)); - } + { + 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 = 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)