Commit Graph

289 Commits

Author SHA1 Message Date
Steven Bosscher c082f9f317 configure.ac (--enable-lto): Add x86_64-apple-darwin* as a platform that supports LTO.
ChangeLog:
	* configure.ac (--enable-lto): Add x86_64-apple-darwin* as
	a platform that supports LTO.
	* configure: Regenerate.

gcc/ChangeLog:
	* config.gcc (i[34567]86-*-darwin*, x86_64-*-darwin*): Add
	lto-macho as lto_binary_reader.
	* target.h (struct gcc_target): New hooks lto_start and	lto_end.
	* target-def.h (TARGET_ASM_LTO_START, TARGET_ASM_LTO_END): Define.
	* cgraphunit.c (ipa_passes): Wrap LTO assembler output generation
	in lto_start and lto_end calls.
	(is_elf_or_coff): Rename to maybe_lto_object_file.  Add Mach-O
	magic numbers.
	(scan_prog_file): Update is_elf_or_coff call.
	* doc/tm.text (TARGET_ASM_LTO_START, TARGET_ASM_LTO_END): Document.

	* collect2.c (main): Fix enum comparison.

	* config/darwin-protos.h (darwin_asm_lto_start, darwin_asm_lto_end):
	Add prototypes.
	* darwin9.h (LINK_COMMAND_SPEC): Pass -flto and -fwhopr to the linker.
	* darwin.h (LINK_COMMAND_SPEC): Likewise.  Define TARGET_ASM_LTO_START
	and TARGET_ASM_LTO_END.
	* darwin.c: Include obstack.h and lto-streamer.h.
	(lto_section_names_offset, lto_section_names_obstack,
	lto_asm_out_file, lto_asm_out_name, saved_asm_out_file): New static
	global variables.
	(LTO_SEGMENT_NAME, LTO_NAMES_SECTION): New defines.
	(darwin_asm_lto_start): New function.  Redirect output to asm_out_file
	to a temporary file.
	(darwin_asm_lto_end): New function.  Restore asm_out_file.
	(darwin_asm_named_section): For LTO sections, replace the name with
	the offset of the section name in a string table, and build this
	table.
	(darwin_file_start): Initialize global vars for LTO support.
	(darwin_file_end): If output to asm_out_file was redirected, append it
	to the proper asm_out_file here.  Add the section names section.

lto/ChangeLog:
	* lto.h (struct lto_file_struct): Document offset member.
	* lto-endian.h: New file.
	* lto-macho.h: New file.
	* lto-macho.c: New file.
	* Make-lang.in: Add rule for lto-macho.o.

From-SVN: r159173
2010-05-07 21:37:43 +00:00
Jan Hubicka 2942c502ee * lto-symtab.c (lto_symtab_entry_def) Add vnode.
(lto_varpool_replace_node): New.
	(lto_symtab_resolve_symbols): Resolve varpool nodes.
	(lto_symtab_merge_decls_1): Prefer decls with varpool node.
	(lto_symtab_merge_cgraph_nodes_1): Merge varpools.
	* cgraph.h (varpool_node_ptr): New type.
	(varpool_node_ptr): New vector.
	(varpool_node_set_def): New structure.
	(varpool_node_set): New type.
	(varpool_node_set): New vector.
	(varpool_node_set_element_def): New structure.
	(varpool_node_set_element, const_varpool_node_set_element): New types.
	(varpool_node_set_iterator): New type.
	(varpool_node): Add prev pointers, add used_from_other_partition,
	in_other_partition.
	(varpool_node_set_new, varpool_node_set_find, varpool_node_set_add,
	varpool_node_set_remove, dump_varpool_node_set, debug_varpool_node_set,
	varpool_get_node, varpool_remove_node): Declare.
	(vsi_end_p, vsi_next, vsi_node, vsi_start, varpool_node_in_set_p,
	varpool_node_set_size): New inlines.
	* cgraph.c (dump_cgraph_node): Dump asm names of aliases.
	* tree-pass.h (varpool_node_set_def): Forward declare.
	(ipa_opt_pass_d): Summary writting takes vnode sets too.
	(ipa_write_optimization_summaries): Update prototype.
	* ipa-cp.c (ipcp_write_summary): Update.
	* ipa-reference.c (ipa_reference_write_summary): Update.
	* lto-cgraph.c (lto_output_varpool_node): New static function.
	(output_varpool): New function.
	(input_varpool_node): New static function.
	(input_varpool_1): New function.
	(input_cgraph): Input varpool.
	* ipa-pure-const.c (pure_const_write_summary): Update.
	* lto-streamer-out.c (lto_output): Update, output varpool too.
	(write_global_stream): Kill WPA hack.
	(produce_asm_for_decls): Update.
	(output_alias_pair_p): Handle variables.
	(output_unreferenced_globals): Output only needed partition of varpool.
	* ipa-inline.c (inline_write_summary): Update.
	* lto-streamer-in.c (lto_input_tree_ref, lto_input_tree): Do not build cgraph.
	* lto-section-in.c (lto_section_name): Add varpool and jump funcs.
	* ipa.c (hash_varpool_node_set_element, eq_varpool_node_set_element,
	varpool_node_set_new, varpool_node_set_add,
	varpool_node_set_remove, varpool_node_set_find, dump_varpool_node_set,
	debug_varpool_node_set): New functions.
	* passes.c (rest_of_decl_compilation): when in LTO do not finalize.
	(execute_one_pass): Process new decls too.
	(ipa_write_summaries_2): Pass around vsets.
	(ipa_write_summaries_1): Likewise.
	(ipa_write_summaries): Build vset; be more selective about cgraph nodes
	to add.
	(ipa_write_optimization_summaries_1): Pass around vsets.
	(ipa_write_optimization_summaries): Likewise.
	* varpool.c (varpool_get_node): New.
	(varpool_node): Update doubly linked lists.
	(varpool_remove_node): New.
	(dump_varpool_node): More dumping.
	(varpool_enqueue_needed_node): Update doubly linked lists.
	(decide_is_variable_needed): Kill ltrans hack.
	(varpool_finalize_decl): Kill lto hack.
	(varpool_assemble_decl): Skip decls in other partitions.
	(varpool_assemble_pending_decls): Update doubly linkes lists.
	(varpool_empty_needed_queue): Likewise.
	(varpool_extra_name_alias): Likewise.
	* lto-streamer.c (lto_get_section_name): Add vars section.
	* lto-streamer.h (lto_section_type): Update.
	(output_varpool, input_varpool): Declare.

	* lto.c (lto_varpool_node_sets): New.
	(lto_1_to_1_map): Partition varpool too.
	(globalize_context_t, globalize_cross_file_statics,
	lto_scan_statics_in_ref_table, lto_scan_statics_in_cgraph_node,
	lto_scan_statics_in_remaining_global_vars): Remove.
	(lto_promote_cross_file_statics): Rewrite.
	(get_filename_for_set): Take vset argument.
	(lto_wpa_write_files): Pass around vsets.

From-SVN: r158854
2010-04-29 07:10:38 +00:00
Martin Jambor e33c6cd6af cgraph.h (struct cgraph_node): New field indirect_calls.
2010-04-28  Martin Jambor  <mjambor@suse.cz>

	* cgraph.h (struct cgraph_node): New field indirect_calls.
	(struct cgraph_indirect_call_info): New type.
	(struct cgraph_edge): Removed field indirect_call. New fields
	indirect_info, indirect_inlining_edge and indirect_unknown_callee.
	(cgraph_create_indirect_edge): Declare.
	(cgraph_make_edge_direct): Likewise.
	(enum LTO_cgraph_tags): New item LTO_cgraph_indirect_edge.
	* ipa-prop.h (struct ipa_param_call_note): Removed.
	(struct ipa_node_params): Removed field param_calls.
	(ipa_create_all_structures_for_iinln): Declare.
	* cgraph.c: Described indirect edges and uids in initial comment.
	(cgraph_add_edge_to_call_site_hash): New function.
	(cgraph_edge): Search also among the indirect edges, use
	cgraph_add_edge_to_call_site_hash to add edges to the call site hash.
	(cgraph_set_call_stmt): Possibly turn an indirect edge into a direct
	one, use cgraph_add_edge_to_call_site_hash to add edges to the call
	site hash.
	(initialize_inline_failed): Assign a reason to indirect edges.
	(cgraph_create_edge_1): New function.
	(cgraph_create_edge): Moved some functionality to
	cgraph_create_edge_1.
	(cgraph_create_indirect_edge): New function.
	(cgraph_edge_remove_callee): Add an assert checking for
	non-indirectness.
	(cgraph_edge_remove_caller): Special-case indirect edges.
	(cgraph_remove_edge): Likewise.
	(cgraph_set_edge_callee): New function.
	(cgraph_redirect_edge_callee): Use cgraph_set_edge_callee.
	(cgraph_make_edge_direct): New function.
	(cgraph_update_edges_for_call_stmt_node): Do nothing only when also
	the declaration of the call statement matches.
	(cgraph_node_remove_callees): Special-case indirect edges.
	(cgraph_clone_edge): Likewise.
	(cgraph_clone_node): Clone also the indirect edges.
	(dump_cgraph_node): Dump indirect_inlining_edge flag instead of
	indirect_call, dump count of indirect_calls edges.
	* ipa-prop.c (iinlining_processed_edges): New variable.
	(ipa_note_param_call): Create indirect edges instead of
	creating notes.  New parameter node.
	(ipa_analyze_call_uses): New parameter node, pass it on to
	ipa_note_param_call.
	(ipa_analyze_stmt_uses): Likewise.
	(ipa_analyze_params_uses): Pass node to ipa_analyze_stmt_uses.
	(print_edge_addition_message): Work on edges rather than on notes.
	(update_call_notes_after_inlining): Likewise, renamed to
	update_indirect_edges_after_inlining.
	(ipa_create_all_structures_for_iinln): New function.
	(ipa_free_node_params_substructures): Do not free notes.
	(ipa_edge_duplication_hook): Propagate bits within
	iinlining_processed_edges bitmap.
	(ipa_node_duplication_hook): Do not duplicate notes.
	(free_all_ipa_structures_after_ipa_cp): Renamed to
	ipa_free_all_structures_after_ipa_cp.
	(free_all_ipa_structures_after_iinln): Renamed to
	ipa_free_all_structures_after_iinln.g
	(ipa_write_param_call_note): Removed.
	(ipa_read_param_call_note): Removed.
	(ipa_write_indirect_edge_info): New function.
	(ipa_read_indirect_edge_info): Likewise.
	(ipa_write_node_info): Do not stream notes, do stream information
	in indirect edges.
	(ipa_read_node_info): Likewise.
	(lto_ipa_fixup_call_notes): Removed.
	* ipa-cp.c (pass_ipa_cp): Set stmt_fixup to NULL.
	* ipa-inline.c (pass_ipa_inline): Likewise.
	* cgraphunit.c (verify_cgraph_node): Check also indirect edges.
	* cif-code.def (INDIRECT_UNKNOWN_CALL): New reason.
	* tree-inline.c (copy_bb): Removed an unnecessary double check for
	is_gimple_call.
	* tree-inline.c (get_indirect_callee_fndecl): Do not consider indirect
	edges.
	* lto-cgraph.c (output_outgoing_cgraph_edges): New function.
	(output_cgraph): Stream also indirect edges.
	(lto_output_edge): Added capability to stream indirect edges.
	(input_edge): Likewise.
	(input_cgraph_1): Likewise.

	* testsuite/gcc.dg/lto/20091209-1_0.c: New testcase.

From-SVN: r158827
2010-04-28 16:05:54 +02:00
Martin Jambor 78eaf7bf18 re PR middle-end/43812 (compiling .cc file with -fwhole-program results in ICE, in ipcp_iterate_stage, at ipa-cp.c:760)
2010-04-27  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/43812
	* ipa.c (dissolve_same_comdat_group_list): New function.
	(function_and_variable_visibility): Call
	dissolve_same_comdat_group_list when comdat group contains external or
	newly local nodes.
	* cgraphunit.c (verify_cgraph_node): Verify that same_comdat_group
	lists are circular and that they contain only DECL_ONE_ONLY nodes.

	* testsuite/g++.dg/ipa/pr43812.C: New test.

From-SVN: r158777
2010-04-27 12:07:47 +02:00
Jan Hubicka ae2b08888a * cgraphunit.c (cgraph_copy_node_for_versioning): Fix profile updating.
From-SVN: r158724
2010-04-26 09:52:05 +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
Martin Jambor 0b6e2868bd cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update new_stmt.
2010-04-19  Martin Jambor  <mjambor@suse.cz>

	* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Update
	new_stmt.
	(cgraph_materialize_all_clones): Assert	!need_ssa_update_p.

From-SVN: r158522
2010-04-19 19:55:22 +02:00
Richard Guenther 33283dadd3 re PR middle-end/43600 (Segmentation fault for large C file (24MB))
2010-03-31  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43600
	* cgraphunit.c (cgraph_output_in_order): Do not allocate
	temporary data on stack.

