From 3cb3fce5a62678369b7d9d5054f6cd8a99c323bd Mon Sep 17 00:00:00 2001 From: bernds Date: Tue, 19 Nov 2013 12:39:06 +0000 Subject: Small cleanups in cgraph. * cgraphunit.c (symtab_terminator): New variable. (queued_nodes): Renamed from first. Use symtab_terminator as initializer. (analyze_functions): Adjust accordingly. (cgraph_process_new_functions): Return void. * cgraph.h (cgraph_process_new_functions): Adjust declaration. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205024 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cgraphunit.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'gcc/cgraphunit.c') diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 2fcd313b853..b84e1989be9 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -268,11 +268,13 @@ decide_is_symbol_needed (symtab_node *node) return false; } -/* Head of the queue of nodes to be processed while building callgraph */ +/* Head and terminator of the queue of nodes to be processed while building + callgraph. */ -static symtab_node *first = (symtab_node *)(void *)1; +static symtab_node symtab_terminator; +static symtab_node *queued_nodes = &symtab_terminator; -/* Add NODE to queue starting at FIRST. +/* Add NODE to queue starting at QUEUED_NODES. The queue is linked via AUX pointers and terminated by pointer to 1. */ static void @@ -280,25 +282,24 @@ enqueue_node (symtab_node *node) { if (node->aux) return; - gcc_checking_assert (first); - node->aux = first; - first = node; + gcc_checking_assert (queued_nodes); + node->aux = queued_nodes; + queued_nodes = node; } /* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these functions into callgraph in a way so they look like ordinary reachable functions inserted into callgraph already at construction time. */ -bool +void cgraph_process_new_functions (void) { - bool output = false; tree fndecl; struct cgraph_node *node; cgraph_node_set_iterator csi; if (!cgraph_new_nodes) - return false; + return; handle_alias_pairs (); /* Note that this queue may grow as its being processed, as the new functions may generate new ones. */ @@ -313,7 +314,6 @@ cgraph_process_new_functions (void) it into reachable functions list. */ cgraph_finalize_function (fndecl, false); - output = true; cgraph_call_function_insertion_hooks (node); enqueue_node (node); break; @@ -354,7 +354,6 @@ cgraph_process_new_functions (void) } free_cgraph_node_set (cgraph_new_nodes); cgraph_new_nodes = NULL; - return output; } /* As an GCC extension we allow redefinition of the function. The @@ -985,11 +984,11 @@ analyze_functions (void) /* Lower representation, build callgraph edges and references for all trivially needed symbols and all symbols referred by them. */ - while (first != (symtab_node *)(void *)1) + while (queued_nodes != &symtab_terminator) { changed = true; - node = first; - first = (symtab_node *)first->aux; + node = queued_nodes; + queued_nodes = (symtab_node *)queued_nodes->aux; cgraph_node *cnode = dyn_cast (node); if (cnode && cnode->definition) { -- cgit v1.2.1