This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Break cgraph building out to cgraphbuild.c
- From: Eric Botcazou <ebotcazou at libertysurf dot fr>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 6 Jan 2007 09:17:28 +0100
- Subject: Re: Break cgraph building out to cgraphbuild.c
- References: <20070103200130.GC10318@kam.mff.cuni.cz>
> Index: cgraphbuild.c
> ===================================================================
> *** cgraphbuild.c (revision 0)
> --- cgraphbuild.c (revision 0)
> ***************
> *** 0 ****
> --- 1,248 ----
> + /* Callgraph construction.
> + Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
> Inc. + Contributed by Jan Hubicka
I think the appropriate line is "Copyright (C) 2007 Free Software Foundation"
> + static tree record_reference (tree *, int *, void *);
Superfluous.
> + /* Walk tree and record all calls. Called via walk_tree. */
> + static tree
> + record_reference (tree *tp, int *walk_subtrees, void *data)
The comment doesn't correctly describe the function and TP should be mentioned
in it. Missing line skip.
> + return NULL;
NULL_TREE
> + }
> +
> + /* Give initial reasons why inlining would fail. Those gets
> + either NULLified or usually overwritten by more precise reason
> + later. */
> + static void
> + initialize_inline_failed (struct cgraph_node *node)
NODE should be mentioned in the comment. "Those get either nullified"
Missing line skip.
> + /* Create cgraph edges for function calls inside BODY from NODE.
> + Also look for functions and variables having addresses taken. */
> +
> + static unsigned int
> + build_cgraph_edges (void)
There is no BODY or NODE argument.
> + {
> + basic_block bb;
> + struct cgraph_node *node = cgraph_node (current_function_decl);
> + struct pointer_set_t *visited_nodes = pointer_set_create ();
> + block_stmt_iterator bsi;
> + tree step;
> +
> + /* Reach the trees by walking over the CFG, and note the
> + enclosing basic-blocks in the call edges. */
"Create the callgraph edges and record the nodes referenced by the function."
> + /* Search variable initializer for refererences to functions and
> variables. + Used by varpool. */
> + void
> + record_references_in_initializer (tree decl)
> + {
> + struct pointer_set_t *visited_nodes = pointer_set_create ();
> + walk_tree (&DECL_INITIAL (decl), record_reference, NULL,
> visited_nodes); + pointer_set_destroy (visited_nodes);
> + }
"Record references to functions and other variables present in the
initial value of DECL, a variable." Missing line skip.
> + /* Rebuild call edges from current function after a passes not aware
> + of cgraph updating. */
> + static unsigned int
> + rebuild_cgraph_edges (void)
"Rebuild cgraph edges for current function node. This needs to be run after
passes that don't update the cgraph." Missing line skip.
--
Eric Botcazou