Commit 306219a2 by Daniel Berlin Committed by Daniel Berlin

tree.h (struct tree_memory_tag): Add aliases member.

2007-01-28  Daniel Berlin  <dberlin@dberlin.org>

	* tree.h (struct tree_memory_tag): Add aliases member.
	(MTAG_ALIASES): New macro.
	* tree-ssa-alias.c (alias_bitmap_obstack): New variable.
	(add_may_alias): Remove pointer-set. Update for may_aliases being
	a bitmap. 
	(mark_aliases_call_clobbered): Update for may_aliases being a
	bitmap.
	(compute_tag_properties): Ditto.
	(create_partition_for): Ditto.
	(compute_memory_partitions): Ditto.
	(dump_may_aliases_for): Ditto.
	(is_aliased_with): Ditto.
	(add_may_alias_for_new_tag): Ditto.
	(rewrite_alias_set_for): Rewrite for may_aliases being a bitmap.
	(compute_is_aliased): New function.
	(compute_may_aliases): Call compute_is_aliased).
	(init_alias_info): Initialize alias_bitmap_obstack.
	(union_alias_set_into): New function.
	(compute_flow_sensitive_aliasing): Use union_aliases_into.
	(have_common_aliases_p): Rewrite to take two bitmaps and use
	intersection.
	(compute_flow_insensitive_aliasing): Stop using pointer-sets.
	Update for bitmaps.
	(finalize_ref_all_pointers): Update for add_may_alias changes.
	(new_type_alias): Ditto.
	* tree-flow-inline.h (may_aliases): Return a bitmap.
	* tree-dfa.c (dump_variable): Check for MTAG_P'ness.
	* tree-ssa.c (verify_flow_insensitive_alias_info): Update for
	may_aliases being a bitmap.
	* tree-flow.h (struct var_ann_d): Remove may_aliases member.
	may_aliases now returns a bitmap.
	* tree-ssa-structalias.c (merge_smts_into): Update for may_aliases
	being a bitmap.
	* tree-ssa-operands.c (add_virtual_operand): Update for
	may_aliases being a bitmap.

