This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Break cgraph building out to cgraphbuild.c


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]