From-SVN: r157867
2010-03-31 13:20:19 +00:00
John David Anglin b932b8b1bb re PR middle-end/41674 (/usr/ccs/bin/ld: Unsatisfied symbols: _GLOBAL__I_65535_0_main)
PR middle-end/41674
	* cgraphunit.c (cgraph_build_static_cdtor): If target doesn't have
	cdtors, set DECL_PRESERVE_P.
	* ipa.c (cgraph_externally_visible_p): Return true if declaration
	should be preseved.

From-SVN: r157779
2010-03-27 15:43:19 +00:00
Martin Jambor 8132a837da re PR middle-end/42450 (another GCC 4.5 ICE on C++ templated code)
2010-03-18  Martin Jambor  <mjambor@suse.cz>

	PR middle-end/42450
	* cgraph.h (cgraph_redirect_edge_call_stmt_to_callee): Declare.
	* cgraphunit.c (cgraph_materialize_all_clones): Update calls in
	all non-clones.  Moved call redirection...
	(cgraph_redirect_edge_call_stmt_to_callee): ...to this new
	function.
	(cgraph_materialize_all_clones): Dispose of all
	combined_args_to_skip bitmaps.
	(verify_cgraph_node): Do not check for edges pointing to wrong
	nodes in inline clones.
	* tree-inline.c (copy_bb): Call
	cgraph_redirect_edge_call_stmt_to_callee.
	* ipa.c (cgraph_remove_unreachable_nodes): Call
	cgraph_node_remove_callees even when there are used clones.

	* testsuite/g++.dg/torture/pr42450.C: New test.

From-SVN: r157546
2010-03-18 21:07:13 +01:00
Martin Jambor 0e0a135920 re PR tree-optimization/43257 (IPA-SRA changes DECL_ASSEMBLER_NAME)
2010-03-11  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/43257
	* tree.c (assign_assembler_name_if_neeeded): New function.
	(free_lang_data_in_cgraph): Assembler name assignment moved to the
	above new function.
	* tree.h (assign_assembler_name_if_neeeded): Declare.
	* cgraphunit.c (cgraph_analyze_function): Create an assembler name for
	the function if needed.

	* testsuite/g++.dg/torture/pr43257.C: New test.

From-SVN: r157393
2010-03-11 23:27:26 +01:00
Alan Modra 715a4e08d0 re PR middle-end/42344 (ICE in rs6000.md with ipa-sra for 252.eon)
PR middle-end/42344
	* cgraph.h (cgraph_make_decl_local): Declare.
	* cgraph.c (cgraph_make_decl_local): New function.
	(cgraph_make_node_local): Use it.
	* cgraphunit.c (cgraph_function_versioning): Likewise.
	* ipa.c (function_and_variable_visibility): Likewise.

From-SVN: r156914
2010-02-20 10:08:20 +10:30
Mike Stump b42186f164 re PR objc/43061 (47 new GCC HEAD@156527 regressions)
PR objc/43061
        * cgraphunit.c (process_function_and_variable_attributes): Check
	DECL_PRESERVE_P instead of looking up attribute "used".
        * ipa-pure-const.c (check_decl): Likewise.
        * ipa-reference.c (has_proper_scope_for_analysis): Likewise.
        * ipa-type-escape.c (has_proper_scope_for_analysis): Likewise.
        * config/sol2.c (solaris_insert_attributes): Set DECL_PRESERVE_P
        instead of attribute "used".
        * config/sol2-c.c (solaris_pragma_init): Likewise.
        (solaris_pragma_fini): Likewise.

From-SVN: r156907
2010-02-19 19:06:38 +00:00
Richard Guenther 313333a6d4 re PR tree-optimization/43068 (ICE: in estimate_operator_cost, at tree-inline.c:3141 with -freorder-blocks -ftracer)
2010-02-15  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43068
	* cgraphunit.c (thunk_adjust): Skip adjusting by fixed_offset
	if that is zero.

	* g++.dg/torture/pr43068.C: New testcase.

From-SVN: r156770
2010-02-15 11:27:54 +00:00
Jakub Jelinek 1124098bb2 sel-sched.c (create_speculation_check): Remove set but not used variable twin.
* sel-sched.c (create_speculation_check): Remove set but not used
	variable twin.
	(try_transformation_cache): Remove set but not used variable ds.
	(calculate_privileged_insns): Remove set but not used variables
	cur_insn and min_spec_insn.
	(find_best_expr): Remove set but not used variable avail_n.
	* tree-predcom.c (base_names_in_chain_on): Remove set but not used
	variable e.
	* cgraphunit.c (assemble_thunk): Remove set but not used variable
	false_label.
	* haifa-sched.c (remove_notes): Remove set but not used variable prev.
	* graphite-clast-to-gimple.c (gloog): Remove set but not used variable
	new_scop_exit_edge.

	* decl.c (create_array_type_for_decl): Remove set but not used
	variable error_msg.  Remove break stmts after return stmts.

From-SVN: r156072
2010-01-20 12:30:05 +01:00
Jakub Jelinek 566f27e42c re PR tree-optimization/42508 (wrong code with "-O1 -fipa-sra")
PR tree-optimization/42508
	* tree-sra.c (convert_callers): Check for recursive call
	by comparing cgraph nodes instead of decls.
	(modify_function): Call ipa_modify_formal_parameters also
	on all same_body aliases.

	* g++.dg/opt/pr42508.C: New test.

	* cgraphunit.c (cgraph_materialize_all_clones): Compare
	cgraph nodes when checking for same_body aliases.

From-SVN: r155640
2010-01-05 09:40:50 +01:00
Jakub Jelinek b66887e4d0 re PR c++/42317 (Issues with comdat virtual dtors)
PR c++/42317
	* cgraph.h (struct cgraph_node): Add same_comdat_group field.
	* cgraph.c (cgraph_remove_node): Unchain node from same_comdat_group
	circular list.
	(cgraph_node_can_be_local_p): Return false for DECL_COMDAT with
	node->same_comdat_group.
	* ipa.c (cgraph_remove_unreachable_nodes): For any reachable node
	mark all its same_comdat_group nodes as also reachable.
	(cgraph_externally_visible_p): Return true even if any of
	same_comdat_group nodes has address taken.
	* lto-cgraph.c (lto_output_node): Stream out same_comdat_group.
	(output_cgraph): Ensure other same_comdat_group nodes are also
	included.
	(input_node): Stream in same_comdat_group.
	(input_cgraph_1): Fix up same_comdat_group fields from references
	to pointers.
	* cgraphunit.c (cgraph_analyze_functions): Mark all other
	same_comdat_group nodes as reachable.
	(cgraph_mark_functions_to_output): For each node->process process
	also other same_comdat_group nodes.
	* ipa-inline.c (cgraph_clone_inlined_nodes): Don't reuse nodes
	with same_comdat_group non-NULL.
	(cgraph_mark_inline_edge): Likewise.

	* decl2.c (cp_write_global_declarations): Clear DECL_EXTERNAL
	also on all other functions in the same comdat group.
	* optimize.c (maybe_clone_body): Also optimize virtual implicit
	dtors.  For virtual comdat dtors tell cgraph that base and deleting
	dtor are in the same comdat group.

	* config/abi/pre/gnu.ver: Don't export certain base dtors that
	weren't previously exported.

	* g++.dg/opt/dtor2.C: New test.
	* g++.dg/opt/dtor2.h: New file.
	* g++.dg/opt/dtor2-aux.cc: New file.

From-SVN: r155143
2009-12-10 22:58:49 +01:00
Jan Hubicka 47cb0d7da1 re PR middle-end/42228 (verify_cgraph_node failed:node has wrong clone_of)
PR middle-end/42228
	PR middle-end/42110
	* cgraph.c (cgraph_create_edge_including_clones): Add old_stmt parameter;
	update edge if it already exists.
	(cgraph_remove_node): Handle correctly cases where we are removing node having
	clones.
	* cgraph.h (cgraph_create_edge_including_clones): Declare.
	(verify_cgraph_node): Add missing error_found = true code.
	(cgraph_materialize_all_clones): Remove call edges of dead nodes.
	* ipa.c (cgraph_remove_unreachable_nodes): Correctly look for master
	clone; fix double linked list removal.
	* tree-inline.c (copy_bb): Update cgraph_create_edge_including_clones call;
	fix frequency of newly created edge.

	* g++.dg/torture/pr42110.C: new file.

From-SVN: r155140
2009-12-10 20:50:47 +00:00
Richard Guenther 154885548c cgraphunit.c (assemble_thunk): Use DECL_ASSEMBLER_NAME instead of DECL_NAME for the entry point.
2009-12-03  Richard Guenther  <rguenther@suse.de>

	* cgraphunit.c (assemble_thunk): Use DECL_ASSEMBLER_NAME
	instead of DECL_NAME for the entry point.

