This re-orders operands so we can default-initialize them to zero now that we only have a single autogenerated function.
Richard. 2014-06-24 Richard Biener <rguent...@suse.de> * genmatch.c (write_fn_prototype): Remove and inline... (decision_tree::gen_gimple): ...here. * gimple-match-head.c (gimple_match_and_simplify): Adjust operand order to put operands last. Make the last two default initialized to zero. (gimple_resimplify1): Adjust. (gimple_resimplify2): Likewise. (gimple_resimplify3): Likewise. (gimple_match_and_simplify): Likewise. Index: genmatch.c =================================================================== --- genmatch.c (revision 211939) +++ genmatch.c (working copy) @@ -849,16 +849,6 @@ decision_tree::print (FILE *f) return decision_tree::print_node (root, f); } -void -write_fn_prototype (FILE *f, unsigned n) -{ - fprintf (f, "static bool\n" - "gimple_match_and_simplify (code_helper code, tree type"); - for (unsigned i = 0; i < n; ++i) - fprintf (f, ", tree op%d", i); - fprintf (f, ", code_helper *res_code, tree *res_ops, gimple_seq *seq, tree (*valueize)(tree))\n"); -} - char * dt_operand::get_name (char *name) { @@ -1132,13 +1122,13 @@ dt_simplify::gen_gimple (FILE *f) void decision_tree::gen_gimple (FILE *f) { - write_fn_prototype (f, 1); - fprintf (f, "{ return gimple_match_and_simplify (code, type, op0, NULL_TREE, NULL_TREE, res_code, res_ops, seq, valueize); }\n\n"); - - write_fn_prototype (f, 2); - fprintf (f, "{ return gimple_match_and_simplify (code, type, op0, op1, NULL_TREE, res_code, res_ops, seq, valueize); }\n\n"); - - write_fn_prototype (f, 3); + fprintf (f, "static bool\n" + "gimple_match_and_simplify (code_helper *res_code, tree *res_ops,\n" + " gimple_seq *seq, tree (*valueize)(tree),\n" + " code_helper code, tree type"); + for (unsigned i = 0; i < 3; ++i) + fprintf (f, ", tree op%d", i); + fprintf (f, ")\n"); fprintf (f, "{\n"); for (unsigned i = 0; i < root->kids.length (); i++) Index: gimple-match-head.c =================================================================== --- gimple-match-head.c (revision 211891) +++ gimple-match-head.c (working copy) @@ -60,18 +60,13 @@ private: int rep; }; -/* Forward declarations of the private auto-generated matchers. They - expect valueized operands in canonical order and they do not +/* Forward declarations of the private auto-generated matcher. + It expects valueized operands in canonical order and does not perform simplification of all-constant operands. */ -static bool gimple_match_and_simplify (code_helper, tree, tree, - code_helper *, tree *, - gimple_seq *, tree (*)(tree)); -static bool gimple_match_and_simplify (code_helper, tree, tree, tree, - code_helper *, tree *, - gimple_seq *, tree (*)(tree)); -static bool gimple_match_and_simplify (code_helper, tree, tree, tree, tree, - code_helper *, tree *, - gimple_seq *, tree (*)(tree)); +static bool gimple_match_and_simplify (code_helper *, tree *, + gimple_seq *, tree (*)(tree), + code_helper, tree, + tree, tree = NULL_TREE, tree = NULL_TREE); /* Return whether T is a constant that we'll dispatch to fold to @@ -130,8 +125,8 @@ gimple_resimplify1 (gimple_seq *seq, code_helper res_code2; tree res_ops2[3] = {}; - if (gimple_match_and_simplify (*res_code, type, res_ops[0], - &res_code2, res_ops2, seq, valueize)) + if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize, + *res_code, type, res_ops[0])) { *res_code = res_code2; res_ops[0] = res_ops2[0]; @@ -199,8 +194,8 @@ gimple_resimplify2 (gimple_seq *seq, code_helper res_code2; tree res_ops2[3] = {}; - if (gimple_match_and_simplify (*res_code, type, res_ops[0], res_ops[1], - &res_code2, res_ops2, seq, valueize)) + if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize, + *res_code, type, res_ops[0], res_ops[1])) { *res_code = res_code2; res_ops[0] = res_ops2[0]; @@ -269,9 +264,9 @@ gimple_resimplify3 (gimple_seq *seq, code_helper res_code2; tree res_ops2[3] = {}; - if (gimple_match_and_simplify (*res_code, type, - res_ops[0], res_ops[1], res_ops[2], - &res_code2, res_ops2, seq, valueize)) + if (gimple_match_and_simplify (&res_code2, res_ops2, seq, valueize, + *res_code, type, + res_ops[0], res_ops[1], res_ops[2])) { *res_code = res_code2; res_ops[0] = res_ops2[0]; @@ -343,8 +338,8 @@ gimple_match_and_simplify (enum tree_cod code_helper rcode; tree ops[3] = {}; - if (!gimple_match_and_simplify (code, type, op0, - &rcode, ops, seq, valueize)) + if (!gimple_match_and_simplify (&rcode, ops, seq, valueize, + code, type, op0)) return NULL_TREE; return maybe_push_res_to_seq (rcode, type, ops, seq); } @@ -374,8 +369,8 @@ gimple_match_and_simplify (enum tree_cod code_helper rcode; tree ops[3] = {}; - if (!gimple_match_and_simplify (code, type, op0, op1, - &rcode, ops, seq, valueize)) + if (!gimple_match_and_simplify (&rcode, ops, seq, valueize, + code, type, op0, op1)) return NULL_TREE; return maybe_push_res_to_seq (rcode, type, ops, seq); } @@ -406,8 +401,8 @@ gimple_match_and_simplify (enum tree_cod code_helper rcode; tree ops[3] = {}; - if (!gimple_match_and_simplify (code, type, op0, op1, op2, - &rcode, ops, seq, valueize)) + if (!gimple_match_and_simplify (&rcode, ops, seq, valueize, + code, type, op0, op1, op2)) return NULL_TREE; return maybe_push_res_to_seq (rcode, type, ops, seq); } @@ -436,8 +431,8 @@ gimple_match_and_simplify (enum built_in code_helper rcode; tree ops[3] = {}; - if (!gimple_match_and_simplify (fn, type, arg0, - &rcode, ops, seq, valueize)) + if (!gimple_match_and_simplify (&rcode, ops, seq, valueize, + fn, type, arg0)) return NULL_TREE; return maybe_push_res_to_seq (rcode, type, ops, seq); }