diff options
author | Jeff Sturm <jsturm@one-point.com> | 2003-09-03 21:03:27 +0000 |
---|---|---|
committer | Jeff Sturm <jsturm@gcc.gnu.org> | 2003-09-03 21:03:27 +0000 |
commit | 7dff32e6609b500f53edeb897c993b60e5e59743 (patch) | |
tree | 31ce3577ac91e4057d0e22250c31cb4ed0ca27b6 /gcc | |
parent | 039c3d42d54967fab2bf452db7133388882a4204 (diff) | |
download | gcc-7dff32e6609b500f53edeb897c993b60e5e59743.zip gcc-7dff32e6609b500f53edeb897c993b60e5e59743.tar.gz gcc-7dff32e6609b500f53edeb897c993b60e5e59743.tar.bz2 |
cgraphunit.c (visited_nodes): New static variable.
* cgraphunit.c (visited_nodes): New static variable.
(record_call_1): Use walk_tree with visited_nodes.
(cgraph_create_edges): Use walk_tree with visited_nodes.
Setup/teardown visited_nodes hashtable.
From-SVN: r71033
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 16 |
2 files changed, 20 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 91ad0d7..54de38c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2003-09-03 Jeff Sturm <jsturm@one-point.com> + + * cgraphunit.c (visited_nodes): New static variable. + (record_call_1): Use walk_tree with visited_nodes. + (cgraph_create_edges): Use walk_tree with visited_nodes. + Setup/teardown visited_nodes hashtable. + 2003-09-03 Roger Sayle <roger@eyesopen.com> * toplev.c (flag_rounding_math): New global variable. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 05626cd..7188501 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -56,6 +56,12 @@ static int nfunctions_inlined; static int initial_insns; static int overall_insns; +/* Records tree nodes seen in cgraph_create_edges. Simply using + 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; + /* Analyze function once it is parsed. Set up the local information available - create cgraph edges for function calls via BODY. */ @@ -145,8 +151,8 @@ record_call_1 (tree *tp, int *walk_subtrees, void *data) taken by something that is not a function call. So only walk the function parameter list, skip the other subtrees. */ - walk_tree_without_duplicates (&TREE_OPERAND (*tp, 1), - record_call_1, data); + walk_tree (&TREE_OPERAND (*tp, 1), record_call_1, data, + visited_nodes); *walk_subtrees = 0; } } @@ -164,7 +170,11 @@ cgraph_create_edges (tree decl, tree body) { /* The nodes we're interested in are never shared, so walk the tree ignoring duplicates. */ - walk_tree_without_duplicates (&body, record_call_1, decl); + visited_nodes = htab_create (37, htab_hash_pointer, + htab_eq_pointer, NULL); + walk_tree (&body, record_call_1, decl, visited_nodes); + htab_delete (visited_nodes); + visited_nodes = NULL; } /* Analyze the function scheduled to be output. */ |