aboutsummaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2008-05-05 07:31:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2008-05-05 05:31:34 +0000
commit24c0514153e41537c29f2680f86303dff8a0b496 (patch)
treef9eda22c81cb7bf94680355477c47aca64696b69 /gcc/ipa-inline.c
parent7ffc24cee0f21151f2f18fc9186bb484c4ffa533 (diff)
downloadgcc-24c0514153e41537c29f2680f86303dff8a0b496.zip
gcc-24c0514153e41537c29f2680f86303dff8a0b496.tar.gz
gcc-24c0514153e41537c29f2680f86303dff8a0b496.tar.bz2
tree-pass.h (pass_O0_always_inline): Declare.
tree-optimization/36100 * tree-pass.h (pass_O0_always_inline): Declare. * ipa-inline.c (inline_transform): Remove dead code. (cgraph_gate_O0_always_inline, cgraph_O0_always_inline, pass_O0_always_inline): New. * passes.c (init_optimization_passes): Add pass_O0_always_inline. From-SVN: r134942
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c67
1 files changed, 59 insertions, 8 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 81246d8..68a4201 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1588,14 +1588,6 @@ inline_transform (struct cgraph_node *node)
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 ();
}
@@ -1628,4 +1620,63 @@ struct ipa_opt_pass pass_ipa_inline =
NULL, /* variable_transform */
};
+
+/* 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"