diff options
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 3 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 23 | ||||
-rw-r--r-- | gcc/tree-flow-inline.h | 2 | ||||
-rw-r--r-- | gcc/tree-flow.h | 1 | ||||
-rw-r--r-- | gcc/tree-inline.c | 22 | ||||
-rw-r--r-- | gcc/tree-profile.c | 3 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 1 | ||||
-rw-r--r-- | gcc/varpool.c | 1 |
9 files changed, 34 insertions, 42 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index aec62a0..5188cdb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2012-05-24 Richard Guenther <rguenther@suse.de> + + * tree-flow.h (create_var_ann): Remove. + * tree-dfa.c (create_var_ann): Remove and inline into its + single caller ... + (add_referenced_var_1): ... here. + * varpool.c (add_new_static_var): Do not call add_referenced_var + for global vars. + * gimple-fold.c (canonicalize_constructor_val): Likewise. + * tree-switch-conversion.c (build_one_array): Likewise. + * tree-profile.c (gimple_gen_ic_profiler): Likewise. + * tree-flow-inline.h (gimple_referenced_vars): Guard against + NULL fn argument. + * tree-inline.c (remap_gimple_op_r): Likewise. Check + gimple_referenced_vars instead of gimple_in_ssa_p. + (copy_tree_body_r): Likewise. + (setup_one_parameter): Likewise. + (declare_return_variable): Likewise. + (tree_function_versioning): Likewise. + 2012-05-24 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/53465 diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 6b4d987..9358bf8 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -164,7 +164,8 @@ canonicalize_constructor_val (tree cval, tree from_decl) if (TREE_CODE (base) == VAR_DECL) { TREE_ADDRESSABLE (base) = 1; - if (cfun && gimple_referenced_vars (cfun)) + if (cfun && gimple_referenced_vars (cfun) + && !is_global_var (base)) add_referenced_var (base); } else if (TREE_CODE (base) == FUNCTION_DECL) diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index e9db01d..2c63933 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -118,27 +118,6 @@ struct gimple_opt_pass pass_referenced_vars = }; -/*--------------------------------------------------------------------------- - Manage annotations ----------------------------------------------------------------------------*/ -/* Create a new annotation for a _DECL node T. */ - -var_ann_t -create_var_ann (tree t) -{ - var_ann_t ann; - - gcc_assert (t); - gcc_assert (TREE_CODE (t) == VAR_DECL - || TREE_CODE (t) == PARM_DECL - || TREE_CODE (t) == RESULT_DECL); - - ann = ggc_alloc_cleared_var_ann_d (); - *DECL_VAR_ANN_PTR (t) = ann; - - return ann; -} - /* Renumber all of the gimple stmt uids. */ void @@ -587,7 +566,7 @@ add_referenced_var_1 (tree var, struct function *fn) return false; if (!*DECL_VAR_ANN_PTR (var)) - create_var_ann (var); + *DECL_VAR_ANN_PTR (var) = ggc_alloc_cleared_var_ann_d (); /* Insert VAR into the referenced_vars hash table if it isn't present. */ if (referenced_var_check_and_insert (var, fn)) diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 8627fc3..748a97c 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -39,7 +39,7 @@ gimple_in_ssa_p (const struct function *fun) static inline htab_t gimple_referenced_vars (const struct function *fun) { - if (!fun->gimple_df) + if (!fun || !fun->gimple_df) return NULL; return fun->gimple_df->referenced_vars; } diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 78bd9f8..4394b28 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -482,7 +482,6 @@ extern int op_prio (const_tree); extern const char *op_symbol_code (enum tree_code); /* In tree-dfa.c */ -extern var_ann_t create_var_ann (tree); extern void renumber_gimple_stmt_uids (void); extern void renumber_gimple_stmt_uids_in_blocks (basic_block *, int); extern void dump_dfa_stats (FILE *); diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3055d93..a987ff0 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -876,8 +876,8 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) /* Global variables we haven't seen yet need to go into referenced vars. If not referenced from types only. */ - if (gimple_in_ssa_p (cfun) - && TREE_CODE (*tp) == VAR_DECL + if (gimple_referenced_vars (cfun) + && TREE_CODE (*tp) == VAR_DECL && !is_global_var (*tp) && id->remapping_type_depth == 0 && !processing_debug_stmt) add_referenced_var (*tp); @@ -1119,8 +1119,8 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) /* Global variables we haven't seen yet needs to go into referenced vars. If not referenced from types or debug stmts only. */ - if (gimple_in_ssa_p (cfun) - && TREE_CODE (*tp) == VAR_DECL + if (gimple_referenced_vars (cfun) + && TREE_CODE (*tp) == VAR_DECL && !is_global_var (*tp) && id->remapping_type_depth == 0 && !processing_debug_stmt) add_referenced_var (*tp); @@ -2604,11 +2604,11 @@ setup_one_parameter (copy_body_data *id, tree p, tree value, tree fn, /* We are eventually using the value - make sure all variables referenced therein are properly recorded. */ if (value - && gimple_in_ssa_p (cfun) + && gimple_referenced_vars (cfun) && TREE_CODE (value) == ADDR_EXPR) { tree base = get_base_address (TREE_OPERAND (value, 0)); - if (base && TREE_CODE (base) == VAR_DECL) + if (base && TREE_CODE (base) == VAR_DECL && !is_global_var (base)) add_referenced_var (base); } @@ -2917,7 +2917,7 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest, gcc_assert (TREE_CODE (TYPE_SIZE_UNIT (callee_type)) == INTEGER_CST); var = copy_result_decl_to_var (result, id); - if (gimple_in_ssa_p (cfun)) + if (gimple_referenced_vars (cfun)) add_referenced_var (var); DECL_SEEN_IN_BIND_EXPR_P (var) = 1; @@ -2978,7 +2978,7 @@ declare_return_variable (copy_body_data *id, tree return_slot, tree modify_dest, && !is_gimple_val (var)) { tree temp = create_tmp_var (TREE_TYPE (result), "retvalptr"); - if (gimple_in_ssa_p (id->src_cfun)) + if (gimple_referenced_vars (cfun)) add_referenced_var (temp); insert_decl_map (id, result, temp); /* When RESULT_DECL is in SSA form, we need to remap and initialize @@ -5194,10 +5194,8 @@ tree_function_versioning (tree old_decl, tree new_decl, if (TREE_CODE (op) == ADDR_EXPR) { - op = TREE_OPERAND (op, 0); - while (handled_component_p (op)) - op = TREE_OPERAND (op, 0); - if (TREE_CODE (op) == VAR_DECL) + op = get_base_address (TREE_OPERAND (op, 0)); + if (op && TREE_CODE (op) == VAR_DECL && !is_global_var (op)) add_referenced_var (op); } gcc_assert (TREE_CODE (replace_info->old_tree) == PARM_DECL); diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 55ea0fa..9461626 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -347,7 +347,6 @@ gimple_gen_ic_profiler (histogram_value value, unsigned tag, unsigned base) gimple_assign_set_lhs (stmt2, make_ssa_name (tmp1, stmt2)); find_referenced_vars_in (stmt2); stmt3 = gimple_build_assign (ic_void_ptr_var, gimple_assign_lhs (stmt2)); - add_referenced_var (ic_void_ptr_var); gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT); gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT); @@ -383,11 +382,9 @@ gimple_gen_ic_func_profiler (void) counter_ptr = force_gimple_operand_gsi (&gsi, ic_gcov_type_ptr_var, true, NULL_TREE, true, GSI_SAME_STMT); - add_referenced_var (ic_gcov_type_ptr_var); ptr_var = force_gimple_operand_gsi (&gsi, ic_void_ptr_var, true, NULL_TREE, true, GSI_SAME_STMT); - add_referenced_var (ic_void_ptr_var); tree_uid = build_int_cst (gcov_type_node, current_function_funcdef_no); stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 4, counter_ptr, tree_uid, cur_func, ptr_var); diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index 4f3d1d3..def6f5d 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -630,7 +630,6 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi, DECL_ARTIFICIAL (decl) = 1; TREE_CONSTANT (decl) = 1; TREE_READONLY (decl) = 1; - add_referenced_var (decl); varpool_finalize_decl (decl); fetch = build4 (ARRAY_REF, value_type, decl, tidx, NULL_TREE, diff --git a/gcc/varpool.c b/gcc/varpool.c index 45cc4cc..487413d 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -458,7 +458,6 @@ add_new_static_var (tree type) DECL_ABSTRACT (new_decl) = 0; lang_hooks.dup_lang_specific_decl (new_decl); new_node = varpool_node (new_decl); - add_referenced_var (new_decl); varpool_finalize_decl (new_decl); return new_node->symbol.decl; |