aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto/lto.c
AgeCommit message (Collapse)AuthorFilesLines
2009-12-15tree.c (free_lang_data_in_binfo): Do not free BINFO_OFFSET and BINFO_VPTR_FIELD.Richard Guenther1-1/+1
2009-12-15 Richard Guenther <rguenther@suse.de> * tree.c (free_lang_data_in_binfo): Do not free BINFO_OFFSET and BINFO_VPTR_FIELD. (free_lang_data_in_type): Do not free TYPE_STUB_DECL if we generate debug information. (free_lang_data_in_decl): Do not free DECL_SIZE_UNIT, DECL_SIZE, DECL_FIELD_OFFSET and DECL_FCONTEXT. (free_lang_data): Do not disable debuginfo. * lto-streamer-out.c (write_symbol_vec): Deal with non-constant DECL_SIZE. (pack_ts_base_value_fields): Write types with false TREE_ASM_WRITTEN. (lto_output_ts_type_tree_pointers): Stream TYPE_STUB_DECL. * lto-streamer-in.c (lto_input_ts_type_tree_pointers): Stream TYPE_STUB_DECL. * dwarf2out.c (add_pure_or_virtual_attribute): Check for DECL_CONTEXT. (gen_type_die_for_member): Test for TYPE_STUB_DECL. * opts.c (decode_options): Do not disable var-tracking for lto. * doc/invoke.texi (-flto): Document -flto vs. -g experimental status. (-fwhopr): Document experimental status. lto/ * lto.c (lto_fixup_field_decl): Fixup DECL_FIELD_OFFSET. (lto_post_options): Do not disable debuginfo. From-SVN: r155259
2009-12-11re PR lto/42037 ("grow domain error" in lto1)Richard Guenther1-1/+1
2009-12-11 Richard Guenther <rguenther@suse.de> PR lto/42037 * lto.c (lto_resolution_read): Properly grow the vector. From-SVN: r155166
2009-11-19re PR bootstrap/42096 (lto.c:289:7: error: implicit declaration of function ↵Rafael Avila de Espindola1-7/+26
'strtoll') 2009-11-19 Rafael Avila de Espindola <espindola@google.com> PR bootstrap/42096 * lto-plugin.c (claim_file_handler): Print offsets in hex. 2009-11-19 Rafael Avila de Espindola <espindola@google.com> PR bootstrap/42096 * lto-elf.c (lto_elf_file_open): Use lto_parse_hex. * lto.c (lto_parse_hex): New. (lto_resolution_read): Use lto_parse_hex. * lto.h (lto_parse_hex): New. From-SVN: r154330
2009-11-17lto-elf.c (lto_file_init): Add offset argument.Rafael Avila de Espindola1-5/+20
2009-11-17 Rafael Avila de Espindola <espindola@google.com> * lto-elf.c (lto_file_init): Add offset argument. (lto_elf_file_open): Record the offset. * lto.c (lto_resolution_read): Change file_name into a lto_file argument. Check offsets. (lto_file_read): Update call to lto_resolution_read. * lto.h (lto_file_struct): Add the offset field. From-SVN: r154251
2009-11-16cgraph.c (cgraph_release_function_body): Update use of ipa_transforms_to_apply.Jan Hubicka1-3/+13
* cgraph.c (cgraph_release_function_body): Update use of ipa_transforms_to_apply. (cgraph_remove_node): Remove ipa_transforms_to_apply. * cgraph.h (struct cgraph_node): Add ipa_transforms_to_apply. * cgraphunit.c (save_inline_function_body): Clear ipa_transforms for copied body. (cgraph_materialize_clone): Remove original if dead. * lto-streamer-in.c (lto_read_body): Remove FIXME and ipa_transforms_to_apply hack. * function.h (struct function): Add ipa_transforms_to_apply. * ipa.c (cgraph_remove_unreachable_nodes): Handle dead clone originals. * tree-inline.c (copy_bb): Update sanity check. (initialize_cfun): Do not copy ipa_transforms_to_apply. (expand_call_inline): remove dead clone originals. (tree_function_versioning): Merge transformation queues. * passes.c (add_ipa_transform_pass): Remove. (execute_one_ipa_transform_pass): Update ipa_transforms_to_apply tracking. (execute_all_ipa_transforms): Update. (execute_one_pass): Update. * lto.c (read_cgraph_and_symbols): Set also ipa_transforms_to_apply. From-SVN: r154200
2009-11-12lto-plugin.c (write_resolution): Assume resolution_file is set.Rafael Avila de Espindola1-4/+6
2009-11-12 Rafael Avila de Espindola <espindola@google.com> * lto-plugin.c (write_resolution): Assume resolution_file is set. Print the symbol name. (all_symbols_read_handler): Create a resolution file. Pass it to gcc. (cleanup_handler): Remove the resolution file. (process_option): Drop the -resolution option. 2009-11-12 Rafael Avila de Espindola <espindola@google.com> * lang.opt (fresolution): Renamed from resolution. * lto-lang.c (lto_handle_option): Handle new option name. * lto.c (lto_resolution_read): Add more checks. Discard rest of line. From-SVN: r154118
2009-10-30re PR lto/41858 (-flto -O2 crashes when many source files.)Richard Guenther1-26/+26
2009-10-30 Richard Guenther <rguenther@suse.de> PR lto/41858 * lto-streamer.h (struct lto_file_decl_data): Remove fd member. lto/ * lto.c (lto_file_read): Do not set file_data->fd. (lto_read_section_data): Use a single-entry file-descriptor cache. Do not check the result of xmalloc. (free_section_data): Do not use file_data->fd. (lto_read_all_file_options): Likewise. From-SVN: r153758
2009-10-22lto-streamer.h (lto_symtab_merge_cgraph_nodes): Declare.Richard Guenther1-57/+9
2009-10-22 Richard Guenther <rguenther@suse.de> * lto-streamer.h (lto_symtab_merge_cgraph_nodes): Declare. * lto-symtab.c (struct lto_symtab_entry_def): Add node member. (lto_symtab_merge): Do not merge cgraph nodes here. (lto_symtab_resolve_can_prevail_p): Simplify. (lto_symtab_resolve_symbols): Store cgraph node. (lto_symtab_merge_decls_1): Simplify. Do not drop non-prevailing functions from the symtab. (lto_symtab_merge_cgraph_nodes_1): New function. (lto_symtab_merge_cgraph_nodes): Likewise. lto/ * lto.c (lto_fixup_jump_functions): Remove. (lto_fixup_decls): Do not fixup jump functions. (read_cgraph_and_symbols): Schedule cgraph merging after summary reading. Schedule type and decl fixup before summary reading. From-SVN: r153460
2009-10-22lto-streamer.h (lto_symtab_clear_resolution): Remove.Richard Biener1-21/+0
2009-10-22 Richard Guenther <rguenther@suse.de> * lto-streamer.h (lto_symtab_clear_resolution): Remove. * lto-symtab.c (lto_symtab_clear_resolution): Likewise. lto/ * lto.c (lto_fixup_data_t): Remove free_list member. (lto_fixup_tree): Do not insert into free_list. (free_decl): Remove. (lto_fixup_decls): Remove free-list handling. From-SVN: r153452
2009-10-22ipa-cp.c (ipcp_write_summary, [...]): New functions.Jan Hubicka1-0/+49
* ipa-cp.c (ipcp_write_summary, ipcp_read_summary): New functions. (pass_ipa_cp): Register them. (ipcp_init_stage): Analyze all functions for whopr/lto. (ipcp_propagate_stage): Skip external calls. (ipcp_iterate_stage): Call ipa_update_after_lto_read if needed. * ipa-reference.c (write_node_summary_p): Fix thinko about availability. * cgraphunit.c (ipa_passes): When in lto, ne er produce new summaries; when in ltrans, skip executing of ipa passes since everything should've been done. * ipa-inline.c (cgraph_decide_inlining): Remove FIXMEs. (inline_generate_summary): Likewise. (inline_read_summary): New function. (inline_write_summary): New function. (pass_ipa_inline): Register new hooks. * ipa-prop.c: Inlcude lto-streamer.h (ipa_edge_args_vector): Update declaration. (ipa_count_arguments, ipa_compute_jump_functions, ipa_free_edge_args_substructures): Move ipa_edge_args_vector into ggc. (ipa_write_jump_function, ipa_read_jump_function, ipa_write_node_info, ipa_read_node_info): New static functions. (ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Update. (duplicate_array): Use xmalloc. (duplicate_ggc_array): New. (ipa_edge_duplication_hook): Use it. (ipa_update_after_lto_read): New function. * ipa-prop.h (ipa_prop_write_jump_functions, ipa_prop_read_jump_functions): Declare. (ipa_pass_through_data, ipa_ancestor_jf_data, ipa_member_ptr_cst, jump_func_value, ipa_member_ptr_cst, ipa_edge_args): Add GTY markers. (ipa_edge_args_vector): Move into GGC. (ipa_check_create_edge_args): Update. (ipa_update_after_lto_read): New. * passes.c (ipa_write_summaries_1): When in wpa, do not write summaries. (ipa_read_summaries): When in ltrans, so not read summaries. * lto-streamer.c (lto_get_section_name): Add LTO_section_jump_functions. * lto-streamer.h (LTO_section_jump_functions): New section. (produce_asm): Declare. * lto-cgraph.c (output_cgraph): Output edges in reverse order. * lto-streamer-out.c (produce_asm): Export. * lto-streamer-in.c: Include tree-pass.h (input_function): Free dominance info when done. (lto_read_body): Push ipa_inline in ltrans stage. * gengtype.c (open_base_files): Add ipa-prop.h into includes. * Makefile.in (GTFILES): Add ipa-prop.h * lto.c (lto_fixup_jump_functions): New function. (lto_fixup_decls): Use it. From-SVN: r153449
2009-10-16re PR lto/41715 (VIEW_CONVERT_EXPR use for mismatched prevailing decl ↵Richard Guenther1-9/+1
replacement doesn't work) 2009-10-16 Richard Guenther <rguenther@suse.de> PR lto/41715 * lto-streamer-in.c (lto_input_tree_ref): Revert last change. (maybe_fixup_handled_component): New function. (input_gimple_stmt): Fixup mismatched decl replacements. lto/ * lto.c (lto_fixup_tree): Revert last change. * gfortran.dg/lto/20091015-1_0.f: New testcase. * gfortran.dg/lto/20091015-1_1.f: Likewise. * gfortran.dg/lto/20091015-1_2.f: Likewise. From-SVN: r152903
2009-10-14lto-symtab.c (lto_symtab_compatible): Fold in ...Richard Guenther1-1/+9
2009-10-14 Richard Guenther <rguenther@suse.de> * lto-symtab.c (lto_symtab_compatible): Fold in ... (lto_symtab_merge): ... here. Rewrite both to take the prevailing and a to-be-merged entry and to queue diagnostics properly. (lto_symtab_resolve_replaceable_p): New predicate for symbol resolution. (lto_symtab_resolve_can_prevail_p): Likewise. (lto_symtab_resolve_symbols): Rewrite. Fold in code that handles merging commons by choosing the largest decl. Fold in code that gives ODR errors. (lto_symtab_merge_decls_2): Simplify a lot. Emit queued diagnostics here. (lto_symtab_merge_decls_1): Re-structure. Deal with the case of no prevailing decl here. Diagnose mismatches in object types here. Drop all but the prevailing decls. (lto_symtab_prevailing_decl): Return the single prevailing decl. * lto-streamer-in.c (lto_input_tree_ref): Deal with VIEW_CONVERT_EXPRs in decl slots. Unshare the tree in this case. lto/ * lto.c (lto_fixup_tree): In case the prevailing decl is not compatible with the one we replace wrap it around a VIEW_CONVERT_EXPR. From-SVN: r152768
2009-10-09re PR driver/41637 (testsuite (-flto/-fwhopr) leaves does not clean up in /tmp)Richard Guenther1-1/+4
2009-10-09 Richard Guenther <rguenther@suse.de> PR driver/41637 * lto-wrapper.c (ltrans_output_file, flto_out, args_name): New globals. (lto_wrapper_exit): New function. (fatal): Use it. (fatal_perror): Likewise. (fork_execute): Use global args_name, do not free it. (run_gcc): Use global ltrans_output_file, flto_out, do not free them. * lto-streamer.h: Remove duplicate prototypes. PR lto/41635 PR lto/41636 lto/ * lto.c (read_cgraph_and_symbols): Do not assert we can open a file. * lto-elf.c (init_shdr##BITS): Fix i18n problems. (init_ehdr##BITS): Likewise. From-SVN: r152588
2009-10-08gimple.c (free_gimple_type_tables): New function.Richard Guenther1-0/+3
2009-10-08 Richard Guenther <rguenther@suse.de> * gimple.c (free_gimple_type_tables): New function. * gimple.h (free_gimple_type_tables): Declare. lto/ * lto.c (read_cgraph_and_symbols): Free the gimple type merging hash tables. From-SVN: r152562
2009-10-07* lto.c: Only include <sys/mman.h> if HAVE_MMAP_FILE.Joseph Myers1-0/+2
From-SVN: r152543
2009-10-07lto-symtab.c (lto_cgraph_replace_node): Assert that inline clones has no ↵Jan Hubicka1-5/+12
address taken. * lto-symtab.c (lto_cgraph_replace_node): Assert that inline clones has no address taken. * cgraph.c (cgraph_mark_needed_node): Assert that inline clones are never needed. (cgraph_clone_node): Clear externally_visible flag for clones. * cgraph.h (cgraph_only_called_directly_p, cgraph_can_remove_if_no_direct_calls_p): New predicates. * tree-pass.h (pass_ipa_whole_program_visibility): Declare. * ipa-cp.c (ipcp_cloning_candidate_p): Use new predicate. (ipcp_initialize_node_lattices, ipcp_estimate_growth, ipcp_insert_stage): Likwise. * cgraphunit.c (cgraph_decide_is_function_needed): Do not compute externally_visible flag. (verify_cgraph_node): Verify that inline clones look right. (process_function_and_variable_attributes): Do not set externally_visible flags. (ipa_passes): Avoid executing small_ipa_passes at LTO stage; they've been already run. * lto-cgraph.c (lto_output_node): Assert that inline clones are not boundaries. * ipa-inline.c (cgraph_clone_inlined_nodes): Use new predicates; clear externally_visible when turning into inline clones (cgraph_mark_inline_edge): Use new predicates. (cgraph_estimate_growth): Likewise. (cgraph_decide_inlining): Likewise. * ipa.c (cgraph_postorder): Likewise. (cgraph_remove_unreachable_nodes): Likewise; sanity check that inline clones are not needed. (cgraph_externally_visible_p): New predicate. (function_and_variable_visibility): Add whole_program parameter; always set externally_visible flag; handle COMDAT function privatization. (local_function_and_variable_visibility): New function. (gate_whole_program_function_and_variable_visibility): New function. (whole_program_function_and_variable_visibility): New function. (pass_ipa_whole_program_visibility): New function. * passes.c (init_optimization_passes): Add whole program visibility pass. (do_per_function_toporder, function_called_by_processed_nodes_p): Do not care about needed/reachable flags. * varpool.c: Include flags.h (decide_is_variable_needed): When doing LTO assume whole-program mode. (varpool_finalize_decl): When we are in LTO read-back, all variables are analyzed. (varpool_analyze_pending_decls): Skip analyzis of analyzed vars. * lto/lto.c (read_cgraph_and_symbols): Mark functions neccesary only at ltrans stage; explain why this is needed and should not. From-SVN: r152520
2009-10-05re PR lto/41552 (Undefined references with -flto, dependent on object file ↵Richard Guenther1-53/+12
ordering) 2009-10-05 Richard Guenther <rguenther@suse.de> PR lto/41552 PR lto/41487 * lto-symtab.c (struct lto_symtab_base_def): Remove. (struct lto_symtab_identifier_def): Likewise. (struct lto_symtab_decl_def): Likewise. (struct lto_symtab_entry_def): New. (lto_symtab_identifier_t): Rename to ... (lto_symtab_entry_t): ... this. (lto_symtab_decls): Remove. (lto_symtab_base_hash): Rename to ... (lto_symtab_entry_hash): ... this. (lto_symtab_base_eq): Rename to ... (lto_symtab_entry_eq): ... this. (lto_symtab_base_marked_p): Rename to ... (lto_symtab_entry_marked_p): ... this. (lto_symtab_identifier_marked_p): Remove. (lto_symtab_decl_marked_p): Likewise. (lto_symtab_maybe_init_hash_tables): Rename to ... (lto_symtab_maybe_init_hash_table): ... this. (lto_symtab_set_resolution_and_file_data): Remove. (lto_symtab_register_decl): New function. (lto_symtab_get_identifier): Remove. (lto_symtab_get): New function. (lto_symtab_get_resolution): Adjust. (lto_symtab_get_identifier_decl): Remove. (lto_symtab_set_identifier_decl): Likewise. (lto_symtab_merge_decl): Rename to ... (lto_symtab_merge): ... this. Rewrite. (lto_symtab_merge_var): Remove. (lto_symtab_merge_fn): Likewise. (lto_symtab_prevailing_decl): Adjust. (lto_cgraph_replace_node): New function. (lto_symtab_merge_decls_2): Likewise. (lto_symtab_merge_decls_1): Likewise. (lto_symtab_fixup_var_decls): Likewise. (lto_symtab_resolve_symbols): Likewise. (lto_symtab_merge_decls): Likewise. (lto_symtab_prevailing_decl): Adjust. (lto_symtab_get_symtab_def): Remove. (lto_symtab_get_file_data): Likewise. (lto_symtab_clear_resolution): Adjust. (lto_symtab_clear_resolution): Likewise. * lto-cgraph.c (input_edge): Do not merge cgraph nodes here. (input_cgraph_1): Likewise. * lto-streamer-in.c (get_resolution): Do not provide fake symbol resolutions here. (deferred_global_decls): Remove. (lto_register_deferred_decls_in_symtab): Likewise. (lto_register_var_decl_in_symtab): Change signature, register variable via lto_symtab_register_decl. (lto_register_function_decl_in_symtab): Likewise. (lto_read_tree): Adjust. * lto-streamer.h (lto_register_deferred_decls_in_symtab): Remove. (lto_symtab_merge_var): Likewise. (lto_symtab_merge_fn): Likewise. (lto_symtab_register_decl): Declare. (lto_symtab_merge_decls): Likewise. lto/ * lto.c (lto_read_decls): Do not register deferred decls. (read_cgraph_and_symbols): Delay symbol and cgraph merging until after reading the IPA summaries. * g++.dg/lto/20091002-1_0.C: Adjust flags. * g++.dg/lto/20091004-1_0.C: New testcase. * g++.dg/lto/20091004-1_1.C: Likewise. * g++.dg/lto/20091004-2_0.C: Likewise. * g++.dg/lto/20091004-2_1.C: Likewise. * g++.dg/lto/20091004-3_0.C: Likewise. * g++.dg/lto/20091004-3_1.C: Likewise. From-SVN: r152450
2009-10-03Merge lto branch into trunk.Diego Novillo1-0/+2067
From-SVN: r152434