Commit Graph

44 Commits

Author SHA1 Message Date
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
Jakub Jelinek 66647d441f Update Copyright years for files modified in 2008 and/or 2009.
From-SVN: r144324
2009-02-20 16:20:38 +01:00
Jan Hubicka c6f7cfc15e tree.c (build_function_type_skip_args, [...]): New functions.
* tree.c (build_function_type_skip_args, build_function_decl_skip_args):
	New functions.
	* tree.h (build_function_type_skip_args, build_function_decl_skip_args):
	Declare.
	* gimple.c (giple_copy_call_skip_args): New function.
	(giple_copy_call_skip_args): Declare.

	* cgraph.h (cgraph_function_versioning): Add skip_args arugmnet
	* ipa-cp.c (ipcp_node_not_modifiable_p): Rename to ...
	(ipcp_node_modifiable_p): ... this one; use tree_versionable_function_p.
	(ipcp_create_replace_map): Improve debug output.
	(ipcp_need_redirect_p): Return false when not clonning.
	(ipcp_update_callgraph): Skip args.
	(ipcp_insert_stage): UPdate call of !ipcp_node_modifiable_p;
	skip args.
	* cgraphunit.c (cgraph_function_versioning): Add skip_args argument.
	(save_inline_function_body): Update call of tree_function_versioning.
	* ipa-prop.c (ipa_edge_removal_hook): Do not ICE on unanalyzed nodes.
	* tree-inline.c (copy_arguments_for_versioning): Add skip_args argument.
	(tree_function_versioning): Likewise.
	* tree-inline.h (tree_function_versioning): Update prototype.

From-SVN: r139761
2008-08-29 11:31:40 +00:00
Richard Biener 726a989a8b backport: ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
2008-07-28  Richard Guenther  <rguenther@suse.de>

	Merge from gimple-tuples-branch.

	* ChangeLog.tuples: ChangeLog from gimple-tuples-branch.
	* gimple.def: New file.
	* gsstruct.def: Likewise.
	* gimple-iterator.c: Likewise.
	* gimple-pretty-print.c: Likewise.
	* tree-gimple.c: Removed.  Merged into ...
	* gimple.c: ... here.  New file.
	* tree-gimple.h: Removed.  Merged into ...
	* gimple.h: ... here.  New file.

	* Makefile.in: Add dependencies on GIMPLE_H and tree-iterator.h.
	* configure.ac: Added support for ENABLE_GIMPLE_CHECKING and the
	--enable-checking=gimple flag.
	* config.in: Likewise.
	* configure: Regenerated.

	* tree-ssa-operands.h: Tuplified.
	* tree-vrp.c: Likewise.
	* tree-loop-linear.c: Likewise.
	* tree-into-ssa.c: Likewise.
	* tree-ssa-loop-im.c: Likewise.
	* tree-dump.c: Likewise.
	* tree-complex.c: Likewise.
	* cgraphbuild.c: Likewise.
	* tree-ssa-threadupdate.c: Likewise.
	* tree-ssa-loop-niter.c: Likewise.
	* tree-pretty-print.c: Likewise.
	* tracer.c: Likewise.
	* gengtype.c: Likewise.
	* tree-loop-distribution.c: Likewise.
	* tree-ssa-loop-unswitch.c: Likewise.
	* cgraph.c: Likewise.
	* cgraph.h: Likewise.
	* tree-ssa-loop-manip.c: Likewise.
	* value-prof.c: Likewise.
	* tree-ssa-loop-ch.c: Likewise.
	* tree-tailcall.c: Likewise.
	* value-prof.h: Likewise.
	* tree.c: Likewise.
	* tree.h: Likewise.
	* tree-pass.h: Likewise.
	* ipa-cp.c: Likewise.
	* tree-scalar-evolution.c: Likewise.
	* tree-scalar-evolution.h: Likewise.
	* target.h: Likewise.
	* lambda-mat.c: Likewise.
	* tree-phinodes.c: Likewise.
	* diagnostic.h: Likewise.
	* builtins.c: Likewise.
	* tree-ssa-alias-warnings.c: Likewise.
	* cfghooks.c: Likewise.
	* fold-const.c: Likewise.
	* cfghooks.h: Likewise.
	* omp-low.c: Likewise.
	* tree-ssa-dse.c: Likewise.
	* ipa-reference.c: Likewise.
	* tree-ssa-uncprop.c: Likewise.
	* toplev.c: Likewise.
	* tree-gimple.c: Likewise.
	* tree-gimple.h: Likewise.
	* tree-chrec.c: Likewise.
	* tree-chrec.h: Likewise.
	* tree-ssa-sccvn.c: Likewise.
	* tree-ssa-sccvn.h: Likewise.
	* cgraphunit.c: Likewise.
	* tree-ssa-copyrename.c: Likewise.
	* tree-ssa-ccp.c: Likewise.
	* tree-ssa-loop-ivopts.c: Likewise.
	* tree-nomudflap.c: Likewise.
	* tree-call-cdce.c: Likewise.
	* ipa-pure-const.c: Likewise.
	* c-format.c: Likewise.
	* tree-stdarg.c: Likewise.
	* tree-ssa-math-opts.c: Likewise.
	* tree-ssa-dom.c: Likewise.
	* tree-nrv.c: Likewise.
	* tree-ssa-propagate.c: Likewise.
	* ipa-utils.c: Likewise.
	* tree-ssa-propagate.h: Likewise.
	* tree-ssa-alias.c: Likewise.
	* gimple-low.c: Likewise.
	* tree-ssa-sink.c: Likewise.
	* ipa-inline.c: Likewise.
	* c-semantics.c: Likewise.
	* dwarf2out.c: Likewise.
	* expr.c: Likewise.
	* tree-ssa-loop-ivcanon.c: Likewise.
	* predict.c: Likewise.
	* tree-ssa-loop.c: Likewise.
	* tree-parloops.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* tree-ssa-ifcombine.c: Likewise.
	* matrix-reorg.c: Likewise.
	* c-decl.c: Likewise.
	* tree-eh.c: Likewise.
	* c-pretty-print.c: Likewise.
	* lambda-trans.c: Likewise.
	* function.c: Likewise.
	* langhooks.c: Likewise.
	* ebitmap.h: Likewise.
	* tree-vectorizer.c: Likewise.
	* function.h: Likewise.
	* langhooks.h: Likewise.
	* tree-vectorizer.h: Likewise.
	* ipa-type-escape.c: Likewise.
	* ipa-type-escape.h: Likewise.
	* domwalk.c: Likewise.
	* tree-if-conv.c: Likewise.
	* profile.c: Likewise.
	* domwalk.h: Likewise.
	* tree-data-ref.c: Likewise.
	* tree-data-ref.h: Likewise.
	* tree-flow-inline.h: Likewise.
	* tree-affine.c: Likewise.
	* tree-vect-analyze.c: Likewise.
	* c-typeck.c: Likewise.
	* gimplify.c: Likewise.
	* coretypes.h: Likewise.
	* tree-ssa-phiopt.c: Likewise.
	* calls.c: Likewise.
	* tree-ssa-coalesce.c: Likewise.
	* tree.def: Likewise.
	* tree-dfa.c: Likewise.
	* except.c: Likewise.
	* except.h: Likewise.
	* cfgexpand.c: Likewise.
	* tree-cfgcleanup.c: Likewise.
	* tree-ssa-pre.c: Likewise.
	* tree-ssa-live.c: Likewise.
	* tree-sra.c: Likewise.
	* tree-ssa-live.h: Likewise.
	* tree-predcom.c: Likewise.
	* lambda.h: Likewise.
	* tree-mudflap.c: Likewise.
	* ipa-prop.c: Likewise.
	* print-tree.c: Likewise.
	* tree-ssa-copy.c: Likewise.
	* ipa-prop.h: Likewise.
	* tree-ssa-forwprop.c: Likewise.
	* ggc-page.c: Likewise.
	* c-omp.c: Likewise.
	* tree-ssa-dce.c: Likewise.
	* tree-vect-patterns.c: Likewise.
	* tree-ssa-ter.c: Likewise.
	* tree-nested.c: Likewise.
	* tree-ssa.c: Likewise.
	* lambda-code.c: Likewise.
	* tree-ssa-loop-prefetch.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-inline.h: Likewise.
	* tree-iterator.c: Likewise.
	* tree-optimize.c: Likewise.
	* tree-ssa-phiprop.c: Likewise.
	* tree-vect-transform.c: Likewise.
	* tree-object-size.c: Likewise.
	* tree-outof-ssa.c: Likewise.
	* cfgloop.c: Likewise.
	* system.h: Likewise.
	* tree-profile.c: Likewise.
	* cfgloop.h: Likewise.
	* c-gimplify.c: Likewise.
	* c-common.c: Likewise.
	* tree-vect-generic.c: Likewise.
	* tree-flow.h: Likewise.
	* c-common.h: Likewise.
	* basic-block.h: Likewise.
	* tree-ssa-structalias.c: Likewise.
	* tree-switch-conversion.c: Likewise.
	* tree-ssa-structalias.h: Likewise.
	* tree-cfg.c: Likewise.
	* passes.c: Likewise.
	* ipa-struct-reorg.c: Likewise.
	* ipa-struct-reorg.h: Likewise.
	* tree-ssa-reassoc.c: Likewise.
	* cfgrtl.c: Likewise.
	* varpool.c: Likewise.
	* stmt.c: Likewise.
	* tree-ssanames.c: Likewise.
	* tree-ssa-threadedge.c: Likewise.
	* langhooks-def.h: Likewise.
	* tree-ssa-operands.c: Likewise.
	* config/alpha/alpha.c: Likewise.
	* config/frv/frv.c: Likewise.
	* config/s390/s390.c: Likewise.
	* config/m32c/m32c.c: Likewise.
	* config/m32c/m32c-protos.h: Likewise.
	* config/spu/spu.c: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/sh/sh.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* config/stormy16/stormy16.c: Likewise.
	* config/ia64/ia64.c: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/pa/pa.c: Likewise.
	* config/mips/mips.c: Likewise.

