summaryrefslogtreecommitdiff
path: root/gcc/tree-optimize.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-28 02:20:29 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-06-28 02:20:29 +0000
commit9e0baf4df3e04c06273651dcbf15dfccefcbdb60 (patch)
tree02b6b104f2f54b8af2a5bad55640e994b28ecfb5 /gcc/tree-optimize.c
parent0bee387e3c1aae76cc96f13a1b6f4180dec18e8a (diff)
downloadgcc-9e0baf4df3e04c06273651dcbf15dfccefcbdb60.tar.gz
* cgraph.c (cgraph_remove_node): Do not release function bodies until
full cgraph is built. * cgraph.h (cgraph_decide_inlining_incrementally): Add early argument. * cgraphunit.c (cgraph_finalize_function): Update call of cgraph_decide_inlining_incrementally. (initialize_inline_failed): Break out of ... (cgraph_analyze_function): ... here. (rebuild_cgraph_edges): New function. (pass_rebuild_cgraph_edges): New pass. * common.opt (fearly-inlining): New flag. * ipa-inline.c: Include ggc.h (cgraph_clone_inlined_nodes): Avoid re-using of original copy when cgraph is not fully built. (cgraph_decide_inlining_incrementally): Add early mode. (cgraph_early_inlining): New function. (cgraph_gate_early_inlining): Likewise. (pass_early_ipa_inline): New pass. * ipa.c (cgraph_postorder): NULLify aux pointer. * tree-inline.c (expand_call_inline): Avoid warning early. * tree-optimize.c (pass_early_local_passes): New. (execute_cleanup_cfg_pre_ipa): New. (pass_cleanup_cfg): New. (register_dump_files): Fix handling subpasses of IPA pass. (init_tree_optimization_passes): Add early passes. (execute_ipa_pass_list): Fix handling of subpasses of IPA pass. * passes.h (pass_early_tree_profile, pass_rebuild_cgraph_edges, pass_early_ipa_inline): New passes. * tree-profile.c (do_early_tree_profiling, pass_early_tree_profile): New. * invoke.texi: Document early-inlining. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101369 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r--gcc/tree-optimize.c60
1 files changed, 57 insertions, 3 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index 24db18684f3..5ebd204c1a9 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -55,7 +55,7 @@ int dump_flags;
bool in_gimple_form;
/* The root of the compilation pass tree, once constructed. */
-static struct tree_opt_pass *all_passes, *all_ipa_passes, * all_lowering_passes;
+static struct tree_opt_pass *all_passes, *all_ipa_passes, *all_lowering_passes;
/* Gate: execute, or not, all of the non-trivial optimizations. */
@@ -84,6 +84,52 @@ static struct tree_opt_pass pass_all_optimizations =
0 /* letter */
};
+static struct tree_opt_pass pass_early_local_passes =
+{
+ NULL, /* name */
+ gate_all_optimizations, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ 0, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0, /* todo_flags_finish */
+ 0 /* letter */
+};
+
+/* Pass: cleanup the CFG just before expanding trees to RTL.
+ This is just a round of label cleanups and case node grouping
+ because after the tree optimizers have run such cleanups may
+ be necessary. */
+
+static void
+execute_cleanup_cfg_pre_ipa (void)
+{
+ cleanup_tree_cfg ();
+}
+
+static struct tree_opt_pass pass_cleanup_cfg =
+{
+ "cleanup_cfg", /* name */
+ NULL, /* gate */
+ execute_cleanup_cfg_pre_ipa, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ 0, /* tv_id */
+ PROP_cfg, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ TODO_dump_func, /* todo_flags_finish */
+ 0 /* letter */
+};
+
+
/* Pass: cleanup the CFG just before expanding trees to RTL.
This is just a round of label cleanups and case node grouping
because after the tree optimizers have run such cleanups may
@@ -322,7 +368,7 @@ register_dump_files (struct tree_opt_pass *pass, bool ipa, int properties)
n++;
if (pass->sub)
- new_properties = register_dump_files (pass->sub, ipa, new_properties);
+ new_properties = register_dump_files (pass->sub, false, new_properties);
/* If we have a gate, combine the properties that we could have with
and without the pass being examined. */
@@ -390,6 +436,8 @@ init_tree_optimization_passes (void)
#define NEXT_PASS(PASS) (p = next_pass_1 (p, &PASS))
/* Intraprocedural optimization passes. */
p = &all_ipa_passes;
+ NEXT_PASS (pass_early_ipa_inline);
+ NEXT_PASS (pass_early_local_passes);
NEXT_PASS (pass_ipa_inline);
*p = NULL;
@@ -405,7 +453,13 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_lower_complex_O0);
NEXT_PASS (pass_lower_vector);
NEXT_PASS (pass_warn_function_return);
+ NEXT_PASS (pass_early_tree_profile);
+ *p = NULL;
+
+ p = &pass_early_local_passes.sub;
NEXT_PASS (pass_tree_profile);
+ NEXT_PASS (pass_cleanup_cfg);
+ NEXT_PASS (pass_rebuild_cgraph_edges);
*p = NULL;
p = &all_passes;
@@ -716,7 +770,7 @@ execute_ipa_pass_list (struct tree_opt_pass *pass)
{
push_cfun (DECL_STRUCT_FUNCTION (node->decl));
current_function_decl = node->decl;
- execute_pass_list (pass);
+ execute_pass_list (pass->sub);
free_dominance_info (CDI_DOMINATORS);
free_dominance_info (CDI_POST_DOMINATORS);
current_function_decl = NULL;