Commit cbfb21c1 by Steven Bosscher Committed by Richard Biener

tree-ssa-sccvn (vn_ssa_aux_obstack): New obstack.

2008-02-28  Steven Bosscher  <stevenb.gcc@gmail.com>

	* tree-ssa-sccvn (vn_ssa_aux_obstack): New obstack.
	(VN_INFO_GET): Allocate new objects on the obstack.
	(init_scc_vn): Initialize the obstack.  Use XDELETE instead of free
	for rpo_numbers_temp, for consistency.
	(free_scc_vn): Free the obstack.

From-SVN: r132750
parent dea61d92
2008-02-28 Steven Bosscher <stevenb.gcc@gmail.com>
* tree-ssa-sccvn (vn_ssa_aux_obstack): New obstack.
(VN_INFO_GET): Allocate new objects on the obstack.
(init_scc_vn): Initialize the obstack. Use XDELETE instead of free
for rpo_numbers_temp, for consistency.
(free_scc_vn): Free the obstack.
2008-02-28 Sebastian Pop <sebastian.pop@amd.com> 2008-02-28 Sebastian Pop <sebastian.pop@amd.com>
* doc/invoke.texi: Document -ftree-loop-distribution. * doc/invoke.texi: Document -ftree-loop-distribution.
......
...@@ -241,9 +241,12 @@ static VEC (tree, heap) *sccstack; ...@@ -241,9 +241,12 @@ static VEC (tree, heap) *sccstack;
DEF_VEC_P(vn_ssa_aux_t); DEF_VEC_P(vn_ssa_aux_t);
DEF_VEC_ALLOC_P(vn_ssa_aux_t, heap); DEF_VEC_ALLOC_P(vn_ssa_aux_t, heap);
/* Table of vn_ssa_aux_t's, one per ssa_name. */ /* Table of vn_ssa_aux_t's, one per ssa_name. The vn_ssa_aux_t objects
are allocated on an obstack for locality reasons, and to free them
without looping over the VEC. */
static VEC (vn_ssa_aux_t, heap) *vn_ssa_aux_table; static VEC (vn_ssa_aux_t, heap) *vn_ssa_aux_table;
static struct obstack vn_ssa_aux_obstack;
/* Return the value numbering information for a given SSA name. */ /* Return the value numbering information for a given SSA name. */
...@@ -264,13 +267,16 @@ VN_INFO_SET (tree name, vn_ssa_aux_t value) ...@@ -264,13 +267,16 @@ VN_INFO_SET (tree name, vn_ssa_aux_t value)
SSA_NAME_VERSION (name), value); SSA_NAME_VERSION (name), value);
} }
/* Get the value numbering info for a given SSA name, creating it if /* Initialize the value numbering info for a given SSA name.
it does not exist. */ This should be called just once for every SSA name. */
vn_ssa_aux_t vn_ssa_aux_t
VN_INFO_GET (tree name) VN_INFO_GET (tree name)
{ {
vn_ssa_aux_t newinfo = XCNEW (struct vn_ssa_aux); vn_ssa_aux_t newinfo;
newinfo = obstack_alloc (&vn_ssa_aux_obstack, sizeof (struct vn_ssa_aux));
memset (newinfo, 0, sizeof (struct vn_ssa_aux));
if (SSA_NAME_VERSION (name) >= VEC_length (vn_ssa_aux_t, vn_ssa_aux_table)) if (SSA_NAME_VERSION (name) >= VEC_length (vn_ssa_aux_t, vn_ssa_aux_table))
VEC_safe_grow (vn_ssa_aux_t, heap, vn_ssa_aux_table, VEC_safe_grow (vn_ssa_aux_t, heap, vn_ssa_aux_table,
SSA_NAME_VERSION (name) + 1); SSA_NAME_VERSION (name) + 1);
...@@ -2007,6 +2013,8 @@ init_scc_vn (void) ...@@ -2007,6 +2013,8 @@ init_scc_vn (void)
/* VEC_alloc doesn't actually grow it to the right size, it just /* VEC_alloc doesn't actually grow it to the right size, it just
preallocates the space to do so. */ preallocates the space to do so. */
VEC_safe_grow (vn_ssa_aux_t, heap, vn_ssa_aux_table, num_ssa_names + 1); VEC_safe_grow (vn_ssa_aux_t, heap, vn_ssa_aux_table, num_ssa_names + 1);
gcc_obstack_init (&vn_ssa_aux_obstack);
shared_lookup_phiargs = NULL; shared_lookup_phiargs = NULL;
shared_lookup_vops = NULL; shared_lookup_vops = NULL;
shared_lookup_references = NULL; shared_lookup_references = NULL;
...@@ -2020,7 +2028,7 @@ init_scc_vn (void) ...@@ -2020,7 +2028,7 @@ init_scc_vn (void)
for (j = 0; j < n_basic_blocks - NUM_FIXED_BLOCKS; j++) for (j = 0; j < n_basic_blocks - NUM_FIXED_BLOCKS; j++)
rpo_numbers[rpo_numbers_temp[j]] = j; rpo_numbers[rpo_numbers_temp[j]] = j;
free (rpo_numbers_temp); XDELETE (rpo_numbers_temp);
VN_TOP = create_tmp_var_raw (void_type_node, "vn_top"); VN_TOP = create_tmp_var_raw (void_type_node, "vn_top");
...@@ -2071,19 +2079,18 @@ free_scc_vn (void) ...@@ -2071,19 +2079,18 @@ free_scc_vn (void)
VEC_free (tree, gc, shared_lookup_vops); VEC_free (tree, gc, shared_lookup_vops);
VEC_free (vn_reference_op_s, heap, shared_lookup_references); VEC_free (vn_reference_op_s, heap, shared_lookup_references);
XDELETEVEC (rpo_numbers); XDELETEVEC (rpo_numbers);
for (i = 0; i < num_ssa_names; i++) for (i = 0; i < num_ssa_names; i++)
{ {
tree name = ssa_name (i); tree name = ssa_name (i);
if (name) if (name
{ && SSA_NAME_VALUE (name)
XDELETE (VN_INFO (name)); && TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
if (SSA_NAME_VALUE (name) && SSA_NAME_VALUE (name) = NULL;
TREE_CODE (SSA_NAME_VALUE (name)) == VALUE_HANDLE)
SSA_NAME_VALUE (name) = NULL;
}
} }
obstack_free (&vn_ssa_aux_obstack, NULL);
VEC_free (vn_ssa_aux_t, heap, vn_ssa_aux_table); VEC_free (vn_ssa_aux_t, heap, vn_ssa_aux_table);
VEC_free (tree, heap, sccstack); VEC_free (tree, heap, sccstack);
free_vn_table (valid_info); free_vn_table (valid_info);
XDELETE (valid_info); XDELETE (valid_info);
......
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