From-SVN: r138207
2008-07-28 14:33:56 +00:00
Jan Hubicka 7e8b322aa0 cgraphbuild.c (record_reference): Drop non-unit-at-a-time code.
* cgraphbuild.c (record_reference): Drop non-unit-at-a-time code.
	(build_cgraph_edges): Likewise.
	* cgraph.c (cgraph_node): Do not update assembler hash.
	(cgraph_remove_node): Drop non-unit-at-a-time code.
	* tree-pass.h (pass_O0_always_inline): Remove.
	* ipa-reference.c (gate_reference): Remove unit-at-a-time check.
	* toplev.c (process_options): Flag unit-at-a-time does not imply
	no section anchors.
	* cgraphunit.c: Update comments.
	(decide_is_function_needed): Drop non-unit-at-a-time mode.
	(cgraph_assemble_pending_functions): Remove.
	(cgraph_reset_node): Drop non-unit-at-a-time code.
	(cgraph_finalize_function): Likewise.
	(cgraph_analyze_function): Likewise.
	(cgraph_finalize_compilation_unit): Likewise.
	(cgraph_expand_function): Likewise.
	(cgraph_optimize): Likesise.
	(save_inline_function_body): Likewise.
	* ipa-pure-const.c (gate_pure_const): Drop flag_unit_at_a_time check.
	* tree-ssa-alias.c (maybe_be_aliased): Likewise.
	* ipa-inline.c: Update comments.
	(enum inlining_mode): remove INLINE_SPEED.
	(cgraph_clone_inlined_nodes): Drop unit-at-a-time check.
	(cgraph_mark_inline_edge): Likewise.
	(try_inline): Likewise.
	(cgraph_decide_inlining_incrementally): Likewise.
	(cgraph_gate_inlining): Remove.
	(cgraph_early_inlining): Remove flag_unit_at_a_time checks.
	(cgraph_gate_early_inlining): Likewise.
	(gate_inline_passes): Remove.
	(pass_inline_parameters, pass_ipa_inline): Remove gates.
	(cgraph_gate_O0_always_inline, cgraph_O0_always_inline, 
	pass_O0_always_inline): Remove.
	* c-pch.c (c_pch_matching): Remove -funit-at-a-time.
	* dwarf2out.c (reference_to_unused): Remove flag_unit_at_a_time check.
	* opts.c (no_unit_at_a_time_default): Remove.
	(decode_options): Remove flag_unit_at_a_time reset and warning.
	* opts.h (no_unit_at_a_time_default): Remove.
	* c-decl.c (diagnose_mismatched_decls): Do not require inline keyword
	early in GNU dialect.
	(merge_decls): Update comment; drop unit-at-a-time check.
	(finish_decl): Likewise.
	(grok_declaration): Remove flag_inline_trees code.
	(finish_functions): Return on function returning non-void on all
	statics.
	* ipa-tye-escape.c (gate_type_escape_vars): Remove.
	* cfgexpand.c (expand_one_static_var): Remove.
	(expand_one_var): Remove expand_one_static_var call.
	(expand_used_vars_for_block): Remove flag_unit_a_time check.
	* c-opts.c (c_common_post_options): Remove flag_inline_trees code
	and flag_unit_at_a-time compatibility checks.
	* varasm.c (assemble_alias): Remove flag_unit_at_a_time check.
	* tree-inline.c (flag_inline_trees): Remove.
	(inlinable_function_p): Don't check it.
	(expand_call_inline): Remove non-unit-at-a-time code.
	* tree-inline.h (flag_inline_trees): Remove.
	* tree-optimize.c (execute_early_local_optimizations): Remove
	unit-at-a-time checks.
	(tree_rest_of_compilation): Likewise.
	* combine.c (setup_incoming_promotions): Likewise.
	* tree-profile.c (tree_gen_ic_func_profiler): Likewise.
	* tree-ssa-structalias.c (delete_points_to_sets): Likewise.
	* passes.c (pass_inline_parameters): Update comments; remove
	O0_alwaysinline pass.
	(execute_one_ipa_transform_pass): Do not reset in_gimple_form.
	(execute_one_pass): Likewise.
	* i386.c (ix86_function_regparm): Remove unit-at-a-time check.
	(ix86_function_sseregparm): Likewise.
	* arm.c (arm_function_in_section_p): Likewise.
	* bfin.c (bfin_load_pic_reg, bfin_function_ok_for_sibcall): Likewise.
	* varpool.c: Update comments.
	(decide_is_variable_needed): Remove unit-at-a-time checks.
	(varpool_finalize_decl): Likewise.

	* ada/utils.c (end_subprog_body): Remove inline trees check.
	* ada/misc.c (gnat_post_options): Do not set flag_inline_trees.

	* fortran/options.c (gfc_post_options): Remove flag_unline_trees code.

	* gcc.dg/winline-4.c: Remove.
	* gcc.dg/pch/valid-3.hs: Remove.
	* gcc.dg/pch/valid-3.c: Remove.
	* g++.old-deja/g++.brendan/crash52.C: Accept returning void warning
	* g++.old-deja/g++.jason/report.C: Likewise.
	* testsuite/g++.dg/warn/pr23075.C: We get returning void warning
	instead of control flow warning.


	* cp/decl.c (duplicate_decls): Update comment and unit-at-a-time.
	(grogfndecl): Drop flag_inline_trees code.
	* cp/pt.c (instantiate_decl): Drop flag_iline_trees code.
	* cp/lex.c (cxx_init): Do not set unit-at-a-time.


	* java/decl.c: Include cgraph.h
	(end_java_method): Remove non-unit-at-a-time code.
	(java_mark_decl_local): Likewise; sanity check that we don't touch
	finalized nodes.

From-SVN: r138140
2008-07-25 13:11:32 +00:00
Michael Meissner ab442df7fb Add ability to set target options (ix86 only) and optimization options on a function specific basis
From-SVN: r138075
2008-07-23 10:28:06 +00:00
Paolo Bonzini 9ff420f135 tree-inline.c (copy_generic_body, [...]): Export.
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

	* tree-inline.c (copy_generic_body, copy_decl_no_change): Export.
	(remap_block): Call id->transform_lang_insert_block instead
	of langhook.
	(optimize_inline_calls, unsave_expr_now, tree_function_versioning):
	Set id.transform_lang_insert_block to NULL.
	(clone_body): Move to cp/optimize.c
	* tree-inline.h (struct copy_body_data): Change
	transform_lang_insert_block to function pointer.
	(copy_generic_body, copy_decl_no_change): Export.
	* langhooks.h (struct lang_hooks_for_decls): Kill insert_block.
	* langhooks-def.h (LANG_HOOKS_INSERT_BLOCK): Kill.
	(LANG_HOOKS_DECLS): Remove LANG_HOOKS_INSERT_BLOCK.

	* c-tree.h (insert_block): Kill.
	* c-decl.c (insert_block): Kill.

