diff options
Diffstat (limited to 'gcc/tree-ssa-loop.c')
-rw-r--r-- | gcc/tree-ssa-loop.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 4ceb282..885954e 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -38,4 +38,106 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "flags.h" #include "tree-inline.h" +/* The loop tree currently optimized. */ + +struct loops *current_loops; + +/* Initializes the loop structures. DUMP is the file to that the details + about the analysis should be dumped. */ + +static struct loops * +tree_loop_optimizer_init (FILE *dump) +{ + struct loops *loops = loop_optimizer_init (dump); + + if (!loops) + return NULL; + + /* Creation of preheaders may create redundant phi nodes if the loop is + entered by more than one edge, but the initial value of the induction + variable is the same on all of them. */ + kill_redundant_phi_nodes (); + rewrite_into_ssa (false); + bitmap_clear (vars_to_rename); + + return loops; +} + +/* The loop superpass. */ + +static bool +gate_loop (void) +{ + return flag_tree_loop_optimize != 0; +} + +struct tree_opt_pass pass_loop = +{ + "loop", /* name */ + gate_loop, /* gate */ + NULL, /* execute */ + NULL, /* sub */ + NULL, /* next */ + 0, /* static_pass_number */ + TV_TREE_LOOP, /* tv_id */ + PROP_cfg, /* properties_required */ + 0, /* properties_provided */ + 0, /* properties_destroyed */ + TODO_ggc_collect, /* todo_flags_start */ + TODO_dump_func | TODO_verify_ssa | TODO_ggc_collect /* todo_flags_finish */ +}; + +/* Loop optimizer initialization. */ + +static void +tree_ssa_loop_init (void) +{ + current_loops = tree_loop_optimizer_init (dump_file); +} + +struct tree_opt_pass pass_loop_init = +{ + "loopinit", /* name */ + NULL, /* gate */ + tree_ssa_loop_init, /* 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 */ + 0 /* todo_flags_finish */ +}; + +/* Loop optimizer finalization. */ + +static void +tree_ssa_loop_done (void) +{ + if (!current_loops) + return; + + loop_optimizer_finalize (current_loops, + (dump_flags & TDF_DETAILS ? dump_file : NULL)); + current_loops = NULL; + cleanup_tree_cfg (); +} + +struct tree_opt_pass pass_loop_done = +{ + "loopdone", /* name */ + NULL, /* gate */ + tree_ssa_loop_done, /* 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 */ + 0 /* todo_flags_finish */ +}; |