diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-28 16:14:44 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-10-28 16:14:44 +0000 |
commit | fb0ac37652a89ad78d1725c082bd88752bdf06a0 (patch) | |
tree | ad9578908d462a27a5795ed5dbda0412a831ec1b | |
parent | 6e062feeb87c624559bb54ebcf278b2bb9b29c95 (diff) | |
download | gcc-fb0ac37652a89ad78d1725c082bd88752bdf06a0.tar.gz |
2007-10-28 Richard Guenther <rguenther@suse.de>
* tree-flow.h (subvar_t): Make it a VEC.
(struct subvar): Remove.
(struct var_ann_d): Use VEC(tree,gc) to store subvars.
* tree-flow-inline.h (get_subvar_at): Adjust iterators over
variable subvars.
* tree-into-ssa.c (mark_sym_for_renaming): Likewise.
* tree-nrv.c (dest_safe_for_nrv_p): Likewise.
* tree-ssa-alias.c (mark_aliases_call_clobbered): Likewise.
(set_initial_properties): Likewise.
(setup_pointers_and_addressables): Likewise.
(new_type_alias): Likewise.
(create_overlap_variables_for): Likewise.
* tree-dfa.c (dump_subvars_for): Likewise.
* tree-ssa-operands.c (add_vars_for_offset): Likewise.
(get_expr_operands): Likewise.
(add_to_addressable_set): Likewise.
* tree-ssa-structalias.c (set_uids_in_ptset): Likewise.
* gcc.dg/tree-ssa/alias-15.c: Adjust pattern.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129699 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 20 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/alias-15.c | 4 | ||||
-rw-r--r-- | gcc/tree-dfa.c | 6 | ||||
-rw-r--r-- | gcc/tree-flow-inline.h | 13 | ||||
-rw-r--r-- | gcc/tree-flow.h | 19 | ||||
-rw-r--r-- | gcc/tree-into-ssa.c | 8 | ||||
-rw-r--r-- | gcc/tree-nrv.c | 11 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 71 | ||||
-rw-r--r-- | gcc/tree-ssa-operands.c | 38 | ||||
-rw-r--r-- | gcc/tree-ssa-structalias.c | 9 |
11 files changed, 120 insertions, 83 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ec6c5710e3..3064b8bd80b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,23 @@ +2007-10-28 Richard Guenther <rguenther@suse.de> + + * tree-flow.h (subvar_t): Make it a VEC. + (struct subvar): Remove. + (struct var_ann_d): Use VEC(tree,gc) to store subvars. + * tree-flow-inline.h (get_subvar_at): Adjust iterators over + variable subvars. + * tree-into-ssa.c (mark_sym_for_renaming): Likewise. + * tree-nrv.c (dest_safe_for_nrv_p): Likewise. + * tree-ssa-alias.c (mark_aliases_call_clobbered): Likewise. + (set_initial_properties): Likewise. + (setup_pointers_and_addressables): Likewise. + (new_type_alias): Likewise. + (create_overlap_variables_for): Likewise. + * tree-dfa.c (dump_subvars_for): Likewise. + * tree-ssa-operands.c (add_vars_for_offset): Likewise. + (get_expr_operands): Likewise. + (add_to_addressable_set): Likewise. + * tree-ssa-structalias.c (set_uids_in_ptset): Likewise. + 2007-10-28 Uros Bizjak <ubizjak@gmail.com> PR tree-optimization/33920 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2988c0c378d..d3305b8c7d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-10-28 Richard Guenther <rguenther@suse.de> + + * gcc.dg/tree-ssa/alias-15.c: Adjust pattern. + 2007-10-28 Martin Michlmayr <tbm@cyrius.com> Uros Bizjak <ubizjak@gmail.com> diff --git a/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c b/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c index 9e409f08216..4155b030c88 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/alias-15.c @@ -15,6 +15,6 @@ int test2(void) return p->b[3] - m.b.b[3]; } -/* { dg-final { scan-tree-dump "SFT.1 created for var m offset 128" "salias" } } */ -/* { dg-final { scan-tree-dump-times "VUSE <SFT.1_" 2 "salias" } } */ +/* { dg-final { scan-tree-dump "SFT.5 created for var m offset 128" "salias" } } */ +/* { dg-final { scan-tree-dump-times "VUSE <SFT.5_" 2 "salias" } } */ /* { dg-final { cleanup-tree-dump "salias" } } */ diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 79f3b8712bc..1ec0264a5fa 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -276,15 +276,17 @@ void dump_subvars_for (FILE *file, tree var) { subvar_t sv = get_subvars_for_var (var); + tree subvar; + unsigned int i; if (!sv) return; fprintf (file, "{ "); - for (; sv; sv = sv->next) + for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i) { - print_generic_expr (file, sv->var, dump_flags); + print_generic_expr (file, subvar, dump_flags); fprintf (file, " "); } diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index 7f47bba4c7d..b87f3d2fc84 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -1609,11 +1609,14 @@ get_subvars_for_var (tree var) static inline tree get_subvar_at (tree var, unsigned HOST_WIDE_INT offset) { - subvar_t sv; - - for (sv = get_subvars_for_var (var); sv; sv = sv->next) - if (SFT_OFFSET (sv->var) == offset) - return sv->var; + subvar_t sv = get_subvars_for_var (var); + unsigned int i; + tree subvar; + + /* ??? Binary search would be possible here. */ + for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i) + if (SFT_OFFSET (subvar) == offset) + return subvar; return NULL_TREE; } diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index 1d6808bfd6c..6e7b88b672b 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -308,18 +308,7 @@ enum noalias_state { }; -struct subvar; -typedef struct subvar *subvar_t; - -/* This structure represents a fake sub-variable for a structure field. */ -struct subvar GTY(()) -{ - /* Fake variable. */ - tree var; - - /* Next subvar for this structure. */ - subvar_t next; -}; +typedef VEC(tree,gc) *subvar_t; struct var_ann_d GTY(()) { @@ -384,9 +373,9 @@ struct var_ann_d GTY(()) current version of this variable (an SSA_NAME). */ tree current_def; - /* If this variable is a structure, this fields holds a list of - symbols representing each of the fields of the structure. */ - subvar_t subvars; + /* If this variable is a structure, this fields holds an array + of symbols representing each of the fields of the structure. */ + VEC(tree,gc) *subvars; /* Mask of values saying the reasons why this variable has escaped the function. */ diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index 2baf879627e..c55f7363697 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -2793,9 +2793,11 @@ mark_sym_for_renaming (tree sym) subvar_t svars; if (var_can_have_subvars (sym) && (svars = get_subvars_for_var (sym))) { - subvar_t sv; - for (sv = svars; sv; sv = sv->next) - mark_sym_for_renaming (sv->var); + unsigned int i; + tree subvar; + + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) + mark_sym_for_renaming (subvar); } } diff --git a/gcc/tree-nrv.c b/gcc/tree-nrv.c index 9acfb60fa22..ef5ee67a2f3 100644 --- a/gcc/tree-nrv.c +++ b/gcc/tree-nrv.c @@ -249,7 +249,9 @@ struct tree_opt_pass pass_nrv = static bool dest_safe_for_nrv_p (tree dest) { - subvar_t subvar; + subvar_t sv; + unsigned int i; + tree subvar; while (handled_component_p (dest)) dest = TREE_OPERAND (dest, 0); @@ -262,9 +264,12 @@ dest_safe_for_nrv_p (tree dest) if (is_call_clobbered (dest)) return false; - for (subvar = get_subvars_for_var (dest); subvar; subvar = subvar->next) - if (is_call_clobbered (subvar->var)) + + sv = get_subvars_for_var (dest); + for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i) + if (is_call_clobbered (subvar)) return false; + return true; } diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e96f0ef899b..dc40c2ef398 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -422,11 +422,13 @@ mark_aliases_call_clobbered (tree tag, VEC (tree, heap) **worklist, { EXECUTE_IF_SET_IN_BITMAP (queued, 0, i, bi) { - subvar_t svars; - svars = get_subvars_for_var (referenced_var (i)); - for (; svars; svars = svars->next) - if (!unmodifiable_var_p (svars->var)) - mark_call_clobbered (svars->var, ta->escape_mask); + subvar_t svars = get_subvars_for_var (referenced_var (i)); + unsigned int i; + tree subvar; + + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) + if (!unmodifiable_var_p (subvar)) + mark_call_clobbered (subvar, ta->escape_mask); } bitmap_clear (queued); } @@ -600,11 +602,13 @@ set_initial_properties (struct alias_info *ai) { EXECUTE_IF_SET_IN_BITMAP (queued, 0, j, bi) { - subvar_t svars; - svars = get_subvars_for_var (referenced_var (j)); - for (; svars; svars = svars->next) - if (!unmodifiable_var_p (svars->var)) - mark_call_clobbered (svars->var, pi->escape_mask); + subvar_t svars = get_subvars_for_var (referenced_var (j)); + unsigned int i; + tree subvar; + + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) + if (!unmodifiable_var_p (subvar)) + mark_call_clobbered (subvar, pi->escape_mask); } bitmap_clear (queued); } @@ -2644,14 +2648,15 @@ setup_pointers_and_addressables (struct alias_info *ai) if (var_can_have_subvars (var) && (svars = get_subvars_for_var (var))) { - subvar_t sv; + unsigned int i; + tree subvar; - for (sv = svars; sv; sv = sv->next) + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) { if (bitmap_bit_p (gimple_addressable_vars (cfun), - DECL_UID (sv->var))) + DECL_UID (subvar))) okay_to_mark = false; - mark_sym_for_renaming (sv->var); + mark_sym_for_renaming (subvar); } } @@ -3574,8 +3579,9 @@ new_type_alias (tree ptr, tree var, tree expr) HOST_WIDE_INT offset, size, maxsize; tree ref; VEC (tree, heap) *overlaps = NULL; - subvar_t sv; - unsigned int len; + unsigned int len, i; + tree subvar; + gcc_assert (symbol_mem_tag (ptr) == NULL_TREE); gcc_assert (!MTAG_P (var)); @@ -3591,12 +3597,12 @@ new_type_alias (tree ptr, tree var, tree expr) if (var_can_have_subvars (ref) && (svars = get_subvars_for_var (ref))) { - for (sv = svars; sv; sv = sv->next) + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) { bool exact; - if (overlap_subvar (offset, maxsize, sv->var, &exact)) - VEC_safe_push (tree, heap, overlaps, sv->var); + if (overlap_subvar (offset, maxsize, subvar, &exact)) + VEC_safe_push (tree, heap, overlaps, subvar); } gcc_assert (overlaps != NULL); } @@ -3610,8 +3616,8 @@ new_type_alias (tree ptr, tree var, tree expr) On mem-ssa branch, the scanning for virtual operands have been split from the rest of tree-ssa-operands, so it should be much easier to fix this problem correctly once mem-ssa is merged. */ - for (sv = svars; sv; sv = sv->next) - VEC_safe_push (tree, heap, overlaps, sv->var); + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) + VEC_safe_push (tree, heap, overlaps, subvar); gcc_assert (overlaps != NULL); } @@ -3873,15 +3879,14 @@ create_overlap_variables_for (tree var) /* Otherwise, create the variables. */ subvars = lookup_subvars_for_var (var); - + *subvars = VEC_alloc (tree, gc, VEC_length (fieldoff_s, fieldstack)); + sort_fieldstack (fieldstack); - for (i = VEC_length (fieldoff_s, fieldstack); - VEC_iterate (fieldoff_s, fieldstack, --i, fo);) + for (i = 0; VEC_iterate (fieldoff_s, fieldstack, i, fo); ++i) { - subvar_t sv; HOST_WIDE_INT fosize; - tree currfotype; + tree currfotype, subvar; fosize = TREE_INT_CST_LOW (fo->size); currfotype = fo->type; @@ -3900,26 +3905,24 @@ create_overlap_variables_for (tree var) && fosize == lastfosize && currfotype == lastfotype)) continue; - sv = GGC_NEW (struct subvar); - sv->next = *subvars; - sv->var = - create_sft (var, fo->type, fo->offset, fosize, fo->alias_set); + subvar = create_sft (var, fo->type, fo->offset, + fosize, fo->alias_set); + VEC_quick_push (tree, *subvars, subvar); if (dump_file) { fprintf (dump_file, "structure field tag %s created for var %s", - get_name (sv->var), get_name (var)); + get_name (subvar), get_name (var)); fprintf (dump_file, " offset " HOST_WIDE_INT_PRINT_DEC, - SFT_OFFSET (sv->var)); + SFT_OFFSET (subvar)); fprintf (dump_file, " size " HOST_WIDE_INT_PRINT_DEC, - SFT_SIZE (sv->var)); + SFT_SIZE (subvar)); fprintf (dump_file, "\n"); } lastfotype = currfotype; lastfooffset = fo->offset; lastfosize = fosize; - *subvars = sv; } /* Once we have created subvars, the original is no longer call diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 206c04bd484..1c4299fffc0 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -1421,20 +1421,23 @@ add_vars_for_offset (tree full_ref, tree var, HOST_WIDE_INT offset, { bool added = false; subvar_t sv = get_subvars_for_var (SFT_PARENT_VAR (var)); - for (; sv; sv = sv->next) + unsigned int i; + tree subvar; + + for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i) { /* Once we hit the end of the parts that could touch, stop looking. */ if (size != -1 - && SFT_OFFSET (var) + offset + size <= SFT_OFFSET (sv->var)) + && SFT_OFFSET (var) + offset + size <= SFT_OFFSET (subvar)) break; - if (overlap_subvar (SFT_OFFSET (var) + offset, size, sv->var, NULL)) + if (overlap_subvar (SFT_OFFSET (var) + offset, size, subvar, NULL)) { added = true; if (is_def) - append_vdef (sv->var); + append_vdef (subvar); else - append_vuse (sv->var); + append_vuse (subvar); } } return added; @@ -2092,9 +2095,10 @@ get_expr_operands (tree stmt, tree *expr_p, int flags) if (var_can_have_subvars (expr) && (svars = get_subvars_for_var (expr))) { - subvar_t sv; - for (sv = svars; sv; sv = sv->next) - add_stmt_operand (&sv->var, s_ann, flags); + unsigned int i; + tree subvar; + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) + add_stmt_operand (&subvar, s_ann, flags); } else add_stmt_operand (expr_p, s_ann, flags); @@ -2137,18 +2141,19 @@ get_expr_operands (tree stmt, tree *expr_p, int flags) ref = get_ref_base_and_extent (expr, &offset, &size, &maxsize); if (SSA_VAR_P (ref) && get_subvars_for_var (ref)) { - subvar_t sv; subvar_t svars = get_subvars_for_var (ref); + unsigned int i; + tree subvar; - for (sv = svars; sv; sv = sv->next) + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) { bool exact; - if (overlap_subvar (offset, maxsize, sv->var, &exact)) + if (overlap_subvar (offset, maxsize, subvar, &exact)) { int subvar_flags = flags; none = false; - add_stmt_operand (&sv->var, s_ann, subvar_flags); + add_stmt_operand (&subvar, s_ann, subvar_flags); } } @@ -2710,11 +2715,12 @@ add_to_addressable_set (tree ref, bitmap *addresses_taken) if (var_can_have_subvars (var) && (svars = get_subvars_for_var (var))) { - subvar_t sv; - for (sv = svars; sv; sv = sv->next) + unsigned int i; + tree subvar; + for (i = 0; VEC_iterate (tree, svars, i, subvar); ++i) { - bitmap_set_bit (*addresses_taken, DECL_UID (sv->var)); - TREE_ADDRESSABLE (sv->var) = 1; + bitmap_set_bit (*addresses_taken, DECL_UID (subvar)); + TREE_ADDRESSABLE (subvar) = 1; } } else diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index a99839c7e84..02124992b5b 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -4702,7 +4702,6 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed, { unsigned int i; bitmap_iterator bi; - subvar_t sv; alias_set_type ptr_alias_set = get_alias_set (TREE_TYPE (ptr)); EXECUTE_IF_SET_IN_BITMAP (from, 0, i, bi) @@ -4717,10 +4716,14 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed, if (vi->has_union && get_subvars_for_var (vi->decl) != NULL) { + unsigned int i; + tree subvar; + subvar_t sv = get_subvars_for_var (vi->decl); + /* Variables containing unions may need to be converted to their SFT's, because SFT's can have unions and we cannot. */ - for (sv = get_subvars_for_var (vi->decl); sv; sv = sv->next) - bitmap_set_bit (into, DECL_UID (sv->var)); + for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i) + bitmap_set_bit (into, DECL_UID (subvar)); } else if (TREE_CODE (vi->decl) == VAR_DECL || TREE_CODE (vi->decl) == PARM_DECL |