From 3922658a2b5ccb2ca2ee19b4d757358bc7ae193b Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 9 Apr 2013 08:26:45 +0000 Subject: [PATCH] tree.h (unsave_expr_now): Remove. 2013-04-09 Richard Biener * tree.h (unsave_expr_now): Remove. * tree-inline.c (mark_local_for_remap_r): Remove. (unsave_expr_1): Likewise. (unsave_r): Likewise. (unsave_expr_now): Likewise. * tree-ssa-copy.c (replace_exp_1): Use unshare_expr. (propagate_tree_value): Likewise. From-SVN: r197620 --- gcc/ChangeLog | 10 ++++ gcc/tree-inline.c | 134 -------------------------------------------- gcc/tree-ssa-copy.c | 4 +- gcc/tree.h | 1 - 4 files changed, 12 insertions(+), 137 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f2d2a610478..39fca53ca29 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2013-04-09 Richard Biener + + * tree.h (unsave_expr_now): Remove. + * tree-inline.c (mark_local_for_remap_r): Remove. + (unsave_expr_1): Likewise. + (unsave_r): Likewise. + (unsave_expr_now): Likewise. + * tree-ssa-copy.c (replace_exp_1): Use unshare_expr. + (propagate_tree_value): Likewise. + 2013-04-08 Steven Bosscher * doc/rtl.texi (sequence): Rewrite documentation to match the diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 978db6ea006..b94ba10ee0b 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -114,9 +114,6 @@ eni_weights eni_time_weights; static tree declare_return_variable (copy_body_data *, tree, tree, basic_block); static void remap_block (tree *, copy_body_data *); static void copy_bind_expr (tree *, int *, copy_body_data *); -static tree mark_local_for_remap_r (tree *, int *, void *); -static void unsave_expr_1 (tree); -static tree unsave_r (tree *, int *, void *); static void declare_inline_vars (tree, tree); static void remap_save_expr (tree *, void *, int *); static void prepend_lexical_block (tree current_block, tree new_block); @@ -4473,137 +4470,6 @@ remap_save_expr (tree *tp, void *st_, int *walk_subtrees) *tp = t; } -/* Called via walk_tree. If *TP points to a DECL_STMT for a local label, - copies the declaration and enters it in the splay_tree in DATA (which is - really an `copy_body_data *'). */ - -static tree -mark_local_for_remap_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data) -{ - copy_body_data *id = (copy_body_data *) data; - - /* Don't walk into types. */ - if (TYPE_P (*tp)) - *walk_subtrees = 0; - - else if (TREE_CODE (*tp) == LABEL_EXPR) - { - tree decl = TREE_OPERAND (*tp, 0); - - /* Copy the decl and remember the copy. */ - insert_decl_map (id, decl, id->copy_decl (decl, id)); - } - - return NULL_TREE; -} - -/* Perform any modifications to EXPR required when it is unsaved. Does - not recurse into EXPR's subtrees. */ - -static void -unsave_expr_1 (tree expr) -{ - switch (TREE_CODE (expr)) - { - case TARGET_EXPR: - /* Don't mess with a TARGET_EXPR that hasn't been expanded. - It's OK for this to happen if it was part of a subtree that - isn't immediately expanded, such as operand 2 of another - TARGET_EXPR. */ - if (TREE_OPERAND (expr, 1)) - break; - - TREE_OPERAND (expr, 1) = TREE_OPERAND (expr, 3); - TREE_OPERAND (expr, 3) = NULL_TREE; - break; - - default: - break; - } -} - -/* Called via walk_tree when an expression is unsaved. Using the - splay_tree pointed to by ST (which is really a `splay_tree'), - remaps all local declarations to appropriate replacements. */ - -static tree -unsave_r (tree *tp, int *walk_subtrees, void *data) -{ - copy_body_data *id = (copy_body_data *) data; - struct pointer_map_t *st = id->decl_map; - tree *n; - - /* Only a local declaration (variable or label). */ - if ((TREE_CODE (*tp) == VAR_DECL && !TREE_STATIC (*tp)) - || TREE_CODE (*tp) == LABEL_DECL) - { - /* Lookup the declaration. */ - n = (tree *) pointer_map_contains (st, *tp); - - /* If it's there, remap it. */ - if (n) - *tp = *n; - } - - else if (TREE_CODE (*tp) == STATEMENT_LIST) - gcc_unreachable (); - else if (TREE_CODE (*tp) == BIND_EXPR) - copy_bind_expr (tp, walk_subtrees, id); - else if (TREE_CODE (*tp) == SAVE_EXPR - || TREE_CODE (*tp) == TARGET_EXPR) - remap_save_expr (tp, st, walk_subtrees); - else - { - copy_tree_r (tp, walk_subtrees, NULL); - - /* Do whatever unsaving is required. */ - unsave_expr_1 (*tp); - } - - /* Keep iterating. */ - return NULL_TREE; -} - -/* Copies everything in EXPR and replaces variables, labels - and SAVE_EXPRs local to EXPR. */ - -tree -unsave_expr_now (tree expr) -{ - copy_body_data id; - - /* There's nothing to do for NULL_TREE. */ - if (expr == 0) - return expr; - - /* Set up ID. */ - memset (&id, 0, sizeof (id)); - id.src_fn = current_function_decl; - id.dst_fn = current_function_decl; - id.decl_map = pointer_map_create (); - id.debug_map = NULL; - - id.copy_decl = copy_decl_no_change; - id.transform_call_graph_edges = CB_CGE_DUPLICATE; - id.transform_new_cfg = false; - id.transform_return_to_modify = false; - id.transform_lang_insert_block = NULL; - - /* Walk the tree once to find local labels. */ - walk_tree_without_duplicates (&expr, mark_local_for_remap_r, &id); - - /* Walk the tree again, copying, remapping, and unsaving. */ - walk_tree (&expr, unsave_r, &id, NULL); - - /* Clean up. */ - pointer_map_destroy (id.decl_map); - if (id.debug_map) - pointer_map_destroy (id.debug_map); - - return expr; -} - /* Called via walk_gimple_seq. If *GSIP points to a GIMPLE_LABEL for a local label, copies the declaration and enters it in the splay_tree in DATA (which is really a 'copy_body_data *'. */ diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c index 75a415454de..1514745dda5 100644 --- a/gcc/tree-ssa-copy.c +++ b/gcc/tree-ssa-copy.c @@ -163,7 +163,7 @@ replace_exp_1 (use_operand_p op_p, tree val, if (TREE_CODE (val) == SSA_NAME) SET_USE (op_p, val); else - SET_USE (op_p, unsave_expr_now (val)); + SET_USE (op_p, unshare_expr (val)); } @@ -214,7 +214,7 @@ propagate_tree_value (tree *op_p, tree val) if (TREE_CODE (val) == SSA_NAME) *op_p = val; else - *op_p = unsave_expr_now (val); + *op_p = unshare_expr (val); } diff --git a/gcc/tree.h b/gcc/tree.h index f9114597e25..f30361a6b09 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -6018,7 +6018,6 @@ extern void indent_to (FILE *, int); extern bool debug_find_tree (tree, tree); /* This is in tree-inline.c since the routine uses data structures from the inliner. */ -extern tree unsave_expr_now (tree); extern tree build_duplicate_type (tree); /* In calls.c */ -- 2.30.2