summaryrefslogtreecommitdiff
path: root/gcc/tree-optimize.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-16 21:30:54 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-01-16 21:30:54 +0000
commit09a2e41255c0a0440f4ed6776545bbccc06a1e04 (patch)
tree804fa8f1f32288cbe6d17f5732d75a433109a589 /gcc/tree-optimize.c
parentf31e6932522849cf6355e519bb82f008fd3cc24c (diff)
downloadgcc-09a2e41255c0a0440f4ed6776545bbccc06a1e04.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120835 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r--gcc/tree-optimize.c65
1 files changed, 10 insertions, 55 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c
index a2439be7574..1299a856ffd 100644
--- a/gcc/tree-optimize.c
+++ b/gcc/tree-optimize.c
@@ -285,9 +285,12 @@ has_abnormal_outgoing_edge_p (basic_block bb)
/* Pass: fixup_cfg. IPA passes, compilation of earlier functions or inlining
might have changed some properties, such as marked functions nothrow or
added calls that can potentially go to non-local labels. Remove redundant
- edges and basic blocks, and create new ones if necessary. */
+ edges and basic blocks, and create new ones if necessary.
-static unsigned int
+ This pass can't be executed as stand alone pass from pass manager, because
+ in between inlining and this fixup the verify_flow_info would fail. */
+
+unsigned int
execute_fixup_cfg (void)
{
basic_block bb;
@@ -310,7 +313,7 @@ execute_fixup_cfg (void)
{
if (gimple_in_ssa_p (cfun))
{
- todo |= TODO_update_ssa;
+ todo |= TODO_update_ssa | TODO_cleanup_cfg;
update_stmt (stmt);
}
TREE_SIDE_EFFECTS (call) = 0;
@@ -320,7 +323,8 @@ execute_fixup_cfg (void)
if (!tree_could_throw_p (stmt) && lookup_stmt_eh_region (stmt))
remove_stmt_from_eh_region (stmt);
}
- tree_purge_dead_eh_edges (bb);
+ if (tree_purge_dead_eh_edges (bb))
+ todo |= TODO_cleanup_cfg;
}
if (current_function_has_nonlocal_label)
@@ -358,7 +362,7 @@ execute_fixup_cfg (void)
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
- todo |= TODO_update_ssa;
+ todo |= TODO_update_ssa | TODO_cleanup_cfg;
gcc_assert (SSA_NAME_OCCURS_IN_ABNORMAL_PHI
(PHI_RESULT (phi)));
mark_sym_for_renaming
@@ -377,24 +381,6 @@ execute_fixup_cfg (void)
return todo;
}
-struct tree_opt_pass pass_fixup_cfg =
-{
- "fixupcfg", /* name */
- NULL, /* gate */
- execute_fixup_cfg, /* 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_cleanup_cfg | TODO_ggc_collect
- | TODO_dump_func | TODO_verify_flow
- | TODO_verify_stmts,/* todo_flags_finish */
- 0 /* letter */ };
-
/* Do the actions required to initialize internal data structures used
in tree-ssa optimization passes. */
@@ -487,13 +473,9 @@ tree_rest_of_compilation (tree fndecl)
/* Initialize the default bitmap obstack. */
bitmap_obstack_initialize (NULL);
- /* We might need the body of this function so that we can expand
- it inline somewhere else. */
- if (cgraph_preserve_function_body_p (fndecl))
- save_inline_function_body (node);
-
/* Initialize the RTL code for the function. */
current_function_decl = fndecl;
+ cfun = DECL_STRUCT_FUNCTION (fndecl);
saved_loc = input_location;
input_location = DECL_SOURCE_LOCATION (fndecl);
init_function_start (fndecl);
@@ -506,33 +488,6 @@ tree_rest_of_compilation (tree fndecl)
tree_register_cfg_hooks ();
- if (flag_inline_trees)
- {
- struct cgraph_edge *e;
- for (e = node->callees; e; e = e->next_callee)
- if (!e->inline_failed || warn_inline)
- break;
- if (e)
- {
- timevar_push (TV_INTEGRATION);
- optimize_inline_calls (fndecl);
- 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);
- }
-
- /* We are not going to maintain the cgraph edges up to date.
- Kill it so it won't confuse us. */
- cgraph_node_remove_callees (node);
-
bitmap_obstack_initialize (&reg_obstack); /* FIXME, only at RTL generation*/
/* Perform all tree transforms and optimizations. */
execute_pass_list (all_passes);