toplev.c (flag_loop_optimize, [...]): New static variables.
authorJan Hubicka <jh@suse.cz>
Fri, 22 Mar 2002 15:32:00 +0000 (16:32 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 22 Mar 2002 15:32:00 +0000 (15:32 +0000)
* toplev.c (flag_loop_optimize, flag_crossjumping):
New static variables.
(rest_of_compilation): Conditionalize crossjumping and
loop optimizer.
(parse_options_and_default_flags): Default loop_optimize and
crossjumping.
(lang_independent_options): Add -fcrossjumping and -floop-optimize
* invoke.texi (crossjumping, loop-optimize): Document.

From-SVN: r51175

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/toplev.c

index e5f30adf4e2f19a7e248a87c6ad5a862d6d26585..7e49d236c9544547d4d7c067c51f4dd621b7a7de 100644 (file)
@@ -1,3 +1,14 @@
+Fri Mar 22 16:30:42 CET 2002  Jan Hubicka  <jh@suse.cz>
+
+       * toplev.c (flag_loop_optimize, flag_crossjumping):
+       New static variables.
+       (rest_of_compilation): Conditionalize crossjumping and
+       loop optimizer.
+       (parse_options_and_default_flags): Default loop_optimize and
+       crossjumping.
+       (lang_independent_options): Add -fcrossjumping and -floop-optimize
+       * invoke.texi (crossjumping, loop-optimize): Document.
+
 2002-03-22  Richard Sandiford  <rsandifo@redhat.com>
 
        * real.c (eiisneg): Move outside #ifdef NANS.
index 52af61dff6da56ec3e52933fa46beb2ab9e03da9..533fda1a4aaf74af534e8484c41f6e5630c2d009 100644 (file)
@@ -266,7 +266,7 @@ in the following sections.
 -fdelayed-branch  -fdelete-null-pointer-checks @gol
 -fexpensive-optimizations  -ffast-math  -ffloat-store @gol
 -fforce-addr  -fforce-mem  -ffunction-sections @gol
--fgcse  -fgcse-lm  -fgcse-sm @gol
+-fgcse  -fgcse-lm  -fgcse-sm -floop-optimize -fcrossjumping @gol
 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions @gol
 -fkeep-static-consts  -fmerge-constants  -fmerge-all-constants @gol
 -fmove-all-movables  -fno-default-inline  -fno-defer-pop @gol
@@ -3495,6 +3495,17 @@ subexpression elimination.  This pass will attempt to move stores out of loops.
 When used in conjunction with @option{-fgcse-lm}, loops containing a load/store sequence
 can be changed to a load before the loop and a store after the loop.
 
+@item -floop-optimize
+@opindex floop-optimize
+Perform loop optimizations: move constant expressions out of loops, simplify
+exit test conditions and optionally do strength-reduction and loop unrolling as
+well.
+
+@item -fcrossjumping
+@opindex crossjumping
+Perform cross-jumping transformation. This transformation unifies equivalent code and save code size. The
+resulting code may or may not perform better than without cross-jumping.
+
 @item -fdelete-null-pointer-checks
 @opindex fdelete-null-pointer-checks
 Use global dataflow analysis to identify and eliminate useless checks
index 121d3f782bb7fc9a836460c514a27c6ad23e2810..ca26e7feb171e3ab6ecde557abe883c52b2ae4f9 100644 (file)
@@ -605,6 +605,14 @@ int flag_syntax_only = 0;
 
 static int flag_gcse;
 
+/* Nonzero means perform loop optimizer.  */
+
+static int flag_loop_optimize;
+
+/* Nonzero means perform crossjumping.  */
+
+static int flag_crossjumping;
+
 /* Nonzero means to use global dataflow analysis to eliminate
    useless null pointer tests.  */
 
@@ -1017,6 +1025,10 @@ static const lang_independent_options f_options[] =
    N_("Perform enhanced load motion during global subexpression elimination") },
   {"gcse-sm", &flag_gcse_sm, 1,
    N_("Perform store motion after global subexpression elimination") },
+  {"loop-optimize", &flag_loop_optimize, 1,
+   N_("Perform the loop optimizations") },
+  {"crossjumping", &flag_crossjumping, 1,
+   N_("Perform cross-jumping optimization") },
   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1,
    N_("Run CSE pass after loop optimizations") },
   {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
@@ -2846,7 +2858,7 @@ rest_of_compilation (decl)
 
   /* Move constant computations out of loops.  */
 
-  if (optimize > 0)
+  if (optimize > 0 && flag_loop_optimize)
     {
       timevar_push (TV_LOOP);
       delete_dead_jumptables ();
@@ -3244,7 +3256,8 @@ rest_of_compilation (decl)
   if (optimize)
     {
       life_analysis (insns, rtl_dump_file, PROP_FINAL);
-      cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_CROSSJUMP | CLEANUP_UPDATE_LIFE);
+      cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_UPDATE_LIFE
+                  | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
 
       /* This is kind of a heuristic.  We need to run combine_stack_adjustments
          even for machines with possibly nonzero RETURN_POPS_ARGS
@@ -3350,7 +3363,7 @@ rest_of_compilation (decl)
         and insn splitting possibly introduced more crossjumping
         oppurtuntities.  */
       cleanup_cfg (CLEANUP_EXPENSIVE | CLEANUP_POST_REGSTACK
-                  | CLEANUP_CROSSJUMP);
+                  | (flag_crossjumping ? CLEANUP_CROSSJUMP : 0));
       if (flag_reorder_blocks)
        {
          reorder_basic_blocks ();
@@ -4645,6 +4658,8 @@ parse_options_and_default_flags (argc, argv)
 #endif
       flag_guess_branch_prob = 1;
       flag_cprop_registers = 1;
+      flag_loop_optimize = 1;
+      flag_crossjumping = 1;
     }
 
   if (optimize >= 2)