mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-23 14:11:05 +08:00
tree-ssa-alias.c (compute_may_aliases): Compute flow sensitive before flow insensitive.
2006-12-04 Daniel Berlin <dberlin@dberlin.org> * tree-ssa-alias.c (compute_may_aliases): Compute flow sensitive before flow insensitive. (compute_flow_sensitive_aliasing): Don't try to add a symbol memory tag to itself. * alias.h (alias_set_subset_of): New prototype. * alias.c (alias_set_subset_of): New function. * tree-ssa-structalias.c: Update comments. (struct variable_info): Add finished_solution. (new_varinfo): Set finished solution to NULL. (var_escaped_vars): Remove. (escaped_vars_tree): Remove. (escaped_vars_id): Remove. (nonlocal_vars_id): Remove. (constraint_expr_type): Add INCLUDES. (graph_size): Removed. (dump_constraint): Support INCLUDES. (build_constraint_graph): Ditto. (collapse_nodes): Add merge_solutions argument. Don't merge attributes. (process_unification_queue): Just use collapse_nodes. (perform_var_substitution): Update call to collapse_nodes. (get_constraint_exp_from_ssa_var): Use INCLUDES. (process_constraint): Fix non-field sensitive handling Handle includes. (get_constraint_for): Use INCLUDES. (make_constraint_from_anything): Renamed from make_constraint_from_escaped. (make_constraint_to_escaped): Removed. (find_global_initializers): Removed. (create_variable_info_for): Do not make constraints to escaped vars anymore. (dump_solution_for_var): Don't print out the equivalent points-to sets, just use the name of the variable it shares it with. (intra_create_variable_infos): Use INCLUDES. Change nonlocal variable sets to anything sets. (init_base_vars): Remove escaped_vars and nonlocal_var initialization. (find_escape_constraints): Removed. (delete_points_to_sets): Remove dead code. (used_smt_calculated): New variable. (set_used_smts): New function. (merge_smts_into): New function. (find_what_p_points_to): Modify to use SMTs. (create_nonlocal_var): Remove. * tree-ssa-operands.c (access_can_touch_variable): Remove reference to nonlocal_all. * tree-ssa.c (verify_name_tags): Remove. From-SVN: r119502
This commit is contained in:
parent
2c05d05ede
commit
c58936b6b7
@ -1,3 +1,50 @@
|
||||
2006-12-04 Daniel Berlin <dberlin@dberlin.org>
|
||||
|
||||
* tree-ssa-alias.c (compute_may_aliases):
|
||||
Compute flow sensitive before flow insensitive.
|
||||
(compute_flow_sensitive_aliasing): Don't try to add
|
||||
a symbol memory tag to itself.
|
||||
* alias.h (alias_set_subset_of): New prototype.
|
||||
* alias.c (alias_set_subset_of): New function.
|
||||
* tree-ssa-structalias.c: Update comments.
|
||||
(struct variable_info): Add finished_solution.
|
||||
(new_varinfo): Set finished solution to NULL.
|
||||
(var_escaped_vars): Remove.
|
||||
(escaped_vars_tree): Remove.
|
||||
(escaped_vars_id): Remove.
|
||||
(constraint_expr_type): Add INCLUDES.
|
||||
(graph_size): Removed.
|
||||
(dump_constraint): Support INCLUDES.
|
||||
(build_constraint_graph): Ditto.
|
||||
(collapse_nodes): Add merge_solutions argument.
|
||||
Don't merge attributes.
|
||||
(process_unification_queue): Just use collapse_nodes.
|
||||
(perform_var_substitution): Update call to collapse_nodes.
|
||||
(get_constraint_exp_from_ssa_var): Use INCLUDES.
|
||||
(process_constraint): Fix non-field sensitive handling
|
||||
Handle includes.
|
||||
(get_constraint_for): Use INCLUDES.
|
||||
(make_constraint_from_escaped): Use nonlocal_vars_id.
|
||||
(make_constraint_to_escaped): Removed.
|
||||
(find_global_initializers): Removed.
|
||||
(create_variable_info_for): Do not make constraints to escaped
|
||||
vars anymore.
|
||||
(dump_solution_for_var): Don't print out the equivalent points-to
|
||||
sets, just use the name of the variable it shares it with.
|
||||
(intra_create_variable_infos): Use INCLUDES.
|
||||
Move initialization of nonlocal variable to init_base_vars.
|
||||
(init_base_vars): Init nonlocal variable here.
|
||||
Remove escaped_vars initialization.
|
||||
(find_escape_constraints): Removed.
|
||||
(delete_points_to_sets): Remove dead code.
|
||||
(used_smt_calculated): New variable.
|
||||
(set_used_smts): New function.
|
||||
(merge_smts_into): New function.
|
||||
(find_what_p_points_to): Modify to use SMTs.
|
||||
* tree-ssa-operands.c (access_can_touch_variable): Remove
|
||||
reference to nonlocal_all.
|
||||
* tree-ssa.c (verify_name_tags): Remove.
|
||||
|
||||
2006-12-04 Carlos O'Donell <carlos@codesourcery.com>
|
||||
|
||||
* config/arm/unwind-arm.c: Adjust __cxa_type_match declaration.
|
||||
|
@ -1837,7 +1837,7 @@ stor-layout.o : stor-layout.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
tree-ssa-structalias.o: tree-ssa-structalias.c tree-ssa-structalias.h \
|
||||
$(SYSTEM_H) $(CONFIG_H) $(GGC_H) $(TREE_H) $(TREE_FLOW_H) \
|
||||
$(TM_H) coretypes.h $(CGRAPH_H) tree-pass.h $(TIMEVAR_H) \
|
||||
gt-tree-ssa-structalias.h $(PARAMS_H)
|
||||
gt-tree-ssa-structalias.h $(PARAMS_H) $(ALIAS_H)
|
||||
tree-ssa.o : tree-ssa.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
|
||||
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) output.h $(DIAGNOSTIC_H) \
|
||||
toplev.h $(FUNCTION_H) $(TIMEVAR_H) $(TM_H) coretypes.h \
|
||||
|
20
gcc/alias.c
20
gcc/alias.c
@ -293,6 +293,26 @@ insert_subset_children (splay_tree_node node, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return true if the first alias set is a subset of the second. */
|
||||
|
||||
bool
|
||||
alias_set_subset_of (HOST_WIDE_INT set1, HOST_WIDE_INT set2)
|
||||
{
|
||||
alias_set_entry ase;
|
||||
|
||||
/* Everything is a subset of the "aliases everything" set. */
|
||||
if (set2 == 0)
|
||||
return true;
|
||||
|
||||
/* Otherwise, check if set1 is a subset of set2. */
|
||||
ase = get_alias_set_entry (set2);
|
||||
if (ase != 0
|
||||
&& (splay_tree_lookup (ase->children,
|
||||
(splay_tree_key) set1)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return 1 if the two specified alias sets may conflict. */
|
||||
|
||||
int
|
||||
|
@ -25,6 +25,7 @@ extern HOST_WIDE_INT new_alias_set (void);
|
||||
extern HOST_WIDE_INT get_varargs_alias_set (void);
|
||||
extern HOST_WIDE_INT get_frame_alias_set (void);
|
||||
extern bool component_uses_parent_alias_set (tree);
|
||||
extern bool alias_set_subset_of (HOST_WIDE_INT, HOST_WIDE_INT);
|
||||
|
||||
/* This alias set can be used to force a memory to conflict with all
|
||||
other memories, creating a barrier across which no memory reference
|
||||
|
@ -14,5 +14,5 @@ main(void)
|
||||
}
|
||||
|
||||
/* The V_*_DEF comes from the initial assignment and the asm. */
|
||||
/* { dg-final { scan-tree-dump-times "_DEF" 3 "alias1" } } */
|
||||
/* { dg-final { scan-tree-dump-times "_DEF" 2 "alias1" } } */
|
||||
/* { dg-final { cleanup-tree-dump "alias1" } } */
|
||||
|
@ -17,5 +17,6 @@ void bar (void)
|
||||
malloc functions may clobber global memory. Only the function result
|
||||
does not alias any other pointer.
|
||||
Hence, we must have a VDEF for a before and after the call to foo(). */
|
||||
/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1"} } */
|
||||
/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1"} } */
|
||||
/* { dg-final { scan-tree-dump-times "V_MUST_DEF" 1 "alias1"} } */
|
||||
/* { dg-final { cleanup-tree-dump "alias1" } } */
|
||||
|
@ -16,5 +16,6 @@ int foo(void)
|
||||
return a.i;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 2 "alias1" } } */
|
||||
/* { dg-final { scan-tree-dump-times "V_MAY_DEF" 1 "alias1" } } */
|
||||
/* { dg-final { scan-tree-dump-times "V_MUST_DEF" 1 "alias1" } } */
|
||||
/* { dg-final { cleanup-tree-dump "alias1" } } */
|
||||
|
@ -646,15 +646,13 @@ compute_may_aliases (void)
|
||||
not needed anymore. */
|
||||
setup_pointers_and_addressables (ai);
|
||||
|
||||
/* Compute flow-sensitive, points-to based aliasing for all the name
|
||||
memory tags. Note that this pass needs to be done before flow
|
||||
insensitive analysis because it uses the points-to information
|
||||
gathered before to mark call-clobbered symbol tags. */
|
||||
compute_flow_sensitive_aliasing (ai);
|
||||
|
||||
/* Compute type-based flow-insensitive aliasing for all the type
|
||||
memory tags. */
|
||||
compute_flow_insensitive_aliasing (ai);
|
||||
|
||||
/* Compute flow-sensitive, points-to based aliasing for all the name
|
||||
memory tags. */
|
||||
compute_flow_sensitive_aliasing (ai);
|
||||
|
||||
/* Compute call clobbering information. */
|
||||
compute_call_clobbered (ai);
|
||||
@ -1121,7 +1119,8 @@ compute_flow_sensitive_aliasing (struct alias_info *ai)
|
||||
EXECUTE_IF_SET_IN_BITMAP (pi->pt_vars, 0, j, bi)
|
||||
{
|
||||
add_may_alias (pi->name_mem_tag, referenced_var (j));
|
||||
add_may_alias (v_ann->symbol_mem_tag, referenced_var (j));
|
||||
if (j != DECL_UID (v_ann->symbol_mem_tag))
|
||||
add_may_alias (v_ann->symbol_mem_tag, referenced_var (j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1056,11 +1056,6 @@ access_can_touch_variable (tree ref, tree alias, HOST_WIDE_INT offset,
|
||||
if (alias == gimple_global_var (cfun))
|
||||
return true;
|
||||
|
||||
/* We cannot prune nonlocal aliases because they are not type
|
||||
specific. */
|
||||
if (alias == gimple_nonlocal_all (cfun))
|
||||
return true;
|
||||
|
||||
/* If ALIAS is an SFT, it can't be touched if the offset
|
||||
and size of the access is not overlapping with the SFT offset and
|
||||
size. This is only true if we are accessing through a pointer
|
||||
|
File diff suppressed because it is too large
Load Diff
126
gcc/tree-ssa.c
126
gcc/tree-ssa.c
@ -488,131 +488,6 @@ err:
|
||||
internal_error ("verify_flow_sensitive_alias_info failed");
|
||||
}
|
||||
|
||||
DEF_VEC_P (bitmap);
|
||||
DEF_VEC_ALLOC_P (bitmap,heap);
|
||||
|
||||
/* Verify that all name tags have different points to sets.
|
||||
This algorithm takes advantage of the fact that every variable with the
|
||||
same name tag must have the same points-to set.
|
||||
So we check a single variable for each name tag, and verify that its
|
||||
points-to set is different from every other points-to set for other name
|
||||
tags.
|
||||
|
||||
Additionally, given a pointer P_i with name tag NMT and symbol tag
|
||||
SMT, this function verified the alias set of SMT is a superset of
|
||||
the alias set of NMT. */
|
||||
|
||||
static void
|
||||
verify_name_tags (void)
|
||||
{
|
||||
size_t i;
|
||||
size_t j;
|
||||
bitmap first, second;
|
||||
VEC(tree,heap) *name_tag_reps = NULL;
|
||||
VEC(bitmap,heap) *pt_vars_for_reps = NULL;
|
||||
bitmap type_aliases = BITMAP_ALLOC (NULL);
|
||||
|
||||
/* First we compute the name tag representatives and their points-to sets. */
|
||||
for (i = 0; i < num_ssa_names; i++)
|
||||
{
|
||||
struct ptr_info_def *pi;
|
||||
tree smt, ptr = ssa_name (i);
|
||||
|
||||
if (ptr == NULL_TREE)
|
||||
continue;
|
||||
|
||||
pi = SSA_NAME_PTR_INFO (ptr);
|
||||
|
||||
if (!TREE_VISITED (ptr)
|
||||
|| !POINTER_TYPE_P (TREE_TYPE (ptr))
|
||||
|| !pi
|
||||
|| !pi->name_mem_tag
|
||||
|| TREE_VISITED (pi->name_mem_tag))
|
||||
continue;
|
||||
|
||||
TREE_VISITED (pi->name_mem_tag) = 1;
|
||||
|
||||
if (pi->pt_vars == NULL)
|
||||
continue;
|
||||
|
||||
VEC_safe_push (tree, heap, name_tag_reps, ptr);
|
||||
VEC_safe_push (bitmap, heap, pt_vars_for_reps, pi->pt_vars);
|
||||
|
||||
/* Verify that alias set of PTR's symbol tag is a superset of the
|
||||
alias set of PTR's name tag. */
|
||||
smt = var_ann (SSA_NAME_VAR (ptr))->symbol_mem_tag;
|
||||
if (smt)
|
||||
{
|
||||
size_t i;
|
||||
VEC(tree,gc) *aliases = var_ann (smt)->may_aliases;
|
||||
tree alias;
|
||||
|
||||
bitmap_clear (type_aliases);
|
||||
for (i = 0; VEC_iterate (tree, aliases, i, alias); i++)
|
||||
bitmap_set_bit (type_aliases, DECL_UID (alias));
|
||||
|
||||
/* When grouping, we may have added PTR's symbol tag into the
|
||||
alias set of PTR's name tag. To prevent a false
|
||||
positive, pretend that SMT is in its own alias set. */
|
||||
bitmap_set_bit (type_aliases, DECL_UID (smt));
|
||||
|
||||
if (bitmap_equal_p (type_aliases, pi->pt_vars))
|
||||
continue;
|
||||
|
||||
if (!bitmap_intersect_compl_p (type_aliases, pi->pt_vars))
|
||||
{
|
||||
error ("alias set of a pointer's symbol tag should be a superset of the corresponding name tag");
|
||||
debug_variable (smt);
|
||||
debug_variable (pi->name_mem_tag);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Now compare all the representative bitmaps with all other representative
|
||||
bitmaps, to verify that they are all different. */
|
||||
for (i = 0; VEC_iterate (bitmap, pt_vars_for_reps, i, first); i++)
|
||||
{
|
||||
for (j = i + 1; VEC_iterate (bitmap, pt_vars_for_reps, j, second); j++)
|
||||
{
|
||||
if (bitmap_equal_p (first, second))
|
||||
{
|
||||
error ("two different pointers with identical points-to sets but different name tags");
|
||||
debug_variable (VEC_index (tree, name_tag_reps, j));
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Lastly, clear out the visited flags. */
|
||||
for (i = 0; i < num_ssa_names; i++)
|
||||
{
|
||||
if (ssa_name (i))
|
||||
{
|
||||
tree ptr = ssa_name (i);
|
||||
struct ptr_info_def *pi = SSA_NAME_PTR_INFO (ptr);
|
||||
if (!TREE_VISITED (ptr)
|
||||
|| !POINTER_TYPE_P (TREE_TYPE (ptr))
|
||||
|| !pi
|
||||
|| !pi->name_mem_tag)
|
||||
continue;
|
||||
TREE_VISITED (pi->name_mem_tag) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* We do not have to free the bitmaps or trees in the vectors, as
|
||||
they are not owned by us. */
|
||||
VEC_free (bitmap, heap, pt_vars_for_reps);
|
||||
VEC_free (tree, heap, name_tag_reps);
|
||||
BITMAP_FREE (type_aliases);
|
||||
return;
|
||||
|
||||
err:
|
||||
debug_variable (VEC_index (tree, name_tag_reps, i));
|
||||
internal_error ("verify_name_tags failed");
|
||||
}
|
||||
|
||||
|
||||
/* Verify the consistency of call clobbering information. */
|
||||
static void
|
||||
verify_call_clobbering (void)
|
||||
@ -659,7 +534,6 @@ static void
|
||||
verify_alias_info (void)
|
||||
{
|
||||
verify_flow_sensitive_alias_info ();
|
||||
verify_name_tags ();
|
||||
verify_call_clobbering ();
|
||||
verify_flow_insensitive_alias_info ();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user