From 5cd4ec7f24ef2fca4e1e27836e5eee7b15b8abd8 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 28 Nov 2006 15:42:37 +0100 Subject: Privatize SSA variables into gimple_df. * tree-flow-inline.h (gimple_in_ssa_p, gimple_aliases_computed_p, gimple_addressable_vars, gimple_call_clobbered_vars, gimple_referenced_vars, gimple_global_var, gimple_nonlocal_all): New accessors. (first_referenced_var): Update. (mark_stmt_modified): Update. (is_call_clobbered): Update. (mark_call_clobbered): Update. (clear_call_clobbered): Update. (mark_non_addressable): Update. * tree-vrp.c (get_value_range): Update. * tree-into-ssa.c (in_ssa_p): Kill. (get_default_def_for): Update. (rewrite_into_ssa): Update. * tree-complex.c (init_parameter_lattice_values): Update. (update_complex_assignment): Update. (update_parameter_components): Update. (expand_complex_libcall): Update. (expand_complex_operations_1): Update. * tree-tailcall.c (arg_needs_copy_p): Update. (add_virtual_phis): Update. (tree_optimize_tail_calls_1): Update. * tree-ssa-dse.c (memory_ssa_name_same): Update. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Update. * tree-ssa-math-opts.c (execute_cse_reciprocals): Update. * tree-ssa-propagate.c (set_rhs): Update. * tree-ssa-alias.c (aliases_computed_p, call_clobbered_vars, addressable_vars, global_var):Kill. (set_initial_properties): Update. (init_alias_info): Update. (finalize_ref_all_pointers): Update. (setup_pointers_and_addressables): Update. (maybe_create_global_var): Update. (create_global_var): Update. (dump_points_to_info): Update. * function.h (struct gimple_df): Forward declare. (struct function): Add GIMPLE_DF field. * gimplify.c (force_gimple_operand): Update. * tree-dfa.c (referenced_vars, default_defs): KIll. (make_rename_temp): Update. (dump_variable): Update. (referenced_var_lookup): Update. (referenced_var_check_and_insert): Update. (default_def): Rename to ... (gimple_default_def): ... this one; accept cfun argument. (set_default_def): Update. * tree-cfgcleanup.c (modified_noreturn_calls): Kill. (cleanup_control_flow): Update. * tree-ssa-pre.c (compute_avail): Update * tree-ssa-live.c (calculate_live_on_entry): Update. * tree-ssa.c (verify_use): Update. (verify_call_clobbering): Update. (verify_call_clobbering): Update. (init_tree_ssa): Update. (delete_tree_ssa): Update. * tree-outof-ssa.c (coalesce_ssa_name): Update. (rewrite_out_of_ssa): Update. * tree-flow.h (gimple_df): New structure collecting dataflow variables. (FREE_SSANAMES, SSANAMES, MODIFIED_NORETURN_CALLS, DEFAULT_DEFS): New private accessors. (in_ssa_p, modified_noreturn_calls, referenced_vars, default_defs, ssa_names, global_var, nonlocal_all, call_clobbered_vars, addressable_vars, aliases_computed_p): Kill. (default_def): Rename to... (gimple_default_def): ... this one. (defaule_def_fn): Kill. (num_referenced_vars, ssa_names, num_ssa_names): Update. * tree-ssa-structalias.c (nonlocal_all): Kill. (get_constraint_exp_from_ssa_var): Update. (create_nonlocal_var): Update. (get_constraint_for): Update. (update_alias_info): Update. (find_global_initializers): Update. (intra_create_variable_infos): Update. (intra_create_variable_infos): (find_what_p_points_to): Update. (init_alias_heapvars): Update. * tree-cfg.c (remove_bb): Update. (gimplify_val): Update. * tree-ssa-reassoc.c (get_rank): Update. (init_reassoc): Update. * tree-ssanames.c: Do not include gt-tree-ssanames.h (ssa_names, free_ssanames): Kill. (init_ssanames): Update. (make_ssa_name): Update. (release_ssa_name): Update. (release_defs): Update. (replace_ssa_name_symbol): Update. * tree-ssa-operands.c (access_can_touch_variable): Update. (add_virtual_operand): Update. (add_call_clobber_ops): Update. (add_call_read_ops): Update. (get_call_expr_operands): Update. (get_asm_expr_operands): Update. From-SVN: r119294 --- gcc/tree-ssanames.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) (limited to 'gcc/tree-ssanames.c') diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c index 5077808..21d5761 100644 --- a/gcc/tree-ssanames.c +++ b/gcc/tree-ssanames.c @@ -57,13 +57,6 @@ Boston, MA 02110-1301, USA. */ We could also use a zone allocator for these objects since they have a very well defined lifetime. If someone wants to experiment with that this is the place to try it. */ - -/* Array of all SSA_NAMEs used in the function. */ -VEC(tree,gc) *ssa_names; - -/* Free list of SSA_NAMEs. This list is wiped at the end of each function - after we leave SSA form. */ -static GTY (()) tree free_ssanames; /* Version numbers with special meanings. We start allocating new version numbers after the special ones. */ @@ -79,7 +72,7 @@ unsigned int ssa_name_nodes_created; void init_ssanames (void) { - ssa_names = VEC_alloc (tree, gc, 50); + SSANAMES (cfun) = VEC_alloc (tree, gc, 50); /* Version 0 is special, so reserve the first slot in the table. Though currently unused, we may use version 0 in alias analysis as part of @@ -88,8 +81,8 @@ init_ssanames (void) We use VEC_quick_push here because we know that SSA_NAMES has at least 50 elements reserved in it. */ - VEC_quick_push (tree, ssa_names, NULL_TREE); - free_ssanames = NULL; + VEC_quick_push (tree, SSANAMES (cfun), NULL_TREE); + FREE_SSANAMES (cfun) = NULL; } /* Finalize management of SSA_NAMEs. */ @@ -97,8 +90,8 @@ init_ssanames (void) void fini_ssanames (void) { - VEC_free (tree, gc, ssa_names); - free_ssanames = NULL; + VEC_free (tree, gc, SSANAMES (cfun)); + FREE_SSANAMES (cfun) = NULL; } /* Dump some simple statistics regarding the re-use of SSA_NAME nodes. */ @@ -129,10 +122,10 @@ make_ssa_name (tree var, tree stmt) gcc_assert (!stmt || EXPR_P (stmt) || TREE_CODE (stmt) == PHI_NODE); /* If our free list has an element, then use it. */ - if (free_ssanames) + if (FREE_SSANAMES (cfun)) { - t = free_ssanames; - free_ssanames = TREE_CHAIN (free_ssanames); + t = FREE_SSANAMES (cfun); + FREE_SSANAMES (cfun) = TREE_CHAIN (FREE_SSANAMES (cfun)); #ifdef GATHER_STATISTICS ssa_name_nodes_reused++; #endif @@ -140,13 +133,13 @@ make_ssa_name (tree var, tree stmt) /* The node was cleared out when we put it on the free list, so there is no need to do so again here. */ gcc_assert (ssa_name (SSA_NAME_VERSION (t)) == NULL); - VEC_replace (tree, ssa_names, SSA_NAME_VERSION (t), t); + VEC_replace (tree, SSANAMES (cfun), SSA_NAME_VERSION (t), t); } else { t = make_node (SSA_NAME); SSA_NAME_VERSION (t) = num_ssa_names; - VEC_safe_push (tree, gc, ssa_names, t); + VEC_safe_push (tree, gc, SSANAMES (cfun), t); #ifdef GATHER_STATISTICS ssa_name_nodes_created++; #endif @@ -183,7 +176,7 @@ release_ssa_name (tree var) /* Never release the default definition for a symbol. It's a special SSA name that should always exist once it's created. */ - if (var == default_def (SSA_NAME_VAR (var))) + if (var == gimple_default_def (cfun, SSA_NAME_VAR (var))) return; /* If VAR has been registered for SSA updating, don't remove it. @@ -213,7 +206,8 @@ release_ssa_name (tree var) while (imm->next != imm) delink_imm_use (imm->next); - VEC_replace (tree, ssa_names, SSA_NAME_VERSION (var), NULL_TREE); + VEC_replace (tree, SSANAMES (cfun), + SSA_NAME_VERSION (var), NULL_TREE); memset (var, 0, tree_size (var)); imm->prev = imm; @@ -234,8 +228,8 @@ release_ssa_name (tree var) SSA_NAME_IN_FREE_LIST (var) = 1; /* And finally link it into the free list. */ - TREE_CHAIN (var) = free_ssanames; - free_ssanames = var; + TREE_CHAIN (var) = FREE_SSANAMES (cfun); + FREE_SSANAMES (cfun) = var; } } @@ -291,7 +285,7 @@ release_defs (tree stmt) /* Make sure that we are in SSA. Otherwise, operand cache may point to garbage. */ - gcc_assert (in_ssa_p); + gcc_assert (gimple_in_ssa_p (cfun)); FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS) if (TREE_CODE (def) == SSA_NAME) @@ -307,5 +301,3 @@ replace_ssa_name_symbol (tree ssa_name, tree sym) SSA_NAME_VAR (ssa_name) = sym; TREE_TYPE (ssa_name) = TREE_TYPE (sym); } - -#include "gt-tree-ssanames.h" -- cgit v1.1