diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-06-20 09:09:27 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-06-20 07:09:27 +0000 |
commit | 569b1784fe1523adf8cbe899834a7cb7f7600bfb (patch) | |
tree | 913b51a061c1f0c708a012298e04dcb6036dec74 /gcc/tree.c | |
parent | 88f5cfcd2bdc48b3def09453babc02d2821f9a60 (diff) | |
download | gcc-569b1784fe1523adf8cbe899834a7cb7f7600bfb.zip gcc-569b1784fe1523adf8cbe899834a7cb7f7600bfb.tar.gz gcc-569b1784fe1523adf8cbe899834a7cb7f7600bfb.tar.bz2 |
cgraph.h (struct symtab_node): Add field in_init_priority_hash (set_init_priority...
* cgraph.h (struct symtab_node): Add field in_init_priority_hash
(set_init_priority, get_init_priority, set_fini_priority,
get_fini_priority): New methods.
* tree.c (init_priority_for_decl): Remove.
(init_ttree): Do not initialize init priority.
(decl_init_priority_lookup, decl_fini_priority_lookup): Rewrite.
(decl_priority_info): Remove.
(decl_init_priority_insert): Rewrite.
(decl_fini_priority_insert): Rewrite.
* tree.h (tree_priority_map_eq, tree_priority_map_hash,
tree_priority_map_marked_p): Remove.
* lto-cgraph.c (lto_output_node, input_node): Stream init priorities.
* lto-streamer-out.c (hash_tree): Do not hash priorities.
* tree-streamer-out.c (pack_ts_decl_with_vis_value_fields): Do
not output priorities.
(pack_ts_function_decl_value_fields): Likewise.
* tree-streamer-in.c (unpack_ts_decl_with_vis_value_fields): Do
not input priorities.
(unpack_ts_function_decl_value_fields): Likewise.
* symtab.c (symbol_priority_map): Declare.
(init_priority_hash): Declare.
(symtab_unregister_node): Unregister from priority hash, too.
(symtab_node::get_init_priority, cgraph_node::get_fini_priority):
New methods.
(symbol_priority_map_eq, symbol_priority_map_hash): New functions.
(symbol_priority_info): New function.
(symtab_node::set_init_priority, cgraph_node::set_fini_priority):
New methods.
* tree-core.h (tree_priority_map): Remove.
* lto.c (compare_tree_sccs_1): Do not compare priorities.
From-SVN: r211838
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 84 |
1 files changed, 30 insertions, 54 deletions
@@ -219,10 +219,6 @@ static GTY ((if_marked ("tree_decl_map_marked_p"), param_is (struct tree_decl_ma static GTY ((if_marked ("tree_vec_map_marked_p"), param_is (struct tree_vec_map))) htab_t debug_args_for_decl; -static GTY ((if_marked ("tree_priority_map_marked_p"), - param_is (struct tree_priority_map))) - htab_t init_priority_for_decl; - static void set_type_quals (tree, int); static int type_hash_eq (const void *, const void *); static hashval_t type_hash_hash (const void *); @@ -573,8 +569,6 @@ init_ttree (void) value_expr_for_decl = htab_create_ggc (512, tree_decl_map_hash, tree_decl_map_eq, 0); - init_priority_for_decl = htab_create_ggc (512, tree_priority_map_hash, - tree_priority_map_eq, 0); int_cst_hash_table = htab_create_ggc (1024, int_cst_hash_hash, int_cst_hash_eq, NULL); @@ -6492,13 +6486,12 @@ tree_decl_map_hash (const void *item) priority_type decl_init_priority_lookup (tree decl) { - struct tree_priority_map *h; - struct tree_map_base in; + symtab_node *snode = symtab_get_node (decl); - gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); - in.from = decl; - h = (struct tree_priority_map *) htab_find (init_priority_for_decl, &in); - return h ? h->init : DEFAULT_INIT_PRIORITY; + if (!snode) + return DEFAULT_INIT_PRIORITY; + return + snode->get_init_priority (); } /* Return the finalization priority for DECL. */ @@ -6506,39 +6499,12 @@ decl_init_priority_lookup (tree decl) priority_type decl_fini_priority_lookup (tree decl) { - struct tree_priority_map *h; - struct tree_map_base in; - - gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); - in.from = decl; - h = (struct tree_priority_map *) htab_find (init_priority_for_decl, &in); - return h ? h->fini : DEFAULT_INIT_PRIORITY; -} - -/* Return the initialization and finalization priority information for - DECL. If there is no previous priority information, a freshly - allocated structure is returned. */ - -static struct tree_priority_map * -decl_priority_info (tree decl) -{ - struct tree_priority_map in; - struct tree_priority_map *h; - void **loc; - - in.base.from = decl; - loc = htab_find_slot (init_priority_for_decl, &in, INSERT); - h = (struct tree_priority_map *) *loc; - if (!h) - { - h = ggc_cleared_alloc<tree_priority_map> (); - *loc = h; - h->base.from = decl; - h->init = DEFAULT_INIT_PRIORITY; - h->fini = DEFAULT_INIT_PRIORITY; - } + cgraph_node *node = cgraph_get_node (decl); - return h; + if (!node) + return DEFAULT_INIT_PRIORITY; + return + node->get_fini_priority (); } /* Set the initialization priority for DECL to PRIORITY. */ @@ -6546,13 +6512,19 @@ decl_priority_info (tree decl) void decl_init_priority_insert (tree decl, priority_type priority) { - struct tree_priority_map *h; + struct symtab_node *snode; - gcc_assert (VAR_OR_FUNCTION_DECL_P (decl)); if (priority == DEFAULT_INIT_PRIORITY) - return; - h = decl_priority_info (decl); - h->init = priority; + { + snode = symtab_get_node (decl); + if (!snode) + return; + } + else if (TREE_CODE (decl) == VAR_DECL) + snode = varpool_node_for_decl (decl); + else + snode = cgraph_get_create_node (decl); + snode->set_init_priority (priority); } /* Set the finalization priority for DECL to PRIORITY. */ @@ -6560,13 +6532,17 @@ decl_init_priority_insert (tree decl, priority_type priority) void decl_fini_priority_insert (tree decl, priority_type priority) { - struct tree_priority_map *h; + struct cgraph_node *node; - gcc_assert (TREE_CODE (decl) == FUNCTION_DECL); if (priority == DEFAULT_INIT_PRIORITY) - return; - h = decl_priority_info (decl); - h->fini = priority; + { + node = cgraph_get_node (decl); + if (!node) + return; + } + else + node = cgraph_get_create_node (decl); + node->set_fini_priority (priority); } /* Print out the statistics for the DECL_DEBUG_EXPR hash table. */ |