diff options
author | Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz> | 2004-06-30 23:29:00 +0200 |
---|---|---|
committer | Zdenek Dvorak <rakdver@gcc.gnu.org> | 2004-06-30 21:29:00 +0000 |
commit | c66b6c6689525b38af7cf9ea184fdef3d54d34f4 (patch) | |
tree | 82db76b65fd80894925f2acf9c613ee3fa4f8fb6 /gcc/tree-ssa-loop.c | |
parent | 5f240ec46eaea80964f62124351e64cda949592e (diff) | |
download | gcc-c66b6c6689525b38af7cf9ea184fdef3d54d34f4.zip gcc-c66b6c6689525b38af7cf9ea184fdef3d54d34f4.tar.gz gcc-c66b6c6689525b38af7cf9ea184fdef3d54d34f4.tar.bz2 |
common.opt (ftree-loop-optimize): New flag.
* common.opt (ftree-loop-optimize): New flag.
* tree-flow.h (kill_redundant_phi_nodes): Declare.
* tree-optimize.c (init_tree_optimization_passes): Add pass_loop.
* tree-pass.h (pass_loop_init, pass_loop_done): Declare.
* tree-ssa-loop.c (current_loops): New variable.
(tree_loop_optimizer_init, gate_loop, tree_ssa_loop_init,
tree_ssa_loop_done): New functions.
(pass_loop, pass_loop_init, pass_loop_done): New passes.
* tree-ssa.c (kill_redundant_phi_nodes): Export.
* doc/invoke.texi (-ftree-loop-optimize): Document.
From-SVN: r83933
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 */ +}; |