diff options
author | Jan Hubicka <jh@suse.cz> | 2008-07-25 15:11:32 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2008-07-25 13:11:32 +0000 |
commit | 7e8b322aa09905a0362ec6c3c518c7aabfa045e0 (patch) | |
tree | 9b604148723313647c631665054f4f32b0f747d9 /gcc/ipa-inline.c | |
parent | 4a7bb85b7b613cf33e18c889234665a324283e71 (diff) | |
download | gcc-7e8b322aa09905a0362ec6c3c518c7aabfa045e0.zip gcc-7e8b322aa09905a0362ec6c3c518c7aabfa045e0.tar.gz gcc-7e8b322aa09905a0362ec6c3c518c7aabfa045e0.tar.bz2 |
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
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 118 |
1 files changed, 17 insertions, 101 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 3683ec7..6d744c4 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -60,7 +60,7 @@ along with GCC; see the file COPYING3. If not see cgraph_decide_inlining implements heuristics taking whole callgraph into account, while cgraph_decide_inlining_incrementally considers - only one function at a time and is used in non-unit-at-a-time mode. + only one function at a time and is used by early inliner. The inliner itself is split into several passes: @@ -82,15 +82,13 @@ along with GCC; see the file COPYING3. If not see to do inlining expanding code size it might result in unbounded growth of whole unit. - This is the main inlining pass in non-unit-at-a-time. - - With unit-at-a-time the pass is run during conversion into SSA form. - Only functions already converted into SSA form are inlined, so the - conversion must happen in topological order on the callgraph (that is - maintained by pass manager). The functions after inlining are early - optimized so the early inliner sees unoptimized function itself, but - all considered callees are already optimized allowing it to unfold - abstraction penalty on C++ effectively and cheaply. + The pass is run during conversion into SSA form. Only functions already + converted into SSA form are inlined, so the conversion must happen in + topological order on the callgraph (that is maintained by pass manager). + The functions after inlining are early optimized so the early inliner sees + unoptimized function itself, but all considered callees are already + optimized allowing it to unfold abstraction penalty on C++ effectively and + cheaply. pass_ipa_early_inlining @@ -150,16 +148,11 @@ along with GCC; see the file COPYING3. If not see In SIZE mode, only functions that reduce function body size after inlining are inlined, this is used during early inlining. - In SPEED mode, all small functions are inlined. This might result in - unbounded growth of compilation unit and is used only in non-unit-at-a-time - mode. - in ALL mode, everything is inlined. This is used during flattening. */ enum inlining_mode { INLINE_NONE = 0, INLINE_ALWAYS_INLINE, INLINE_SIZE, - INLINE_SPEED, INLINE_ALL }; static bool @@ -211,8 +204,7 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, bool update_o In that case just go ahead and re-use it. */ if (!e->callee->callers->next_caller && !e->callee->needed - && !cgraph_new_nodes - && flag_unit_at_a_time) + && !cgraph_new_nodes) { gcc_assert (!e->callee->global.inlined_to); if (DECL_SAVED_TREE (e->callee->decl)) @@ -262,7 +254,7 @@ cgraph_mark_inline_edge (struct cgraph_edge *e, bool update_original) gcc_assert (e->inline_failed); e->inline_failed = NULL; - if (!e->callee->global.inlined && flag_unit_at_a_time) + if (!e->callee->global.inlined) DECL_POSSIBLY_INLINED (e->callee->decl) = true; e->callee->global.inlined = true; @@ -1299,13 +1291,13 @@ try_inline (struct cgraph_edge *e, enum inlining_mode mode, int depth) if (e->inline_failed) cgraph_mark_inline (e); - /* In order to fully inline always_inline functions at -O0, we need to + /* In order to fully inline always_inline functions, we need to recurse here, since the inlined functions might not be processed by incremental inlining at all yet. Also flattening needs to be done recursively. */ - if (!flag_unit_at_a_time || mode == INLINE_ALL || always_inline) + if (mode == INLINE_ALL || always_inline) cgraph_decide_inlining_incrementally (e->callee, mode, depth + 1); callee->aux = (void *)(size_t) callee_mode; return true; @@ -1495,20 +1487,11 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node, } if (cgraph_default_inline_p (e->callee, &failed_reason)) inlined |= try_inline (e, mode, depth); - else if (!flag_unit_at_a_time) - e->inline_failed = failed_reason; } node->aux = (void *)(size_t) old_mode; return inlined; } -/* When inlining shall be performed. */ -static bool -cgraph_gate_inlining (void) -{ - return flag_inline_trees; -} - /* Because inlining might remove no-longer reachable nodes, we need to keep the array visible to garbage collector to avoid reading collected out nodes. */ @@ -1526,9 +1509,7 @@ cgraph_early_inlining (void) if (sorrycount || errorcount) return 0; - if (cgraph_decide_inlining_incrementally (node, - flag_unit_at_a_time || optimize_size - ? INLINE_SIZE : INLINE_SPEED, 0)) + if (cgraph_decide_inlining_incrementally (node, INLINE_SIZE, 0)) { timevar_push (TV_INTEGRATION); todo = optimize_inline_calls (current_function_decl); @@ -1541,7 +1522,7 @@ cgraph_early_inlining (void) static bool cgraph_gate_early_inlining (void) { - return flag_inline_trees && flag_early_inlining; + return flag_early_inlining; } struct gimple_opt_pass pass_early_inline = @@ -1567,7 +1548,7 @@ struct gimple_opt_pass pass_early_inline = static bool cgraph_gate_ipa_early_inlining (void) { - return (flag_inline_trees && flag_early_inlining + return (flag_early_inlining && (flag_branch_probabilities || flag_test_coverage || profile_arc_flag)); } @@ -1626,19 +1607,12 @@ compute_inline_parameters_for_current (void) return 0; } -/* When inlining shall be performed. */ -static bool -gate_inline_passes (void) -{ - return flag_inline_trees; -} - struct gimple_opt_pass pass_inline_parameters = { { GIMPLE_PASS, NULL, /* name */ - gate_inline_passes, /* gate */ + NULL, /* gate */ compute_inline_parameters_for_current,/* execute */ NULL, /* sub */ NULL, /* next */ @@ -1746,7 +1720,7 @@ struct ipa_opt_pass pass_ipa_inline = { IPA_PASS, "inline", /* name */ - cgraph_gate_inlining, /* gate */ + NULL, /* gate */ cgraph_decide_inlining, /* execute */ NULL, /* sub */ NULL, /* next */ @@ -1769,62 +1743,4 @@ struct ipa_opt_pass pass_ipa_inline = }; -/* When inlining shall be performed. */ -static bool -cgraph_gate_O0_always_inline (void) -{ - return !flag_unit_at_a_time || !flag_inline_trees; -} - -static unsigned int -cgraph_O0_always_inline (void) -{ - struct cgraph_node *node = cgraph_node (current_function_decl); - unsigned int todo = 0; - bool inlined; - - if (sorrycount || errorcount) - return 0; - inlined = cgraph_decide_inlining_incrementally (node, INLINE_SPEED, 0); - /* We might need the body of this function so that we can expand - it inline somewhere else. */ - if (cgraph_preserve_function_body_p (current_function_decl)) - save_inline_function_body (node); - if (inlined || warn_inline) - { - timevar_push (TV_INTEGRATION); - todo = optimize_inline_calls (current_function_decl); - timevar_pop (TV_INTEGRATION); - } - /* In non-unit-at-a-time we must mark all referenced functions as needed. */ - if (!flag_unit_at_a_time) - { - struct cgraph_edge *e; - for (e = node->callees; e; e = e->next_callee) - if (e->callee->analyzed) - cgraph_mark_needed_node (e->callee); - } - return todo | execute_fixup_cfg (); -} - -struct gimple_opt_pass pass_O0_always_inline = -{ - { - GIMPLE_PASS, - "always_inline", /* name */ - cgraph_gate_O0_always_inline, /* gate */ - cgraph_O0_always_inline, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_INLINE_HEURISTICS, /* tv_id */ - 0, /* properties_required */ - PROP_cfg, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - TODO_dump_func | TODO_verify_flow - | TODO_verify_stmts /* todo_flags_finish */ - } -}; - #include "gt-ipa-inline.h" |