Commit 780e37d3 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-flow.h (struct var_ann_d): Change type of may_aliases field to VEC(tree, gc) *.

	* tree-flow.h (struct var_ann_d): Change type of
	may_aliases field to VEC(tree, gc) *.
	(may_aliases): Declaration changed.
	* tree-ssa-alias.c (group_aliases, add_may_alias,
	replace_may_alias, dump_may_aliases_for,
	is_aliased_with, add_type_alias, new_type_alias):
	Work with VEC(tree, gc) * instead of varray.
	* tree-flow-inline.h (may_aliases): Ditto.
	* tree-ssa.c (verify_flow_insensitive_alias_info,
	verify_name_tags): Ditto.
	* tree-ssa-operands.c (add_stmt_operand): Ditto.

From-SVN: r108804
parent b214e1e7
2005-12-19 Zdenek Dvorak <dvorakz@suse.cz>
* tree-flow.h (struct var_ann_d): Change type of
may_aliases field to VEC(tree, gc) *.
(may_aliases): Declaration changed.
* tree-ssa-alias.c (group_aliases, add_may_alias,
replace_may_alias, dump_may_aliases_for,
is_aliased_with, add_type_alias, new_type_alias):
Work with VEC(tree, gc) * instead of varray.
* tree-flow-inline.h (may_aliases): Ditto.
* tree-ssa.c (verify_flow_insensitive_alias_info,
verify_name_tags): Ditto.
* tree-ssa-operands.c (add_stmt_operand): Ditto.
2005-12-19 J"orn Rennecke <joern.rennecke@st.com> 2005-12-19 J"orn Rennecke <joern.rennecke@st.com>
* cfgcleanup.c: Temporarily revert patches for PR 20070 till Bernd * cfgcleanup.c: Temporarily revert patches for PR 20070 till Bernd
......
...@@ -182,7 +182,7 @@ bb_for_stmt (tree t) ...@@ -182,7 +182,7 @@ bb_for_stmt (tree t)
/* Return the may_aliases varray for variable VAR, or NULL if it has /* Return the may_aliases varray for variable VAR, or NULL if it has
no may aliases. */ no may aliases. */
static inline varray_type static inline VEC(tree, gc) *
may_aliases (tree var) may_aliases (tree var)
{ {
var_ann_t ann = var_ann (var); var_ann_t ann = var_ann (var);
......
...@@ -196,7 +196,7 @@ struct var_ann_d GTY(()) ...@@ -196,7 +196,7 @@ struct var_ann_d GTY(())
tree type_mem_tag; tree type_mem_tag;
/* Variables that may alias this variable. */ /* Variables that may alias this variable. */
varray_type may_aliases; 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. */
...@@ -309,7 +309,7 @@ extern void set_bb_for_stmt (tree, basic_block); ...@@ -309,7 +309,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 varray_type may_aliases (tree); static inline VEC(tree, gc) *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);
......
...@@ -1108,15 +1108,15 @@ group_aliases (struct alias_info *ai) ...@@ -1108,15 +1108,15 @@ group_aliases (struct alias_info *ai)
size_t j; size_t j;
tree ptr = VARRAY_TREE (ai->processed_ptrs, i); tree ptr = VARRAY_TREE (ai->processed_ptrs, i);
tree name_tag = SSA_NAME_PTR_INFO (ptr)->name_mem_tag; tree name_tag = SSA_NAME_PTR_INFO (ptr)->name_mem_tag;
varray_type aliases; VEC(tree,gc) *aliases;
tree alias;
if (name_tag == NULL_TREE) if (name_tag == NULL_TREE)
continue; continue;
aliases = var_ann (name_tag)->may_aliases; aliases = var_ann (name_tag)->may_aliases;
for (j = 0; aliases && j < VARRAY_ACTIVE_SIZE (aliases); j++) for (j = 0; VEC_iterate (tree, aliases, j, alias); j++)
{ {
tree alias = VARRAY_TREE (aliases, j);
var_ann_t ann = var_ann (alias); var_ann_t ann = var_ann (alias);
if ((!MTAG_P (alias) if ((!MTAG_P (alias)
...@@ -1125,9 +1125,9 @@ group_aliases (struct alias_info *ai) ...@@ -1125,9 +1125,9 @@ group_aliases (struct alias_info *ai)
{ {
tree new_alias; tree new_alias;
gcc_assert (VARRAY_ACTIVE_SIZE (ann->may_aliases) == 1); gcc_assert (VEC_length (tree, ann->may_aliases) == 1);
new_alias = VARRAY_TREE (ann->may_aliases, 0); new_alias = VEC_index (tree, ann->may_aliases, 0);
replace_may_alias (name_tag, j, new_alias); replace_may_alias (name_tag, j, new_alias);
} }
} }
...@@ -1578,6 +1578,7 @@ add_may_alias (tree var, tree alias) ...@@ -1578,6 +1578,7 @@ add_may_alias (tree var, tree alias)
size_t i; size_t i;
var_ann_t v_ann = get_var_ann (var); var_ann_t v_ann = get_var_ann (var);
var_ann_t a_ann = get_var_ann (alias); var_ann_t a_ann = get_var_ann (alias);
tree al;
/* Don't allow self-referential aliases. */ /* Don't allow self-referential aliases. */
gcc_assert (var != alias); gcc_assert (var != alias);
...@@ -1590,11 +1591,11 @@ add_may_alias (tree var, tree alias) ...@@ -1590,11 +1591,11 @@ add_may_alias (tree var, tree alias)
#endif #endif
if (v_ann->may_aliases == NULL) if (v_ann->may_aliases == NULL)
VARRAY_TREE_INIT (v_ann->may_aliases, 2, "aliases"); v_ann->may_aliases = VEC_alloc (tree, gc, 2);
/* Avoid adding duplicates. */ /* Avoid adding duplicates. */
for (i = 0; i < VARRAY_ACTIVE_SIZE (v_ann->may_aliases); i++) for (i = 0; VEC_iterate (tree, v_ann->may_aliases, i, al); i++)
if (alias == VARRAY_TREE (v_ann->may_aliases, i)) if (alias == al)
return; return;
/* If VAR is a call-clobbered variable, so is its new ALIAS. /* If VAR is a call-clobbered variable, so is its new ALIAS.
...@@ -1607,7 +1608,7 @@ add_may_alias (tree var, tree alias) ...@@ -1607,7 +1608,7 @@ add_may_alias (tree var, tree alias)
else if (is_call_clobbered (alias)) else if (is_call_clobbered (alias))
mark_call_clobbered (var); mark_call_clobbered (var);
VARRAY_PUSH_TREE (v_ann->may_aliases, alias); VEC_safe_push (tree, gc, v_ann->may_aliases, alias);
a_ann->is_alias_tag = 1; a_ann->is_alias_tag = 1;
} }
...@@ -1618,7 +1619,7 @@ static void ...@@ -1618,7 +1619,7 @@ static void
replace_may_alias (tree var, size_t i, tree new_alias) replace_may_alias (tree var, size_t i, tree new_alias)
{ {
var_ann_t v_ann = var_ann (var); var_ann_t v_ann = var_ann (var);
VARRAY_TREE (v_ann->may_aliases, i) = new_alias; VEC_replace (tree, v_ann->may_aliases, i, new_alias);
/* If VAR is a call-clobbered variable, so is NEW_ALIAS. /* If VAR is a call-clobbered variable, so is NEW_ALIAS.
FIXME, call-clobbering should only depend on whether an address FIXME, call-clobbering should only depend on whether an address
...@@ -2152,7 +2153,7 @@ debug_points_to_info (void) ...@@ -2152,7 +2153,7 @@ debug_points_to_info (void)
void void
dump_may_aliases_for (FILE *file, tree var) dump_may_aliases_for (FILE *file, tree var)
{ {
varray_type aliases; VEC(tree, gc) *aliases;
if (TREE_CODE (var) == SSA_NAME) if (TREE_CODE (var) == SSA_NAME)
var = SSA_NAME_VAR (var); var = SSA_NAME_VAR (var);
...@@ -2161,10 +2162,11 @@ dump_may_aliases_for (FILE *file, tree var) ...@@ -2161,10 +2162,11 @@ dump_may_aliases_for (FILE *file, tree var)
if (aliases) if (aliases)
{ {
size_t i; size_t i;
tree al;
fprintf (file, "{ "); fprintf (file, "{ ");
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
{ {
print_generic_expr (file, VARRAY_TREE (aliases, i), dump_flags); print_generic_expr (file, al, dump_flags);
fprintf (file, " "); fprintf (file, " ");
} }
fprintf (file, "}"); fprintf (file, "}");
...@@ -2223,7 +2225,8 @@ bool ...@@ -2223,7 +2225,8 @@ bool
is_aliased_with (tree tag, tree sym) is_aliased_with (tree tag, tree sym)
{ {
size_t i; size_t i;
varray_type aliases; VEC(tree,gc) *aliases;
tree al;
if (var_ann (sym)->is_alias_tag) if (var_ann (sym)->is_alias_tag)
{ {
...@@ -2232,8 +2235,8 @@ is_aliased_with (tree tag, tree sym) ...@@ -2232,8 +2235,8 @@ is_aliased_with (tree tag, tree sym)
if (aliases == NULL) if (aliases == NULL)
return false; return false;
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
if (VARRAY_TREE (aliases, i) == sym) if (al == sym)
return true; return true;
} }
else else
...@@ -2243,8 +2246,8 @@ is_aliased_with (tree tag, tree sym) ...@@ -2243,8 +2246,8 @@ is_aliased_with (tree tag, tree sym)
if (aliases == NULL) if (aliases == NULL)
return false; return false;
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
if (VARRAY_TREE (aliases, i) == tag) if (al == tag)
return true; return true;
} }
...@@ -2258,11 +2261,12 @@ is_aliased_with (tree tag, tree sym) ...@@ -2258,11 +2261,12 @@ is_aliased_with (tree tag, tree sym)
void void
add_type_alias (tree ptr, tree var) add_type_alias (tree ptr, tree var)
{ {
varray_type aliases; VEC(tree, gc) *aliases;
tree tag; tree tag, al;
var_ann_t ann = var_ann (ptr); var_ann_t ann = var_ann (ptr);
subvar_t svars; subvar_t svars;
VEC (tree, heap) *varvec = NULL; VEC (tree, heap) *varvec = NULL;
unsigned i;
if (ann->type_mem_tag == NULL_TREE) if (ann->type_mem_tag == NULL_TREE)
{ {
...@@ -2322,9 +2326,8 @@ found_tag: ...@@ -2322,9 +2326,8 @@ found_tag:
mark_sym_for_renaming (tag); mark_sym_for_renaming (tag);
if ((aliases = var_ann (tag)->may_aliases) != NULL) if ((aliases = var_ann (tag)->may_aliases) != NULL)
{ {
size_t i; for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) mark_sym_for_renaming (al);
mark_sym_for_renaming (VARRAY_TREE (aliases, i));
} }
/* If we had grouped aliases, VAR may have aliases of its own. Mark /* If we had grouped aliases, VAR may have aliases of its own. Mark
...@@ -2332,9 +2335,8 @@ found_tag: ...@@ -2332,9 +2335,8 @@ found_tag:
aliases of VAR will need to be updated. */ aliases of VAR will need to be updated. */
if ((aliases = var_ann (var)->may_aliases) != NULL) if ((aliases = var_ann (var)->may_aliases) != NULL)
{ {
size_t i; for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) mark_sym_for_renaming (al);
mark_sym_for_renaming (VARRAY_TREE (aliases, i));
} }
VEC_free (tree, heap, varvec); VEC_free (tree, heap, varvec);
} }
...@@ -2377,12 +2379,12 @@ new_type_alias (tree ptr, tree var) ...@@ -2377,12 +2379,12 @@ new_type_alias (tree ptr, tree var)
same defs/uses/vdefs/vuses will be found after replacing a reference same defs/uses/vdefs/vuses will be found after replacing a reference
to var (or ARRAY_REF to var) with an INDIRECT_REF to ptr whose value to var (or ARRAY_REF to var) with an INDIRECT_REF to ptr whose value
is the address of var. */ is the address of var. */
varray_type aliases = v_ann->may_aliases; VEC(tree, gc) *aliases = v_ann->may_aliases;
if ((aliases != NULL) if ((aliases != NULL)
&& (VARRAY_ACTIVE_SIZE (aliases) == 1)) && (VEC_length (tree, aliases) == 1))
{ {
tree ali = VARRAY_TREE (aliases, 0); tree ali = VEC_index (tree, aliases, 0);
if (TREE_CODE (ali) == TYPE_MEMORY_TAG) if (TREE_CODE (ali) == TYPE_MEMORY_TAG)
{ {
...@@ -2398,10 +2400,11 @@ new_type_alias (tree ptr, tree var) ...@@ -2398,10 +2400,11 @@ new_type_alias (tree ptr, tree var)
add_may_alias (tag, var); add_may_alias (tag, var);
else else
{ {
size_t i; unsigned i;
tree al;
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
add_may_alias (tag, VARRAY_TREE (aliases, i)); add_may_alias (tag, al);
} }
} }
} }
......
...@@ -1601,7 +1601,7 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) ...@@ -1601,7 +1601,7 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
} }
else else
{ {
varray_type aliases; VEC(tree,gc) *aliases;
/* The variable is not a GIMPLE register. Add it (or its aliases) to /* The variable is not a GIMPLE register. Add it (or its aliases) to
virtual operands, unless the caller has specifically requested virtual operands, unless the caller has specifically requested
...@@ -1639,11 +1639,12 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) ...@@ -1639,11 +1639,12 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
} }
else else
{ {
size_t i; unsigned i;
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 (VARRAY_ACTIVE_SIZE (aliases) != 0); gcc_assert (VEC_length (tree, aliases) != 0);
if (flags & opf_is_def) if (flags & opf_is_def)
{ {
...@@ -1654,8 +1655,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) ...@@ -1654,8 +1655,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
if (v_ann->is_alias_tag) if (v_ann->is_alias_tag)
append_v_may_def (var); append_v_may_def (var);
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
append_v_may_def (VARRAY_TREE (aliases, i)); append_v_may_def (al);
} }
else else
{ {
...@@ -1664,8 +1665,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) ...@@ -1664,8 +1665,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags)
if (v_ann->is_alias_tag) if (v_ann->is_alias_tag)
append_vuse (var); append_vuse (var);
for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, al); i++)
append_vuse (VARRAY_TREE (aliases, i)); append_vuse (al);
} }
} }
} }
......
...@@ -381,15 +381,14 @@ verify_flow_insensitive_alias_info (void) ...@@ -381,15 +381,14 @@ verify_flow_insensitive_alias_info (void)
{ {
size_t j; size_t j;
var_ann_t ann; var_ann_t ann;
varray_type may_aliases; VEC(tree,gc) *may_aliases;
tree alias;
ann = var_ann (var); ann = var_ann (var);
may_aliases = ann->may_aliases; may_aliases = ann->may_aliases;
for (j = 0; may_aliases && j < VARRAY_ACTIVE_SIZE (may_aliases); j++) for (j = 0; VEC_iterate (tree, may_aliases, j, alias); j++)
{ {
tree alias = VARRAY_TREE (may_aliases, j);
bitmap_set_bit (visited, DECL_UID (alias)); bitmap_set_bit (visited, DECL_UID (alias));
if (!may_be_aliased (alias)) if (!may_be_aliased (alias))
...@@ -545,13 +544,12 @@ verify_name_tags (void) ...@@ -545,13 +544,12 @@ verify_name_tags (void)
if (tmt) if (tmt)
{ {
size_t i; size_t i;
varray_type aliases = var_ann (tmt)->may_aliases; VEC(tree,gc) *aliases = var_ann (tmt)->may_aliases;
tree alias;
bitmap_clear (type_aliases); bitmap_clear (type_aliases);
for (i = 0; aliases && i < VARRAY_ACTIVE_SIZE (aliases); i++) for (i = 0; VEC_iterate (tree, aliases, i, alias); i++)
{ bitmap_set_bit (type_aliases, DECL_UID (alias));
tree alias = VARRAY_TREE (aliases, i);
bitmap_set_bit (type_aliases, DECL_UID (alias));
}
/* When grouping, we may have added PTR's type tag into the /* When grouping, we may have added PTR's type tag into the
alias set of PTR's name tag. To prevent a false alias set of PTR's name tag. To prevent a false
......
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