From bbf9ad070dd1acea0c60aa531a738c8fc8d410d5 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 12 Jun 2013 11:12:47 +0200 Subject: lto-symtab.c (lto_symtab_merge_symbols): Populate symtab hashtable. * lto-symtab.c (lto_symtab_merge_symbols): Populate symtab hashtable. * cgraph.h (varpool_create_empty_node): Declare. * lto-cgraph.c (input_node, input_varpool_node): Forcingly create duplicated nodes. * symtab.c (symtab_unregister_node): Be lax about missin entries in node hash. (symtab_get_node): Update comment. * varpool.c (varpool_create_empty_node): Break out from ... (varpool_node_for_decl): ... here. * lto-streamer.h (lto_file_decl_data): Add RESOLUTION_MAP. * lto.c (register_resolution): Take lto_file_data argument. (lto_register_var_decl_in_symtab, lto_register_function_decl_in_symtab): Update. (read_cgraph_and_symbols): Update resolution_map handling. From-SVN: r199990 --- gcc/lto/ChangeLog | 7 +++++++ gcc/lto/lto.c | 46 +++++++++++++++++++++++----------------------- 2 files changed, 30 insertions(+), 23 deletions(-) (limited to 'gcc/lto') diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 153f023..216882a 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,10 @@ +2013-06-12 Jan Hubicka + + * lto.c (register_resolution): Take lto_file_data argument. + (lto_register_var_decl_in_symtab, + lto_register_function_decl_in_symtab): Update. + (read_cgraph_and_symbols): Update resolution_map handling. + 2013-06-11 Jan Hubicka * lto-partition.c (get_symbol_class): Simplify weakref handling. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index c90a2d8..a4c5d29 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -1726,18 +1726,16 @@ get_resolution (struct data_in *data_in, unsigned index) return LDPR_UNKNOWN; } -/* Map assigning declarations their resolutions. */ -static pointer_map_t *resolution_map; - /* We need to record resolutions until symbol table is read. */ static void -register_resolution (tree decl, enum ld_plugin_symbol_resolution resolution) +register_resolution (struct lto_file_decl_data *file_data, tree decl, + enum ld_plugin_symbol_resolution resolution) { if (resolution == LDPR_UNKNOWN) return; - if (!resolution_map) - resolution_map = pointer_map_create (); - *pointer_map_insert (resolution_map, decl) = (void *)(size_t)resolution; + if (!file_data->resolution_map) + file_data->resolution_map = pointer_map_create (); + *pointer_map_insert (file_data->resolution_map, decl) = (void *)(size_t)resolution; } /* Register DECL with the global symbol table and change its @@ -1764,7 +1762,7 @@ lto_register_var_decl_in_symtab (struct data_in *data_in, tree decl) unsigned ix; if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); - register_resolution (decl, get_resolution (data_in, ix)); + register_resolution (data_in->file_data, decl, get_resolution (data_in, ix)); } } @@ -1784,7 +1782,7 @@ lto_register_function_decl_in_symtab (struct data_in *data_in, tree decl) unsigned ix; if (!streamer_tree_cache_lookup (data_in->reader_cache, decl, &ix)) gcc_unreachable (); - register_resolution (decl, get_resolution (data_in, ix)); + register_resolution (data_in->file_data, decl, get_resolution (data_in, ix)); } } @@ -2865,6 +2863,8 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) struct cgraph_node *node; int count = 0; struct lto_file_decl_data **decl_data; + void **res; + symtab_node snode; init_cgraph (); @@ -2971,21 +2971,21 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) input_symtab (); /* Store resolutions into the symbol table. */ - if (resolution_map) - { - void **res; - symtab_node snode; - FOR_EACH_SYMBOL (snode) - if (symtab_real_symbol_p (snode) - && (res = pointer_map_contains (resolution_map, - snode->symbol.decl))) - snode->symbol.resolution - = (enum ld_plugin_symbol_resolution)(size_t)*res; - - pointer_map_destroy (resolution_map); - resolution_map = NULL; - } + FOR_EACH_SYMBOL (snode) + if (symtab_real_symbol_p (snode) + && snode->symbol.lto_file_data + && snode->symbol.lto_file_data->resolution_map + && (res = pointer_map_contains (snode->symbol.lto_file_data->resolution_map, + snode->symbol.decl))) + snode->symbol.resolution + = (enum ld_plugin_symbol_resolution)(size_t)*res; + for (i = 0; all_file_decl_data[i]; i++) + if (all_file_decl_data[i]->resolution_map) + { + pointer_map_destroy (all_file_decl_data[i]->resolution_map); + all_file_decl_data[i]->resolution_map = NULL; + } timevar_pop (TV_IPA_LTO_CGRAPH_IO); -- cgit v1.1