diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-12 00:08:41 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-12 00:08:41 +0000 |
commit | dd94094915dcac76fd0e05505efaed5e148dca70 (patch) | |
tree | 549c93fd7b517405b6cf8a6a87d32d1556f8e140 /gcc/tree-ssa.c | |
parent | 66ae6f24242674998398c0bfeba29b84da4b3e6a (diff) | |
download | gcc-dd94094915dcac76fd0e05505efaed5e148dca70.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@90508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa.c')
-rw-r--r-- | gcc/tree-ssa.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 024f8593257..d0419b70dff 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); } } |