diff options
author | Steven Bosscher <stevenb@suse.de> | 2004-11-12 00:08:41 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2004-11-12 00:08:41 +0000 |
commit | d0ce8e4c9772b478f7ce3088a46c5824c9c83c5a (patch) | |
tree | 549c93fd7b517405b6cf8a6a87d32d1556f8e140 | |
parent | 903676f62fc20f2bf6b7732ad0466f0749b49300 (diff) | |
download | gcc-d0ce8e4c9772b478f7ce3088a46c5824c9c83c5a.zip gcc-d0ce8e4c9772b478f7ce3088a46c5824c9c83c5a.tar.gz gcc-d0ce8e4c9772b478f7ce3088a46c5824c9c83c5a.tar.bz2 |
tree-ssa.c (walk_use_def_chains_1): Make the visited map a pointer set instead of a bitmap.
* tree-ssa.c (walk_use_def_chains_1): Make the visited map a
pointer set instead of a bitmap.
(walk_use_def_chains): Create, pass and clean up that pointer_set.
* tree-ssa-alias.c (struct alias_info): Make the ssa_names_visited
field an sbitmap.
(init_alias_info): Allocate and zero it here.
(delete_alias_info): Delete it here.
(collect_points_to_info_for): Use it.
From-SVN: r90508
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 11 | ||||
-rw-r--r-- | gcc/tree-ssa.c | 17 |
3 files changed, 27 insertions, 13 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee0a537..873a005 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2004-11-12 Steven Bosscher <stevenb@suse.de> + + * tree-ssa.c (walk_use_def_chains_1): Make the visited map a + pointer set instead of a bitmap. + (walk_use_def_chains): Create, pass and clean up that pointer_set. + + * tree-ssa-alias.c (struct alias_info): Make the ssa_names_visited + field an sbitmap. + (init_alias_info): Allocate and zero it here. + (delete_alias_info): Delete it here. + (collect_points_to_info_for): Use it. + 2004-11-11 Kazu Hirata <kazu@cs.umass.edu> * alias.c (record_alias_subset, addr_side_effect_eval): diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 8e42427..2da76ce 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -73,7 +73,7 @@ struct alias_info /* SSA names visited while collecting points-to information. If bit I is set, it means that SSA variable with version I has already been visited. */ - bitmap ssa_names_visited; + sbitmap ssa_names_visited; /* Array of SSA_NAME pointers processed by the points-to collector. */ varray_type processed_ptrs; @@ -368,7 +368,8 @@ init_alias_info (void) static bool aliases_computed_p = false; ai = xcalloc (1, sizeof (struct alias_info)); - ai->ssa_names_visited = BITMAP_XMALLOC (); + ai->ssa_names_visited = sbitmap_alloc (num_ssa_names); + sbitmap_zero (ai->ssa_names_visited); VARRAY_TREE_INIT (ai->processed_ptrs, 50, "processed_ptrs"); ai->addresses_needed = BITMAP_XMALLOC (); VARRAY_UINT_INIT (ai->num_references, num_referenced_vars, "num_references"); @@ -449,7 +450,7 @@ delete_alias_info (struct alias_info *ai) { size_t i; - BITMAP_XFREE (ai->ssa_names_visited); + sbitmap_free (ai->ssa_names_visited); ai->processed_ptrs = NULL; BITMAP_XFREE (ai->addresses_needed); @@ -484,9 +485,9 @@ collect_points_to_info_for (struct alias_info *ai, tree ptr) { gcc_assert (POINTER_TYPE_P (TREE_TYPE (ptr))); - if (!bitmap_bit_p (ai->ssa_names_visited, SSA_NAME_VERSION (ptr))) + if (!TEST_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (ptr))) { - bitmap_set_bit (ai->ssa_names_visited, SSA_NAME_VERSION (ptr)); + SET_BIT (ai->ssa_names_visited, SSA_NAME_VERSION (ptr)); walk_use_def_chains (ptr, collect_points_to_info_r, ai, true); VARRAY_PUSH_TREE (ai->processed_ptrs, ptr); } diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 024f859..d0419b7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -36,6 +36,7 @@ Boston, MA 02111-1307, USA. */ #include "function.h" #include "diagnostic.h" #include "bitmap.h" +#include "pointer-set.h" #include "tree-flow.h" #include "tree-gimple.h" #include "tree-inline.h" @@ -905,8 +906,10 @@ tree_ssa_useless_type_conversion (tree expr) /* Internal helper for walk_use_def_chains. VAR, FN and DATA are as described in walk_use_def_chains. - VISITED is a bitmap used to mark visited SSA_NAMEs to avoid - infinite loops. + VISITED is a pointer set used to mark visited SSA_NAMEs to avoid + infinite loops. We used to have a bitmap for this to just mark + SSA versions we had visited. But non-sparse bitmaps are way too + expensive, while sparse bitmaps may cause quadratic behavior. IS_DFS is true if the caller wants to perform a depth-first search when visiting PHI nodes. A DFS will visit each PHI argument and @@ -916,15 +919,13 @@ tree_ssa_useless_type_conversion (tree expr) static bool walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data, - bitmap visited, bool is_dfs) + struct pointer_set_t *visited, bool is_dfs) { tree def_stmt; - if (bitmap_bit_p (visited, SSA_NAME_VERSION (var))) + if (pointer_set_insert (visited, var)) return false; - bitmap_set_bit (visited, SSA_NAME_VERSION (var)); - def_stmt = SSA_NAME_DEF_STMT (var); if (TREE_CODE (def_stmt) != PHI_NODE) @@ -1002,9 +1003,9 @@ walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data, (*fn) (var, def_stmt, data); else { - bitmap visited = BITMAP_XMALLOC (); + struct pointer_set_t *visited = pointer_set_create (); walk_use_def_chains_1 (var, fn, data, visited, is_dfs); - BITMAP_XFREE (visited); + pointer_set_destroy (visited); } } |