From d822570f733f2660b8bd5c78cf5077e654c4387e Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 30 Oct 2014 15:36:05 +0000 Subject: genmatch.c (capture_info::walk_c_expr): Ignore capture uses inside TREE_TYPE (). 2014-10-30 Richard Biener * genmatch.c (capture_info::walk_c_expr): Ignore capture uses inside TREE_TYPE (). * gimple-ssa-strength-reduction.c (stmt_cost): Use CASE_CONVERT. (find_candidates_dom_walker::before_dom_children): Likewise. (replace_mult_candidate): Use CONVERT_EXPR_CODE_P. (replace_profitable_candidates): Likewise. * tree-ssa-dom.c (initialize_hash_element): Canonicalize CONVERT_EXPR_CODE_P to CONVERT_EXPR. * convert.c (convert_to_integer): Use CASE_CONVERT. From-SVN: r216939 --- gcc/genmatch.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'gcc/genmatch.c') diff --git a/gcc/genmatch.c b/gcc/genmatch.c index ebdb7d3..35d852c 100644 --- a/gcc/genmatch.c +++ b/gcc/genmatch.c @@ -2004,21 +2004,34 @@ capture_info::walk_result (operand *o, bool conditional_p) void capture_info::walk_c_expr (c_expr *e) { - /* Give up for C exprs mentioning captures. */ + /* Give up for C exprs mentioning captures not inside TREE_TYPE (). */ + unsigned p_depth = 0; for (unsigned i = 0; i < e->code.length (); ++i) - if (e->code[i].type == CPP_ATSIGN - && (e->code[i+1].type == CPP_NUMBER - || e->code[i+1].type == CPP_NAME) - && !(e->code[i+1].flags & PREV_WHITE)) - { - const cpp_token *n = &e->code[i+1]; - const char *id; - if (n->type == CPP_NUMBER) - id = (const char *)n->val.str.text; - else - id = (const char *)CPP_HASHNODE (n->val.node.node)->ident.str; - info[(*e->capture_ids)[id]].force_no_side_effects_p = true; - } + { + const cpp_token *t = &e->code[i]; + const cpp_token *n = i < e->code.length () - 1 ? &e->code[i+1] : NULL; + if (t->type == CPP_NAME + && strcmp ((const char *)CPP_HASHNODE + (t->val.node.node)->ident.str, "TREE_TYPE") == 0 + && n->type == CPP_OPEN_PAREN) + p_depth++; + else if (t->type == CPP_CLOSE_PAREN + && p_depth > 0) + p_depth--; + else if (p_depth == 0 + && t->type == CPP_ATSIGN + && (n->type == CPP_NUMBER + || n->type == CPP_NAME) + && !(n->flags & PREV_WHITE)) + { + const char *id; + if (n->type == CPP_NUMBER) + id = (const char *)n->val.str.text; + else + id = (const char *)CPP_HASHNODE (n->val.node.node)->ident.str; + info[(*e->capture_ids)[id]].force_no_side_effects_p = true; + } + } } -- cgit v1.1