From-SVN: r154954
2009-12-03 16:06:03 +00:00
Grigori Fursin 090fa0ab61 cgraphunit.c (plugin.h): Include.
2009-12-01  Grigori Fursin  <grigori.fursin@inria.fr>
            Joern Rennecke  <amylaar@spamcop.net>

        * cgraphunit.c (plugin.h): Include.
        (ipa_passes): Invoke PLUGIN_ALL_IPA_PASSES_START /
        PLUGIN_ALL_IPA_PASSES_END at start / end of processing.
        * gcc-plugin.h (highlev-plugin-common.h, hashtab.h): Include.
        (enum plugin_event): Define by including plugin.def.
        Last enumerator is now called PLUGIN_EVENT_FIRST_DYNAMIC.
        (plugin_event_name): Change type to const char **.
        (get_event_last, get_named_event_id, unregister_callback): Declare.
        (register_callback): Change type of event argument to int.
        (highlev-plugin-common.h): New file.
        * Makefile.in (GCC_PLUGIN_H): Add highlev-plugin-common.h and
        $(HASHTAB_H)
        (tree-optimize.o passes.o): Depend on $(PLUGIN_H).
        (PLUGIN_HEADERS): Add opts.h, $(PARAMS_H) and plugin.def.
        (s-header-vars): New rule.
        (install-plugin): Depend on s-header-vars.  Install b-header-vars.
        * params.c (get_num_compiler_params): New function.
        * params.h (get_num_compiler_params): Declare.
        * passes.c (plugin.h): Include.
        (make_pass_instance): Invoke PLUGIN_NEW_PASS.
        (do_per_function_toporder, pass_init_dump_file): No longer static.
        (pass_fini_dump_file): Likewise.
        (execute_one_pass): Likewise.  Invoke PLUGIN_OVERRIDE_GATE and
        PLUGIN_PASS_EXECUTION.
        (execute_ipa_pass_list): Invoke PLUGIN_EARLY_GIMPLE_PASSES_START and
        PLUGIN_EARLY_GIMPLE_PASSES_END.
        * plugin.c (plugin_event_name_init): New array, defined by
        including plugin.def.
        (FMT_FOR_PLUGIN_EVENT): Update.
        (plugin_event_name): Change type to const char ** and initialize
        to plugin_event_name_init.
        (event_tab, event_last, event_horizon): New variable.
        (get_event_last): New function.
        (plugin_callbacks_init): New array.
        (plugin_callbacks: Change type to struct callback_info **.
        Initialize to plugin_callbacks_init.
        (htab_event_eq, get_named_event_id, unregister_callback): New function.
        (invoke_plugin_va_callbacks): Likewise.
        (register_callback): Change type of event argument to int.
        Handle new events.  Allow dynamic events.
        (invoke_plugin_callbacks): Likewise.  Return success status.
        (plugins_active_p): Allow dynamic callbacks.
        * plugin.def: New file.
        * plugin.h (invoke_plugin_callbacks): Update prototype.
        (invoke_plugin_va_callbacks): Declare.
        * tree-optimize.c (plugin.h): Include.
        (tree_rest_of_compilation): Invoke PLUGIN_ALL_PASSES_START and
        PLUGIN_ALL_PASSES_END.
        * tree-pass.h (execute_one_pass, pass_init_dump_file): Declare.
        (pass_fini_dump_file, do_per_function_toporder): Likewise.
        * doc/plugin.texi: Document new event types.

Co-Authored-By: Joern Rennecke <amylaar@spamcop.net>

From-SVN: r154877
2009-12-01 19:12:29 +00:00
Jan Hubicka 6744a6abc3 cgraph.c (same_body_alias_1): Break out of
* cgraph.c (same_body_alias_1): Break out of
	(same_body_alias): ... here; remove comdat check; it is handled
	in cp already.
	(cgraph_add_thunk): New.
	(dump_cgraph_node): Dump aliases and thunks.
	* cgraph.h (cgraph_thunk_info): New structure.
	(struct cgraph_node): Add thunk info.
	(cgraph_add_thunk): New.
	* cgraphunit.c (cgraph_emit_thunks): Remove.
	(cgraph_finalize_compilation_unit): Do not call cgraph_emit_thunks.
	(assemble_thunk): New function.
	(cgraph_expand_function): Handle thunks.
	(thunk_adjust): New.
	(init_lowered_empty_function): New.
	* optimize.c (maybe_clone_body): Emit thunks associated to alias.
	* Make-lang.in (method.o): Add dependency on gimple.h.
	* method.c: Include gimple.h
	(make_alias_for_thunk): Use same body alias instead of assemble_alias.
	(use_thunk): Drop codegen; use cgraph_add_thunk; gimplify
	generic thunks.
	* semantics.c (expand_or_defer_fn): Emit associated thunks.
	* cp-objcp-common.h (LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS): Remove.
	* lto-cgraph.c (lto_output_node): Stream thunk info.
	(input_node): Likewise.
	* langhooks.h (lang_hooks_for_callgraph): Remove emit_associated_thunks.
	* langhooks-def.h (LANG_HOOKS_CALLGRAPH_EMIT_ASSOCIATED_THUNKS): Remove.
	(LANG_HOOKS_CALLGRAPH_INITIALIZER): Update.
	* i386.c (x86_output_mi_thunk): Make output prettier.

From-SVN: r154736
2009-11-29 10:32:08 +00:00
H.J. Lu b8698a0f37 Remove trailing white spaces.
2009-11-25  H.J. Lu  <hongjiu.lu@intel.com>

	* alias.c: Remove trailing white spaces.
	* alloc-pool.c: Likewise.
	* alloc-pool.h: Likewise.
	* attribs.c: Likewise.
	* auto-inc-dec.c: Likewise.
	* basic-block.h: Likewise.
	* bb-reorder.c: Likewise.
	* bt-load.c: Likewise.
	* builtins.c: Likewise.
	* builtins.def: Likewise.
	* c-common.c: Likewise.
	* c-common.h: Likewise.
	* c-cppbuiltin.c: Likewise.
	* c-decl.c: Likewise.
	* c-format.c: Likewise.
	* c-lex.c: Likewise.
	* c-omp.c: Likewise.
	* c-opts.c: Likewise.
	* c-parser.c: Likewise.
	* c-pretty-print.c: Likewise.
	* c-tree.h: Likewise.
	* c-typeck.c: Likewise.
	* caller-save.c: Likewise.
	* calls.c: Likewise.
	* cfg.c: Likewise.
	* cfganal.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfghooks.c: Likewise.
	* cfghooks.h: Likewise.
	* cfglayout.c: Likewise.
	* cfgloop.c: Likewise.
	* cfgloop.h: Likewise.
	* cfgloopmanip.c: Likewise.
	* cfgrtl.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* cgraphbuild.c: Likewise.
	* cgraphunit.c: Likewise.
	* cif-code.def: Likewise.
	* collect2.c: Likewise.
	* combine.c: Likewise.
	* convert.c: Likewise.
	* coverage.c: Likewise.
	* crtstuff.c: Likewise.
	* cse.c: Likewise.
	* cselib.c: Likewise.
	* dbgcnt.c: Likewise.
	* dbgcnt.def: Likewise.
	* dbgcnt.h: Likewise.
	* dbxout.c: Likewise.
	* dce.c: Likewise.
	* ddg.c: Likewise.
	* ddg.h: Likewise.
	* defaults.h: Likewise.
	* df-byte-scan.c: Likewise.
	* df-core.c: Likewise.
	* df-problems.c: Likewise.
	* df-scan.c: Likewise.
	* df.h: Likewise.
	* dfp.c: Likewise.
	* diagnostic.c: Likewise.
	* diagnostic.h: Likewise.
	* dominance.c: Likewise.
	* domwalk.c: Likewise.
	* double-int.c: Likewise.
	* double-int.h: Likewise.
	* dse.c: Likewise.
	* dwarf2asm.c: Likewise.
	* dwarf2asm.h: Likewise.
	* dwarf2out.c: Likewise.
	* ebitmap.c: Likewise.
	* ebitmap.h: Likewise.
	* emit-rtl.c: Likewise.
	* et-forest.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* expmed.c: Likewise.
	* expr.c: Likewise.
	* expr.h: Likewise.
	* final.c: Likewise.
	* flags.h: Likewise.
	* fold-const.c: Likewise.
	* function.c: Likewise.
	* function.h: Likewise.
	* fwprop.c: Likewise.
	* gcc.c: Likewise.
	* gcov-dump.c: Likewise.
	* gcov-io.c: Likewise.
	* gcov-io.h: Likewise.
	* gcov.c: Likewise.
	* gcse.c: Likewise.
	* genattr.c: Likewise.
	* genattrtab.c: Likewise.
	* genautomata.c: Likewise.
	* genchecksum.c: Likewise.
	* genconfig.c: Likewise.
	* genflags.c: Likewise.
	* gengtype-parse.c: Likewise.
	* gengtype.c: Likewise.
	* gengtype.h: Likewise.
	* genmddeps.c: Likewise.
	* genmodes.c: Likewise.
	* genopinit.c: Likewise.
	* genpreds.c: Likewise.
	* gensupport.c: Likewise.
	* ggc-common.c: Likewise.
	* ggc-page.c: Likewise.
	* ggc-zone.c: Likewise.
	* ggc.h: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-low.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* gimple.c: Likewise.
	* gimple.def: Likewise.
	* gimple.h: Likewise.
	* gimplify.c: Likewise.
	* graphds.c: Likewise.
	* graphite-clast-to-gimple.c: Likewise.
	* gthr-nks.h: Likewise.
	* gthr-posix.c: Likewise.
	* gthr-posix.h: Likewise.
	* gthr-posix95.h: Likewise.
	* gthr-single.h: Likewise.
	* gthr-tpf.h: Likewise.
	* gthr-vxworks.h: Likewise.
	* gthr.h: Likewise.
	* haifa-sched.c: Likewise.
	* hard-reg-set.h: Likewise.
	* hooks.c: Likewise.
	* hooks.h: Likewise.
	* hosthooks.h: Likewise.
	* hwint.h: Likewise.
	* ifcvt.c: Likewise.
	* incpath.c: Likewise.
	* init-regs.c: Likewise.
	* integrate.c: Likewise.
	* ipa-cp.c: Likewise.
	* ipa-inline.c: Likewise.
	* ipa-prop.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* ipa-reference.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* ipa-utils.c: Likewise.
	* ipa-utils.h: Likewise.
	* ipa.c: Likewise.
	* ira-build.c: Likewise.
	* ira-color.c: Likewise.
	* ira-conflicts.c: Likewise.
	* ira-costs.c: Likewise.
	* ira-emit.c: Likewise.
	* ira-int.h: Likewise.
	* ira-lives.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* lambda-code.c: Likewise.
	* lambda-mat.c: Likewise.
	* lambda-trans.c: Likewise.
	* lambda.h: Likewise.
	* langhooks.c: Likewise.
	* lcm.c: Likewise.
	* libgcov.c: Likewise.
	* lists.c: Likewise.
	* loop-doloop.c: Likewise.
	* loop-init.c: Likewise.
	* loop-invariant.c: Likewise.
	* loop-iv.c: Likewise.
	* loop-unroll.c: Likewise.
	* lower-subreg.c: Likewise.
	* lto-cgraph.c: Likewise.
	* lto-compress.c: Likewise.
	* lto-opts.c: Likewise.
	* lto-section-in.c: Likewise.
	* lto-section-out.c: Likewise.
	* lto-streamer-in.c: Likewise.
	* lto-streamer-out.c: Likewise.
	* lto-streamer.c: Likewise.
	* lto-streamer.h: Likewise.
	* lto-symtab.c: Likewise.
	* lto-wpa-fixup.c: Likewise.
	* matrix-reorg.c: Likewise.
	* mcf.c: Likewise.
	* mode-switching.c: Likewise.
	* modulo-sched.c: Likewise.
	* omega.c: Likewise.
	* omega.h: Likewise.
	* omp-low.c: Likewise.
	* optabs.c: Likewise.
	* optabs.h: Likewise.
	* opts-common.c: Likewise.
	* opts.c: Likewise.
	* params.def: Likewise.
	* params.h: Likewise.
	* passes.c: Likewise.
	* plugin.c: Likewise.
	* postreload-gcse.c: Likewise.
	* postreload.c: Likewise.
	* predict.c: Likewise.
	* predict.def: Likewise.
	* pretty-print.c: Likewise.
	* pretty-print.h: Likewise.
	* print-rtl.c: Likewise.
	* print-tree.c: Likewise.
	* profile.c: Likewise.
	* read-rtl.c: Likewise.
	* real.c: Likewise.
	* recog.c: Likewise.
	* reg-stack.c: Likewise.
	* regcprop.c: Likewise.
	* reginfo.c: Likewise.
	* regmove.c: Likewise.
	* regrename.c: Likewise.
	* regs.h: Likewise.
	* regstat.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* resource.c: Likewise.
	* rtl.c: Likewise.
	* rtl.def: Likewise.
	* rtl.h: Likewise.
	* rtlanal.c: Likewise.
	* sbitmap.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-int.h: Likewise.
	* sched-rgn.c: Likewise.
	* sched-vis.c: Likewise.
	* sdbout.c: Likewise.
	* sel-sched-dump.c: Likewise.
	* sel-sched-dump.h: Likewise.
	* sel-sched-ir.c: Likewise.
	* sel-sched-ir.h: Likewise.
	* sel-sched.c: Likewise.
	* sel-sched.h: Likewise.
	* sese.c: Likewise.
	* sese.h: Likewise.
	* simplify-rtx.c: Likewise.
	* stack-ptr-mod.c: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* store-motion.c: Likewise.
	* stringpool.c: Likewise.
	* stub-objc.c: Likewise.
	* sync-builtins.def: Likewise.
	* target-def.h: Likewise.
	* target.h: Likewise.
	* targhooks.c: Likewise.
	* targhooks.h: Likewise.
	* timevar.c: Likewise.
	* tlink.c: Likewise.
	* toplev.c: Likewise.
	* toplev.h: Likewise.
	* tracer.c: Likewise.
	* tree-affine.c: Likewise.
	* tree-affine.h: Likewise.
	* tree-browser.def: Likewise.
	* tree-call-cdce.c: Likewise.
	* tree-cfg.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-complex.c: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-dfa.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-dump.h: Likewise.
	* tree-eh.c: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-flow.h: Likewise.
	* tree-if-conv.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-mudflap.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-pass.h: Likewise.
	* tree-phinodes.c: Likewise.
	* tree-predcom.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tree-profile.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-alias.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-operands.c: Likewise.
	* tree-ssa-operands.h: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* tree-ssa.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-tailcall.c: Likewise.
	* tree-vect-data-refs.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-vect-loop-manip.c: Likewise.
	* tree-vect-loop.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-vect-slp.c: Likewise.
	* tree-vect-stmts.c: Likewise.
	* tree-vectorizer.c: Likewise.
	* tree-vectorizer.h: Likewise.
	* tree-vrp.c: Likewise.
	* tree.c: Likewise.
	* tree.def: Likewise.
	* tree.h: Likewise.
	* treestruct.def: Likewise.
	* unwind-compat.c: Likewise.
	* unwind-dw2-fde-glibc.c: Likewise.
	* unwind-dw2.c: Likewise.
	* value-prof.c: Likewise.
	* value-prof.h: Likewise.
	* var-tracking.c: Likewise.
	* varasm.c: Likewise.
	* varpool.c: Likewise.
	* vec.c: Likewise.
	* vec.h: Likewise.
	* vmsdbgout.c: Likewise.
	* web.c: Likewise.
	* xcoffout.c: Likewise.

From-SVN: r154645
2009-11-25 02:55:54 -08:00
Jakub Jelinek b25833451b re PR c++/3187 (gcc lays down two copies of constructors)
PR c++/3187
	* cgraph.h (struct cgraph_node): Add same_body and same_body_alias
	fields.
	(cgraph_same_body_alias, cgraph_remove_same_body_alias): New
	prototypes.
	* cgraphunit.c (cgraph_expand_function, cgraph_emit_thunks,
	cgraph_materialize_all_clones): Handle same_body aliases.
	* cgraph.c (cgraph_allocate_node): New function.
	(cgraph_create_node): Use it.
	(cgraph_node_for_decl, cgraph_node, cgraph_get_node,
	cgraph_node_for_asm, cgraph_remove_node): Handle same_body aliases.
	(cgraph_same_body_alias, cgraph_remove_same_body_alias): New
	functions.
	* lto-cgraph.c (lto_output_node): Stream out same_body aliases.
	(input_node): Stream in same_body aliases.
	* lto-symtab.c (lto_cgraph_replace_node): Clear node pointers
	for same_body aliases.
	(lto_symtab_merge_cgraph_nodes_1): Handle same_body aliases.

	* cp-tree.h (expand_or_defer_fn_1): New prototype.
	* decl2.c (cp_write_global_declarations): Mark as !DECL_EXTERNAL
	also all same_body aliases.
	* semantics.c (expand_or_defer_fn): Move most of the function
	except registering with cgraph to ...
	(expand_or_defer_fn_1): ... here.  New function.
	* optimize.c: Include cgraph.h.
	(maybe_clone_body): If in charge parm is not used and both base
	and complete clones are created and are not comdat, tell cgraph
	they have the same body.
	* Make-lang.in (cp/optimize.o): Depend on $(CGRAPH_H).

	* g++.dg/abi/mangle26.C: Also match *C2* definition.
	* g++.dg/abi/mangle27.C: Likewise.
	* g++.dg/abi/mangle28.C: Likewise.
	* g++.dg/abi/mangle29.C: Likewise.

From-SVN: r154284
2009-11-18 10:53:52 +01:00
Jan Hubicka f875410705 cgraph.c (cgraph_update_edges_for_call_stmt_node): Do not access removed node.
* cgraph.c (cgraph_update_edges_for_call_stmt_node): Do not access
	removed node.
	* cgraphunit.c (verify_cgraph_node): Verify frequencies for match.

From-SVN: r154242
2009-11-17 09:35:51 +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
Jan Hubicka a82892595b cgraph.h (varpool_node_name): Declare.
* cgraph.h (varpool_node_name): Declare.
	* cgraphunit.c (process_function_and_variable_attributes): Set force_output
	flag on used variables.
	* ipa.c (function_and_variable_visibility): Dump externally visible and needed
	variables.
	* varpool.c (varpool_node_name): Export.
	(decide_is_variable_needed): Check COMDAT for externally visible vars;
	ignore needed flag.

From-SVN: r154121
2009-11-12 16:21:59 +00:00
Richard Henderson 9ba0399e73 * cgraphunit.c (cgraph_optimize): Maintain timevar stack properly.
From-SVN: r153618
2009-10-27 16:25:54 -07: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
Jakub Jelinek 3df9609a72 re PR debug/40521 (-g causes GCC to generate .eh_frame)
PR debug/40521
	* debug.h (struct gcc_debug_hooks): Add assembly_start hook.
	* cgraphunit.c (cgraph_optimize): Call it.
	* dwarf2out.c (dwarf2out_init): Move .cfi_sections printing into...
	(dwarf2out_assembly_start): ... here.  New hook.
	(dwarf2out_debug_hooks): Add dwarf2out_assembly_start.
	* debug.c (do_nothing_debug_hooks): Do nothing for assembly_start
	hook.
	* dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Likewise.
	* sdbout.c (sdb_debug_hooks): Likewise.
	* vmsdbgout.c (vmsdbg_debug_hooks): Add vmsdbgout_assembly_start.
	(vmsdbgout_assembly_start): New hook.

From-SVN: r152930
2009-10-17 09:28:13 +02: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
Diego Novillo d7f09764d7 Merge lto branch into trunk.
From-SVN: r152434
2009-10-03 17:10:11 -04:00
Jakub Jelinek 9f62cb922f cgraphunit.c (cgraph_lower_function): Revert last change.
* cgraphunit.c (cgraph_lower_function): Revert last change.
	* targhooks.c (default_static_chain): Use !DECL_STATIC_CHAIN
	instead of DECL_NO_STATIC_CHAIN.
	* tree-cfg.c (verify_gimple_call): Likewise.
	* tree-nested.c (get_chain_decl, get_chain_field,
	convert_tramp_reference_op, convert_gimple_call): Likewise.
	(convert_all_function_calls): Likewise.  Always set or clear
	DECL_STATIC_CHAIN initially, for !n->outer clear it.
	(lower_nested_functions): Remove DECL_NO_STATIC_CHAIN checking code.
	* c-parser.c (c_parser_declaration_or_fndef): Set DECL_STATIC_CHAIN
	if nested.
	* print-tree.c (print_node): Handle DECL_STATIC_CHAIN instead of
	DECL_NO_STATIC_CHAIN.
	* config/i386/i386.c (ix86_static_chain): Use !DECL_STATIC_CHAIN
	instead of DECL_NO_STATIC_CHAIN.
	(ix86_function_regparm, find_drap_reg): Likewise.  Don't test
	decl_function_context.
	* varasm.c (initializer_constant_valid_p): Likewise.
	* tree.h (DECL_NO_STATIC_CHAIN): Renamed to ...
	(DECL_STATIC_CHAIN): ... this.
	* config/moxie/moxie.c (moxie_static_chain): Use !DECL_STATIC_CHAIN
	instead of DECL_NO_STATIC_CHAIN.

	* method.c (make_thunk, make_alias_for): Don't set
	DECL_NO_STATIC_CHAIN.
	* decl.c (builtin_function_1, grokfndecl): Likewise.
	* lex.c (build_lang_decl): Likewise.

	* gcc-interface/utils.c (gnat_pushdecl): Don't set
	DECL_NO_STATIC_CHAIN, set DECL_STATIC_CHAIN for
	nested functions.

	* testsuite/gcc.target/i386/pr12329.c: Adjust.

From-SVN: r152114
2009-09-24 11:21:39 +02:00
Jakub Jelinek 66f0e027f5 re PR bootstrap/41436 (Revision 152018 failed to bootstrap on i386)
PR bootstrap/41436
	* cgraphunit.c (cgraph_lower_function): Set DECL_NO_STATIC_CHAIN
	on non-nested functions.

From-SVN: r152067
2009-09-23 15:06:20 +02:00
Richard Henderson 1d65f45cfa Squash commit of EH in gimple
From-SVN: r151696
2009-09-14 12:18:58 -07:00
Richard Guenther 90097c6771 re PR middle-end/41257 (Bogus error '*.LTHUNK0' aliased to undefined symbol '_ZN1CD1Ev')
2009-09-10  Richard Guenther  <rguenther@suse.de>

	PR middle-end/41257
	* cgraphunit.c (cgraph_emit_thunks): Emit thunks only for
	reachable nodes.
	(cgraph_finalize_compilation_unit): Compute reachability
	before emitting thunks.  Properly process aliases before
	possibly removing unreachable nodes.

	* g++.dg/torture/pr41257-2.C: New testcase.

From-SVN: r151592
2009-09-10 11:42:25 +00:00
Richard Guenther 5f1a9ebbc1 re PR middle-end/41257 (Bogus error '*.LTHUNK0' aliased to undefined symbol '_ZN1CD1Ev')
2009-09-04  Richard Guenther  <rguenther@suse.de>

	PR middle-end/41257
	* (cgraph_finalize_compilation_unit): Move finalizing aliases
	after emitting tunks.  Move emitting thunks and ctors from ...
	(cgraph_optimize): ... here.  Remove redundant
	cgraph_analyze_functions.
	* varasm.c (find_decl_and_mark_needed): Remove no longer
	necessary check.
	(finish_aliases_1): Adjust check for thunk aliases.

	* g++.dg/torture/pr41257.C: New testcase.

From-SVN: r151431
2009-09-04 18:54:01 +00:00
Diego Novillo 4537ec0c86 [multiple changes]
2009-09-01  Diego Novillo  <dnovillo@google.com>

	* c-lang.c (lang_hooks): Remove const qualifier.

java/ChangeLog

	* lang.c (lang_hooks): Remove const qualifier.

objc/ChangeLog

	* objc-lang.c (lang_hooks): Remove const qualifier.

objcp/ChangeLog

	* objcp-lang.c (lang_hooks): Remove const qualifier.

ada/ChangeLog

	* gcc-interface/misc.c (lang_hooks): Remove const qualifier.

fortran/ChangeLog

	* f95-lang.c (lang_hooks): Remove const qualifier.

cp/ChangeLog

	* cp-lang.c (lang_hooks): Remove const qualifier.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* cgraph.c (cgraph_node_for_decl): New.
	* cgraph.h (cgraph_node_for_decl): Declare.
	* tree.c (host_integerp): Return 0 if T is NULL.


2009-09-01  Diego Novillo  <dnovillo@google.com>

	* tree.h (struct alias_pair): Move from varasm.c.
	(alias_pairs): Likewise.
	(TYPE_MAXVAL): Define.
	(TYPE_MINVAL): Define.
	(iterative_hash_host_wide_int): Declare.
	(remove_unreachable_alias_pairs): Declare.
	* tree-pass.h (pass_ipa_free_lang_data): Declare.
	* diagnostic.c (default_diagnostic_starter): Make extern.
	(default_diagnostic_finalizer): Make extern.
	* diagnostic.h (default_diagnostic_starter): Declare.
	(default_diagnostic_finalizer): Declare.
	(default_tree_printer): Declare.
	* toplev.c (default_tree_printer): Make extern.


2009-09-01  Richard Guenther  <rguenther@suse.de>
	    Diego Novillo  <dnovillo@google.com>

	* cgraph.c (cgraph_add_new_function): Remove gimplification.
	* cgraphunit.c (cgraph_expand_function): Do not emit
	associated thunks from here.
	(cgraph_emit_thunks): New.
	(cgraph_optimize): Call it.
	Return if any IPA pass finds an error.
	* varasm.c (finish_aliases_1): Ignore errorneous aliases used
	by thunks.


2009-09-01  Simon Baldwin  <simonb@google.com>
	    Rafael Espindola  <espindola@google.com>
	    Richard Guenther  <rguenther@suse.de>
	    Doug Kwan  <dougkwan@google.com>
	    Diego Novillo  <dnovillo@google.com>

	* tree.c: Include tree-pass.h, langhooks-def.h,
	diagnostic.h, cgraph.h, timevar.h, except.h and debug.h.
	(free_lang_data_in_type): New.
	(need_assembler_name_p): New.
	(free_lang_data_in_block): New.
	(free_lang_data_in_decl): New.
	(struct free_lang_data_d): New.
	(add_tree_to_fld_list): New.
	(find_decls_types_r): New.
	(get_eh_types_for_runtime): New.
	(find_decls_types_in_eh_region): New.
	(find_decls_types_in_node): New.
	(find_decls_types_in_var): New.
	(free_lang_data_in_cgraph): New.
	(free_lang_data): New.
	(gate_free_lang_data): New.
	(pass_ipa_free_lang_data): New.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* timevar.def (TV_IPA_FREE_LANG_DATA): Define.
	* langhooks.h (struct lang_hooks): Add field free_lang_data.
	(lang_hooks): Remove const qualifier.
	* ipa.c (cgraph_remove_unreachable_nodes): Call
	remove_unreachable_alias_pairs.
	* except.c (add_type_for_runtime): Check if TYPE has
	already been converted.
	(lookup_type_for_runtime): Likewise.
	(check_handled): Handle converted types.
	* varasm.c (remove_unreachable_alias_pairs): New.
	* gimple.c: Include demangle.h.
	(gimple_decl_printable_name): New.
	(gimple_fold_obj_type_ref): New.
	* gimple.h (gimple_decl_printable_name): Declare.
	(gimple_fold_obj_type_ref): Declare.
	* passes.c (init_optimization_passes): Add pass
	pass_ipa_free_lang_data.
	* langhooks-def.h (LANG_HOOKS_FREE_LANG_DATA): Define.
	(LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_FREE_LANG_DATA.

testsuite/ChangeLog

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* gcc.dg/gomp/combined-1.c: Adjust expected pattern.
	* g++.dg/tree-prof/inline_mismatch_args.C: Likewise.
	* g++.dg/warn/unit-1.C: Likewise.
	* g++.dg/ipa/iinline-1.C: Likewise.
	* g++.dg/template/cond2.C: Adjust expected line location for the
	error.
	* g++.dg/template/pr35240.C: Likewise.


cp/ChangeLog

2009-09-01  Doug Kwan  <dougkwan@google.com>

	* tree.c (cp_fix_function_decl_p): New.
	(cp_free_lang_data): New.

2009-09-01  Diego Novillo  <dnovillo@google.com>

	* Make-lang.in (decl2.o): Add dependency on $(POINTER_SET_H).
	* decl2.c: Include pointer-set.h.
	(collect_candidates_for_java_method_aliases): New.
	(cp_write_global_declarations): Call it.
	Add local variable CANDIDATES.  If set, call
	build_java_method_aliases.
	(build_java_method_aliases): Add argument CANDIDATES.
	Use it to determine if FNDECL should get a hidden alias.
	* cp-objcp-common.h (LANG_HOOKS_FREE_LANG_DATA): Define.
	* cp-tree.h (cp_free_lang_data): Declare.

2009-09-03  Richard Guenther  <rguenther@suse.de>

	* method.c (use_thunk): Use cgraph_finalize_function to hand
	off thunks to the cgraph.
	* semantics.c (emit_associated_thunks): Do not emit thunks
	for really extern functions.

From-SVN: r151360
2009-09-03 00:07:12 -04:00
Jan Hubicka 08ad1d6d82 cgraph.h (combined_args_to_skip): New field.
2009-07-20  Jan Hubicka  <jh@suse.cz>
            Martin Jambor  <mjambor@suse.cz>

	* cgraph.h (combined_args_to_skip): New field.
	* cgraph.c (cgraph_create_virtual_clone): Properly handle
	combined_args_to_skip and args_to_skip.
	* tree-inline.c (update_clone_info): New function.
	(tree_function_versioning): Call update_clone_info.
	* cgraphunit.c: (cgraph_materialize_clone): Dump materialized functions.
	(cgraph_materialize_all_clones): More extensive dumping, working
	with combined_args_to_skip rather than args_to_skip.



Co-Authored-By: Martin Jambor <mjambor@suse.cz>

From-SVN: r149808
2009-07-20 14:15:02 +02:00
Richard Guenther a406865a08 re PR c/40401 (ICE: verify_gimple failed)
2009-07-17  Richard Guenther  <rguenther@suse.de>

	PR c/40401
	* tree-pass.h (pass_diagnose_omp_blocks): Declare.
	(pass_warn_unused_result): Likewise.
	(TODO_set_props): Remove.
	* omp-low.c (diagnose_omp_structured_block_errors): Change to
	run as a pass.
	(pass_diagnose_omp_blocks): Define.
	* c-decl.c (pop_file_scope): Do not finalize the CU here.
	(c_gimple_diagnostics_recursively): Remove.
	(finish_function): Do not call it.
	(c_write_global_declarations): Continue after errors.
	Finalize the CU here.
	* c-gimplify.c (c_genericize): Do not gimplify here.
	* c-common.c (c_warn_unused_result): Move ...
	* tree-cfg.c (do_warn_unused_result): ... here.
	(run_warn_unused_result): New function.
	(gate_warn_unused_result): New function.
	(pass_warn_unused_result): New pass.
	* c-common.h (c_warn_unused_result): Remove.
	* flags.h (flag_warn_unused_result): Declare.
	* c-opts.c (c_common_init_options): Enable flag_warn_unused_result.
	* opts.c (flag_warn_unused_result): Initialize to false.

	* toplev.c (compile_file): Add comment.
	* omp-low.c (create_omp_child_function): Do not register
	the function with the frontend.
	(diagnose_omp_structured_block_errors): Prepare to be
	called as optimization pass.
	(gate_diagnose_omp_blocks): New function.
	(pass_diagnose_omp_blocks): New pass.
	* cgraph.h (cgraph_optimize): Remove.
	(cgraph_analyze_function): Likewise.
	* cgraph.c (cgraph_add_new_function): Gimplify C++ thunks.
	* cgraphunit.c (cgraph_lower_function): Lower nested functions
	before their parents here.
	(cgraph_finalize_function): Not here.
	(cgraph_analyze_function): Gimplify functions here.
	(cgraph_finalize_compilation_unit): Continue after errors.
	Optimize the callgraph from here.
	(cgraph_optimize): Make static.
	* langhooks.c (write_global_declarations): Finalize the CU.
	* gimplify.c (gimplify_asm_expr): Do not emit ASMs with errors.
	(gimplify_function_tree): Assert we gimplify only once.
	Set PROP_gimple_any property.
	* tree-nested.c (gimplify_all_functions): New function.
	(lower_nested_functions): Gimplify all nested functions.
	* gimple.h (diagnose_omp_structured_block_errors): Remove.
	* passes.c (init_optimization_passes): Add pass_warn_unused_result
	and pass_diagnose_omp_blocks after gimplification.  Do not
	set TODO_set_props on all_lowering_passes.
	(execute_one_pass): Do not handle TODO_set_props.
	* Makefile.in (cgraphunit.o): Add $(TREE_DUMP_H) dependency.
	(gimplify.o): Add tree-pass.h dependency.
	* tree-inline.c (copy_statement_list): Properly copy STATEMENT_LIST.
	(copy_tree_body_r): Properly handle TARGET_EXPR like SAVE_EXPR.
	(unsave_r): Likewise.
	* c-omp.c (c_finish_omp_atomic): Set DECL_CONTEXT on the
	temporary variable.

	cp/
	* decl.c (finish_function): Do not emit unused result warnings
	from here.
	* cp-objcp-common.h (LANG_HOOKS_POST_GIMPLIFY_PASS): Use
	c_warn_unused_result_pass.
	* semantics.c (expand_or_defer_fn): Adjust assertion about IL status.
	* optimize.c (clone_body): Clone in GENERIC.
	(maybe_clone_body): Do not clear DECL_SAVED_TREE.
	* decl2.c (cp_write_global_declarations): Fix body test.
	Do not call cgraph_optimize.
	* Make-lang.in (optimize.o): Add tree-iterator.h dependency.
	* method.c (use_thunk): Register thunk with
	cgraph_finalize_function.
	* error.c (function_category): Guard access of DECL_LANG_SPECIFIC.

	java/
	* java-gimplify.c (java_genericize): Do not gimplify here.
	But replace all local references.
	(java_gimplify_expr): Do not replace local references here.
	(java_gimplify_modify_expr): Likewise.
	* jcf-parse.c (java_parse_file): Do not finalize the CU or
	optimize the cgraph here.
	* decl.c (java_replace_reference): Make static.
	(java_replace_references): New function.
	(end_java_method): Clear base_decl_map.
	* java-tree.h (java_replace_references): Declare.
	(java_replace_reference): Remove.

	ada/
	* utils.c (end_subprog_body): Revert to pre-tuples state.  Remove
	unused parameter.
	(gnat_gimplify_function): Do not gimplify here.
	Fold into its only caller and remove.
	(gnat_builtin_function): Adjust for end_subprog_body signature change.
	(gnat_write_global_declarations): Also finalize the CU.
	* misc.c (gnat_parse_file): Do not finalize the CU here.
	* trans.c (gigi): Revert to pre-tuples state.
	(Subprogram_Body_to_gnu): Adjust for end_subprog_body signature
	change.
	* gigi.h (end_subprog_body): Remove unused parameter.

	fortran/
	* f95-lang.c (gfc_be_parse_file): Do not finalize the CU here.
	* trans-decl.c (gfc_gimplify_function): Remove.
	(build_entry_thunks): Do not gimplify here.
	(create_main_function): Likewise.
	(gfc_generate_function_code): Likewise.

	* g++.dg/rtti/crash4.C: New testcase.
	* g++.dg/torture/20090706-1.C: Likewise.
	* gcc.dg/redecl-17.c: Likewise.

	* gfortran.dg/missing_optional_dummy_5.f90: Adjust pattern.
	* gcc.dg/declspec-9.c: Expect extra error.
	* gcc.dg/declspec-10.c: Likewise.
	* gcc.dg/declspec-11.c: Likewise.
	* gcc.dg/redecl-10.c: Expect extra warnings.
	* gcc.target/i386/pr39082-1.c: Adjust diagnostic location.
	* gcc.target/i386/pr39545-1.c: Likewise.
	* g++.dg/ext/asm3.C: Expect more errors.
	* g++.dg/gomp/block-1.C: Likewise.
	* g++.dg/gomp/block-2.C: Likewise.
	* g++.dg/gomp/block-3.C: Likewise.
	* g++.dg/gomp/block-5.C: Likewise.
	* g++.old-deja/g++.jason/report.C: Expect extra warnings.
	* g++.dg/warn/unused-result1.C: XFAIL.

From-SVN: r149750
2009-07-17 15:49:34 +00:00
Aldy Hernandez db3927fb49 re PR c/40435 (Revision 148442 caused many regressions on trunk)
2009-07-17  Aldy Hernandez  <aldyh@redhat.com>
	    Manuel López-Ibáñez  <manu@gcc.gnu.org>

	PR 40435 
	* tree-complex.c, tree-loop-distribution.c,
	tree.c, tree.h, builtins.c, fold-const.c, omp-low.c,
	cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c,
	gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c,
	stor-layout.c, tree-if-conv.c, c-typeck.c,
	gimplify.c, calls.c, tree-sra.c, tree-mudflap.c,
	tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c,
	varasm.c, tree-inline.c, c-common.c,
	c-common.h, gimple.c, tree-switch-conversion.c, gimple.h,
	tree-cfg.c, c-parser.c, convert.c: Add location
	argument to fold_{unary,binary,ternary}, fold_build[123],
	build_call_expr, build_size_arg, build_fold_addr_expr,
	build_call_array, non_lvalue, size_diffop,
	fold_build1_initializer, fold_build2_initializer,
	fold_build3_initializer, fold_build_call_array,
	fold_build_call_array_initializer, fold_single_bit_test,
	omit_one_operand, omit_two_operands, invert_truthvalue,
	fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
	combine_comparisons, fold_builtin_*, fold_call_expr,
	build_range_check, maybe_fold_offset_to_address, round_up,
	round_down.
objc/
	* objc-act.c: Add location argument to all calls to
	build_fold_addr_expr.
testsuite/
	* gcc.dg/pr36902.c: Add column info.
	* g++.dg/gcov/gcov-2.C: Change count for definition.
cp/
	* typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c,
	tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c,
	call.c, cvt.c, mangle.c: Add location argument to
	fold_{unary,binary,ternary}, fold_build[123], build_call_expr,
	build_size_arg, build_fold_addr_expr, build_call_array,
	non_lvalue, size_diffop, fold_build1_initializer,
	fold_build2_initializer, fold_build3_initializer,
	fold_build_call_array, fold_build_call_array_initializer,
	fold_single_bit_test, omit_one_operand, omit_two_operands,
	invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref,
	fold_indirect_ref, combine_comparisons, fold_builtin_*,
	fold_call_expr, build_range_check, maybe_fold_offset_to_address,
	round_up, round_down.
fortran/
	* trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c,
	trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location
	argument to fold_{unary,binary,ternary}, fold_build[123],
	build_call_expr, build_size_arg, build_fold_addr_expr,
	build_call_array, non_lvalue, size_diffop,
	fold_build1_initializer, fold_build2_initializer,
	fold_build3_initializer, fold_build_call_array,
	fold_build_call_array_initializer, fold_single_bit_test,
	omit_one_operand, omit_two_operands, invert_truthvalue,
	fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref,
	combine_comparisons, fold_builtin_*, fold_call_expr,
	build_range_check, maybe_fold_offset_to_address, round_up,
	round_down.

Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>

From-SVN: r149722
2009-07-16 22:29:52 +00:00
Manuel López-Ibáñez c5d753640d cgraphunit.c: Replace %J by an explicit location.
2009-07-07  Manuel López-Ibáñez  <manu@gcc.gnu.org>

	* cgraphunit.c: Replace %J by an explicit location. Update all
	calls.
	* c-decl.c: Likewise.
	* function.c: Likewise.
	* varasm.c: Likewise.
	* tree-ssa.c: Likewise.
	* c-common.c: Likewise.
	* tree-cfg.c: Likewise.
	* config/spu/spu.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/v850/v850.c: Likewise.
java/	
	* class.c: Replace %J by an explicit location. Update all calls.
objc/	
	* objc-act.c: Replace %J by an explicit location. Update all
	calls.
cp/
	* init.c: Replace %J by an explicit location. Update all calls.
	* decl.c: Likewise.
	* typeck2.c: Likewise.
	* pt.c: Likewise.
	* name-lookup.c: Likewise.

From-SVN: r149312
2009-07-07 02:55:59 +00:00
Eric Botcazou f82a627cf5 cgraphunit.c (cgraph_finalize_compilation_unit): Call finalize_size_functions before further processing.
* cgraphunit.c (cgraph_finalize_compilation_unit): Call
	finalize_size_functions before further processing.
	* stor-layout.c: Include cgraph.h, tree-inline.h and tree-dump.h.
	(variable_size): Call self_referential_size on size expressions
	that contain a PLACEHOLDER_EXPR.
	(size_functions): New static variable.
	(copy_self_referential_tree_r): New static function.
	(self_referential_size): Likewise.
	(finalize_size_functions): New global function.
	* tree.c: Include tree-inline.h.
	(push_without_duplicates): New static function.
	(find_placeholder_in_expr): New global function.
	(substitute_in_expr) <tcc_declaration>: Return the replacement object
	on equality.
	<tcc_expression>: Likewise.
	<tcc_vl_exp>: If the replacement object is a constant, try to inline
	the call in the expression.
	* tree.h (finalize_size_functions): Declare.
	(find_placeholder_in_expr): Likewise.
	(FIND_PLACEHOLDER_IN_EXPR): New macro.
	(substitute_placeholder_in_expr): Update comment.
	* tree-inline.c (remap_decl): Do not unshare trees if do_not_unshare
	is true.
	(copy_tree_body_r): Likewise.
	(copy_tree_body): New static function.
	(maybe_inline_call_in_expr): New global function.
	* tree-inline.h (struct copy_body_data): Add do_not_unshare field.
	(maybe_inline_call_in_expr): Declare.
	* Makefile.in (tree.o): Depend on TREE_INLINE_H.
	(stor-layout.o): Depend on CGRAPH_H, TREE_INLINE_H, TREE_DUMP_H and
	GIMPLE_H.
ada/
	* gcc-interface/decl.c: Include tree-inline.h.
	(annotate_value) <CALL_EXPR>: Try to inline the call in the expression.
	* gcc-interface/utils.c (max_size) <CALL_EXPR>: Likewise.
	* gcc-interface/utils2.c: Include tree-inline.
	(known_alignment) <CALL_EXPR>: Likewise.

From-SVN: r149112
2009-06-30 17:26:32 +00:00
Rafael Avila de Espindola fc26fae3db cgraphunit.c (cgraph_function_versioning,save_inline_function_body): Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cgraphunit.c (cgraph_function_versioning,save_inline_function_body):
	Use DECL_COMDAT_GROUP instead of DECL_ONE_ONLY.
	* cgraph.c (cgraph_create_virtual_clone): Use DECL_COMDAT_GROUP.
	* config/i386/i386.c (ix86_file_end): Compute DECL_COMDAT_GROUP.
	* dwarf2asm.c(dw2_force_const_mem): Update call to make_decl_one_only.
	* langhooks-def.h (lhd_comdat_group, LANG_HOOKS_COMDAT_GROUP): Remove.
	(LANG_HOOKS_DECLS): Remove LANG_HOOKS_COMDAT_GROUP.
	* langhooks.c (lhd_comdat_group): Remove.
	* langhooks.h (lang_hooks_for_decls): Remove comdat_group.
	* tree.h (DECL_COMDAT_GROUP): New.
	(DECL_ONE_ONLY): Use DECL_COMDAT_GROUP.
	(tree_decl_with_vis): Add comdat_group. Remove one_only.
	(make_decl_one_only): Change signature.
	* varasm.c (get_emutls_init_templ_addr, emutls_decl): Update call to
	make_decl_one_only.
	(make_decl_one_only): Change signature.
	(default_elf_asm_named_section): Use DECL_COMDAT_GROUP.

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* cp-objcp-common.h (LANG_HOOKS_COMDAT_GROUP): Remove.
	* cp-tree.h (cxx_comdat_group): Change signature.
	* decl.c (duplicate_decls): Use DECL_COMDAT_GROUP.
	(cxx_comdat_group): Change signature.
	* decl2.c (comdat_linkage, maybe_make_one_only): Update call to
	make_decl_one_only.
	(constrain_visibility, get_guard): Use DECL_COMDAT_GROUP.
	* method.c (use_thunk): Update call to make_decl_one_only.
	* optimize.c (maybe_clone_body): Use DECL_COMDAT_GROUP

2009-06-15  Rafael Avila de Espindola  <espindola@google.com>

	* g++.dg/abi/mangle11.C: Update warning line.
	* g++.dg/abi/mangle12.C: Update warning line.
	* g++.dg/abi/mangle17.C: Update warning line.
	* g++.dg/abi/mangle20-2.C: Update warning line.

From-SVN: r148492
2009-06-15 14:25:50 +00:00
Aldy Hernandez c2255bc488 java-gimplify.c (java_gimplify_block): New argument to build_empty_stmt.
gcc/java/
	* java-gimplify.c (java_gimplify_block): New argument to
	build_empty_stmt.
	* expr.c (force_evaluation_order): Same.
	* typeck.c: Add location to build_decl or PUSH_FIELD calls.
	* class.c: Same.
	* decl.c: Same.
	* jcf-parse.c: Same.
	* constants.c: Same.
	* resource.c: Same.
	* except.c: Same.
	* builtins.c: Same.
	* expr.c: Same.
	* java-tree.h (PUSH_FIELD): Add location field.
gcc/objc/
	* objc-act.c (finish_var_decl): Pass location to finish_decl.
	(objc_get_parm_info): Same.
	(get_super_receiver): Same.
	* objc-act.c (objc_build_component_ref): Pass location to
	build_compound_ref.
	(build_module_initializer_routine): Pass location to
	c_end_compound_stmt.
	(objc_generate_static_init_call): Pass location to build_stmt.
	(build_typed_selector_reference): New location argument.
	(build_selector_reference): Same.
	(objc_substitute_decl): Pass location to build_array_ref.
	(next_sjlj_build_try_catch_finally): Pass location to build_stmt.
	(objc_begin_catch_clause): Same.
	(objc_finish_try_stmt): Same.
	(objc_finish_catch_clause): Pass location to c_end_compound_stmt.
	(objc_build_throw_stmt): New argument.
	(generate_shared_structures): Pass location to build_c_cast.
	(objc_build_message_expr): Use local location.
	(objc_finish_message_expr): Use input_location.
	(build_objc_method_call): New argument.
	(objc_build_selector_expr): Same.
	(get_super_receiver): Pass location to build_c_cast,
	build_modify_expr, build_compound_expr.
	* objc-act.c: Add location to all calls to start_struct, build_decl,
	finish_struct.
gcc/
	* tree-pretty-print.c (dump_generic_node): Dump column numbers.
	* gimple-pretty-print.c (dump_gimple_stmt): Same.
	* gimplify.c (gimplify_modify_expr): Set location for GIMPLE_ASSIGNs
	created.
	* c-parser.c (c_parser_binary_expression): Use current column while
	building binary operations.
	* common.opt (fshow-column): Enable by default.
	* tree-vrp.c (check_array_ref): Use warning_at.
	(check_array_bounds): Use location from call back if expr has no
	location.
	* tree.h: Add location argument to maybe_fold_*.
	* tree-ssa-ccp.c (ccp_fold): Pass location to maybe_fold_*.
	(maybe_fold_offset_to_array_ref): Add location argument and use it.
	(maybe_fold_offset_to_component_ref): Same.
	(maybe_fold_offset_to_reference): Same.
	(maybe_fold_offset_to_address): Same.
	(maybe_fold_stmt_indirect): Same.
	(maybe_fold_stmt_addition): Same.
	(fold_stmt_r): Pass location to maybe_fold_*.
	(fold_gimple_assign): Same.
	* c-tree.h: Add location argument to finish_decl,
	default_function_array_conversion, store_init_value.
	* c-decl.c (define_label): Use error_at.
	(c_make_fname_decl): Pass location to finish_decl.
	(finish_decl): New location argument.
	(build_compound_literal): Pass location to store_init_value.
	(grokdeclarator): Pass location to finish_decl.
	(grokfield): Same.
	* c-typeck.c (array_to_pointer_conversion): New location argument.
	(function_to_pointer_conversion): Same.
	(default_function_array_conversion): Same.
	(parser_build_unary_op): Pass location to overflow_warning.
	(parser_build_binary_op): Same.  Use warning_at.
	(build_unary_op): Pass location to array_to_pointer_conversion.
	(build_c_cast): Pass location to digest_init.
	(build_modify_expr): New location argument.
	(convert_for_assignment): Same.
	(store_init_value): Same.
	(digest_init): Same.
	(output_init_element): Pass location to digest_init and
	array_to_pointer_conversion.
	(c_finish_return): Pass location to convert_for_assignment.
	* gimplify.c (gimplify_conversion): Pass location to
	maybe_fold_offset_to_address.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Pass location
	to maybe_fold_stmt_addition.
	* c-omp.c (c_finish_omp_atomic): Pass new location to
	build_modify_expr.
	(c_finish_omp_for): Same.
	* c-common.c (overflow_warning): New argument.
	* c-common.h: New argument to build_modify_expr, overflow_warning.
	* c-parser.c (c_parser_declaration_or_fndef): Pass location to
	finish_decl.
	(c_parser_initializer): Pass location to
	default_function_array_conversion.
	(c_parser_initelt): Same.
	(c_parser_initval): Same.
	(c_parser_asm_operands): Same.
	(c_parser_expr_no_commas): Same.  Pass location to build_modify_expr.
	(c_parser_conditional_expression): Same.
	(c_parser_binary_expression): Add location info to stack.  Use it.
	(c_parser_unary_expression): Pass location to
	default_function_array_conversion, parser_build_unary_op,
	build_indirect_ref, c_parser_postfix_expression_after_primary.
	(c_parser_postfix_expression_after_primary): New location argument.
	Use it.
	(c_parser_expression_conv): Pass location to
	default_function_array_conversion.
	(c_parser_expr_list): Same.
	(c_parser_omp_atomic): Same.
	(c_parser_omp_for_loop): Same.
	* c-tree.h: (struct c_declarator): Add comment to id_loc.
	(build_array_declarator): New argument.
	* c-decl.c (build_array_declarator): Add location argument.
	(grokdeclarator): Set id_loc for cdk_array.
	* c-parser.c (c_parser_direct_declarator_inner): Pass location to
	build_array_declarator.
	* tree.c (build_omp_clause): Add location argument.
	* tree.h (OMP_CLAUSE_HAS_LOCATION): New macro.
	(OMP_CLAUSE_LOCATION): New macro.
	(struct tree_omp_clause): Add location field.
	(build_omp_clause): Add argument.
	* testsuite/gcc.dg/gomp/for-1.c: Fix column.
	* cp/pt.c (tsubst_omp_for_iterator): Pass location to
	build_omp_clause.
	* cp/parser.c (cp_parser_omp_var_list_no_open): Same.
	(cp_parser_omp_clause_collapse): Same.
	(cp_parser_omp_clause_default): Same.
	(cp_parser_omp_clause_if): Same.
	(cp_parser_omp_clause_nowait): Same.
	(cp_parser_omp_clause_num_threads): Same.
	(cp_parser_omp_clause_ordered): Same.
	(cp_parser_omp_clause_schedule): Same.
	(cp_parser_omp_clause_untied): Same.
	(cp_parser_omp_for_loop): Same.
	(cp_parser_omp_parallel): Pass location to c_split_parallel_clauses.
	* c-tree.h (c_start_case): Add location argument.
	(c_process_expr_stmt): Same.
	(c_finish_goto_*): Same.
	* tree-parloops.c (initialize_reductions): Pass location to
	build_omp_clause.
	(create_parallel_loop): Same.
	* fortran/trans-openmp.c (gfc_trans_omp_variable_list): Same.
	(gfc_trans_omp_reduction_list): Same.
	(gfc_trans_omp_clauses): Same.
	(gfc_trans_omp_do): Same.
	* c-typeck.c (c_finish_goto_label): Same.
	(c_finish_goto_ptr): New location argument.
	(c_start_case): Same.
	(emit_side_effect_warnings): Same.
	(c_process_expr_stmt): Same.
	(c_finish_stmt_expr): Same.
	(c_finish_omp_clauses): Use error_at instead of error.
	* gimplify.c (gimplify_adjust_omp_clauses_1): Pass location to
	build_omp_clause.
	* c-omp.c (c_split_parallel_clauses): New location argument.
	* tree-nested.c (convert_nonlocal_reference_stmt): Pass location
	to build_omp_clause.
	(convert_local_reference_stmt): Same.
	(convert_gimple_call): Same.
	* c-common.h (c_split_parallel_clauses): New argument.
	* c-parser.c (c_parser_statement_after_labels): Pass location to
	c_finish_goto_label.
	(c_parser_switch_statement): Pass location to c_start_case.
	(c_parser_for_statement): Pass location to c_finish_expr_stmt,
	and c_process_expr_stmt.
	(c_parser_omp_variable_list): Add location argument.
	(c_parser_omp_clause_collapse): Pass location to
	build_omp_clause.
	(c_parser_omp_clause_default): Same.
	(c_parser_omp_clause_if): Same.
	(c_parser_omp_clause_num_threads): Same.
	(-c_parser_omp_clause_ordered): Same.
	(c_parser_omp_clause_reduction): Pass location to
	c_parser_omp_variable_list.
	(c_parser_omp_clause_schedule): Pass location to build_omp_clause.
	(c_parser_omp_clause_untied): Same.
	(c_parser_omp_for_loop): Pass location to c_process_expr_stmt.
	(c_parser_omp_parallel): Pass location to
	c_split_parallel_clauses.
	* c-tree.h (check_for_loop_decls, undeclared_variable,
	build_component_ref, build_array_ref, build_external_ref,
	c_expr_sizeof_expr, c_expr_sizeof_type, parser_build_unary_op,
	build_conditional_expr, build_compound_expr, c_cast_expr,
	build_c_cast, build_asm_expr, c_end_compound_stmt, c_finish_stmt_expr,
	c_finish_return, c_finish_omp_parallel, c_finish_omp_task): New
	argument.
	* c-semantics.c (build_stmt): Same.
	(build_case_label): Same.
	* c-decl.c (c_finish_incomplete_decl): Pass location on down.
	(undeclared_variable): New argument.
	(make_label): Same.
	(lookup_label): Pass location on down.
	(define_label): Same.
	(finish_decl): Same.
	(build_compound_literal): Same.
	(finish_struct): Same.
	(finish_function): Do not set location here.
	(check_for_loop_decls): New argument.
	* tree.c (save_expr): Set location.
	(build_empty_stmt): New argument.
	* tree.h (build_empty_stmt): New argument to build_empty_stmt.
	(CAN_HAVE_LOCATION_P): Make sure we have a non empty node.
	* builtins.c (gimplify_va_arg_expr): Use locations.
	(expand_builtin_sync_operation): Same.
	* c-typeck.c (build_component_ref): New argument.
	(build_array_ref): Same.
	(build_external_ref): Same.
	(c_expr_sizeof_expr): Same.
	(c_expr_sizeof_type): Same.
	(parser_build_unary_op): Same.
	(build_conditional_expr): Same.
	(build_compound_expr): Pass location on down.
	(build_compound_expr): New argument.
	(build_c_cast): Same.
	(c_cast_expr): Same.
	(build_asm_expr): Same.
	(c_finish_return): Same.
	(c_process_expr_stmt): Pass location on down.
	(c_finish_stmt_expr): New argument.
	(push_clenaup): Same.
	(c_finish_omp_parallel): Same.
	(c_finish_omp_task): Same.
	* gimplify.c (gimplify_call_expr): Pass location on down.
	* c-omp.c (c_finish_omp_master): New argument.
	(c_finish_omp_critical): Same.
	(c_finish_omp_ordered): Same.
	(c_finish_omp_barrier): Same.
	(-c_finish_omp_taskwait): Same.
	(c_finish_omp_atomic): Same.
	(c_finish_omp_flush): Same.
	* tree-inline.c (copy_tree_body_r): Pass location on down.
	(inline_forbidden_p): Remove use of input_location.
	* c-gimplify.c (c_build_bind_expr): New argument.
	* c-common.c (c_common_truthvalue_conversion): Pass location on down.
	(c_sizeof_or_alignof_type): New argument.
	(c_alignof_expr): Same.
	(build_va_arg): Same.
	(c_add_case_label): Same.
	* c-common.h (c_sizeof_or_alignof_type, c_alignof_expr,
	c_sizeof, c_alignof, build_va_arg, build_stmt, build_case_label,
	c_build_bind_expr, objc_build_selector_expr, objc_build_throw_stmt,
	c_finish_omp_master, c_finish_omp_critical, c_finish_omp_ordered,
	c_finish_omp_barrier, c_finish_omp_atomic, c_finish_omp_flush,
	c_finish_omp_taskwait, c_finish_omp_for, c_split_parallel_clauses):
	New argument.
	* stub-objc.c (objc_build_selector_expr): Same.
	(objc_build_throw_stmt): Same.
	* c-parser.c (c_parser_declaration_or_fndef): Pass location on down.
	(c_parser_initelt): Same.
	(c_parser_compound_statement): Same.
	(c_parser_compound_statement_nostart): Same.
	(c_parser_label): Same.
	(c_parser_statement_after_labels): Same.
	(c_parser_if_body): Same.
	(c_parser_else_body): Same.
	(c_parser_if_statement): Same.
	(c_parser_switch_statement): Same.
	(c_parser_while_statement): Same.
	(c_parser_do_statement): Same.
	(c_parser_for_statement): Same.
	(c_parser_asm_statement): Same.
	(c_parser_conditional_expression): Same.
	(c_parser_binary_expression): Same.
	(c_parser_cast_expression): Same.
	(c_parser_unary_expression): Same.
	(c_parser_sizeof_expression): Same.
	(c_parser_alignof_expression): Same.
	(c_parser_postfix_expression): Same.
	(c_parser_expression): Same.
	(c_parser_objc_receiver): Same.
	(c_parser_omp_variable_list): Same.
	(c_parser_omp_structured_block): Same.
	(c_parser_omp_atomic): New argument.
	(c_parser_omp_barrier): Same.
	(c_parser_omp_critical): Same.
	(c_parser_omp_flush): Pass location on down.
	(c_parser_omp_for_loop): New argument.
	(c_parser_omp_for): Same.
	(c_parser_omp_master): Same.
	(c_parser_omp_ordered): Same.
	(c_parser_omp_sections_scope): Same.
	(c_parser_omp_sections): Same.
	(c_parser_omp_parallel): Same.
	(c_parser_omp_single): Same.
	(c_parser_omp_task): Same.
	(c_parser_omp_taskwait): Pass location on down.
	(c_parser_omp_construct): Same.
	(c_parser_omp_threadprivate): Same.
	* dwarf2asm.c, targhooks.c, optabs.c, tree.c, tree.h, target.h,
	builtins.c, omp-low.c, cgraphunit.c, tree-call-cdce.c,
	tree-ssa-alias.c, gimple-low.c, c-tree.h, expr.c, tree-parloops.c,
	c-decl.c, tree-eh.c, langhooks.c, function.c, stor-layout.c,
	c-typeck.c, gimplify.c, c-pragma.c, expmed.c, except.c, coverage.c,
	emit-rtl.c, cfgexpand.c, tree-mudflap.c, varasm.c, tree-nested.c,
	rtl.h, tree-inline.c, tree-profile.c, c-common.c, c-common.h,
	tree-switch-conversion.c, tree-cfg.c, ipa-struct-reorg.c, c-parser.c,
	config/i386/i386.c, stmt.c:
	Add location argument to the following function definitions and/or
	function calls: build_decl, objcp_start_struct, objcp_finish_struct,
	start_struct, finish_struct, PUSH_FIELD, create_artificial_label,
	cp_make_fname_decl, pushtag, implicitly_declare, c_make_fname_decl,
	build_compound_literal, parser_xref_tag, resolve_overloaded_builtin,
	do_case, c_finish_bc_stmt, build_compound_literal,
	build_function_call.
	* c-decl.c (build_compound_literal): Add location argument.
	Make all diagnostic calls use location.
	(start_struct): Same.
	(finish_struct): Same.
	(start_enum): Same.
	(build_enumerator): Same.
	(start_function): Same.
	(grokdeclarator): Make all diagnostic calls use location.
	(store_parm_decls_oldstyle): Same.
	* c-typeck.c (build_function_call): Add location argument.
	Make all diagnostic calls use location.
	(do_case): Same.
	(c_finish_bc_stmt): Same.
	* tree-nested.c (get_trampoline_type): Add argument.
	Pass location to build_decl.
	(lookup_tramp_for_decl): Pass location to get_trampoline_type.
	* rtl.h (RTL_LOCATION): New.
	* c-common.c (c_add_case_label): Add location argument.
	Make all diagnostic calls use location.
	* c-common.h: Add location argument to make_fname_decl, do_case,
	c_add_case_label, build_function_call, resolve_overloaded_builtin.
	* c-parser.c (c_parser_enum_specifier): Rename ident_loc to enum_loc.
	Set it appropriately for every case.  Pass enum_loc to start_enum
	call.  Pass value_loc first to build_enumerator.  Pass enum_loc to
	parser_xref_tag.
	(c_parser_struct_or_union_specifier): Save location.  Use it for
	start_struct, finish_struct, and parser_xref_tag.
gcc/testsuite/
	* gcc.dg/old-style-prom-3.c: Add column info.
	* gcc.dg/overflow-warn-1.c
	* gcc.dg/gomp/pr27415.c
	* gcc.dg/gomp/for-1.c: Same.
	* gcc.dg/enum-compat-1.c: Same.
	* gcc.dg/c99-tag-3.c: Same.
	* gcc.dg/Wredundant-decls-2.c: Same.
	* gcc.dg/func-ptr-conv-1.c: Same.
	* gcc.dg/asm-wide-1.c: Same.
	* gcc.dg/nofixed-point-2.c: Same.
	* gcc.dg/cpp/line3.c: Same.
	* gcc.dg/array-10.c: Same.
	* gcc.dg/c99-vla-jump-1.c: Same.
	* gcc.dg/pr20368-1.c: Same.
	* gcc.dg/Wshadow-3.c: Same.
	* gcc.dg/c90-const-expr-8.c: Same.
	* gcc.dg/label-decl-2.c: Same.
	* gcc.dg/dremf-type-compat-2.c: Same.
	* gcc.dg/c90-const-expr-5.c: Same.
	* gcc.dg/builtins-30.c: Same.
	* gcc.dg/Warray-bounds.c: Same.
	* gcc.dg/Wcxx-compat-2.c: Same.
	* gcc.dg/tree-ssa/col-1.c: Same.
	* gcc.dg/old-style-prom-2.c: Same.
	* gcc.dg/cast-function-1.c: Same.
	* gcc.dg/pr15698-1.c: Same.
	* gcc.dg/dremf-type-compat-3.c: Same.
	* gcc.dg/vla-8.c: Same.
	* gcc.dg/gomp/pr27415.c: Move firstprivate diagnostics to correct
	line.
	* gcc.dg/label-decl-2.c: Move label diagnostic to correct line.
	* gcc.dg/old-style-prom-3.c: Check for error on the correct line.
	* gcc.dg/enum-compat-1.c: Same.
	* gcc.dg/dremf-type-compat-2.c: Same.
	* gcc.dg/old-style-prom-2.c: Same.
	* gcc.dg/pr15698-1.c: Same.
	* gcc.dg/pr20368-1.c: Same.
	* gcc.dg/dremf-type-compat-3.c: Same.
	* gcc.dg/builtins-30.c: Same.  Test for columns.
gcc/objcp/
	* objcp-decl.h (c_end_compound_stmt): New argument.
	* objcp-decl.c (objcp_start_struct): Add argument.
	(objcp_finish_struct): Same.
gcc/cp/
	* typeck.c (cp_build_binary_op): Pass location to overflow_warning.
	(build_modify_expr): New arg.
	* semantics.c (finish_unary_op_expr): Pass location to
	overflow_warning.
	(handle_omp_for_class_iterator): Pass location to build_modify_expr.
	* typeck.c (cxx_sizeof_or_alignof_type): Pass location to
	c_sizeof_or_alignof_type.
	(build_array_ref): New argument.
	(build_compound_expr): Same.
	(build_const_cast): Same.
	(build_ptrmemfunc): Pass location to build_c_cast.
	* init.c (avoid_placement_new_aliasing): Pass location to
	build_stmt.
	(build_vec_delete_1): Pass location to cp_build_modify_expr,
	build_compound_expr.
	* class.c (build_vtbl_ref_1): Pass location to build_array_ref.
	* decl.c (poplevel): Pass location to c_build_bind_expr.
	(finish_case_label): Pass location to build_case_label.
	(finish_constructor_body): Same.
	(finish_destructor_body): Pass location to build_stmt.
	(cxx_maybe_build_cleanup): Same, but to build_compound_expr.
	* call.c (build_new_op): Pass location to build_array_ref.
	(build_x_va_arg): Pass location to build_va_arg.
	* except.c (expand_end_catch_block): Pass location to
	build_stmt.
	* cp-tree.h (build_array_ref): New argument.
	(build_compound_expr): Same.
	(build_c_cast): Same.
	* cp-gimplify.c (gimplify_if_stmt): Pass location on down.
	(gimplify_switch_stmt): Same.
	* typeck2.c (split_nonconstant_init_1): Same.
	* pt.c (tsubst_copy): Same.
	* semantics.c (add_decl_expr): Same.
	(do_poplevel): Same.
	(push_cleanup): Same.
	(finish_goto_stmt): Same.
	(finish_expr_stmt): Same.
	(begin_if_stmt): Same.
	(begin_while_stmt): Same.
	(begin_do_stmt): Same.
	(finish_return_stmt): Same.
	(begin_for_stmt): Same.
	(finish_break_stmt): Same.
	(finish_continue_stmt): Same.
	(begin_switch_stmt): Same.
	(begin_try_block): Same.
	(begin_handler): Same.
	(finish_asm_stmt): Same.
	(finish_label_stmt): Same.
	(finish_stmt_expr_expr): Same.
	(finalize_nrv_r): Same.
	(finish_omp_atomic): Same.
	* name-lookup.c (do_using_directive): Same.
	* decl2.c (grok_array_decl): Same.
	* parser.c (cp_parser_cast_expression): Same.
	(cp_parser_selection_statement): Same.
	(cp_parser_implicitly_scoped_statement): Same.
	(cp_parser_objc_selector_expression): Same.
	(cp_parser_objc_synchronized_statement): Same.
	(cp_parser_objc_throw_statement): Same.
	(cp_parser_omp_critical): Same.
	(cp_parser_omp_master): Same.
	* typeck.c (build_function_call): Add location argument.
	* init.c: Add location argument to all build_decl calls.
	* class.c: Same.
	* method.c: Same.
	* rtti.c: Same.
	* tree.c: Same.
	* pt.c: Same.
	* semantics.c: Same.
	* lex.c: Same.
	* decl2.c: Same.
	* cp-gimplify.c: Same.
	* decl.c: Same.
	(cp_make_fname_decl): Add location argument.  Pass location ot
	build_decl.
	(finish_case_label): Same.
	* cp-tree.h (finish_case_label): Add location argument.
	* parser.c (cp_parser_label_for_labeled_statement): Pass location to
	finish_case_label.
gcc/fortran/
	* trans-array.c (gfc_trans_allocate_array_storage): Pass
	location on down.
	(gfc_trans_array_constructor_value): Same.
	(gfc_trans_scalarized_loop_end): Same.
	(gfc_conv_ss_startstride): Same.
	(gfc_trans_g77_array): Same.
	(gfc_trans_dummy_array_bias): Same.
	(gfc_conv_array_parameter): Same.
	(structure_alloc_comps): Same.
	* trans-expr.c (gfc_conv_function_call): Same.
	(fill_with_spaces): Same.
	(gfc_trans_string_copy): Same.
	(gfc_trans_scalar_assign): Same.
	* trans-stmt.c (gfc_trans_goto): Same.
	(gfc_trans_if_1): Same.
	(gfc_trans_simple_do): Same.
	(gfc_trans_do): Same.
	(gfc_trans_do_while): Same.
	(gfc_trans_logical_select): Same.
	(gfc_trans_select): Same.
	(gfc_trans_forall_loop): Same.
	(gfc_trans_nested_forall_loop): Same.
	(generate_loop_for_temp_to_lhs): Same.
	(generate_loop_for_rhs_to_temp): Same.
	(gfc_trans_forall_1): Same.
	(gfc_trans_where_assign): Same.
	(gfc_trans_where_3): Same.
	(gfc_trans_allocate): Same.
	* trans.c (gfc_finish_block): Same.
	(gfc_trans_runtime_check): Same.
	(gfc_call_malloc): Same.
	(gfc_allocate_with_status): Same.
	(gfc_call_free): Same.
	(gfc_deallocate_with_status): Same.
	(gfc_call_realloc): Same.
	(gfc_trans_code): Same.
	* trans-decl.c (gfc_init_default_dt): Same.
	(gfc_generate_constructors): Same.
	* trans-io.c (gfc_trans_io_runtime_check): Same.
	* trans-intrinsic.c (gfc_conv_intrinsic_ctime): Same.
	(gfc_conv_intrinsic_fdate): Same.
	(gfc_conv_intrinsic_ttynam): Same.
	(gfc_conv_intrinsic_minmax): Same.
	(gfc_conv_intrinsic_minmax_char): Same.
	(gfc_conv_intrinsic_anyall): Same.
	(gfc_conv_intrinsic_count): Same.
	(gfc_conv_intrinsic_arith): Same.
	(gfc_conv_intrinsic_minmaxloc): Same.
	(gfc_conv_intrinsic_minmaxval): Same.
	(gfc_conv_intrinsic_rrspacing): Same.
	(gfc_conv_intrinsic_array_transfer): Same.
	(gfc_conv_intrinsic_trim): Same.
	(gfc_conv_intrinsic_repeat): Same.

From-SVN: r148442
2009-06-12 22:06:47 +00:00
Jan Hubicka 21ecdec5db re PR middle-end/39834 (verify_cgraph_node failed with -O3 -Winline)
PR debug/39834
	* gcc.dg/torture/pr39834.c
	PR middle-end/39834
	* cgraphunit.c (save_inline_function_body): Do not copy transform hooks
	for saved inline bodies.
	* ipa-passes.c (do_per_function): Do not add the hoks multiple times
	for given function.

From-SVN: r148292
2009-06-08 19:21:33 +00:00
Jan Hubicka d88e5c3725 cgraph.h (struct cgraph_node): Add finalized_by_frotnend flag.
2009-05-15  Jan Hubicka  <jh@suse.cz>

	* cgraph.h (struct cgraph_node): Add finalized_by_frotnend flag.
	* cgraphunit.c (cgraph_finalize_function): Set it.
	(cgraph_expand_function): Use it.

From-SVN: r147586
2009-05-15 17:09:13 +00:00
Ian Lance Taylor 24b97832e7 basic-block.h (enum profile_status): Break out of struct control_flow_graph.
./:	* basic-block.h (enum profile_status): Break out of struct
	control_flow_graph.
	* cgraph.h (struct inline_summary): Break out of struct
	cgraph_local_info.
	* cgraphunit.c (enum cgraph_order_sort_kind): New enum, broken out
	of struct cgraph_order_sort.
	* combine.c (enum undo_kind): New enum, broken out of struct
	undo.
	* cse.c (struct branch_path): Break out of struct
	cse_basic_block_data.
	* except.h (enum eh_region_type): Break out of struct eh_region.
	* gcc.c (enum add_del): Break out of struct modify_target.
	* genrecog.c (enum decision_type): Break out of struct
	decision_test.
	* ggc-page.c (struct ggc_pch_ondisk): Break out of struct
	ggc_pch_data.
	* matrix-reorg.c (struct free_info): Break out of struct
	matrix_info.
	* regmove.c (enum match_use): New enum, broken out of struct
	match.
	* sched-int.h (enum post_call_group): New enum, broken out of
	struct deps.
	(struct deps_reg): Break out of struct deps.
	* target.h (struct asm_int_op): Break out of struct gcc_target.
	* tree-eh.c (struct goto_queue_node): Break out of struct
	leh_tf_state.
	* tree-inline.h (enum copy_body_cge_which): Break out of
	copy_body_data.
	* tree-pass.h (enum opt_pass_type): Break out of struct opt_pass.

	* c-decl.c (in_struct, struct_types): New static variables.
	(pushtag): Add loc parameter.  Change all callers.
	(lookup_tag): Add ploc parameter.  Change all callers.
	(check_compound_literal_type): New function.
	(parser_xref_tag): Add loc parameter.  Change all callers.  If
	-Wc++-compat, warn about struct/union/enum types defined within a
	struct or union.
	(start_struct): Add enclosing_in_struct, enclosing_struct_types,
	and loc parameters.  Change all callers.  Change error calls to
	error_at, using loc.  For a redefinition, if the location of the
	original definition is known, report it.  Set in_struct and
	struct_types.  If -Wc++-compat warn if in sizeof, typeof, or
	alignof.
	(finish_struct): Add new parameters enclosing_in_struct and
	enclosing_struct_types.  Change all callers.  Set
	C_TYPE_DEFINED_IN_STRUCT for all struct/union/enum types defined
	in the struct.  If in a struct, add this struct to struct_types.
	(start_enum): Add loc parameter.  Change all callers.  Use
	error_at for errors, using loc.  For a redefinition, if the
	location of the original definition is known, report it.  If in a
	struct, add this enum type to struct_types.  If -Wc++-compat warn
	if in sizeof, typeof, or alignof.
	* c-parser.c (disable_extension_diagnostics): Disable
	-Wc++-compat.
	(enable_extension_diagnostics): Reenable -Wc++-compat if
	appropriate.
	(c_parser_enum_specifier): Get enum location for start_enum.
	(c_parser_struct_or_union_specifier): Get struct location for
	start_struct.  Save in_struct and struct_types status between
	start_struct and finish_struct.
	(c_parser_cast_expression): Get location of cast.
	(c_parser_alignof_expression): Get location of type.
	(c_parser_postfix_expression): Likewise.
	(c_parser_postfix_expression_after_paren_type): Add type_loc
	parameter.  Change all callers.  Call
	check_compound_literal_type.  Use type_loc for error about
	variable size type.
	* c-typeck.c (build_external_ref): If -Wc++-compat, warn about a
	use of an enum constant from an enum type defined in a struct or
	union.
	(c_cast_expr): Add loc parameter.  Change all callers.  If
	-Wc++-compat, warn about defining a type in a cast.
	* c-tree.h (C_TYPE_DEFINED_IN_STRUCT): Define.
	(start_enum, start_struct, finish_struct): Update declarations.
	(parser_xref_tag, c_cast_expr): Update declarations.
	(check_compound_literal_type): Declare.
fortran/:
	* gfortran.h (enum gfc_omp_sched_kind): New enum, broken out of
	gfc_omp_clauses.
	(enum gfc_omp_default_sharing): Likewise.
	* module.c (enum gfc_rsym_state): New enum, broken out of
	pointer_info.
	(enum gfc_wsym_state): Likewise.
	* parse.c (enum state_order): New enum, broken out of st_state.
objc/:
	* objc-act.c (objc_building_struct): New static variable.
	(objc_in_struct, objc_struct_types): New static variables.
	(objc_start_struct, objc_finish_struct): New static functions.
	(generate_struct_by_value_array): Call objc_start_struct instead
	of start_struct, and call objc_finish_struct instead of
	finish_struct.
	(objc_build_struct, build_objc_symtab_template): Likewise.
	(build_module_descriptor): Likewise.
	(build_next_objc_exception_stuff): Likewise.
	(build_protocol_template): Likewise.
	(build_method_prototype_list_template): Likewise.
	(build_method_prototype_template): Likewise.
	(build_category_template, build_selector_template): Likewise.
	(build_class_template, build_super_template): Likewise.
	(build_ivar_template, build_ivar_list_template): Likewise.
	(build_method_list_template): Likewise.
	(build_method_template): Likewise.
objcp/:
	* objcp-decl.h (start_struct): Add three new, ignored, macro
	parameters.
	(finish_struct): Add two new, ignored, macro parameters.
testsuite/:
	* gcc.dg/Wcxx-compat-7.c: New testcase.
	* gcc.dg/Wcxx-compat-8.c: New testcase.
	* gcc.dg/c99-tag-1.c: Recognize new "originally defined here"
	notes
	* gcc.dg/pr17188-1.c: Likewise.
	* gcc.dg/pr39084.c: Likewise.

From-SVN: r147358
2009-05-11 01:02:40 +00:00
Jan Hubicka 9a23acef1d re PR middle-end/40080 (error: missing callgraph edge for call stmt)
PR middle-end/40080
	* cgraphunit.c (cgraph_materialize_all_clones): Do not redirect
	indirect calls; verify cgraph afterwards.

From-SVN: r147320
2009-05-09 20:10:37 +00:00
Jan Hubicka 9187e02deb cgraphbuild.c (compute_call_stmt_bb_frequency): Accept function argument; handle correctly when profile is absent.
* cgraphbuild.c (compute_call_stmt_bb_frequency): Accept function argument;
	handle correctly when profile is absent.
	(build_cgraph_edges): Update.
	(rebuild_cgraph_edges): Update.
	* cgraph.c: Do not include varrau.h 
	(cgraph_set_call_stmt_including_clones, cgraph_create_edge_including_clones):
	New function
	(cgraph_update_edges_for_call_stmt_node): New stati cfunction.
	(cgraph_update_edges_for_call_stmt): Handle clones.
	(cgraph_remove_node): Handle clone tree.
	(cgraph_remove_node_and_inline_clones): New function.
	(dump_cgraph_node): Dump clone tree.
	(cgraph_clone_node): Handle clone tree.
	(clone_function_name): Bring here from tree-inline.c
	(cgraph_create_virtual_clone): New function.
	* cgraph.h (ipa_replace_map): Move ehre from ipa.h
	(cgraph_clone_info): New function
	(strut cgraph_node): Add clone_info and new clone tree pointers.
	(cgraph_remove_node_and_inline_clones, cgraph_set_call_stmt_including_clones,
	cgraph_create_edge_including_clones, cgraph_create_virtual_clone): Declare.
	(cgraph_function_versioning): Use VEC argument.
	(compute_call_stmt_bb_frequency): Update prototype.
	(cgraph_materialize_all_clones): New function.
	* ipa-cp.c (ipcp_update_cloned_node): Remove.
	(ipcp_create_replace_map): Update to VECtors.
	(ipcp_update_callgraph): Use virtual clones.
	(ipcp_update_bb_counts, ipcp_update_edges_counts): Remove.
	(ipcp_update_profiling): Do not update local profiling.
	(ipcp_insert_stage): Use VECtors and virtual clones.
	* cgraphunit.c (verify_cgraph_node): Verify clone tree.
	(clone_of_p): New function.
	(cgraph_preserve_function_body_p): Use clone tree.
	(cgraph_optimize): Materialize clones.
	(cgraph_function_versioning): Update for VECtors.
	(save_inline_function_body): Use clone tree.
	(cgraph_materialize_clone, cgraph_materialize_all_clones): New functions.
	* ipa-inline.c (cgraph_default_inline_p): Use analyzed flags.
	* ipa.c: Include gimple.h.
	(cgraph_remove_unreachable_nodes): Use clone tree.
	* ipa-prop.c (ipa_note_param_call): Update call of compute_call_stmt_bb_frequency.
	* ipa-prop.h (ipa_replace_map): Move to cgraph.h.
	* tree-inline.c: Do not include varray.h; do not include gt-tree-inline.h
	(copy_bb): Handle updating of clone tree; add new edge when new call
	appears.
	(expand_call_inline): Be strict about every call having edge.
	(clone_fn_id_num, clone_function_name): Move to cgraph.c.
	(delete_unreachable_blocks_update_callgraph): New function.
	(tree_function_versioning): Use VECtors; always remove unreachable blocks
	and fold conditionals.
	* tree-inline.h: Do not include varray.h
	(tree_function_versioning): Remove.
	* Makefile.in (GTFILES): Remove tree-inline.c
	* passes.c (do_per_function): Do only functions having body.
	* ipa-struct-reorg.c (do_reorg_1, collect_data_accesses): Handle cone tree.

From-SVN: r147294
2009-05-08 19:19:51 +00:00
Joseph Myers 4f1e4960a6 attribs.c (decl_attributes): Use %qE for identifiers in diagnostics.
* attribs.c (decl_attributes): Use %qE for identifiers in
	diagnostics.
	* cgraphunit.c (verify_cgraph_node): Translate function names to
	locale character set in diagnostics.
	* coverage.c (get_coverage_counts): Use %qE for identifiers in
	diagnostics.
	* doc/invoke.texi (-finstrument-functions-exclude-function-list):
	Document that functions are named in UTF-8.
	* expr.c (expand_expr_real_1): Translate function names to locale
	character set in diagnostics.
	* gimplify.c (omp_notice_variable, omp_is_private,
	gimplify_scan_omp_clauses): Use %qE for identifiers in
	diagnostics.
	* langhooks.c (lhd_print_error_function): Translate function names
	to locale character set.
	* langhooks.h (decl_printable_name): Document that return value is
	in internal character set.
	* stmt.c: Include pretty-print.h
	(tree_conflicts_with_clobbers_p): Use %qE for identifiers in
	diagnostics.
	(resolve_operand_name_1): Translate named operand name to locale
	character set.
	* stor-layout.c (finalize_record_size): Use %qE for identifiers in
	diagnostics.
	* toplev.c (announce_function): Translate function names to locale
	character set.
	(warn_deprecated_use): Use %qE for identifiers in diagnostics.
	(default_tree_printer): Use pp_identifier or translate identifiers
	to locale character set.  Mark "<anonymous>" for translation.
	* tree-mudflap.c (mx_register_decls, mudflap_finish_file): Use %qE
	for identifiers in diagnostics.
	* tree.c (handle_dll_attribute): Use %qE for identifiers in
	diagnostics.
	* varasm.c (output_constructor): Use %qE for identifiers in
	diagnostics.

testsuite:
	* gcc.dg/ucnid-11.c, gcc.dg/ucnid-12.c, gcc.dg/ucnid-13.c: New
	tests.

From-SVN: r147111
2009-05-05 00:44:36 +01:00