cp:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

	* optimize.c (clone_body): New, from tree-inline.c.

ada:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

	* gigi.h (insert_block): Kill.
	* utils.c (insert_block): Kill.

java:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

	* java-tree.h (insert_block): Kill.
	* decl.c (insert_block): Kill.

fortran:
2007-03-09  Paolo Bonzini  <bonzini@gnu.org>

	* f95-lang.c (insert_block): Kill.

From-SVN: r133861
2008-04-03 05:41:57 +00:00
Richard Guenther 4f5c64b8ac re PR tree-optimization/35006 (Segfault in remove_unused_locals with nested functions)
2008-01-29  Richard Guenther  <rguenther@suse.de>

	PR middle-end/35006
	* tree-inline.h (struct copy_body_data): Add remapping_type_depth
	field.
	* tree-inline.c (remap_type): Increment remapping_type_depth
	around remapping types.
	(copy_body_r): Only add referenced variables if they are referenced
	from code, not types.

	* gcc.c-torture/compile/pr35006.c: New testcase.

From-SVN: r131939
2008-01-29 15:47:19 +00:00
Jan Hubicka 88743d3a8a re PR tree-optimization/34708 (Inlining heuristics issue)
PR tree-optimization/34708
	* tree-inline.c (estimate_num_insns_1): Compute cost of SWITCH_EXPR
	based on number of case labels.
	(init_inline_once): Remove switch_cost.
	* tree-inline.h (eni_weights_d): Remove switch_cost.

From-SVN: r131433
2008-01-09 19:19:40 +00:00
Jan Hubicka 045685a9b5 re PR tree-optimization/31081 (Inliner messes up SSA for abnormals)
PR tree-optimization/31081
	* tree-inline.c (remap_ssa_name): Initialize uninitialized SSA vars to
	0 when inlining and not inlining to first basic block.
	(remap_decl): When var is initialized to 0, don't set default_def.
	(expand_call_inline): Set entry_bb.
	* tree-inline.h (copy_body_data): Add entry_bb.

From-SVN: r131306
2008-01-03 21:23:26 +00:00
Jakub Jelinek 416c991fdd re PR middle-end/34018 (ICE: verify_stmts failed)
PR middle-end/34018
	* tree-inline.h (copy_body_data): Add regimplify field.
	* tree-inline.c (copy_body_r): Set id->regimplify to true
	if an TREE_INVARIANT ADDR_EXPR is no longer invariant after
	substitutions.
	(copy_bb): Clear id->regimplify before walk_tree, if it is
	set afterwards, regimplify the whole statement.

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

From-SVN: r130068
2007-11-10 08:46:31 +01:00
Pranav Bhandarkar 625a2efbe7 tree-inline.h (eni_weights): Add field target_builtin_cost to reflect the cost per call to a target specific...
2007-09-24  Pranav Bhandarkar  <pranav.bhandarkar@celunite.com>
        Ramana Radhakrishnan  <ramana@hercules.pun.celunite.com>

        * tree-inline.h (eni_weights): Add field target_builtin_cost to
        reflect the cost per call to a target specific builtin.
        * tree-inline.c (estimate_num_insns_1): If it is a CALL_EXPR for
        * a
        call to a target specific builtin, then use
target_builtin_call_cost.
        (init_inline_once): Initialize target_builtin_call_cost field.

Co-Authored-By: Ramana Radhakrishnan <ramana@hercules.pun.celunite.com>

From-SVN: r128714
2007-09-24 13:31:25 +00:00
Jakub Jelinek 6ef5231bdf builtins.def (BUILT_IN_VA_ARG_PACK): New built-in.
* builtins.def (BUILT_IN_VA_ARG_PACK): New built-in.
	* tree.h (CALL_EXPR_VA_ARG_PACK): Define.
	* tree-inline.h (copy_body_data): Add call_expr field.
	* tree-inline.c (expand_call_inline): Initialize call_expr.
	(copy_bb): Append anonymous inline fn arguments to arguments
	when inlining a CALL_EXPR_VA_ARG_PACK call.
	* builtins.c (expand_builtin): Issue an error if
	BUILT_IN_VA_ARG_PACK is seen during expand.
	(fold_call_expr, fold_builtin_call_array): Don't fold
	CALL_EXPR_VA_ARG_PACK CALL_EXPRs or calls with
	__builtin_va_arg_pack () call as last argument.
	* gimplify.c (gimplify_call_expr): If last argument to a vararg
	function is __builtin_va_arg_pack (), decrease number of call
	arguments and instead set CALL_EXPR_VA_ARG_PACK on the CALL_EXPR.
	* expr.c (expand_expr_real_1): Issue an error if
	CALL_EXPR_VA_ARG_PACK CALL_EXPR is seen during expand.
	* tree-pretty-print.c (dump_generic_node): Handle printing
	CALL_EXPR_VA_ARG_PACK bit on CALL_EXPRs.
	* doc/extend.texi (__builtin_va_arg_pack): Document.

	* gcc.c-torture/execute/va-arg-pack-1.c: New test.
	* gcc.dg/va-arg-pack-1.c: New test.

From-SVN: r128150
2007-09-05 22:45:27 +02:00
Sandra Loosemore db2960f402 Add target hook invoked when cfun changes.
2007-09-05  Sandra Loosemore  <sandra@codesourcery.com>

	gcc/
	Add target hook invoked when cfun changes.

	* doc/tm.texi (TARGET_SET_CURRENT_FUNCTION): Document.
	* target.h (struct gcc_target): Add set_current_function.
	* target-def.h (TARGET_SET_CURRENT_FUNCTION): Define.
	(TARGET_INITIALIZER): Add initializer for set_current_function.
	* tree.h (push_struct_function): New.
	* tree-inline.h (push_cfun, pop_cfun): Move declarations to...
	* function.h: Here.
	(set_cfun): Declare.
	* tree-inline.c (cfun_stack, push_cfun, pop_cfun): Moved to...
	* function.c:  Here.
	(push_function_context_to): Use allocate_struct_function
	to create null context, not init_dummy_function_start.  Use set_cfun.
	(pop_function_context_from): Use set_cfun.
	(in_dummy_function): New.
	(invoke_set_current_function_hook): New.
	(set_cfun): New.
	(push_cfun, pop_cfun): Use set_cfun.
	(push_struct_function): New.
	(allocate_struct_function): Call invoke_set_current_function_hook
	before returning.
	(prepare_function_start): Don't set cfun here.  Remove unused
	argument; fix all callers.
	(init_dummy_function_start): Fiddle with in_dummy_function.  Call
	push_struct_function.
	(init_function_start): Set cfun here.
	(expand_dummy_function_end): Fiddle with in_dummy_function.  Pop cfun.
	* omp-low.c (create_omp_child_function): Use push_struct_function
	and pop_cfun to save/restore state.
	(expand_omp_parallel): Remove unused saved_cfun variable.
	* cgraphunit.c (ipa_passes): Use set_cfun.
	* gimple-low.c (record_vars_into): Use push_cfun/pop_cfun here.
	* dwarf2out.c (dwarf2out_abstract_function): Likewise.
	* matrix-reorg.c (transform_allocation_sites): Likewise.
	(matrix_reorg): Use set_cfun.
	* gimplify.c (gimplify_function_tree): Use push_cfun/pop_cfun here.
	* tree-optimize.c (tree_rest_of_compilation): Remove one redundant
	assignment to cfun; use set_cfun for the other.
	* tree-cfg.c (move_sese_region_to_fn): Use set_cfun.
	(dump_function_to_file): Use push_cfun/pop_cfun here.
	* c-decl.c (finish_function): Use set_cfun.

	gcc/ada/
	* trans.c (Compilation_unit_to_gnu): Use set_cfun.
	* utils.c (end_subprog_body): Likewise.

	gcc/cp/
	* decl.c (finish_function): Use set_cfun.
	* method.c (use_thunk): Likewise.

	gcc/fortran/
	* trans-decl.c (build_entry_thunks): Use set_cfun.
	(gfc_generate_function_code): Likewise.

	gcc/java/
	* decl.c (finish_method): Use set_cfun.

	gcc/treelang/
	* treetree.c (tree_code_create_function_wrapup):  Use set_cfun.

