diff options
author | Jan Hubicka <jh@suse.cz> | 2012-04-16 16:34:22 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-04-16 14:34:22 +0000 |
commit | 2aae768068b8f9e0b36b593f80a6403dc5063d83 (patch) | |
tree | 5faa94b4b722d5a4697b6faeb99c4c72e121c4ff /gcc/cgraph.c | |
parent | 1c4010c6d61d3fa7f5fceeb09ea06a260bc5128c (diff) | |
download | gcc-2aae768068b8f9e0b36b593f80a6403dc5063d83.zip gcc-2aae768068b8f9e0b36b593f80a6403dc5063d83.tar.gz gcc-2aae768068b8f9e0b36b593f80a6403dc5063d83.tar.bz2 |
cgraph.h (symtab_node_base): Add next and previous pointers.
* cgraph.h (symtab_node_base): Add next and previous pointers.
(cgraph_node): Remove next and preivous pointers.
(varpool_node): Likewise; remove next/previous GTY marker;
it is not type safe.
(symtab_node_def): Update GTY marker
(x_cgraph_nodes, cgraph_nodes): Remove.
(symtab_nodes): New function.
(cgraph_order): Rename to ...
(symtab_order): ... this one.
(symtab_register_node, symtab_unregister_node, symtab_remove_node):
Declare.
(x_varpool_nodes, varpool_nodes): Remove.
(FOR_EACH_STATIC_VARIABLE): Update.
(symtab_function_p, symtab_variable_p): New function.
(FOR_EACH_VARIABLE): Update.
(varpool_first_variable, varpool_next_variable): New functions.
(FOR_EACH_VARIABLE): Update.
(cgraph_first_defined_function): Update.
(cgraph_next_defined_function, cgraph_next_defined_function): Update.
(FOR_EACH_DEFINED_FUNCTION, FOR_EACH_FUNCTION): Update.
(cgraph_first_function, cgraph_next_function): New.
(FOR_EACH_FUNCTION): Update.
(cgraph_first_function_with_gimple_body,
cgraph_next_function_with_gimple_body): Update.
* symtab.c: New file.
* cgraph.c: Update copyright dates.
(x_cgraph_nodes, cgraph_order): Remove.
(NEXT_FREE_NODE): Update.
(SET_NEXT_FREE_NODE): New.
(cgraph_create_node_1): Remove common code.
(cgraph_create_node); Remove common code; call symtab_register_node.
(cgraph_remove_node): Remove common code; call symtab_unregister-node.
(cgraph_add_asm_node); update.
(cgraph_clone_node): Register new node.
* cgraphunit.c (process_function_and_variable_attributes): Update.
(cgraph_analyze_functions): Update.
(cgraph_analyze_functions): Update.
(cgraph_output_in_order): Update.
* lto-cgraph.c (input_node, input_varpool_node, input_cgraph_1): Update.
* ipa-inline.c (recursive_inlining); update.
* lto-streamer-in.c (lto_input_toplevel_asms); Update.
* ipa.c (cgraph_remove_unreachable_nodes): Update.
* Makefile.in: Add symtab.o
* varpool.c (x_varpool_nodes): Remove
(varpool_node): Remove common code; call symtab_register_node.
(varpool_remove_node); Remove common code; call symtab_unregister_node.
From-SVN: r186496
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r-- | gcc/cgraph.c | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 4f5a9da..6a54db9 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1,6 +1,6 @@ /* Callgraph handling code. - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011, 2012 Free Software Foundation, Inc. Contributed by Jan Hubicka This file is part of GCC. @@ -124,9 +124,6 @@ static GTY((param_is (union symtab_node_def))) htab_t cgraph_hash; /* Hash table used to convert assembler names into nodes. */ static GTY((param_is (union symtab_node_def))) htab_t assembler_name_hash; -/* The linked list of cgraph nodes. */ -symtab_node x_cgraph_nodes; - /* Queue of cgraph nodes scheduled to be lowered. */ symtab_node x_cgraph_nodes_queue; #define cgraph_nodes_queue ((struct cgraph_node *)x_cgraph_nodes_queue) @@ -160,11 +157,6 @@ struct cgraph_asm_node *cgraph_asm_nodes; /* Last node in cgraph_asm_nodes. */ static GTY(()) struct cgraph_asm_node *cgraph_asm_last_node; -/* The order index of the next cgraph node to be created. This is - used so that we can sort the cgraph nodes in order by when we saw - them, to support -fno-toplevel-reorder. */ -int cgraph_order; - /* List of hooks triggered on cgraph_edge events. */ struct cgraph_edge_hook_list { cgraph_edge_hook hook; @@ -216,7 +208,8 @@ bool same_body_aliases_done; /* Macros to access the next item in the list of free cgraph nodes and edges. */ -#define NEXT_FREE_NODE(NODE) (NODE)->next +#define NEXT_FREE_NODE(NODE) cgraph ((NODE)->symbol.next) +#define SET_NEXT_FREE_NODE(NODE,NODE2) ((NODE))->symbol.next = (symtab_node)NODE2 #define NEXT_FREE_EDGE(EDGE) (EDGE)->prev_caller /* Register HOOK to be called with DATA on each removed edge. */ @@ -475,15 +468,8 @@ cgraph_create_node_1 (void) struct cgraph_node *node = cgraph_allocate_node (); node->symbol.type = SYMTAB_FUNCTION; - node->next = cgraph_nodes; - node->symbol.order = cgraph_order++; - if (cgraph_nodes) - cgraph_nodes->previous = node; - node->previous = NULL; node->frequency = NODE_FREQUENCY_NORMAL; node->count_materialization_scale = REG_BR_PROB_BASE; - ipa_empty_ref_list (&node->symbol.ref_list); - x_cgraph_nodes = (symtab_node)node; cgraph_n_nodes++; return node; } @@ -506,6 +492,7 @@ cgraph_create_node (tree decl) node = cgraph_create_node_1 (); node->symbol.decl = decl; + symtab_register_node ((symtab_node)node); *slot = node; if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL) { @@ -1418,8 +1405,6 @@ cgraph_remove_node (struct cgraph_node *node) cgraph_call_node_removal_hooks (node); cgraph_node_remove_callers (node); cgraph_node_remove_callees (node); - ipa_remove_all_references (&node->symbol.ref_list); - ipa_remove_all_refering (&node->symbol.ref_list); VEC_free (ipa_opt_pass, heap, node->ipa_transforms_to_apply); @@ -1437,14 +1422,7 @@ cgraph_remove_node (struct cgraph_node *node) node2 = &(*node2)->next_nested; *node2 = node->next_nested; } - if (node->previous) - node->previous->next = node->next; - else - x_cgraph_nodes = (symtab_node)node->next; - if (node->next) - node->next->previous = node->previous; - node->next = NULL; - node->previous = NULL; + symtab_unregister_node ((symtab_node)node); slot = htab_find_slot (cgraph_hash, node, NO_INSERT); if (*slot == node) { @@ -1567,20 +1545,6 @@ cgraph_remove_node (struct cgraph_node *node) } } - if (node->symbol.same_comdat_group) - { - symtab_node prev; - for (prev = node->symbol.same_comdat_group; - prev->symbol.same_comdat_group != (symtab_node)node; - prev = prev->symbol.same_comdat_group) - ; - if (node->symbol.same_comdat_group == prev) - prev->symbol.same_comdat_group = NULL; - else - prev->symbol.same_comdat_group = node->symbol.same_comdat_group; - node->symbol.same_comdat_group = NULL; - } - /* While all the clones are removed after being proceeded, the function itself is kept in the cgraph even after it is compiled. Check whether we are done with this body and reclaim it proactively if this is the case. @@ -1621,7 +1585,7 @@ cgraph_remove_node (struct cgraph_node *node) memset (node, 0, sizeof(*node)); node->symbol.type = SYMTAB_FUNCTION; node->uid = uid; - NEXT_FREE_NODE (node) = free_nodes; + SET_NEXT_FREE_NODE (node, free_nodes); free_nodes = node; } @@ -2029,7 +1993,7 @@ cgraph_add_asm_node (tree asm_str) node = ggc_alloc_cleared_cgraph_asm_node (); node->asm_str = asm_str; - node->order = cgraph_order++; + node->order = symtab_order++; node->next = NULL; if (cgraph_asm_nodes == NULL) cgraph_asm_nodes = node; @@ -2134,6 +2098,7 @@ cgraph_clone_node (struct cgraph_node *n, tree decl, gcov_type count, int freq, unsigned i; new_node->symbol.decl = decl; + symtab_register_node ((symtab_node)new_node); new_node->origin = n->origin; if (new_node->origin) { |