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. From-SVN: r205024
This commit is contained in:
parent
d8a2d370dc
commit
b4d05578ef
3 changed files with 24 additions and 16 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2013-11-19 Bernd Schmidt <bernds@codesourcery.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2013-11-19 Marek Polacek <polacek@redhat.com>
|
2013-11-19 Marek Polacek <polacek@redhat.com>
|
||||||
|
|
||||||
* opts.c (common_handle_option): Add -fsanitize=null option.
|
* opts.c (common_handle_option): Add -fsanitize=null option.
|
||||||
|
@ -20,7 +29,7 @@
|
||||||
(make_pass_sanopt): Likewise.
|
(make_pass_sanopt): Likewise.
|
||||||
(class pass_sanopt): New class.
|
(class pass_sanopt): New class.
|
||||||
* ubsan.c: Include tree-pass.h, gimple-ssa.h, gimple-walk.h,
|
* ubsan.c: Include tree-pass.h, gimple-ssa.h, gimple-walk.h,
|
||||||
gimple-iterator.h and cfgloop.h.
|
gimple-iterator.h and cfgloop.h.
|
||||||
(PROB_VERY_UNLIKELY): Define.
|
(PROB_VERY_UNLIKELY): Define.
|
||||||
(tree_type_map_hash): New function.
|
(tree_type_map_hash): New function.
|
||||||
(ubsan_type_descriptor): Add new parameter.
|
(ubsan_type_descriptor): Add new parameter.
|
||||||
|
|
|
@ -743,7 +743,7 @@ void cgraph_finalize_function (tree, bool);
|
||||||
void finalize_compilation_unit (void);
|
void finalize_compilation_unit (void);
|
||||||
void compile (void);
|
void compile (void);
|
||||||
void init_cgraph (void);
|
void init_cgraph (void);
|
||||||
bool cgraph_process_new_functions (void);
|
void cgraph_process_new_functions (void);
|
||||||
void cgraph_process_same_body_aliases (void);
|
void cgraph_process_same_body_aliases (void);
|
||||||
void fixup_same_cpp_alias_visibility (symtab_node *, symtab_node *target, tree);
|
void fixup_same_cpp_alias_visibility (symtab_node *, symtab_node *target, tree);
|
||||||
/* Initialize datastructures so DECL is a function in lowered gimple form.
|
/* Initialize datastructures so DECL is a function in lowered gimple form.
|
||||||
|
|
|
@ -268,11 +268,13 @@ decide_is_symbol_needed (symtab_node *node)
|
||||||
return false;
|
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. */
|
The queue is linked via AUX pointers and terminated by pointer to 1. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -280,25 +282,24 @@ enqueue_node (symtab_node *node)
|
||||||
{
|
{
|
||||||
if (node->aux)
|
if (node->aux)
|
||||||
return;
|
return;
|
||||||
gcc_checking_assert (first);
|
gcc_checking_assert (queued_nodes);
|
||||||
node->aux = first;
|
node->aux = queued_nodes;
|
||||||
first = node;
|
queued_nodes = node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these
|
/* Process CGRAPH_NEW_FUNCTIONS and perform actions necessary to add these
|
||||||
functions into callgraph in a way so they look like ordinary reachable
|
functions into callgraph in a way so they look like ordinary reachable
|
||||||
functions inserted into callgraph already at construction time. */
|
functions inserted into callgraph already at construction time. */
|
||||||
|
|
||||||
bool
|
void
|
||||||
cgraph_process_new_functions (void)
|
cgraph_process_new_functions (void)
|
||||||
{
|
{
|
||||||
bool output = false;
|
|
||||||
tree fndecl;
|
tree fndecl;
|
||||||
struct cgraph_node *node;
|
struct cgraph_node *node;
|
||||||
cgraph_node_set_iterator csi;
|
cgraph_node_set_iterator csi;
|
||||||
|
|
||||||
if (!cgraph_new_nodes)
|
if (!cgraph_new_nodes)
|
||||||
return false;
|
return;
|
||||||
handle_alias_pairs ();
|
handle_alias_pairs ();
|
||||||
/* Note that this queue may grow as its being processed, as the new
|
/* Note that this queue may grow as its being processed, as the new
|
||||||
functions may generate new ones. */
|
functions may generate new ones. */
|
||||||
|
@ -313,7 +314,6 @@ cgraph_process_new_functions (void)
|
||||||
it into reachable functions list. */
|
it into reachable functions list. */
|
||||||
|
|
||||||
cgraph_finalize_function (fndecl, false);
|
cgraph_finalize_function (fndecl, false);
|
||||||
output = true;
|
|
||||||
cgraph_call_function_insertion_hooks (node);
|
cgraph_call_function_insertion_hooks (node);
|
||||||
enqueue_node (node);
|
enqueue_node (node);
|
||||||
break;
|
break;
|
||||||
|
@ -354,7 +354,6 @@ cgraph_process_new_functions (void)
|
||||||
}
|
}
|
||||||
free_cgraph_node_set (cgraph_new_nodes);
|
free_cgraph_node_set (cgraph_new_nodes);
|
||||||
cgraph_new_nodes = NULL;
|
cgraph_new_nodes = NULL;
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* As an GCC extension we allow redefinition of the function. The
|
/* 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
|
/* Lower representation, build callgraph edges and references for all trivially
|
||||||
needed symbols and all symbols referred by them. */
|
needed symbols and all symbols referred by them. */
|
||||||
while (first != (symtab_node *)(void *)1)
|
while (queued_nodes != &symtab_terminator)
|
||||||
{
|
{
|
||||||
changed = true;
|
changed = true;
|
||||||
node = first;
|
node = queued_nodes;
|
||||||
first = (symtab_node *)first->aux;
|
queued_nodes = (symtab_node *)queued_nodes->aux;
|
||||||
cgraph_node *cnode = dyn_cast <cgraph_node> (node);
|
cgraph_node *cnode = dyn_cast <cgraph_node> (node);
|
||||||
if (cnode && cnode->definition)
|
if (cnode && cnode->definition)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue