From 0c58f841a52644c9845b3c136f3264e6a728ba76 Mon Sep 17 00:00:00 2001 From: Matt Austern Date: Thu, 14 Oct 2004 23:15:29 +0000 Subject: Speed up walk_tree by introducing a special-purpose hash table. * pointer-set.c: New file, special-purpose hash table. * pointer-set.h: New file. * tree.h (struct pointer_set_t): Declare as opaque type. (tree_walk): Last argument is pointer_set_t* now. * tree-inline.c (WALK_SUBTREE): Convert from htab to pset. (walk_type_fields): (walk_tree): Convert from htab_t to pointer_set_t for keeping track of which nodes have already been visited. (walk_tree_without_duplicates): Convert from htab_t to pointer_set_t. * cgraphunit.c (cgraph_create_edges): Likewise. (cgraph_characterize_statics_local): Likewise. * tree-dfa.c (collect_dfa_stats): Likewise. * langhooks-def.h (lhd_tree_inlining_walk_subtrees): Last arg is pointer_set_t* now. * langhooks.c (lhd_tree_inlining_walk_subtrees): Likewise. * langhooks.h (struct lang_hooks_for_tree_inlining): Last arg type of walk_subtrees is pointer_set_t* now. * Makefile.in (OBJS-common): add pointer-set.o (tree-inline.o): Depends on pointer-set.h (tree-dfa.o): Likewise (cgraphunit.o): Likewise * cp/Make-lang.in (pt.o): depends on pointer-set.h * cp/cp-tree.h (cp_walk_subtrees): Last argument is pointer_set_t* now. * cp/pt.c (struct pair_fn_data): Use pointer_set_t, not htab_t (for_each_template_parm): Convert from htab_t to pointer_set_t. * cp/tree.c (cp_walk_subtrees): Last argument is pointer_set_t* now. * java/lang.c (java_tree_inlining_walk_subtrees): Last arg is struct pointer_set_t* now. From-SVN: r89062 --- gcc/cgraphunit.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 5d0a32f..e942aad 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -186,7 +186,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "tree-flow.h" #include "tree-inline.h" #include "langhooks.h" -#include "hashtab.h" +#include "pointer-set.h" #include "toplev.h" #include "flags.h" #include "ggc.h" @@ -223,7 +223,7 @@ static int overall_insns; walk_tree_without_duplicates doesn't guarantee each node is visited once because it gets a new htab upon each recursive call from record_calls_1. */ -static htab_t visited_nodes; +static struct pointer_set_t *visited_nodes; static FILE *cgraph_dump_file; @@ -698,10 +698,9 @@ cgraph_create_edges (struct cgraph_node *node, tree body) { /* The nodes we're interested in are never shared, so walk the tree ignoring duplicates. */ - visited_nodes = htab_create (37, htab_hash_pointer, - htab_eq_pointer, NULL); + visited_nodes = pointer_set_create (); walk_tree (&body, record_call_1, node, visited_nodes); - htab_delete (visited_nodes); + pointer_set_destroy (visited_nodes); visited_nodes = NULL; } @@ -2288,8 +2287,7 @@ cgraph_characterize_statics_local (struct cgraph_node *fn) /* The nodes we're interested in are never shared, so walk the tree ignoring duplicates. */ - visited_nodes = htab_create (37, htab_hash_pointer, - htab_eq_pointer, NULL); + visited_nodes = pointer_set_create (); /* FIXME -- PROFILE-RESTRUCTURE: Remove creation of _decl_uid vars. */ l->statics_read_by_decl_uid = BITMAP_GGC_ALLOC (); @@ -2299,7 +2297,7 @@ cgraph_characterize_statics_local (struct cgraph_node *fn) fprintf (cgraph_dump_file, "\n local analysis of %s", cgraph_node_name (fn)); walk_tree (&DECL_SAVED_TREE (decl), scan_for_static_refs, fn, visited_nodes); - htab_delete (visited_nodes); + pointer_set_destroy (visited_nodes); visited_nodes = NULL; } -- cgit v1.1