From-SVN: r128132
2007-09-05 10:24:54 -04:00
Richard Guenther c536a6a77a tree.h (DECL_DISREGARD_INLINE_LIMITS): New.
2007-08-28  Richard Guenther  <rguenther@suse.de>

	* tree.h (DECL_DISREGARD_INLINE_LIMITS): New.
	(struct tree_function_decl): Make function_code a bitfield.
	Add disregard_inline_limits flag.
	* cgraphunit.c (cgraph_process_new_functions): Check
	DECL_DISREGARD_INLINE_LIMITS instead of disregard_inline_limits_p.
	(cgraph_preserve_function_body_p): Likewise.
	* ipa-inline.c (compute_inline_parameters): Likewise.
	* c-decl.c (finish_function): Set DECL_DISREGARD_INLINE_LIMITS
	for GNU C extern inline functions.
	(merge_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
	* tree-inline.c (disregard_inline_limits_p): Remove.
	* tree-inline.h (disregard_inline_limits_p): Likewise.
	* c-common.c (handle_always_inline_attribute): Set
	DECL_DISREGARD_INLINE_LIMITS.
	* langhooks.c (add_builtin_function): Verify the function code
	fits in the bitfield.

	cp/
	* decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS.

From-SVN: r127851
2007-08-28 09:03:59 +00:00
Richard Guenther 1d51f40667 c-objc-common.c (c_disregard_inline_limits): Remove.
2007-08-20  Richard Guenther  <rguenther@suse.de>

	* c-objc-common.c (c_disregard_inline_limits): Remove.
	* c-objc-common.h (c_disregard_inline_limits): Likewise.
	* cgraphunit.c (cgraph_process_new_functions): Call
	disregard_inline_limits_p.
	(cgraph_preserve_function_body_p): Likewise.
	* ipa-inline.c (compute_inline_parameters): Likewise.
	* langhooks-def.h (lhd_tree_inlining_disregard_inline_limits):
	Remove.
	(LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS): Remove.
	(LANG_HOOKS_TREE_INLINING_INITIALIZER): Remove initializer for
	disregard_inline_limits langhook.
	* langhooks.c (lhd_tree_inlining_disregard_inline_limits):
	Remove.
	* langhooks.h (lang_hooks_for_tree_inlining): Remove
	disregard_inline_limits langhook.
	* tree-inline.c (disregard_inline_limits_p): New function.
	* tree-inline.h (disregard_inline_limits_p): Declare.

From-SVN: r127644
2007-08-20 11:37:08 +00:00
Nick Clifton 9dcd6f09a3 Change copyright header to refer to version 3 of the GNU General Public License and to point readers at the COPYING3 file and the FSF's license web page.
From-SVN: r126948
2007-07-26 08:37:01 +00:00
Richard Guenther 6be42dd4a2 omp-low.c (splay-tree.h): Include.
2007-03-31  Richard Guenther  <rguenther@suse.de>

	* omp-low.c (splay-tree.h): Include.
	(lookup_decl): Replace splay-tree usage by pointer-map.
	(maybe_lookup_decl): Likewise.
	(new_omp_context): Likewise.
	(delete_omp_context): Likewise.
	* gimplify.c (splay-tree.h): Include.
	* tree-inline.c (insert_decl_map): Replace splay-tree usage by
	pointer-map.
	(remap_ssa_name): Likewise.
	(remap_decl): Likewise.
	(remap_type_1): Likewise.
	(remap_type): Likewise.
	(copy_body_r): Likewise.
	(expand_call_inline): Likewise.
	(clone_body): Likewise.
	(copy_tree_r): Likewise.
	(remap_save_expr): Likewise.
	(unsave_r): Likewise.
	(unsave_expr_now): Likewise.
	(tree_function_versioning): Likewise.
	(build_duplicate_type): Likewise.
	* tree-inline.h (pointer-set.h): Include instead of splay-tree.h.
	(struct copy_body_data): Replace splay-tree by pointer-map.
	* Makefile.in (TREE_INLINE_H): Depend on pointer-map.h, not $(SPLAY_TREE_H).
	(gimplify.o): Depend on $(SPLAY_TREE_H).
	(omp-low.p): Likewise.

	* optimize.c (maybe_clone_body): Replace splay-tree usage by
	pointer-map.

From-SVN: r123381
2007-03-31 14:07:29 +00:00
Zdenek Dvorak 7f9bc51b09 tree-ssa-loop-unswitch.c: Include tree-inline.h.
* tree-ssa-loop-unswitch.c: Include tree-inline.h.
	(tree_unswitch_single_loop): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-ssa-loop-manip.c: Include tree-inline.h.
	(can_unroll_loop_p): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-ssa-loop-ch.c (should_duplicate_loop_header_p):
	Pass eni_size_weights to estimate_num_insns.
	* tree.h (init_inline_once): Export.
	* toplev.c (backend_init): Call init_inline_once.
	* cgraphunit.c (cgraph_process_new_functions,
	cgraph_analyze_function): Pass eni_inlining_weights to
	estimate_num_insns.
	* ipa-inline.c (compute_inline_parameters): Ditto.
	* tree-ssa-loop-ivcanon.c (tree_num_loop_insns): Pass weights
	to estimate_num_insns.
	(try_unroll_loop_completely): Pass eni_size_weights to
	tree_num_loop_insns.
	* tree-eh.c (decide_copy_try_finally): Pass eni_size_weights
	ot estimate_num_insns.
	* tree-ssa-loop-prefetch.c: Include tree-inline.h.
	(loop_prefetch_arrays): Pass eni_time_weights to tree_num_loop_insns.
	* tree-inline.c (eni_inlining_weights, eni_size_weights,
	eni_time_weights): New variables.
	(init_inline_once): Initialize them.
	(struct eni_data): Mew.
	(estimate_num_insns_1, estimate_num_insns): Use weights.
	* tree-inline.h (struct eni_weights_d): New.
	(eni_inlining_weights, eni_size_weights, eni_time_weights): Declare.
	(estimate_num_insns): Declaration changed.
	* cfgloop.h (tree_num_loop_insns): Declaration changed.
	* Makefile.in (tree-ssa-loop-unswitch.o, tree-ssa-loop-prefetch.o,
	tree-ssa-loop-manip.o): Add TREE_INLINE_H dependency.

	* gcc.dg/tree-ssa/loop-23.c: New test.

From-SVN: r121260
2007-01-28 17:40:38 +00:00
Jan Hubicka 873aa8f548 cgraph.h (cgraph_decide_inlining_incrementally): Kill.
* cgraph.h (cgraph_decide_inlining_incrementally): Kill.
	* tree-pass.h: Reorder to make IPA passes appear toegher.
	(pass_early_inline, pass_inline_parameters, pass_apply_inline): Declare.
	* cgraphunit.c (cgraph_finalize_function): Do not compute inling
	parameters, do not call early inliner.
	* ipa-inline.c: Update comments.  Include tree-flow.h
	(cgraph_decide_inlining): Do not compute inlining parameters.
	(cgraph_decide_inlining_incrementally): Return TODOs; assume to
	be called with function context set up.
	(pass_ipa_inline): Remove unreachable functions before pass.
	(cgraph_early_inlining): Simplify assuming to be called from the
	PM as local pass.
	(pass_early_inline): New pass.
	(cgraph_gate_ipa_early_inlining): New gate.
	(pass_ipa_early_inline): Turn into simple wrapper.
	(compute_inline_parameters): New function.
	(gate_inline_passes): New gate.
	(pass_inline_parameters): New pass.
	(apply_inline): Move here from tree-optimize.c
	(pass_apply_inline): New pass.
	* ipa.c (cgraph_remove_unreachable_nodes): Verify cgraph after
	transforming.
	* tree-inline.c (optimize_inline_calls): Return TODOs rather than
	doing them by hand.
	(tree_function_versioning): Do not allocate dummy struct function.
	* tree-inline.h (optimize_inline_calls): Update prototype.
	* tree-optimize.c (execute_fixup_cfg): Export.
	(pass_fixup_cfg): Remove
	(tree_rest_of_compilation): Do not apply inlines.
	* tree-flow.h (execute_fixup_cfg): Declare.
	* Makefile.in (gt-passes.c): New.
	* passes.c: Include gt-passes.h
	(init_optimization_passes): New passes.
	(nnodes, order): New static vars.
	(do_per_function_toporder): New function.
	(execute_one_pass): Dump current pass here.
	(execute_ipa_pass_list): Don't dump current pass here.

From-SVN: r120835
2007-01-16 21:30:54 +00:00
Jan Hubicka b8a00a4dcb tree-inline.c (copy_bb): Insert new statements to statements_to_fold set.
* tree-inline.c (copy_bb): Insert new statements to statements_to_fold
	set.
	(fold_marked_statements): New function.
	(optimize_inline_calls, tree_function_versioning): Fold new statements.
	* tree-inline.h (copy_body_data): Add statemetns_to_fold.

From-SVN: r120430
2007-01-04 08:56:05 +00:00
Jan Hubicka ff28a94d32 invoke.texi (large-stack-frame, [...]): New params.
* invoke.texi (large-stack-frame, large-stack-frame-growth): New params.
	* cgraph.c (dump_cgraph_node): Dump stack usage.
	* cgraph.h (cgraph_local_info): Add estimated_self_stack_size.
	(cgraph_global_info): Add estimated_stack_size and stack_frame_offset.
	* cgraphunit.c (cgraph_analyze_function): Analyze stack sizes.
	* ipa-inline.c (cgraph_clone_inlined_nodes): Propagate stack usage.
	(cgraph_check_inline_limits): Limit stack growth.
	* cfgexpand.c: Include tree-inline.h.
	(account_stack_vars): New function.
	(expand_one_var): New param to just account the stack; return estimated
	size.
	(expand_used_vars_for_block): Update call of expand_one_var.
	(account_used_vars_for_block): New function.
	(estimated_stack_frame_size): Likewise.
	(init_vars_expansion, fini_vars_expansion): Break out from..
	(expand_used_vars): ... here.
	* tree-inline.h (estimated_stack_frame_size): Declare.
	* params.def (PARAM_LARGE_STACK_FRAME, PARAM_STACK_FRAME_GROWTH): New.

From-SVN: r119281
2006-11-28 10:53:16 +00:00
Kazu Hirata 917f1b7ea3 builtins.c, [...]: Fix comment typos.
* builtins.c, config/arm/arm.c, config/i386/cygwin.h,
	config/i386/i386.c, config/ia64/ia64.c, config/s390/fixdfdi.h,
	config/sh/sh.c, config/sh/sh.h, df-scan.c, except.c,
	haifa-sched.c, optabs.c, rtl.h, sched-deps.c, sched-int.h,
	sched-rgn.c, tree-inline.h, tree-ssa-dom.c,
	tree-ssa-loop-prefetch.c, tree-ssa-operands.c,
	tree-vect-patterns.c, tree-vrp.c: Fix comment typos.  Follow
	spelling convensions.
	* config/ia64/ia64.opt, doc/contrib.texi, doc/invoke.texi,
	doc/passes.texi, doc/tm.texi, doc/tree-ssa.texi: Fix comment
	typos.  Follow spelling conventions.

From-SVN: r112782
2006-04-08 17:01:17 +00:00
Richard Henderson 1b369fae18 backport: Makefile.in (TREE_INLINE_H): New.
Merge from gomp branch:
        * Makefile.in (TREE_INLINE_H): New.  Use it as needed.
        * tree-inline.h (struct copy_body_data): Move from tree-inline.c
        and rename from struct inline_data.  Rename callee* to dst*;
        caller* to src*; add copy_decl hook, transform_call_graph_edges,
        transform_new_cfg, transform_return_to_modify, and
        transform_lang_insert_block flags; remove cloning_p, versioning_p,
        update_clones_p.
        (copy_body_r, insert_decl_map, remap_decl, remap_type): Declare.
        (copy_decl_for_dup): Remove.
        * tree-inline.c (struct inline_data): Move to header.
        (insert_decl_map): Export.
        (remap_decl): Update for member name changes.  Use copy_decl hook.
        Allow for replacement to be a non-decl.  Remove dead code.
        (remap_type_1): Check for existing mapping.
        (remap_type): Export.
        (remap_decls): Update for member name changes.
        (remap_block, copy_bb, copy_cfg_body, copy_generic_body): Likewise.
        (copy_body, setup_one_parameter, declare_return_variable): Likewise.
        (expand_call_inline, optimize_inline_calls, clone_body): Likewise.
        (copy_tree_r, mark_local_for_remap_r, unsave_expr_now): Likewise.
        (tree_function_versioning, build_duplicate_type): Likewise.
        (copy_body_r): Likewise.  Export.
        (copy_decl_for_dup): Split into ...
        (copy_decl_for_dup_finish, copy_decl_to_var,
        copy_decl_no_change, copy_decl_maybe_to_var): ... these.
        (replace_ref_tree, inlining_p): Remove.

From-SVN: r109797
2006-01-16 18:17:16 -08:00
Jan Hubicka ea99e0becf cgraph.c (cgraph_insert_node_to_hashtable): New function.
* cgraph.c (cgraph_insert_node_to_hashtable): New function.
	* cgraph.h (cgraph_node): Add inline_decl.
	(cgraph_insert_node_to_hashtable): Declare.
	(save_inline_function_body): Declare.
	* cgraphunit.c (verify_cgraph_node): Inline edges might point to inline
	clones.
	(cgraph_preserve_function_body_p): Do not presrve when dump is enabled.
	(cgraph_function_versioning): Update call of tree_function_versioning.
	(save_inline_function_body): New function.
	* function.h (struct function): Kill saved_eh, saved_cfg, saved_args,
	saved_static_chain_decl, saved_blocks and saved-unexpanded_var_list.
	* ipa-inline.c (cgraph_mark_inline_edge): Look for inline clones.
	(cgraph_default_inline_p): Likewise.
	(cgraph_decide_inlining_incrementally): Likewise.
	* tree-inline.c (inline_data): Kill saving_p add update_clones_p.
	(copy_bb): Kill saving; do updating of clones.
	(copy_cfg_body): Kill saving.
	(initialize_inlined-parameters): Likewise.
	(expand_call_inline): Likewise.
	(save_body): Kill.
	(tree_function_versioning): New parameter "update_clones".
	(inlining_p): Kill saving.
	* tree-inline.h (tree_function_versioning): Update prototype.
	* tree-optimize.c (tree_rest_of_compilation): Use clonning instead of
	saving.

From-SVN: r109580
2006-01-11 13:13:37 +00:00
Razya Ladelsky 19734dd84e Interprocedural constant propagation.
From-SVN: r102626
2005-08-01 07:47:25 +00:00
Kelley Cook 366ccddb2b Update FSF address.
From-SVN: r101317
2005-06-25 02:02:01 +00:00
Steven Bosscher e21aff8abe cgraph.h (cgraph_node): Add 'lowered' state.
* cgraph.h (cgraph_node): Add 'lowered' state.
	(cgraph_lower_function): Declare.
	* cgraphunit.c (cgraph_finalize_function): Initialize lowered flag.
	(cgraph_lower_function): New function.
	(cgraph_create_edges): Deal with lowered function bodies.
	(verify_cgraph_node): Likewise.
	(cgraph_analyze_function): Do lowering job.
	(cgraph_build_static_cdtor): Likewise.
	* function.h (struct function): Add saved_eh and saved_cfg.
	* integrate.c (copy_decl_for_inlining): Kill LABEL_DECL_UID field.
	* tree-cfg.c (fold_cond_expr_cond): Export.
	* tree-flow.h (fold_cond_expr_cond): Declare.
	* tree-inline.c: Include basic-block, ggc, tree-flow, except.h and
	pointer-set.
	(struct_inline_data): Kill fnd, first_inlined_fn, ret_label,
	in_target_cleanup_p, tree_pruner, tsi; add callee, caller and
	callee_cfun, block, eh_region, eh_region_offset.
	(inlining_p): New predicate.
	(remap_decl): Update for new inline_data; declare newly created inline
	vars in low gimple way.
	(copy_body_r): Update for new datastructure, simplify some of handling
	when we are in gimple; remap LABEL_DECLs for EH; copy TREE_BLOCK;
	deal with RESX_EXPRs.
	(copy_bb): New.
	(copy_edges_for_bb): Likewise.
	(remap_decl_1): New.
	(copy_cfg_body): New.
	(copy_generic_body): Rewrite to work on low gimple.
	(copy_body): Turn into simple wrapper around copy_cfg_body.
	(setup_one_parameter): Insert new statements into given basic block.
	(initialize_initialized_parameters): Likewise, reorganize way things are
	gimplified.
	(declare_return_variable): Update for new inline data datastructure.
	(inline_forbidden_p): Work on low gimple.
	(estimate_num_insns): Likewise.
	(expand_call_inline): Work on CFG.
	(push_cfun, pop_cfun): New functions.
	(cfun_stack): New stack.
	(add_lexical_block): New function.
	(gimple_expand_calls_inline): Work on basic block.
	(optimize_inline_calls): Likewise.
	(clone_body, save_body, unsave_ewpr_now): Update for new
	datastructures.
	(declare_inline_vars): Work on block instead of bind_expr.
	(inlining_p): New predicate.
	* tree-inline.h (push_cfun, pop_cfun): Declare.
	* tree-optimize.c: Include except.h
	(all_lowering_passes): New variable.
	(execute_fixup_cfg, pass_fixup_cfg): New pass.
	(init_tree_optimization_passes): Move some to all_lowering_passes.
	(tree_lowering_passes): New function.
	(tree_rest_of_compilation): Register cfg hooks; save/unsave eh.

Co-Authored-By: Dale Johannesen <dalej@apple.com>
Co-Authored-By: Jan Hubicka <jh@suse.cz>
Co-Authored-By: Stuart Hastings <stuart@apple.com>

From-SVN: r99840
2005-05-17 16:56:32 +00:00
Kazu Hirata 5f99662735 builtin-types.def, [...]: Update copyright.
* builtin-types.def, c-convert.c, c-format.c, ddg.c, debug.c,
	debug.h, et-forest.c, et-forest.h, gcov.c, rtl-profile.c,
	rtlhooks-def.h, rtlhooks.c, sdbout.c, tree-inline.h,
	tree-profile.c, tsystem.h, value-prof.h: Update copyright.

From-SVN: r97209
2005-03-29 22:15:53 +00:00
Richard Guenther e5c4f28a6c cgraphunit.c (cgraph_estimate_size_after_inlining): Compute call cost based on argument sizes.
* cgraphunit.c (cgraph_estimate_size_after_inlining): Compute
	call cost based on argument sizes.
	(cgraph_mark_inline_edge): Avoid inline unit from shringking by
	inlining.
	* params.def: (max-inline-inssn-single): Set to 450.
	(max-inline-insns-auto): Set to 90.
	(max-inline-insns-recursive): Set to 450
	(max-inline-insns-recursive-auto): Set to 450.
	(large-function-insns): Set to 2700.
	(inline-call-cost): New parameter.
	* tree-inline.c (estimate_move_cost): New function.
	(estimate_num_insns_1): Compute move sizes costs by estimate_move_cost
	for non-gimple-regs, set cost to 0 for gimple-regs.  Compute call size
	based on arguments.
	* tree-inline.h (estimate_move_cost): Declare.
	* invoke.texi: (max-inline-inssn-single): Change default to 450.
	(max-inline-insns-auto): Change default to 90.
	(max-inline-insns-recursive): Change default to 450
	(max-inline-insns-recursive-auto): Change default to 450.
	(large-function-insns): Change default to 2700.
	(inline-call-cost): Document new parameter.

	* gcc.dg/winline-6.c: Modify so inlined function have nonzero cost.

Co-Authored-By: Jan Hubicka <jh@suse.cz>

From-SVN: r96892
2005-03-22 20:53:40 +00:00
Kazu Hirata 892c7e1ec6 tree-inline.c (remap_save_expr): Make it static.
* tree-inline.c (remap_save_expr): Make it static.
	* tree-inline.h: Remove the corresponding prototype.

From-SVN: r90313
2004-11-08 22:40:09 +00:00
Kazu Hirata f30278e8b4 bitmap.c, [...]: Update copyright.
* bitmap.c, bitmap.h, builtin-attrs.def, cfglayout.h,
	collect2.h, conflict.c, coretypes.h, coverage.h, errors.h,
	gcc.h, gcov-dump.c, gen-protos.c, gencheck.c, gencodes.c,
	genconstants.c, gengenrtl.c, genmodes.c, genpeep.c,
	gensupport.h, graph.h, gthr-gnat.c, gthr-gnat.h, gthr-posix.c,
	gthr-posix.h, hard-reg-set.h, hwint.h, integrate.h, libgcc2.c,
	lists.c, machmode.def, mips-tdump.c, opts.h, params.c,
	predict.def, predict.h, protoize.c, reload.h, resource.h,
	rtl-error.c, sbitmap.c, sbitmap.h, sreal.c, tlink.c,
	tree-dump.h, tree-inline.h, unwind-dw2-fde.c, unwind-dw2.c,
	unwind-sjlj.c, value-prof.h: Update copyright.

From-SVN: r89097
2004-10-15 14:47:12 +00:00
Richard Kenner 1a837f7746 re PR tree-optimization/15077 (ICE in make_decl_rtl when inlining tail recursive nested function)
PR optimization/15077
	* function.h (struct function): Add field saved_static_chain_decl.
	Fix comment for static_chain_decl.
	* tree-inline.c (save_body): Add new arg and handle static_chain_decl.
	* tree-inline.h (save_body): Add new arg.
	* tree-optimize.c (tree_rest_of_compilation): Handle saving
	static_chain_decl.

From-SVN: r85247
2004-07-27 22:27:20 -04:00
Richard Henderson 82c8274320 c-decl.c (grokdeclarator): Don't frob current_function_decl around variable_size.
* c-decl.c (grokdeclarator): Don't frob current_function_decl
        around variable_size.
        (set_decl_nonlocal): Remove.
        (store_parm_decls): Add stmts for pending sizes.
        * calls.c (calls_function, calls_function_1): Remove.
        (precompute_arguments): Don't call it.
        * cfgexpand.c (set_save_expr_context): Remove.
        (tree_expand_cfg): Don't call it.
        * dwarf2out.c (add_bound_info): Don't handle SAVE_EXPR.
        (dwarf2out_finish): Likewise.
        * expr.c (emit_block_move): Adjust addresses to BLKmode.
        (store_constructor): Don't pre-evaluate SAVE_EXPR.
        (safe_from_p): Don't queue SAVE_EXPRs.
        (expand_expr_real_1 <case SAVE_EXPR>): Rewrite to expect,
        or build plain VAR_DECLs.
        * fold-const.c (twoval_comparison_p): Don't look at SAVE_EXPR_RTL.
        (fold): Likewise.
        (fold_checksum_tree): Don't special-case SAVE_EXPR.
        * function.c (free_after_compilation): Don't clear x_save_expr_regs.
        (put_var_into_stack): Don't handle SAVE_EXPR.
        (gen_mem_addressof): Likewise.
        * function.h (struct function): Remove x_save_expr_regs.
        (save_expr_regs): Remove.
        * gengtype.c (adjust_field_tree_exp): Don't special-case SAVE_EXPR.
        * print-tree.c (print_node): Don't dump SAVE_EXPR_NOPLACEHOLDER.
        * stor-layout.c (variable_size): Don't set it.
        (force_type_save_exprs, force_type_save_exprs_1): Remove.
        * tree-inline.c (remap_save_expr): Remove fn argument.  Update
        all callers.  Don't set SAVE_EXPR_CONTEXT.
        * tree-inline.h (remap_save_expr): Update decl.
        * tree.c (save_expr): Update build size.
        (first_rtl_op): Don't handle SAVE_EXPR.
        (unsave_expr_1, contains_placeholder_p): Likewise.
        (decl_function_context): Likewise.
        * tree.def (SAVE_EXPR): Remove args 1 and 2.
        * tree.h (SAVE_EXPR_CONTEXT, SAVE_EXPR_RTL): Remove.
        (SAVE_EXPR_NOPLACEHOLDER, SAVE_EXPR_PERSISTENT_P): Remove.
cp/
        * tree.c (cp_unsave_r): Update remap_save_expr call.
java/
        * jcf-write.c (generate_bytecode_insns <case SAVE_EXPR>): Rewrite.

From-SVN: r84036
2004-07-02 17:15:50 -07:00
Diego Novillo 6de9cd9a88 Merge tree-ssa-20020619-branch into mainline.
From-SVN: r81764
2004-05-13 02:41:07 -04:00
Jan Hubicka 18c6ada9b2 cgraph.c: Add overall comment.
* cgraph.c: Add overall comment.
	(cgraph_inline_hash): New global variable.
	(cgraph_create_node): Break out from ...
	(cgraph_node): ... here.
	(cgraph_edge): New function.
	(cgraph_create_edge): New CALL_EXPR argument; some sanity checking.
	(cgraph_remove_edge): Accept edge, intead of source and destination.
	(cgraph_redirect_edge_callee): New.
	(cgraph_remove_node): Update all new datastructures.
	(cgraph_record_call, cgraph_remove_call): Kill.
	(dump_cgraph_node): Break out from ... ; dump new datastructures.
	(dump_cgraph): ... here.
	(cgraph_function_possibly_inlined_p): Use new hashtable.
	(cgraph_clone_edge, cgraph_clone_node): New.
	* cgraph.h: Include hashtab.h
	(struct cgraph_global_info): Kill cloned_times, inline_once, will_be_output
	fields, add inlined_to pointer.
	(cgraph_node): Add pointer to next_clone.
	(cgraph_remove_edge, cgraph_create_edge): Update prototype.
	(cgraph_remove_call, cgraph_record_call): Kill.
	(cgraph_inline_hash): Declare.
	(dump_cgraph_node, cgraph_edge, cg4raph_clone_edge, cgraph_clone_node,
	cgraph_redirect_edge_callee): Declare.
	(cgraph_create_edges, cgraph_inline_p): Update prorotype.
	(cgraph_preserve_function_body_p, verify_cgraph, verify_cgraph_node,
	cgraph_mark_inline_edge, cgraph_clone_inlined_nodes): Declare.
	* cgraphunit.c: Add overall comment.
	(cgraph_optimize_function): Kill.
	(cgraph_assemble_pending_functions): Do not assemble inline clones.
	(cgraph_finalize_function): Update call of cgraph_remove_node
	(record_call_1): Record call sites.
	(cgraph_create_edges): Accept node instead of decl argument.
	(error_found): New static variable.
	(verify_cgraph_node_1, verify_cgraph_node, verify_cgraph): New functions.
	(cgraph_analyze_function): Update for new datastructures.
	(cgraph_finalize_compilation_unit): Plug memory leak.
	(cgraph_optimize_function): Kill.
	(cgraph_expand_function): Do not use cgraph_optimize_function.
	(INLINED_TIMES, SET_INLINED_TIMES, cgraph_inlined_into,
	cgraph_inlined_callees): Kill.
	(cgraph_remove_unreachable_nodes): Verify cgraph; update handling of
	clones.
	(estimate_growth): Simplify.
	(cgraph_clone_inlined_nodes): New function.
	(cgraph_mark_inline_edge): Re-implement.
	(cgraph_mark_inline): Likewise.
	(cgraph_check_inline_limits): Simplify.
	(cgraph_recursive_inlining_p): New.
	(update_callee_keys): Break out from ...
	(cgraph_decide_inlining_of_small_functions): ... here; simplify.
	(cgraph_decide_inlining, cgraph_decide_inlining_incrementally):
	Likewise.
	(cgraph_expand_all_functions):  Remove inline clones from the ordered
	list.
	(cgraph_preserve_function_body_p): New predicate.
	(cgraph_optimize): Verify cgraph.
	* function.h (struct function): Add fields saved_tree/saved_args.
	* timevar.def (TV_CGRAPH_VERIFY): Use verifier.
	* toplev.c (rest_of_compilation): Do not free cfun.
	* tree-inline.c: Include function.h
	(struct inline_data): Add saving_p field; replace decl/current_decl by
	node/current_node.
	(insert_decl_map): New function.
	(copy_body_r): Handle saving; update cgraph datastructure.
	(copy_body): Handle recursive inlining.
	(initialize_inlined_parameters): Likewise.
	(expand_call_inline): Propagate node attributes; update cgraph.
	(optimize_inline_calls): Verify that datastructure still match.
	(save_body): New function.
	* tree-inline.h (save_body): New.
	* tree-optimize.c (tree_rest_of_compilation): preserve function body; do inlining.
	* langhooks-def.c (LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): New.
	* langhooks.c (lang_hooks): Add update_decl_after_saving.

	* cp-lang. (LANG_HOOKS_UPDATE_DECL_AFTER_SAVING): Define.
	* cp-tree.h (cp_update_decl_after_saving): Declare.
	* tree.c (cp_update_decl_after_saving): Define.

	* Make-lang.in (com.o): Add dependnecy on function.h
	* com.c: Include function.h
	(finish_function): Clear DECL_STRUCT_FUNCTION.

	* utils.c: Include function.h
	(end_subprog_body): Clear DECL_STRUCT_FUNCTION.

From-SVN: r80334
2004-04-01 23:28:15 +00:00
Steven Bosscher b3c3af2f63 tree.h (DID_INLINE_FUNC): Remove macro.
2003-08-05  Steven Bosscher  <steven@gcc.gnu.org>

	* tree.h (DID_INLINE_FUNC): Remove macro.
	(DECL_DECLARED_INLINE_P): Move from c-tree.h and cp/cp-tree.h,
	add tree check for FUNCTION_DECL.
	(DECL_ESTIMATED_INSNS): Move from c-common.h and java/java-tree.h.
	(struct tree_decl): Rename inlined_function_flag to
	declared_inline_flag.
	* c-common.h (c_lang_decl): Remove.
	(DECL_ESTIMATED_INSNS): Remove.
	* c-tree.h (struct lang_decl): Don't include c_lang_decl.
	(DECL_DECLARED_INLINE_P): Remove.
	* c-decl.c (grokdeclarator): Update comment.  With -finline-functions,
	do not reset DECL_DECLARED_INLINE_P.  Don't use DID_INLINE_FUNC.
	(finish_function): Make uninlinable a bool.  Fixup call to
	tree_inlinable_function_p() and fix some code style issues.
	* cgraph.h (disgread_inline_limits): Fix spelling: `disregard'.
	* cgraph.c (dump_cgraph): Likewise.
	* cgraphunit.c (cgraph_decide_inlining): Likewise
	(cgraph_finalize_compilation_unit): Likewise.
	Also update call to tree_inlinable_function_p().
	(cgraph_default_inline_p): Don't use DID_INLINE_FUNC.  Instead
	look at DECL_DECLARED_INLINE and reverse logic.
	* print-tree.c (print_node): Likewise.
	* toplev.c (rest_of_handle_inlining): Don't use DID_INLINE_FUNC.
	* tree-inline.h (tree_inlinable_function_p): Make a bool.  Update
	prototype.
	* tree-inline.c (inlinable_function_p): Split up in this function to
	check for basic inlining inhibiting conditions, and new
	limits_allow_inlining() function.  Warn if inlining is impossible
	because the inline candidate calls alloca or uses sjlj exceptions.
	(limits_allow_inlining): this new function to check if the inlining
	limits are satisfied.  Throttle from currfn_max_inline_insns, not from
	MAX_INLINE_INSNS_SINGLE.  The latter only makes sense if
	MAX_INLINE_INSNS_AUTO and MAX_INLINE_INSNS_SINGLE are equal.
	Update prototypes.
	(tree_inlinable_function_p): Make a bool.  Update call to
	inlinable_function_p
	(expand_call_inline): Use limits_allow_inlining() when not in
	unit-at-a-time mode to decide on inlining.  Don't use DID_INLINE_FUNC,
	instead see if the function was declared `inline'.

cp/
	* cp-tree.h (struct lang_decl): Don't include c_lang_decl.
	(DECL_DECLARED_INLINE_P): Remove.
	* decl2.c (import_export_decl): Only look at DECL_DECLARED_INLINE_P
	if decl is a FUNCTION_DECL.  This never made sense, but now it is
	required to avoid a tree check failure.
	* decl.c (grokfndecl): Don't touch DID_INLINE_FUNC.
	* optimize.c (maybe_clone_body): Likewise.

java/
	* java-tree.h (DECL_ESTIMATED_INSNS): Remove.

From-SVN: r70174
2003-08-05 14:11:53 +00:00
Andreas Jaeger 46c5ad278b sbitmap.c: Convert prototypes to ISO C90.
* sbitmap.c: Convert prototypes to ISO C90.
	* sbitmap.h: Likewise.
	* scan-decls.c: Likewise.
	* scan.c: Likewise.
	* sched-deps.c: Likewise.
	* sched-ebb.c: Likewise.
	* sched-int.h: Likewise.
	* sched-rgn.c: Likewise.
	* sched-vis.c: Likewise.
	* sibcall.c: Likewise.
	* simplify-rtx.c: Likewise.
	* sreal.c: Likewise.
	* sreal.h: Likewise.
	* ssa-ccp.c: Likewise.
	* ssa-dce.c: Likewise.
	* ssa.c: Likewise.
	* ssa.h: Likewise.
	* stack.h: Likewise.
	* stmt.c: Likewise.
	* stor-layout.c: Likewise.
	* stringpool.c: Likewise.
	* target.h: Likewise.
	* timevar.c: Likewise.
	* timevar.h: Likewise.
	* tlink.c: Likewise.
	* tracer.c: Likewise.
	* tree-inline.c: Likewise.
	* tree-inline.h: Likewise.
	* tree.c: Likewise.
	* tree.h: Likewise.

From-SVN: r69002
2003-07-06 14:35:56 +02:00
Nathanael Nerode 63b025a5c3 genattrtab.h, [...]: Replace "GNU CC" with "GCC".
* genattrtab.h, hosthooks-def.h, hosthooks.h, langhooks-def.h,
	langhooks.h, tree-inline.h: Replace "GNU CC" with "GCC".

From-SVN: r64298
2003-03-13 03:51:01 +00:00
Jan Hubicka 18d13f3417 inline-3.c: New test.
* gcc.dg/inline-3.c: New test.

	* c-decl.c: (finish_function): Update call of tree_inlinable_function_p.
	* cgraph.h: (cgraph_local_info): Add can_inline_once
	(cgraph_global_info): Add inline_once.
	(cgraph_node): Add previous.
	(cgraph_remove_node): New.
	* cgraphunit.c (cgraph_mark_functions_to_inline_once): New static
	function.
	(cgraph_optimize): Call it.
	(cgraph_finalize_function):  Set inlinable flags.
	(cgraph_finalize_compilation_unit):  Actually remove the reclaimed nodes.
	(cgraph_mark_functions_to_output):  Use new inlining heuristics flags.
	(cgraph_expand_function): Likewise.
	* cgraph.c
	(cgraph_node): Put nodes into doubly linked chain.
	(cgraph_remove_node): New function.
	* flags.h (flag_inline_functions_called_once): Declare.
	* tree-inline.c: Include cgraph.h
	(inlinable_functions_p): Add extra argument to bypass limits.
	(expand_call_inline):  Obey cgraph flag.
	* tree-inline.h (tree_inlinable_function_p): Update prototype.

From-SVN: r63983
2003-03-08 13:26:37 +00:00
Kazu Hirata 41077ce4b3 target.h: Fix formatting.
* target.h: Fix formatting.
	* timevar.h: Likewise.
	* tlink.c: Likewise.
	* toplev.c: Likewise.
	* toplev.h: Likewise.
	* tree.c: Likewise.
	* tree-dump.h: Likewise.
	* tree.h: Likewise.
	* tree-inline.h: Likewise.
	* unroll.c: Likewise.
	* unwind-dw2.c: Likewise.
	* unwind-dw2-fde.c: Likewise.
	* unwind-dw2-fde-glibc.c: Likewise.
	* unwind-dw2-fde.h: Likewise.
	* unwind.h: Likewise.
	* unwind-sjlj.c: Likewise.
	* varasm.c: Likewise.
	* varray.h: Likewise.
	* vmsdbg.h: Likewise.
	* vmsdbgout.c: Likewise.
	* xcoffout.h: Likewise.

From-SVN: r54123
2002-05-31 22:15:42 +00:00
Alexandre Oliva 69dcadffba langhooks.h: New file.
* langhooks.h: New file.
* Makefile.in (OBJS): Added langhooks.o.
(c-lang.o): Depend on langhooks.h.
(c-common.o): Don't depend on tree-inline.h.
(tree-inline.o): Depend on toplev.h.
(langhooks.o): New rule.
* c-common.c: Don't include tree-inline.h.
(c_mark_lang_decl): Mark argument c as unused.
(c_common_lang_init): Don't initialize hooks here.
* c-lang.c: Include langhooks.h, then override some macros.
(lang_hooks): Initialize with macros in langhooks.h.
(c_init): Don't initialize hooks here.
* toplev.c (struct lang_hooks_for_tree_inlining): New struct.
(struct lang_hooks): Add tree_inlining.  Refer to langhooks.h.
* tree-inline.c: Include toplev.h.  Don't define hook variables.
* tree-inline.h: Don't define hook types nor declare hook
variables.  Move macros to...
* langhooks.c: ... new file, as functions.  Adjust all callers.

From-SVN: r46096
2001-10-08 20:54:07 +00:00
Alexandre Oliva 4838c5ee55 Makefile.in (c-decl.o): Depend on tree-inline.h.
* Makefile.in (c-decl.o): Depend on tree-inline.h.
(c-lang.o): Likewise, as well as insn-config.h and integrate.h.
* c-decl.c: Include tree-inline.h.
(c_expand_body): Call optimize_inline_calls. Determine whether
a function is inlinable upfront, and only clear
DECL_SAVED_TREE, DECL_INITIAL and DECL_ARGUMENTS if it isn't.
* c-lang.c: Include tree-inline.h, insn-config.h and integrate.h.
(c_disregard_inline_limits): New function.
(inline_forbidden_p, c_cannot_inline_tree_fn): Likewise.
(c_post_options): Enable tree inlining if inlining is enabled.
Don't inline trees when instrumenting functions.
(c_init): Initialize lang_disregard_inline_limits and
lang_cannot_inline_tree_fn.
* tree-inline.c (initialize_inlined_parameters): Handle calls
with fewer arguments than declared parameters, and fewer
parameters than passed arguments.  Don't assume value is a
DECL.
(declare_return_variable): Convert return value back to the
original type, if it was promoted.
(tree_inlinable_function_p): New function.
(inlinable_function_p): Don't look at DECL_INLINE if we're
inlining all functions.  Make it work with a NULL id.
Re-check DECL_UNINLINABLE after language-specific checks.
(varargs_function_p): Move back to cp/tree.c.
* tree-inline.h (tree_inlinable_function_p): Declare it.
(varargs_function_p): Removed declaration.
* integrate.h (function_attribute_inlinable_p): Declare it.
* integrate.c (function_attribute_inlinable_p): Export it.
(save_for_inline): Don't bother to prepare argvec when not
inlining.
* cse.c (check_for_label_ref): Don't check deleted labels.

From-SVN: r46025
2001-10-05 04:20:27 +00:00
Alexandre Oliva 588d3ade13 Makefile.in (OBJS): Added tree-inline.o.
* Makefile.in (OBJS): Added tree-inline.o.
(c-common.o): Depend on tree-inline.h.
(tree-inline.o): New target.
* c-common.c: Include tree-inline.h.
(c_mark_lang_decl): Don't mark saved_tree.
(c_common_lang_init): Set lang_anon_aggr_type_p.
* c-common.h (walk_tree_fn, DECL_SAVED_TREE): Moved to tree.h.
(struct c_lang_decl): Moved saved_tree to tree_decl.
* ggc-common.c: Mark saved_tree and inlined_fns of FUNCTION_DECLs.
* integrate.h (function_attribute_inlinable_p): Declare it.
* integrate.c (function_attribute_inlinable_p): Export it.
* tree-inline.c: New file.  Define variables declared in...
* tree-inline.h: New file.  Declare functions to be moved to
tree-inline.c.  Define macros and declare types and hooks for
language-specific tree inlining.
(flag_inline_trees): Moved definition from cp/decl2.c.
* tree.h (walk_tree_fn, DECL_SAVED_TREE): Moved from c-common.h.
(TREE_READONLY_DECL_P, DECL_INLINED_FNS): Moved from cp/cp-tree.h.
(struct tree_decl): Moved saved_tree from c_lang_decl and
inlined_fns from C++'s lang_decl.

From-SVN: r46021
2001-10-05 02:49:16 +00:00