diff options
author | Jan Hubicka <jh@suse.cz> | 2009-10-08 20:52:57 +0200 |
---|---|---|
committer | Michael Meissner <meissner@gcc.gnu.org> | 2009-10-08 18:52:57 +0000 |
commit | 625f802cafd00f2a6933d7f85ff6f284237096e9 (patch) | |
tree | 36dfcd47579c82b5abe65af64b2523a5a00a1900 /gcc/cgraphbuild.c | |
parent | 007a178cff07dc03e9df0cc0798d5077dbd9a944 (diff) | |
download | gcc-625f802cafd00f2a6933d7f85ff6f284237096e9.zip gcc-625f802cafd00f2a6933d7f85ff6f284237096e9.tar.gz gcc-625f802cafd00f2a6933d7f85ff6f284237096e9.tar.bz2 |
Fix 41626 from Jan Hubicka
From-SVN: r152569
Diffstat (limited to 'gcc/cgraphbuild.c')
-rw-r--r-- | gcc/cgraphbuild.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/cgraphbuild.c b/gcc/cgraphbuild.c index d61def2..65e3d67 100644 --- a/gcc/cgraphbuild.c +++ b/gcc/cgraphbuild.c @@ -33,13 +33,16 @@ along with GCC; see the file COPYING3. If not see #include "tree-pass.h" /* Walk tree and record all calls and references to functions/variables. - Called via walk_tree: TP is pointer to tree to be examined. */ + Called via walk_tree: TP is pointer to tree to be examined. + When DATA is non-null, record references to callgraph. + */ static tree -record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) +record_reference (tree *tp, int *walk_subtrees, void *data) { tree t = *tp; tree decl; + bool do_callgraph = data != NULL; switch (TREE_CODE (t)) { @@ -57,7 +60,7 @@ record_reference (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) /* Record dereferences to the functions. This makes the functions reachable unconditionally. */ decl = TREE_OPERAND (*tp, 0); - if (TREE_CODE (decl) == FUNCTION_DECL) + if (TREE_CODE (decl) == FUNCTION_DECL && do_callgraph) cgraph_mark_address_taken_node (cgraph_node (decl)); break; @@ -218,13 +221,15 @@ struct gimple_opt_pass pass_build_cgraph_edges = }; /* Record references to functions and other variables present in the - initial value of DECL, a variable. */ + initial value of DECL, a variable. + When ONLY_VARS is true, we mark needed only variables, not functions. */ void -record_references_in_initializer (tree decl) +record_references_in_initializer (tree decl, bool only_vars) { struct pointer_set_t *visited_nodes = pointer_set_create (); - walk_tree (&DECL_INITIAL (decl), record_reference, NULL, visited_nodes); + walk_tree (&DECL_INITIAL (decl), record_reference, + only_vars ? NULL : decl, visited_nodes); pointer_set_destroy (visited_nodes); } |