Commit 4b1a4694 by Nathan Froyd Committed by Nathan Froyd

tree-flow.h (struct gimple_df): Make free_ssanames a VEC.

	* tree-flow.h (struct gimple_df): Make free_ssanames a VEC.
	* tree-ssanames.c (fini_ssanames): VEC_free it.
	(make_ssa_name_fn): Update for VECness of free_ssanames.
	(release_ssa_name, release_dead_ssa_names): Likewise.
	* tree.h (struct tree_ssa_name): Include tree_typed instead of
	tree_common.
	* tree.c (initialize_tree_contains_struct): Mark TS_SSA_NAME as
	TS_TYPED instead of TS_COMMON.

From-SVN: r172393
parent 4da3b811
2011-04-13 Nathan Froyd <froydnj@codesourcery.com> 2011-04-13 Nathan Froyd <froydnj@codesourcery.com>
* tree-flow.h (struct gimple_df): Make free_ssanames a VEC.
* tree-ssanames.c (fini_ssanames): VEC_free it.
(make_ssa_name_fn): Update for VECness of free_ssanames.
(release_ssa_name, release_dead_ssa_names): Likewise.
* tree.h (struct tree_ssa_name): Include tree_typed instead of
tree_common.
* tree.c (initialize_tree_contains_struct): Mark TS_SSA_NAME as
TS_TYPED instead of TS_COMMON.
2011-04-13 Nathan Froyd <froydnj@codesourcery.com>
* postreload-gcse.c (gcse_after_reload_main): Add calls to * postreload-gcse.c (gcse_after_reload_main): Add calls to
statistics_counter_event. statistics_counter_event.
* tree-ssa-copyrename.c (stats): Define. * tree-ssa-copyrename.c (stats): Define.
......
...@@ -61,7 +61,7 @@ struct GTY(()) gimple_df { ...@@ -61,7 +61,7 @@ struct GTY(()) gimple_df {
struct pointer_map_t * GTY((skip(""))) decls_to_pointers; struct pointer_map_t * GTY((skip(""))) decls_to_pointers;
/* Free list of SSA_NAMEs. */ /* Free list of SSA_NAMEs. */
tree free_ssanames; VEC(tree,gc) *free_ssanames;
/* Hashtable holding definition for symbol. If this field is not NULL, it /* Hashtable holding definition for symbol. If this field is not NULL, it
means that the first reference to this variable in the function is a means that the first reference to this variable in the function is a
......
...@@ -96,7 +96,7 @@ void ...@@ -96,7 +96,7 @@ void
fini_ssanames (void) fini_ssanames (void)
{ {
VEC_free (tree, gc, SSANAMES (cfun)); VEC_free (tree, gc, SSANAMES (cfun));
FREE_SSANAMES (cfun) = NULL; VEC_free (tree, gc, FREE_SSANAMES (cfun));
} }
/* Dump some simple statistics regarding the re-use of SSA_NAME nodes. */ /* Dump some simple statistics regarding the re-use of SSA_NAME nodes. */
...@@ -124,10 +124,9 @@ make_ssa_name_fn (struct function *fn, tree var, gimple stmt) ...@@ -124,10 +124,9 @@ make_ssa_name_fn (struct function *fn, tree var, gimple stmt)
gcc_assert (DECL_P (var)); gcc_assert (DECL_P (var));
/* If our free list has an element, then use it. */ /* If our free list has an element, then use it. */
if (FREE_SSANAMES (fn)) if (!VEC_empty (tree, FREE_SSANAMES (fn)))
{ {
t = FREE_SSANAMES (fn); t = VEC_pop (tree, FREE_SSANAMES (fn));
FREE_SSANAMES (fn) = TREE_CHAIN (FREE_SSANAMES (fn));
#ifdef GATHER_STATISTICS #ifdef GATHER_STATISTICS
ssa_name_nodes_reused++; ssa_name_nodes_reused++;
#endif #endif
...@@ -234,9 +233,8 @@ release_ssa_name (tree var) ...@@ -234,9 +233,8 @@ release_ssa_name (tree var)
/* Note this SSA_NAME is now in the first list. */ /* Note this SSA_NAME is now in the first list. */
SSA_NAME_IN_FREE_LIST (var) = 1; SSA_NAME_IN_FREE_LIST (var) = 1;
/* And finally link it into the free list. */ /* And finally put it on the free list. */
TREE_CHAIN (var) = FREE_SSANAMES (cfun); VEC_safe_push (tree, gc, FREE_SSANAMES (cfun), var);
FREE_SSANAMES (cfun) = var;
} }
} }
...@@ -334,8 +332,8 @@ replace_ssa_name_symbol (tree ssa_name, tree sym) ...@@ -334,8 +332,8 @@ replace_ssa_name_symbol (tree ssa_name, tree sym)
static unsigned int static unsigned int
release_dead_ssa_names (void) release_dead_ssa_names (void)
{ {
tree t, next; tree t;
int n = 0; int n = VEC_length (tree, FREE_SSANAMES (cfun));
referenced_var_iterator rvi; referenced_var_iterator rvi;
/* Current defs point to various dead SSA names that in turn point to /* Current defs point to various dead SSA names that in turn point to
...@@ -343,17 +341,7 @@ release_dead_ssa_names (void) ...@@ -343,17 +341,7 @@ release_dead_ssa_names (void)
FOR_EACH_REFERENCED_VAR (cfun, t, rvi) FOR_EACH_REFERENCED_VAR (cfun, t, rvi)
set_current_def (t, NULL); set_current_def (t, NULL);
/* Now release the freelist. */ /* Now release the freelist. */
for (t = FREE_SSANAMES (cfun); t; t = next) VEC_free (tree, gc, FREE_SSANAMES (cfun));
{
next = TREE_CHAIN (t);
/* Dangling pointers might make GGC to still see dead SSA names, so it is
important to unlink the list and avoid GGC from seeing all subsequent
SSA names. In longer run we want to have all dangling pointers here
removed (since they usually go through dead statements that consume
considerable amounts of memory). */
TREE_CHAIN (t) = NULL_TREE;
n++;
}
FREE_SSANAMES (cfun) = NULL; FREE_SSANAMES (cfun) = NULL;
statistics_counter_event (cfun, "SSA names released", n); statistics_counter_event (cfun, "SSA names released", n);
......
...@@ -377,6 +377,7 @@ initialize_tree_contains_struct (void) ...@@ -377,6 +377,7 @@ initialize_tree_contains_struct (void)
case TS_VECTOR: case TS_VECTOR:
case TS_STRING: case TS_STRING:
case TS_COMPLEX: case TS_COMPLEX:
case TS_SSA_NAME:
MARK_TS_TYPED (code); MARK_TS_TYPED (code);
break; break;
...@@ -386,7 +387,6 @@ initialize_tree_contains_struct (void) ...@@ -386,7 +387,6 @@ initialize_tree_contains_struct (void)
case TS_LIST: case TS_LIST:
case TS_VEC: case TS_VEC:
case TS_EXP: case TS_EXP:
case TS_SSA_NAME:
case TS_BLOCK: case TS_BLOCK:
case TS_BINFO: case TS_BINFO:
case TS_STATEMENT_LIST: case TS_STATEMENT_LIST:
......
...@@ -1970,7 +1970,7 @@ typedef struct GTY(()) ssa_use_operand_d { ...@@ -1970,7 +1970,7 @@ typedef struct GTY(()) ssa_use_operand_d {
#define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses #define SSA_NAME_IMM_USE_NODE(NODE) SSA_NAME_CHECK (NODE)->ssa_name.imm_uses
struct GTY(()) tree_ssa_name { struct GTY(()) tree_ssa_name {
struct tree_common common; struct tree_typed typed;
/* _DECL wrapped by this SSA name. */ /* _DECL wrapped by this SSA name. */
tree var; tree var;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment