Commit d394a308 by Richard Biener Committed by Richard Biener

tree-ssa-structalias.c (final_solutions, [...]): New pointer-map and obstack.

2013-01-30  Richard Biener  <rguenther@suse.de>

	* tree-ssa-structalias.c (final_solutions, final_solutions_obstack):
	New pointer-map and obstack.
	(init_alias_vars): Allocate pointer-map and obstack.
	(delete_points_to_sets): Free them.
	(find_what_var_points_to): Cache result.
	(find_what_p_points_to): Adjust for changed interface of
	find_what_var_points_to.
	(compute_points_to_sets): Likewise.
	(ipa_pta_execute): Likewise.

From-SVN: r195573
parent 20804d96
2013-01-30 Richard Biener <rguenther@suse.de>
* tree-ssa-structalias.c (final_solutions, final_solutions_obstack):
New pointer-map and obstack.
(init_alias_vars): Allocate pointer-map and obstack.
(delete_points_to_sets): Free them.
(find_what_var_points_to): Cache result.
(find_what_p_points_to): Adjust for changed interface of
find_what_var_points_to.
(compute_points_to_sets): Likewise.
(ipa_pta_execute): Likewise.
2013-01-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2013-01-30 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (HAVE_AS_SPARC_NOBITS): New test. * configure.ac (HAVE_AS_SPARC_NOBITS): New test.
......
...@@ -303,7 +303,9 @@ static inline bool type_can_have_subvars (const_tree); ...@@ -303,7 +303,9 @@ static inline bool type_can_have_subvars (const_tree);
/* Pool of variable info structures. */ /* Pool of variable info structures. */
static alloc_pool variable_info_pool; static alloc_pool variable_info_pool;
/* Map varinfo to final pt_solution. */
static pointer_map_t *final_solutions;
struct obstack final_solutions_obstack;
/* Table of variable info structures for constraint variables. /* Table of variable info structures for constraint variables.
Indexed directly by variable info id. */ Indexed directly by variable info id. */
...@@ -5872,21 +5874,29 @@ set_uids_in_ptset (bitmap into, bitmap from, struct pt_solution *pt) ...@@ -5872,21 +5874,29 @@ set_uids_in_ptset (bitmap into, bitmap from, struct pt_solution *pt)
/* Compute the points-to solution *PT for the variable VI. */ /* Compute the points-to solution *PT for the variable VI. */
static void static struct pt_solution
find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt) find_what_var_points_to (varinfo_t orig_vi)
{ {
unsigned int i; unsigned int i;
bitmap_iterator bi; bitmap_iterator bi;
bitmap finished_solution; bitmap finished_solution;
bitmap result; bitmap result;
varinfo_t vi; varinfo_t vi;
void **slot;
memset (pt, 0, sizeof (struct pt_solution)); struct pt_solution *pt;
/* This variable may have been collapsed, let's get the real /* This variable may have been collapsed, let's get the real
variable. */ variable. */
vi = get_varinfo (find (orig_vi->id)); vi = get_varinfo (find (orig_vi->id));
/* See if we have already computed the solution and return it. */
slot = pointer_map_insert (final_solutions, vi);
if (*slot != NULL)
return *(struct pt_solution *)*slot;
*slot = pt = XOBNEW (&final_solutions_obstack, struct pt_solution);
memset (pt, 0, sizeof (struct pt_solution));
/* Translate artificial variables into SSA_NAME_PTR_INFO /* Translate artificial variables into SSA_NAME_PTR_INFO
attributes. */ attributes. */
EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi) EXECUTE_IF_SET_IN_BITMAP (vi->solution, 0, i, bi)
...@@ -5921,7 +5931,7 @@ find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt) ...@@ -5921,7 +5931,7 @@ find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt)
/* Instead of doing extra work, simply do not create /* Instead of doing extra work, simply do not create
elaborate points-to information for pt_anything pointers. */ elaborate points-to information for pt_anything pointers. */
if (pt->anything) if (pt->anything)
return; return *pt;
/* Share the final set of variables when possible. */ /* Share the final set of variables when possible. */
finished_solution = BITMAP_GGC_ALLOC (); finished_solution = BITMAP_GGC_ALLOC ();
...@@ -5939,6 +5949,8 @@ find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt) ...@@ -5939,6 +5949,8 @@ find_what_var_points_to (varinfo_t orig_vi, struct pt_solution *pt)
pt->vars = result; pt->vars = result;
bitmap_clear (finished_solution); bitmap_clear (finished_solution);
} }
return *pt;
} }
/* Given a pointer variable P, fill in its points-to set. */ /* Given a pointer variable P, fill in its points-to set. */
...@@ -5963,7 +5975,7 @@ find_what_p_points_to (tree p) ...@@ -5963,7 +5975,7 @@ find_what_p_points_to (tree p)
return; return;
pi = get_ptr_info (p); pi = get_ptr_info (p);
find_what_var_points_to (vi, &pi->pt); pi->pt = find_what_var_points_to (vi);
} }
...@@ -6480,6 +6492,9 @@ init_alias_vars (void) ...@@ -6480,6 +6492,9 @@ init_alias_vars (void)
init_base_vars (); init_base_vars ();
gcc_obstack_init (&fake_var_decl_obstack); gcc_obstack_init (&fake_var_decl_obstack);
final_solutions = pointer_map_create ();
gcc_obstack_init (&final_solutions_obstack);
} }
/* Remove the REF and ADDRESS edges from GRAPH, as well as all the /* Remove the REF and ADDRESS edges from GRAPH, as well as all the
...@@ -6638,8 +6653,7 @@ compute_points_to_sets (void) ...@@ -6638,8 +6653,7 @@ compute_points_to_sets (void)
solve_constraints (); solve_constraints ();
/* Compute the points-to set for ESCAPED used for call-clobber analysis. */ /* Compute the points-to set for ESCAPED used for call-clobber analysis. */
find_what_var_points_to (get_varinfo (escaped_id), cfun->gimple_df->escaped = find_what_var_points_to (get_varinfo (escaped_id));
&cfun->gimple_df->escaped);
/* Make sure the ESCAPED solution (which is used as placeholder in /* Make sure the ESCAPED solution (which is used as placeholder in
other solutions) does not reference itself. This simplifies other solutions) does not reference itself. This simplifies
...@@ -6679,7 +6693,7 @@ compute_points_to_sets (void) ...@@ -6679,7 +6693,7 @@ compute_points_to_sets (void)
memset (pt, 0, sizeof (struct pt_solution)); memset (pt, 0, sizeof (struct pt_solution));
else if ((vi = lookup_call_use_vi (stmt)) != NULL) else if ((vi = lookup_call_use_vi (stmt)) != NULL)
{ {
find_what_var_points_to (vi, pt); *pt = find_what_var_points_to (vi);
/* Escaped (and thus nonlocal) variables are always /* Escaped (and thus nonlocal) variables are always
implicitly used by calls. */ implicitly used by calls. */
/* ??? ESCAPED can be empty even though NONLOCAL /* ??? ESCAPED can be empty even though NONLOCAL
...@@ -6700,7 +6714,7 @@ compute_points_to_sets (void) ...@@ -6700,7 +6714,7 @@ compute_points_to_sets (void)
memset (pt, 0, sizeof (struct pt_solution)); memset (pt, 0, sizeof (struct pt_solution));
else if ((vi = lookup_call_clobber_vi (stmt)) != NULL) else if ((vi = lookup_call_clobber_vi (stmt)) != NULL)
{ {
find_what_var_points_to (vi, pt); *pt = find_what_var_points_to (vi);
/* Escaped (and thus nonlocal) variables are always /* Escaped (and thus nonlocal) variables are always
implicitly clobbered by calls. */ implicitly clobbered by calls. */
/* ??? ESCAPED can be empty even though NONLOCAL /* ??? ESCAPED can be empty even though NONLOCAL
...@@ -6755,6 +6769,9 @@ delete_points_to_sets (void) ...@@ -6755,6 +6769,9 @@ delete_points_to_sets (void)
free_alloc_pool (constraint_pool); free_alloc_pool (constraint_pool);
obstack_free (&fake_var_decl_obstack, NULL); obstack_free (&fake_var_decl_obstack, NULL);
pointer_map_destroy (final_solutions);
obstack_free (&final_solutions_obstack, NULL);
} }
...@@ -7023,7 +7040,7 @@ ipa_pta_execute (void) ...@@ -7023,7 +7040,7 @@ ipa_pta_execute (void)
??? Note that the computed escape set is not correct ??? Note that the computed escape set is not correct
for the whole unit as we fail to consider graph edges to for the whole unit as we fail to consider graph edges to
externally visible functions. */ externally visible functions. */
find_what_var_points_to (get_varinfo (escaped_id), &ipa_escaped_pt); ipa_escaped_pt = find_what_var_points_to (get_varinfo (escaped_id));
/* Make sure the ESCAPED solution (which is used as placeholder in /* Make sure the ESCAPED solution (which is used as placeholder in
other solutions) does not reference itself. This simplifies other solutions) does not reference itself. This simplifies
...@@ -7058,9 +7075,9 @@ ipa_pta_execute (void) ...@@ -7058,9 +7075,9 @@ ipa_pta_execute (void)
/* Compute the call-use and call-clobber sets for all direct calls. */ /* Compute the call-use and call-clobber sets for all direct calls. */
fi = lookup_vi_for_tree (node->symbol.decl); fi = lookup_vi_for_tree (node->symbol.decl);
gcc_assert (fi->is_fn_info); gcc_assert (fi->is_fn_info);
find_what_var_points_to (first_vi_for_offset (fi, fi_clobbers), clobbers
&clobbers); = find_what_var_points_to (first_vi_for_offset (fi, fi_clobbers));
find_what_var_points_to (first_vi_for_offset (fi, fi_uses), &uses); uses = find_what_var_points_to (first_vi_for_offset (fi, fi_uses));
for (e = node->callers; e; e = e->next_caller) for (e = node->callers; e; e = e->next_caller)
{ {
if (!e->call_stmt) if (!e->call_stmt)
...@@ -7097,7 +7114,7 @@ ipa_pta_execute (void) ...@@ -7097,7 +7114,7 @@ ipa_pta_execute (void)
memset (pt, 0, sizeof (struct pt_solution)); memset (pt, 0, sizeof (struct pt_solution));
else if ((vi = lookup_call_use_vi (stmt)) != NULL) else if ((vi = lookup_call_use_vi (stmt)) != NULL)
{ {
find_what_var_points_to (vi, pt); *pt = find_what_var_points_to (vi);
/* Escaped (and thus nonlocal) variables are always /* Escaped (and thus nonlocal) variables are always
implicitly used by calls. */ implicitly used by calls. */
/* ??? ESCAPED can be empty even though NONLOCAL /* ??? ESCAPED can be empty even though NONLOCAL
...@@ -7118,7 +7135,7 @@ ipa_pta_execute (void) ...@@ -7118,7 +7135,7 @@ ipa_pta_execute (void)
memset (pt, 0, sizeof (struct pt_solution)); memset (pt, 0, sizeof (struct pt_solution));
else if ((vi = lookup_call_clobber_vi (stmt)) != NULL) else if ((vi = lookup_call_clobber_vi (stmt)) != NULL)
{ {
find_what_var_points_to (vi, pt); *pt = find_what_var_points_to (vi);
/* Escaped (and thus nonlocal) variables are always /* Escaped (and thus nonlocal) variables are always
implicitly clobbered by calls. */ implicitly clobbered by calls. */
/* ??? ESCAPED can be empty even though NONLOCAL /* ??? ESCAPED can be empty even though NONLOCAL
...@@ -7178,14 +7195,14 @@ ipa_pta_execute (void) ...@@ -7178,14 +7195,14 @@ ipa_pta_execute (void)
if (!uses->anything) if (!uses->anything)
{ {
find_what_var_points_to sol = find_what_var_points_to
(first_vi_for_offset (vi, fi_uses), &sol); (first_vi_for_offset (vi, fi_uses));
pt_solution_ior_into (uses, &sol); pt_solution_ior_into (uses, &sol);
} }
if (!clobbers->anything) if (!clobbers->anything)
{ {
find_what_var_points_to sol = find_what_var_points_to
(first_vi_for_offset (vi, fi_clobbers), &sol); (first_vi_for_offset (vi, fi_clobbers));
pt_solution_ior_into (clobbers, &sol); pt_solution_ior_into (clobbers, &sol);
} }
} }
......
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