X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=blobdiff_plain;f=gcc%2Flto%2Flto.c;h=b6001d85dd0becd1f7729a5e63d42052af984bca;hp=1544f05ab4fc381e58af99964b1d66d6ae6de320;hb=b3d889a555f0de3257a55e1f1ad5e3c540d4fd15;hpb=08843223915f937a606645b334d9743aee7d91d0 diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 1544f05ab4f..b6001d85dd0 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -378,7 +378,7 @@ lto_file_read (lto_file *file, FILE *resolution_file) file_data = XCNEW (struct lto_file_decl_data); file_data->file_name = file->filename; - file_data->section_hash_table = lto_elf_build_section_table (file); + file_data->section_hash_table = lto_obj_build_section_table (file); file_data->renaming_hash_table = lto_create_renaming_table (); data = lto_get_section_data (file_data, LTO_section_decls, NULL, &len); @@ -760,7 +760,8 @@ globalize_cross_file_statics (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, } else if (TREE_CODE (t) == FUNCTION_DECL && !TREE_PUBLIC (t)) { - if (!cgraph_node_in_set_p (cgraph_node (t), context->set)) + if (!cgraph_node_in_set_p (cgraph_node (t), context->set) + || cgraph_node (t)->address_taken) { /* This file-scope static function is reachable from a set which does not contain the function DECL. Make it global @@ -1039,16 +1040,16 @@ lto_wpa_write_files (void) if (cgraph_node_set_needs_ltrans_p (set)) { /* Write all the nodes in SET to TEMP_FILENAME. */ - file = lto_elf_file_open (temp_filename, true); + file = lto_obj_file_open (temp_filename, true); if (!file) - fatal_error ("lto_elf_file_open() failed"); + fatal_error ("lto_obj_file_open() failed"); lto_set_current_out_file (file); - ipa_write_summaries_of_cgraph_node_set (set); + ipa_write_optimization_summaries (set); lto_set_current_out_file (NULL); - lto_elf_file_close (file); + lto_obj_file_close (file); } } @@ -1560,28 +1561,6 @@ lto_fixup_tree (tree *tp, int *walk_subtrees, void *data) if (t != prevailing) { - if (TREE_CODE (t) == FUNCTION_DECL - && TREE_NOTHROW (prevailing) != TREE_NOTHROW (t)) - { - /* If the prevailing definition does not throw but the - declaration (T) was considered throwing, then we - simply add PREVAILING to the list of throwing - functions. However, if the opposite is true, then - the call to PREVAILING was generated assuming that - the function didn't throw, which means that CFG - cleanup may have removed surrounding try/catch - regions. - - Note that we currently accept these cases even when - they occur within a single file. It's certainly a - user error, but we silently allow the compiler to - remove surrounding try/catch regions. Perhaps we - could emit a warning here, instead of silently - accepting the conflicting declaration. */ - if (TREE_NOTHROW (prevailing)) - lto_mark_nothrow_fndecl (prevailing); - } - /* Also replace t with prevailing defintion. We don't want to insert the other defintion in the seen set as we want to replace all instances of it. */ @@ -1761,17 +1740,17 @@ lto_read_all_file_options (void) for (i = 0; i < num_in_fnames; i++) { struct lto_file_decl_data *file_data; - lto_file *file = lto_elf_file_open (in_fnames[i], false); + lto_file *file = lto_obj_file_open (in_fnames[i], false); if (!file) break; file_data = XCNEW (struct lto_file_decl_data); file_data->file_name = file->filename; - file_data->section_hash_table = lto_elf_build_section_table (file); + file_data->section_hash_table = lto_obj_build_section_table (file); lto_read_file_options (file_data); - lto_elf_file_close (file); + lto_obj_file_close (file); htab_delete (file_data->section_hash_table); free (file_data); } @@ -1821,12 +1800,20 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) gcc_assert (num_objects == nfiles); } + if (!quiet_flag) + fprintf (stderr, "Reading object files:"); + /* Read all of the object files specified on the command line. */ for (i = 0, last_file_ix = 0; i < nfiles; ++i) { struct lto_file_decl_data *file_data = NULL; + if (!quiet_flag) + { + fprintf (stderr, " %s", fnames[i]); + fflush (stderr); + } - current_lto_file = lto_elf_file_open (fnames[i], false); + current_lto_file = lto_obj_file_open (fnames[i], false); if (!current_lto_file) break; @@ -1836,7 +1823,7 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) all_file_decl_data[last_file_ix++] = file_data; - lto_elf_file_close (current_lto_file); + lto_obj_file_close (current_lto_file); current_lto_file = NULL; } @@ -1851,9 +1838,15 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) /* Each pass will set the appropriate timer. */ timevar_pop (TV_IPA_LTO_DECL_IO); + if (!quiet_flag) + fprintf (stderr, "\nReading the callgraph\n"); + /* Read the callgraph. */ input_cgraph (); + if (!quiet_flag) + fprintf (stderr, "Merging declarations\n"); + /* Merge global decls. */ lto_symtab_merge_decls (); @@ -1861,8 +1854,14 @@ read_cgraph_and_symbols (unsigned nfiles, const char **fnames) lto_fixup_decls (all_file_decl_data); free_gimple_type_tables (); + if (!quiet_flag) + fprintf (stderr, "Reading summaries\n"); + /* Read the IPA summary data. */ - ipa_read_summaries (); + if (flag_ltrans) + ipa_read_optimization_summaries (); + else + ipa_read_summaries (); /* Finally merge the cgraph according to the decl merging decisions. */ lto_symtab_merge_cgraph_nodes (); @@ -1908,6 +1907,11 @@ materialize_cgraph (void) unsigned i; timevar_id_t lto_timer; + if (!quiet_flag) + fprintf (stderr, + flag_wpa ? "Materializing decls:" : "Reading function bodies:"); + + /* Now that we have input the cgraph, we need to clear all of the aux nodes and read the functions if we are not running in WPA mode. */ timevar_push (TV_IPA_LTO_GIMPLE_IO); @@ -1926,6 +1930,7 @@ materialize_cgraph (void) if (node->local.lto_file_data && !DECL_IS_BUILTIN (node->decl)) { + announce_function (node->decl); lto_materialize_function (node); lto_stats.num_input_cgraph_nodes++; } @@ -1947,8 +1952,8 @@ materialize_cgraph (void) for (i = 0; VEC_iterate (tree, lto_global_var_decls, i, decl); i++) rest_of_decl_compilation (decl, 1, 0); - /* Fix up any calls to DECLs that have become not exception throwing. */ - lto_fixup_nothrow_decls (); + if (!quiet_flag) + fprintf (stderr, "\n"); timevar_pop (lto_timer); } @@ -1986,7 +1991,14 @@ do_whole_program_analysis (void) lto_1_to_1_map (); + if (!quiet_flag) + { + fprintf (stderr, "\nStreaming out"); + fflush (stderr); + } output_files = lto_wpa_write_files (); + if (!quiet_flag) + fprintf (stderr, "\n"); /* Show the LTO report before launching LTRANS. */ if (flag_lto_report)