From 2fd737226122c501a151ebe377ce177be944b205 Mon Sep 17 00:00:00 2001 From: rakdver Date: Mon, 19 Dec 2005 19:13:21 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108804 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 14 +++++++++++ gcc/tree-flow-inline.h | 2 +- gcc/tree-flow.h | 4 +-- gcc/tree-ssa-alias.c | 67 ++++++++++++++++++++++++++----------------------- gcc/tree-ssa-operands.c | 15 +++++------ gcc/tree-ssa.c | 18 ++++++------- 6 files changed, 68 insertions(+), 52 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f696975b60b..9780498fc42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2005-12-19 Zdenek Dvorak + + * 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 * cfgcleanup.c: Temporarily revert patches for PR 20070 till Bernd diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 27ce86d7d6e..057b2496c1a 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -182,7 +182,7 @@ bb_for_stmt (tree t) /* Return the may_aliases varray for variable VAR, or NULL if it has no may aliases. */ -static inline varray_type +static inline VEC(tree, gc) * may_aliases (tree var) { var_ann_t ann = var_ann (var); diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 9675288eee6..e59e809ea5e 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -196,7 +196,7 @@ struct var_ann_d GTY(()) tree type_mem_tag; /* 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 variable represents storage for. */ @@ -309,7 +309,7 @@ extern void set_bb_for_stmt (tree, basic_block); static inline bool noreturn_call_p (tree); static inline void update_stmt (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 const char *get_filename (tree); static inline bool is_exec_stmt (tree); diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 76ede774445..d7f12c35cea 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1108,15 +1108,15 @@ group_aliases (struct alias_info *ai) size_t j; tree ptr = VARRAY_TREE (ai->processed_ptrs, i); 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) continue; 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); if ((!MTAG_P (alias) @@ -1125,9 +1125,9 @@ group_aliases (struct alias_info *ai) { 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); } } @@ -1578,6 +1578,7 @@ add_may_alias (tree var, tree alias) size_t i; var_ann_t v_ann = get_var_ann (var); var_ann_t a_ann = get_var_ann (alias); + tree al; /* Don't allow self-referential aliases. */ gcc_assert (var != alias); @@ -1590,11 +1591,11 @@ add_may_alias (tree var, tree alias) #endif 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. */ - for (i = 0; i < VARRAY_ACTIVE_SIZE (v_ann->may_aliases); i++) - if (alias == VARRAY_TREE (v_ann->may_aliases, i)) + for (i = 0; VEC_iterate (tree, v_ann->may_aliases, i, al); i++) + if (alias == al) return; /* If VAR is a call-clobbered variable, so is its new ALIAS. @@ -1607,7 +1608,7 @@ add_may_alias (tree var, tree alias) else if (is_call_clobbered (alias)) 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; } @@ -1618,7 +1619,7 @@ static void replace_may_alias (tree var, size_t i, tree new_alias) { 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. FIXME, call-clobbering should only depend on whether an address @@ -2152,7 +2153,7 @@ debug_points_to_info (void) void dump_may_aliases_for (FILE *file, tree var) { - varray_type aliases; + VEC(tree, gc) *aliases; if (TREE_CODE (var) == SSA_NAME) var = SSA_NAME_VAR (var); @@ -2161,10 +2162,11 @@ dump_may_aliases_for (FILE *file, tree var) if (aliases) { size_t i; + tree al; 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, "}"); @@ -2223,7 +2225,8 @@ bool is_aliased_with (tree tag, tree sym) { size_t i; - varray_type aliases; + VEC(tree,gc) *aliases; + tree al; if (var_ann (sym)->is_alias_tag) { @@ -2232,8 +2235,8 @@ is_aliased_with (tree tag, tree sym) if (aliases == NULL) return false; - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - if (VARRAY_TREE (aliases, i) == sym) + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + if (al == sym) return true; } else @@ -2243,8 +2246,8 @@ is_aliased_with (tree tag, tree sym) if (aliases == NULL) return false; - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - if (VARRAY_TREE (aliases, i) == tag) + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + if (al == tag) return true; } @@ -2258,11 +2261,12 @@ is_aliased_with (tree tag, tree sym) void add_type_alias (tree ptr, tree var) { - varray_type aliases; - tree tag; + VEC(tree, gc) *aliases; + tree tag, al; var_ann_t ann = var_ann (ptr); subvar_t svars; VEC (tree, heap) *varvec = NULL; + unsigned i; if (ann->type_mem_tag == NULL_TREE) { @@ -2322,9 +2326,8 @@ found_tag: mark_sym_for_renaming (tag); if ((aliases = var_ann (tag)->may_aliases) != NULL) { - size_t i; - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - mark_sym_for_renaming (VARRAY_TREE (aliases, i)); + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + mark_sym_for_renaming (al); } /* If we had grouped aliases, VAR may have aliases of its own. Mark @@ -2332,9 +2335,8 @@ found_tag: aliases of VAR will need to be updated. */ if ((aliases = var_ann (var)->may_aliases) != NULL) { - size_t i; - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - mark_sym_for_renaming (VARRAY_TREE (aliases, i)); + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + mark_sym_for_renaming (al); } VEC_free (tree, heap, varvec); } @@ -2377,12 +2379,12 @@ new_type_alias (tree ptr, tree var) 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 is the address of var. */ - varray_type aliases = v_ann->may_aliases; + VEC(tree, gc) *aliases = v_ann->may_aliases; 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) { @@ -2398,10 +2400,11 @@ new_type_alias (tree ptr, tree var) add_may_alias (tag, var); else { - size_t i; + unsigned i; + tree al; - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - add_may_alias (tag, VARRAY_TREE (aliases, i)); + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + add_may_alias (tag, al); } } } diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 674e9ce773d..236db303ffc 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1601,7 +1601,7 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) } else { - varray_type aliases; + VEC(tree,gc) *aliases; /* The variable is not a GIMPLE register. Add it (or its aliases) to 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) } else { - size_t i; + unsigned i; + tree al; /* The variable is aliased. Add its aliases to the virtual operands. */ - gcc_assert (VARRAY_ACTIVE_SIZE (aliases) != 0); + gcc_assert (VEC_length (tree, aliases) != 0); if (flags & opf_is_def) { @@ -1654,8 +1655,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) if (v_ann->is_alias_tag) append_v_may_def (var); - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - append_v_may_def (VARRAY_TREE (aliases, i)); + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + append_v_may_def (al); } else { @@ -1664,8 +1665,8 @@ add_stmt_operand (tree *var_p, stmt_ann_t s_ann, int flags) if (v_ann->is_alias_tag) append_vuse (var); - for (i = 0; i < VARRAY_ACTIVE_SIZE (aliases); i++) - append_vuse (VARRAY_TREE (aliases, i)); + for (i = 0; VEC_iterate (tree, aliases, i, al); i++) + append_vuse (al); } } } diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 2cd641244e9..f6924b3e634 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -381,15 +381,14 @@ verify_flow_insensitive_alias_info (void) { size_t j; var_ann_t ann; - varray_type may_aliases; + VEC(tree,gc) *may_aliases; + tree alias; ann = var_ann (var); 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)); if (!may_be_aliased (alias)) @@ -545,13 +544,12 @@ verify_name_tags (void) if (tmt) { 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); - for (i = 0; aliases && i < VARRAY_ACTIVE_SIZE (aliases); i++) - { - tree alias = VARRAY_TREE (aliases, i); - bitmap_set_bit (type_aliases, DECL_UID (alias)); - } + 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 type tag into the alias set of PTR's name tag. To prevent a false -- 2.11.0