From-SVN: r121302
parent acd724f6
2007-01-28 Daniel Berlin <dberlin@dberlin.org>
* tree.h (struct tree_memory_tag): Add aliases member.
(MTAG_ALIASES): New macro.
* tree-ssa-alias.c (alias_bitmap_obstack): New variable.
(add_may_alias): Remove pointer-set. Update for may_aliases being
a bitmap.
(mark_aliases_call_clobbered): Update for may_aliases being a
bitmap.
(compute_tag_properties): Ditto.
(create_partition_for): Ditto.
(compute_memory_partitions): Ditto.
(dump_may_aliases_for): Ditto.
(is_aliased_with): Ditto.
(add_may_alias_for_new_tag): Ditto.
(rewrite_alias_set_for): Rewrite for may_aliases being a bitmap.
(compute_is_aliased): New function.
(compute_may_aliases): Call compute_is_aliased).
(init_alias_info): Initialize alias_bitmap_obstack.
(union_alias_set_into): New function.
(compute_flow_sensitive_aliasing): Use union_aliases_into.
(have_common_aliases_p): Rewrite to take two bitmaps and use
intersection.
(compute_flow_insensitive_aliasing): Stop using pointer-sets.
Update for bitmaps.
(finalize_ref_all_pointers): Update for add_may_alias changes.
(new_type_alias): Ditto.
* tree-flow-inline.h (may_aliases): Return a bitmap.
* tree-dfa.c (dump_variable): Check for MTAG_P'ness.
* tree-ssa.c (verify_flow_insensitive_alias_info): Update for
may_aliases being a bitmap.
* tree-flow.h (struct var_ann_d): Remove may_aliases member.
may_aliases now returns a bitmap.
* tree-ssa-structalias.c (merge_smts_into): Update for may_aliases
being a bitmap.
* tree-ssa-operands.c (add_virtual_operand): Update for
may_aliases being a bitmap.
2007-01-29 Daniel Berlin <dberlin@dberlin.org> 2007-01-29 Daniel Berlin <dberlin@dberlin.org>
PR tree-optimization/30630 PR tree-optimization/30630
......
...@@ -383,7 +383,7 @@ dump_variable (FILE *file, tree var) ...@@ -383,7 +383,7 @@ dump_variable (FILE *file, tree var)
print_generic_expr (file, gimple_default_def (cfun, var), dump_flags); print_generic_expr (file, gimple_default_def (cfun, var), dump_flags);
} }
if (may_aliases (var)) if (MTAG_P (var) && may_aliases (var))
{ {
fprintf (file, ", may aliases: "); fprintf (file, ", may aliases: ");
dump_may_aliases_for (file, var); dump_may_aliases_for (file, var);
......
...@@ -303,13 +303,12 @@ bb_for_stmt (tree t) ...@@ -303,13 +303,12 @@ bb_for_stmt (tree t)
return ann ? ann->bb : NULL; return ann ? ann->bb : NULL;
} }
/* Return the may_aliases varray for variable VAR, or NULL if it has /* Return the may_aliases bitmap for variable VAR, or NULL if it has
no may aliases. */ no may aliases. */
static inline VEC(tree, gc) * static inline bitmap
may_aliases (tree var) may_aliases (tree var)
{ {
var_ann_t ann = var_ann (var); return MTAG_ALIASES (var);
return ann ? ann->may_aliases : NULL;
} }
/* Return the line number for EXPR, or return -1 if we have no line /* Return the line number for EXPR, or return -1 if we have no line
......
...@@ -266,11 +266,6 @@ struct var_ann_d GTY(()) ...@@ -266,11 +266,6 @@ struct var_ann_d GTY(())
to convert to hash table? */ to convert to hash table? */
tree symbol_mem_tag; tree symbol_mem_tag;
/* Variables that may alias this variable. This may only be set on
memory tags (NAME_MEMORY_TAG or TYPE_MEMORY_TAG). FIXME, move to
struct tree_memory_tag. */
VEC(tree, gc) *may_aliases;
/* Used when going out of SSA form to indicate which partition this /* Used when going out of SSA form to indicate which partition this
variable represents storage for. */ variable represents storage for. */
unsigned partition; unsigned partition;
...@@ -431,7 +426,7 @@ extern void set_bb_for_stmt (tree, basic_block); ...@@ -431,7 +426,7 @@ extern void set_bb_for_stmt (tree, basic_block);
static inline bool noreturn_call_p (tree); static inline bool noreturn_call_p (tree);
static inline void update_stmt (tree); static inline void update_stmt (tree);
static inline bool stmt_modified_p (tree); static inline bool stmt_modified_p (tree);
static inline VEC(tree, gc) *may_aliases (tree); static inline bitmap may_aliases (tree);
static inline int get_lineno (tree); static inline int get_lineno (tree);
static inline const char *get_filename (tree); static inline const char *get_filename (tree);
static inline bool is_exec_stmt (tree); static inline bool is_exec_stmt (tree);
......
...@@ -1441,7 +1441,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1441,7 +1441,7 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
tree full_ref, HOST_WIDE_INT offset, tree full_ref, HOST_WIDE_INT offset,
HOST_WIDE_INT size, bool for_clobber) HOST_WIDE_INT size, bool for_clobber)
{ {
VEC(tree,gc) *aliases; bitmap aliases = NULL;
tree sym; tree sym;
var_ann_t v_ann; var_ann_t v_ann;
...@@ -1479,7 +1479,8 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1479,7 +1479,8 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
if (flags & opf_no_vops) if (flags & opf_no_vops)
return; return;
aliases = v_ann->may_aliases; if (MTAG_P (var))
aliases = MTAG_ALIASES (var);
if (aliases == NULL) if (aliases == NULL)
{ {
if (s_ann && !gimple_aliases_computed_p (cfun)) if (s_ann && !gimple_aliases_computed_p (cfun))
...@@ -1492,19 +1493,20 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1492,19 +1493,20 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
} }
else else
{ {
unsigned i; bitmap_iterator bi;
unsigned int i;
tree al; tree al;
/* The variable is aliased. Add its aliases to the virtual /* The variable is aliased. Add its aliases to the virtual
operands. */ operands. */
gcc_assert (VEC_length (tree, aliases) != 0); gcc_assert (!bitmap_empty_p (aliases));
if (flags & opf_def) if (flags & opf_def)
{ {
bool none_added = true; bool none_added = true;
EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
{ {
al = referenced_var (i);
if (!access_can_touch_variable (full_ref, al, offset, size)) if (!access_can_touch_variable (full_ref, al, offset, size))
continue; continue;
...@@ -1534,14 +1536,15 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags, ...@@ -1534,14 +1536,15 @@ add_virtual_operand (tree var, stmt_ann_t s_ann, int flags,
else else
{ {
bool none_added = true; bool none_added = true;
for (i = 0; VEC_iterate (tree, aliases, i, al); i++) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, i, bi)
{ {
al = referenced_var (i);
if (!access_can_touch_variable (full_ref, al, offset, size)) if (!access_can_touch_variable (full_ref, al, offset, size))
continue; continue;
none_added = false; none_added = false;
append_vuse (al); append_vuse (al);
} }
/* Similarly, append a virtual uses for VAR itself, when /* Similarly, append a virtual uses for VAR itself, when
it is an alias tag. */ it is an alias tag. */
if (v_ann->is_aliased || none_added) if (v_ann->is_aliased || none_added)
......
...@@ -4326,7 +4326,7 @@ merge_smts_into (tree p, varinfo_t vi) ...@@ -4326,7 +4326,7 @@ merge_smts_into (tree p, varinfo_t vi)
unsigned int i; unsigned int i;
bitmap_iterator bi; bitmap_iterator bi;
tree smt; tree smt;
VEC(tree, gc) *aliases; bitmap aliases;
tree var = p; tree var = p;
if (TREE_CODE (p) == SSA_NAME) if (TREE_CODE (p) == SSA_NAME)
...@@ -4350,15 +4350,9 @@ merge_smts_into (tree p, varinfo_t vi) ...@@ -4350,15 +4350,9 @@ merge_smts_into (tree p, varinfo_t vi)
bitmap_set_bit (vi->finished_solution, i); bitmap_set_bit (vi->finished_solution, i);
} }
aliases = var_ann (smt)->may_aliases; aliases = MTAG_ALIASES (smt);
if (aliases) if (aliases)
{ bitmap_ior_into (vi->finished_solution, aliases);
size_t k;
tree al;
for (k = 0; VEC_iterate (tree, aliases, k, al); k++)
bitmap_set_bit (vi->finished_solution,
DECL_UID (al));
}
} }
} }
......
...@@ -380,17 +380,20 @@ verify_flow_insensitive_alias_info (void) ...@@ -380,17 +380,20 @@ verify_flow_insensitive_alias_info (void)
FOR_EACH_REFERENCED_VAR (var, rvi) FOR_EACH_REFERENCED_VAR (var, rvi)
{ {
size_t j; unsigned int j;
var_ann_t ann; bitmap aliases;
VEC(tree,gc) *may_aliases;
tree alias; tree alias;
bitmap_iterator bi;
ann = var_ann (var); if (!MTAG_P (var) || !MTAG_ALIASES (var))
may_aliases = ann->may_aliases; continue;
aliases = MTAG_ALIASES (var);
for (j = 0; VEC_iterate (tree, may_aliases, j, alias); j++) EXECUTE_IF_SET_IN_BITMAP (aliases, 0, j, bi)
{ {
bitmap_set_bit (visited, DECL_UID (alias)); alias = referenced_var (j);
bitmap_set_bit (visited, j);
if (TREE_CODE (alias) != MEMORY_PARTITION_TAG if (TREE_CODE (alias) != MEMORY_PARTITION_TAG
&& !may_be_aliased (alias)) && !may_be_aliased (alias))
......
...@@ -2439,10 +2439,14 @@ struct tree_decl_minimal GTY(()) ...@@ -2439,10 +2439,14 @@ struct tree_decl_minimal GTY(())
struct tree_memory_tag GTY(()) struct tree_memory_tag GTY(())
{ {
struct tree_decl_minimal common; struct tree_decl_minimal common;
bitmap GTY ((skip)) aliases;
unsigned int is_global:1; unsigned int is_global:1;
}; };
#define MTAG_GLOBAL(NODE) (TREE_MEMORY_TAG_CHECK (NODE)->mtag.is_global) #define MTAG_GLOBAL(NODE) (TREE_MEMORY_TAG_CHECK (NODE)->mtag.is_global)
#define MTAG_ALIASES(NODE) (TREE_MEMORY_TAG_CHECK (NODE)->mtag.aliases)
struct tree_struct_field_tag GTY(()) struct tree_struct_field_tag GTY(())
{ {
......
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