Commit Graph

40 Commits

Author SHA1 Message Date
Dave Korn 3bec79c52e re PR lto/42776 (LTO doesn't work on non-ELF platforms.)
ChangeLog:

	PR lto/42776
	* configure.ac (--enable-lto): Refactor handling so libelf tests
	are only performed inside then-clause of ACX_ELF_TARGET_IFELSE,
	and allow LTO to be explicitly enabled on non-ELF platforms that
	are known to support it inside else-clause.
	* configure: Regenerate.

gcc/ChangeLog:

	PR lto/42776
	* configure.ac (gcc_cv_as_section_has_align): Set if installed
	binutils supports extended .section directive needed by LTO, or
	warn if older binutils found.
	(LTO_BINARY_READER): New AC_SUBST'd variable.
	(LTO_USE_LIBELF): Likewise.
	* gcc/config.gcc (lto_binary_reader): New target-specific configure
	variable.
	* gcc/Makefile.in (LTO_BINARY_READER): Import AC_SUBST'd autoconf var.
	(LTO_USE_LIBELF): Likewise.
	* configure: Regenerate.

	* collect2.c (is_elf): Rename from this ...
	(is_elf_or_coff): ... to this, and recognize and allow i386 COFF
	 object files in addition to ELF-formatted ones.
	(scan_prog_file): Caller updated.  Also allow for LTO info marker
	symbol to be prefixed or not by an extra underscore.

	* config/i386/t-cygming (winnt.o): Also depend on LTO_STREAMER_H.
	* config/i386/winnt.c: Also #include lto-streamer.h
	(i386_pe_asm_named_section): Specify 1-byte section alignment for
	LTO named sections.
	(i386_pe_asm_output_aligned_decl_common): Add comment.
	(i386_pe_maybe_record_exported_symbol): Allow decl arg to be NULL.

gcc/lto/ChangeLog:

	PR lto/42776
	* Make-lang.in (LTO_OBJS): Use LTO_BINARY_READER instead of
	hardcoding 'lto-elf.o'.
	($(LTO_EXE)): Use LTO_USE_LIBELF instead of hardcoding '-lelf'.

	* lto-coff.h: New file.
	* lto-coff.c: Likewise.

gcc/testsuite/ChangeLog:

	PR lto/42776
	* lib/lto.exp (lto_prune_vis_warns): New function.
	(lto-link-and-maybe-run): Call it.

From-SVN: r158762
2010-04-27 02:22:40 +00:00
Richard Guenther 21aac88050 lto.c (lto_fixup_type): Deal with non-type TYPE_CONTEXT.
2010-04-26  Richard Guenther  <rguenther@suse.de>

	* lto.c (lto_fixup_type): Deal with non-type TYPE_CONTEXT.

	* gcc.dg/lto/20100426_0.c: New testcase.

From-SVN: r158729
2010-04-26 11:03:59 +00:00
Dave Korn 2cee010136 lto.h (lto_elf_file_open): Rename prototype from this ...
* lto.h (lto_elf_file_open): Rename prototype from this ...
	(lto_obj_file_open): ... to this.
	(lto_elf_file_close): Likewise ...
	(lto_obj_file_close): ... and likewise.
	(lto_elf_build_section_table): Likewise ...
	(lto_obj_build_section_table): ... and likewise.
	(lto_elf_begin_section): Likewise ...
	(lto_obj_begin_section): ... and likewise.
	(lto_elf_append_data): Likewise ...
	(lto_obj_append_data): ... and likewise.
	(lto_elf_end_section): Likewise ...
	(lto_obj_end_section): ... and likewise.
	* lto.c (lto_file_read): Update references to the above.
	(lto_wpa_write_files): Likewise.
	(lto_read_all_file_options): Likewise.
	(read_cgraph_and_symbols): Likewise.
	* lto-lang.c (LANG_HOOKS_BEGIN_SECTION): Likewise.
	(LANG_HOOKS_APPEND_DATA): Likewise.
	(LANG_HOOKS_END_SECTION): Likewise.
	* lto-elf.c (lto_elf_file_open): Rename from this ...
	(lto_obj_file_open): ... to this, updating any references.
	(lto_elf_file_close): Likewise ...
	(lto_obj_file_close): ... and likewise.
	(lto_elf_build_section_table): Likewise ...
	(lto_obj_build_section_table): ... and likewise.
	(lto_elf_begin_section): Likewise ...
	(lto_obj_begin_section): ... and likewise.
	(lto_elf_append_data): Likewise ...
	(lto_obj_append_data): ... and likewise.
	(lto_elf_end_section): Likewise ...
	(lto_obj_end_section): ... and likewise.

From-SVN: r158718
2010-04-26 03:41:04 +00:00
Jan Hubicka bc58d7e1bd timevar.def (TV_WHOPR_WPA_FIXUP): Remove.
* timevar.def (TV_WHOPR_WPA_FIXUP): Remove.
	* lto-section-in.c (lto_section_name): Remove wpa_fixup.
	* lto-wpa-fixup.c: Remove.
	* Makefile.in (lto-wpa-fixup.o): Remove.
	* passes.c (init_optimization_passes): Remove pass_ipa_lto_wpa_fixup.
	(execute_all_ipa_transforms): Set cgraph_state to CGRAPH_STATE_IPA_SSA.
	* lto-streamer.c (lto_get_section_name): Remove wpa_fixup section.
	
	* lto.c (lto_fixup_tree): Do not call wpa fixup.
	(materialize_cgraph): Likewise.

From-SVN: r158622
2010-04-21 21:58:50 +00:00
Jan Hubicka e792884f75 tree-pass.h (ipa_opt_pass_d): Rename function_read_summary...
* tree-pass.h (ipa_opt_pass_d): Rename function_read_summary;
	add write_optimization_summary, read_optimization_summary.
	(ipa_write_summaries_of_cgraph_node_set): Remove.
	(ipa_write_optimization_summaries): Declare.
	(ipa_read_optimization_summaries): Declare.
	* ipa-cp.c (pass_ipa_cp): Update.
	* ipa-reference.c (pass_ipa_reference): Update.
	* ipa-pure-const.c (pass_ipa_pure_const): Update.
	* lto-streamer-out.c (pass_ipa_lto_gimple, pass_ipa_lto_finish):
	Update.
	* ipa-inline.c (pass_ipa_inline): Update.
	* ipa.c (pass_ipa_whole_program): Update.
	* lto-wpa-fixup.c (pass_ipa_lto_wpa_fixup): Update.
	* passes.c (ipa_write_summaries_1): Do not test wpa.
	(ipa_write_optimization_summaries_1): New.
	(ipa_write_optimization_summaries): New.
	(ipa_read_summaries): Do not test ltrans.
	(ipa_read_optimization_summaries_1): New.
	(ipa_read_optimization_summaries): New.

	* lto.c (lto_wpa_write_files): Update.
	(read_cgraph_and_symbols): Be more verbose.
	(materialize_cgraph): Likewise.
	(do_whole_program_analysis): Likewise.

From-SVN: r158616
2010-04-21 17:44:03 +00:00
Jan Hubicka c9945504c9 lto.c (globalize_cross_file_statics): When function has address taken, it needs to be public.
* lto.c (globalize_cross_file_statics): When function has address taken,
	it needs to be public.
	* varpool.c (decide_is_variable_needed): Variable is always needed
	during ltrans.

From-SVN: r158609
2010-04-21 14:41:03 +00:00
Jan Hubicka a837268b2b cgraph.c (cgraph_remove_node): Kill bodies in other partitoin.
* cgraph.c (cgraph_remove_node): Kill bodies in other partitoin.
	(dump_cgraph_node): Dump new flags.
	* cgraph.h (struct cgraph_node): Add flags reachable_from_other_partition
	and in_other_partition.
	(cgraph_can_remove_if_no_direct_calls_p): Functions used by other partition
	can not be removed.
	* cgraphunit.c (cgraph_mark_functions_to_output): Functions used by the other
	partition must be output; silence sanity checking on leaking functions
	bodies from other paritition.
	* lto-cgraph.c (reachable_from_other_partition_p): New function.
	(lto_output_node): Output new flags; do not sanity check that inline
	clones are output; drop lto_forced_extern_inline_p code; do not mock
	visibility flags at partition boundaries.
	(add_node_to): New function.
	(output_cgraph): Use it to sort functions so masters appear before
	clones.
	(input_overwrite_node): Input new flags.
	* passes.c (ipa_write_summaries): Do not call
	lto_new_extern_inline_states.
	* lto-section-out.c (forced_extern_inline, lto_new_extern_inline_states,
	lto_delete_extern_inline_states, lto_force_functions_extern_inline,
	lto_forced_extern_inline_p): Kill.
	* lto-streamer.h (lto_new_extern_inline_states,
	* lto_delete_extern_inline_states, lto_force_functions_extern_inline,
	lto_forced_extern_inline_p): Kill.

	* lto.c (lto_add_inline_clones): Do not track inlined_decls.
	(lto_add_all_inlinees): Likewise.
	(lto_wpa_write_files): Likewise.

From-SVN: r158563
2010-04-20 14:49:18 +00:00
Eric Botcazou 3b9e5d953c fold-const.c (fold_comparison): Use ssizetype.
2010-04-18  Eric Botcazou  <ebotcazou@adacore.com>

	* fold-const.c (fold_comparison): Use ssizetype.
	* gimple-fold.c (maybe_fold_offset_to_array_ref): Likewise.
	* ipa-prop.c (ipa_modify_call_arguments): Use sizetype.
	* tree-loop-distribution.c (build_size_arg_loc): Likewise.
	* tree-object-size.c (compute_object_sizes): Use size_type_node.

	* tree.h (initialize_sizetypes): Remove parameter.
	(build_common_tree_nodes): Remove second parameter.
	* stor-layout.c (initialize_sizetypes): Remove parameter.
	Always create an unsigned type.
	(set_sizetype): Assert that the passed type is unsigned and simplify.
	* tree.c (build_common_tree_nodes): Remove second parameter.
	Adjust call to initialize_sizetypes.
	* c-decl.c (c_init_decl_processing): Remove second argument in call to
	build_common_tree_nodes.
cp/
	* decl.c (cxx_init_decl_processing): Remove second argument in call to
	build_common_tree_nodes.
java/
	* decl.c (java_init_decl_processing): Remove argument in call to
	initialize_sizetypes
fortran/
	* f95-lang.c (gfc_init_decl_processing): Remove second argument in call
	to build_common_tree_nodes.
ada/
	* gcc-interface/misc.c (gnat_init): Remove second argument in call to
	build_common_tree_nodes.
lto/
	* lto-lang.c (lto_init): Remove second argument in call to
	build_common_tree_nodes.

From-SVN: r158496
2010-04-18 21:49:29 +00:00
Rainer Orth 8ccb78f2d0 configure.ac: Check for elf_getshdrstrndx or elf_getshstrndx separately.
toplevel:
	* configure.ac: Check for elf_getshdrstrndx or elf_getshstrndx
	separately.
	* configure: Regenerate.

	gcc:
	* configure.ac: Check for elf_getshdrstrndx or elf_getshstrndx
	flavor.
	* configure: Regenerate.
	* config.in: Regenerate.
	* doc/install.texi (Prerequisites): Document that Solaris 2 libelf
	works.

	gcc/lto:
	* lto-elf.c [!HAVE_ELF_GETSHDRSTRNDX] (elf_getshdrstrndx): New
	function.

From-SVN: r158423
2010-04-16 13:45:25 +00:00
Eric Botcazou 2f9b99e6c6 re PR bootstrap/43276 (lto-elf.c:388:10: error: 'EM_SPARC')
PR bootstrap/43276
	* lto-elf.c: Define EM_* constants if not already defined.

From-SVN: r157305
2010-03-09 09:01:56 +00:00
Eric Botcazou bef7d288df lto-elf.c (is_compatible_architecture): New static function.
* lto-elf.c (is_compatible_architecture): New static function.
	(DEFINE_VALIDATE_EHDR): Use it to validate the architecture.

From-SVN: r157192
2010-03-03 10:29:22 +00:00
Richard Guenther f68df07c55 re PR driver/43021 (Driver no longer handles fancy names)
2010-02-11  Richard Guenther  <rguenther@suse.de>

	PR driver/43021
	* gcc.c (process_command): Handle LTO file@offset case more
	appropriately.

	lto/
	* lto-elf.c (lto_elf_file_open): Handle file@offset case more
	appropriately.

From-SVN: r156695
2010-02-11 12:23:08 +00:00
Andy Hutchinson 3cdea2b453 lto.c (O_BINARY): Define.
2010-01-11  Andy Hutchinson  <hutchinsonandy@gcc.gnu.org>

   * lto.c (O_BINARY): Define.
   (lto_read_section_data): Open file in binary mode.
   * lto-elf.c (O_BINARY): Define.
   (lto_elf_file_open): Open file in binary mode.

From-SVN: r155820
2010-01-11 23:15:32 +00:00
Richard Guenther c59449fa24 re PR lto/42528 (ICE with -flto and -fsigned-char)
2010-01-08  Richard Guenther  <rguenther@suse.de>

	PR lto/42528
	* c.opt (fsigned-char): Also let LTO handle this option.
	(funsigned-char): Likewise.

	lto/
	* lto-lang.c (lto_handle_option): Handle -f[un]signed-char.
	(lto_init): Do not init char_type_node in a standard way
	but according to flag_signed_char.

	* gcc.dg/lto/20100103-1_0.c: New testcase.
	* gcc.dg/lto/20100103-2_0.c: Likewise.

From-SVN: r155740
2010-01-08 16:57:59 +00:00
H.J. Lu d7fb0a6db1 Pass -dumpbase and -dumpdir to gcc for LTO
gcc/

2010-01-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR lto/41564
	* common.opt: Add dumpdir.

	* gcc.c (cc1_options): Add "-dumpbase %B" only if -dumpbase
	isn't specified.
	(option_map): Add --dumpdir.

	* gcc.h (DEFAULT_WORD_SWITCH_TAKES_ARG): Add dumpdir.

	* lto-wrapper.c (run_gcc): Add -dumpbase and -dumpdir for -o.

	* opts.c (decode_options): Try dump_dir_name first if
	dump_base_name isn't an absolute path.
	(common_handle_option): Handle OPT_dumpdir.

	* toplev.c (dump_dir_name): New.
	(print_switch_values): Also ignore -dumpdir.

	* toplev.h (dump_dir_name): New.

gcc/lto/

2010-01-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR lto/41564
	* lto.c (DUMPBASE_SUFFIX): New.
	(lto_execute_ltrans): Append a sequence number to -dumpbase
	for LTRANS.

From-SVN: r155591
2010-01-03 09:03:38 -08:00
H.J. Lu 78ce4053fa Stop if the command line option file is missing
2010-01-02  H.J. Lu  <hongjiu.lu@intel.com>

	PR lto/42580
	* lto-elf.c (lto_elf_file_open): Stop if the command line
	option file is missing.

From-SVN: r155575
2010-01-02 09:30:12 -08:00
Richard Guenther 2a71eb48e4 tree.c (free_lang_data_in_binfo): Do not free BINFO_OFFSET and BINFO_VPTR_FIELD.
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-15 16:30:22 +00:00
Dmitry Gorbachev a818bca1e3 Make-lang.in ($(LTO_EXE)): Use $(LINKER).
2009-12-14  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>

	* Make-lang.in ($(LTO_EXE)): Use $(LINKER).

From-SVN: r155212
2009-12-14 10:42:52 +00:00
Richard Guenther e7d00517fa re PR lto/42037 ("grow domain error" in lto1)
2009-12-11  Richard Guenther  <rguenther@suse.de>

	PR lto/42037
	* lto.c (lto_resolution_read): Properly grow the vector.

From-SVN: r155166
2009-12-11 15:52:57 +00:00
Richard Guenther 1ab5389345 re PR lto/41915 (FAIL: gcc.dg/torture/builtin-math-7.c -O2 -flto execution test)
2009-12-11  Richard Guenther  <rguenther@suse.de>

	PR lto/41915
	* lto-lang.c (lto_init_options): Initialize flag_complex_method
	to the C99 default.  Do not set flag_unit_at_a_time.

From-SVN: r155164
2009-12-11 14:49:35 +00:00
Jakub Jelinek 0f900dfafa matrix-reorg.c (analyze_matrix_allocation_site): Remove unused malloc_fname variable.
* matrix-reorg.c (analyze_matrix_allocation_site): Remove unused
	malloc_fname variable.
	(check_allocation_function): Remove unused gsi and bb_level_0
	variables.
	(transform_access_sites): Remove unused d_type_size and d_type_size_k
	variables.
	* omega.c (resurrect_subs): Remove unused n variable.
	(omega_solve_geq): Remove unused neweqns variable.
	* lto-streamer-in.c (lto_read_tree): Remove unused end_marker variable.
	* tree-inline.c (declare_return_variable): Remove USE_P argument,
	return use instead of var.
	(remap_decl, remap_block): Remove unused fn variable.
	(expand_call_inline): Remove unused retvar variable, adjust
	declare_return_variable caller.
	(optimize_inline_calls): Remove unused prev_fn variable.
	* tree-vect-slp.c (vect_analyze_slp_instance): Remove unused ncopies
	variable.
	(vect_create_mask_and_perm): Remove unused group_size and dr_chain_size
	variables.
	* tree-ssa-loop-niter.c (split_to_var_and_offset): Handle MINUS_EXPR
	properly.
	* tree-vect-loop.c (vect_analyze_loop_form): Remove unused backedge
	variable.
	(vect_create_epilog_for_reduction): Remove unused bytesize variable.
	* omp-low.c (workshare_safe_to_combine_p): Remove par_entry_bb
	parameter.  Remove unused par_stmt variable.
	(determine_parallel_type): Adjust workshare_safe_to_combine_p caller.
	(expand_omp_sections): Remove unused l1 variable.
	(lower_omp_for): Remove unused ilist variable.
	* tree-loop-distribution.c (mark_nodes_having_upstream_mem_writes):
	Remove unused has_upstream_mem_write_p variable.
	* recog.c (decode_asm_operands): Remove unused noperands variable.
	* tree-ssa-alias.c (refs_may_alias_p_1): Remove unused size1 and
	size2 variable.
	* libgcov.c (__gcov_merge_delta): Remove unused last variable.
	* tree-call-cdce.c (gen_conditions_for_pow_int_base): Remove unused
	base_nm variable.
	(gen_conditions_for_pow): Remove unused ec variable.
	* tree-ssa-sccvn.c (vn_reference_lookup_3): Remove unused size
	variable.
	* ipa-struct-reorg.c (program_redefines_malloc_p): Remove unused
	fndecl variable.
	* tree-ssa-sink.c (statement_sink_location): Remove unused code
	variable.
	* regmove.c (copy_src_to_dest): Remove unused insn_uid and move_uid
	variables.
	* tree-complex.c (create_one_component_var): Remove unused inner_type
	variable.
	* calls.c (emit_call_1): Don't GEN_INT (struct_value_size)
	unnecessarily when GEN_*CALL omits that argument.
	* regrename.c (regrename_optimize): Remove unused regs_seen variable.
	(build_def_use): Remove unused icode variable.
	* ipa-pure-const.c (check_call): Remove unused callee and avail
	variables.
	* tree-dfa.c (add_referenced_var): Remove unused v_ann variable.
	* tree-vect-patterns.c (vect_recog_pow_pattern): Remove unused type
	variable.
	(vect_pattern_recog): Remove unused stmt variable.
	* sel-sched-ir.c (make_regions_from_the_rest): Remove unused
	new_regions variable.
	* postreload.c (reload_cse_simplify_operands): Remove unused mode
	variable.
	* tree-parloops.c (create_call_for_reduction_1): Remove unused
	addr_type variable.
	(create_parallel_loop): Remove unused res variable.
	(gen_parallel_loop): Remove unused nloop variable.
	* tree-vect-loop-manip.c (vect_loop_versioning): Likewise.
	* value-prof.c (gimple_mod_subtract_transform,
	gimple_stringops_transform): Remove unused value variable.
	(gimple_stringops_values_to_profile): Remove unused fcode variable.
	* tree-vrp.c (register_new_assert_for): Remove unused found variable.
	(vrp_visit_switch_stmt): Remove unused n variable.
	* tree-vect-stmts.c (vectorizable_conversion): Remove unused expr
	variable.
	(vectorizable_operation): Remove unused shift_p variable.
	(vectorizable_store): Remove unused first_stmt_vinfo variable.
	* tree-ssa-operands.c (add_stmt_operand): Remove unused v_ann variable.
	* tree-vect-data-refs.c (vect_analyze_data_refs): Remove unused bb
	variable.
	(vect_permute_store_chain): Remove unused scalar_dest variable.
	(vect_supportable_dr_alignment): Remove unused invariant_in_outerloop
	variable.
	* tree-ssa-threadupdate.c (thread_single_edge): Remove unused
	local_info variable.
	* tree-optimize.c (tree_rest_of_compilation): Remove unused node
	variable.
	* optabs.c (expand_binop): Remove unused equiv_value variable.
	(emit_libcall_block): Remove unused prev variable.
	(init_optabs): Remove unused int_mode variable.
	* tree-ssa-structalias.c (scc_visit): Remove unused have_ref_node
	variable.
	(do_structure_copy): Remove unused lhsbase and rhsbase variables.
	(find_func_aliases): Remove unused rhstype variable.
	(ipa_pta_execute): Remove unused varid variable.
gcc/objc/
	* objc-act.c (generate_shared_structures): Remove unused sc_spec and
	decl_specs variables.
	(objc_build_message_expr): Remove unused loc variable.
	(objc_finish_message_expr): Remove unused saved_rtype variable.
	(encode_field_decl): Remove unused type variable.
gcc/lto/
	* lto-lang.c (handle_nonnull_attribute): Remove unused attr_arg_num
	variable.

From-SVN: r154726
2009-11-28 17:21:00 +01:00
Rafael Avila de Espindola 92fa7608a4 re PR bootstrap/42096 (lto.c:289:7: error: implicit declaration of function '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-19 15:30:04 +00:00
Rafael Avila de Espindola 9870fe4f88 lto-elf.c (lto_file_init): Add offset argument.
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-17 16:00:19 +00:00
Rafael Avila de Espindola 1b70729f70 lto-elf.c (lto_elf_file_open): Use strtoll to parse the offset.
2009-11-16  Rafael Avila de Espindola  <espindola@google.com>

	* lto-elf.c (lto_elf_file_open): Use strtoll to parse the offset.

From-SVN: r154215
2009-11-16 20:25:42 +00:00
Jan Hubicka 0e3776dbee cgraph.c (cgraph_release_function_body): Update use of ipa_transforms_to_apply.
* 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-16 13:26:40 +00:00
Rafael Avila de Espindola 06bd7f563b lto-plugin.c (write_resolution): Assume resolution_file is set.
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-11-12 14:01:49 +00:00
Richard Guenther 7e9dc421e5 gcc.c (process_command): Handle arguments name@offset.
2009-11-04  Richard Guenther  <rguenther@suse.de>
            Rafael Avila de Espindola  <espindola@google.com>
 
	* gcc.c (process_command): Handle arguments name@offset.

2009-11-04  Richard Guenther  <rguenther@suse.de>
            Rafael Avila de Espindola  <espindola@google.com>

	* lto-elf.c (lto_elf_build_section_table): Add the base offset.
	(lto_elf_file_open): Handle offsets in arguments name@offest.

2009-11-04  Richard Guenther  <rguenther@suse.de>
            Rafael Avila de Espindola  <espindola@google.com>

	* lto-plugin.c (plugin_file_info): Remove temp field.
	(cleanup_handler): Don't delete temporary objects.
	(claim_file_handler): Don't create temporary objects.


Co-Authored-By: Rafael Avila de Espindola <espindola@google.com>

From-SVN: r153903
2009-11-04 17:24:37 +00:00
Richard Guenther b207f90082 re PR lto/41858 (-flto -O2 crashes when many source files.)
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-30 15:58:57 +00:00
Richard Guenther 2c9281556f lto-streamer.h (lto_symtab_merge_cgraph_nodes): Declare.
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-22 15:38:23 +00:00
Richard Biener f9c91f8a90 lto-streamer.h (lto_symtab_clear_resolution): Remove.
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-22 12:17:12 +00:00
Jan Hubicka fb3f88cc0d ipa-cp.c (ipcp_write_summary, [...]): New functions.
* 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-22 10:02:29 +00:00
Richard Guenther 35f1e9f475 re PR lto/41715 (VIEW_CONVERT_EXPR use for mismatched prevailing decl 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-16 14:23:22 +00:00
Richard Guenther 200c8750d6 lto-symtab.c (lto_symtab_compatible): Fold in ...
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-14 14:14:44 +00:00
Richard Guenther b1b07c92e1 re PR driver/41637 (testsuite (-flto/-fwhopr) leaves does not clean up in /tmp)
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-09 13:24:59 +00:00
Joseph Myers 3c2e7d4535 lto-elf.c (init_shdr##BITS, [...]): Remove trailing "." from diagnostics.
* lto-elf.c (init_shdr##BITS, lto_elf_begin_section_with_type,
	init_ehdr##BITS, lto_elf_file_close): Remove trailing "." from
	diagnostics.
	* lto-lang.c (lto_post_options): Remove trailing "." from
	diagnostics.

From-SVN: r152579
2009-10-08 22:54:16 +01:00
Richard Guenther 0d0bfe1795 gimple.c (free_gimple_type_tables): New function.
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-08 15:32:30 +00:00
Joseph Myers 4bedf19ae7 * lto.c: Only include <sys/mman.h> if HAVE_MMAP_FILE.
From-SVN: r152543
2009-10-07 23:50:09 +01:00
Jan Hubicka b20996ff13 lto-symtab.c (lto_cgraph_replace_node): Assert that inline clones has no 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-07 09:01:16 +00:00
Richard Guenther 1a735925e3 re PR lto/41552 (Undefined references with -flto, dependent on object file 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-05 14:05:54 +00:00
Diego Novillo d7f09764d7 Merge lto branch into trunk.
From-SVN: r152434
2009-10-03 17:10:11 -04:00