From e073091fa3480f69458a0e4a1bec12a7273a98f9 Mon Sep 17 00:00:00 2001 From: law Date: Sun, 26 Oct 1997 16:56:15 +0000 Subject: [PATCH] * toplev.c (flag_rerun_loop_opt): New variable. (f_options): Handle -frerun-loop-opt. (rest_of_compilation): If -frerun-loop-opt, then run the loop optimizer twice. (main): Enable -frerun-loop-opt by default for -O2 or greater. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16180 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/invoke.texi | 25 ++++++++++++++++++++++++- gcc/toplev.c | 27 +++++++++++++++++++++++++++ 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1b6628ca77..9ad14ce3434 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ Sun Oct 26 09:21:40 1997 Jeffrey A Law (law@cygnus.com) + * toplev.c (flag_rerun_loop_opt): New variable. + (f_options): Handle -frerun-loop-opt. + (rest_of_compilation): If -frerun-loop-opt, then run the loop + optimizer twice. + (main): Enable -frerun-loop-opt by default for -O2 or greater. + * loop.c (simplify_giv_expr): Adding two invariants results in an invariant. diff --git a/gcc/invoke.texi b/gcc/invoke.texi index 5934a4375c1..34ec2187a44 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -149,7 +149,7 @@ in the following sections. -fkeep-inline-functions -fno-default-inline -fno-defer-pop -fno-function-cse -fno-inline -fno-peephole -fomit-frame-pointer -fregmove --frerun-cse-after-loop -fschedule-insns +-frerun-cse-after-loop -frerun-loop-opt -fschedule-insns -fschedule-insns2 -fstrength-reduce -fthread-jumps -funroll-all-loops -funroll-loops -fmove-all-movables -freduce-all-givs @@ -245,6 +245,10 @@ in the following sections. -msoft-float -mhard-float -mbsd -mxopen -mno-symrename +@emph{MN10300 Options} +-mmult-bug +-mno-mult-bug + @emph{M32R/D Options} -mcode-model=@var{model type} -msdata=@var{sdata type} -G @var{num} @@ -2165,6 +2169,9 @@ body of the @code{if}. Re-run common subexpression elimination after loop optimizations has been performed. +@item -frerun-loop-opt +Run the loop optimizer twice. + @item -fexpensive-optimizations Perform a number of minor optimizations that are relatively expensive. @@ -2798,6 +2805,7 @@ that macro, which enables you to change the defaults. * Convex Options:: * AMD29K Options:: * ARM Options:: +* MN10300 Options:: * M32R/D Options:: * M88K Options:: * RS/6000 and PowerPC Options:: @@ -3437,6 +3445,21 @@ suppresses this pass. The post-processor is never run when the compiler is built for cross-compilation. @end table +@node MN10300 Options +@subsection MN10300 Options +@cindex MN10300 options +These @samp{-m} options are defined for Matsushita MN10300 architectures: + +@table @code +@item -mmult-bug +Generate code to avoid bugs in the multiply instructions for the MN10300 +processors. This is the default. + +@item -mno-mult-bug +Do not generate code to avoid bugs in the multiply instructions for the +MN10300 processors. +@end table + @node M32R/D Options @subsection M32R/D Options @cindex M32R/D options diff --git a/gcc/toplev.c b/gcc/toplev.c index 9fabc8f3a55..c36554f1c83 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -505,6 +505,10 @@ int flag_syntax_only = 0; static int flag_rerun_cse_after_loop; +/* Nonzero means to run loop optimizations twice. */ + +static int flag_rerun_loop_opt; + /* Nonzero for -finline-functions: ok to inline functions that look like good inline candidates. */ @@ -707,6 +711,7 @@ struct { char *string; int *variable; int on_value;} f_options[] = {"reg-struct-return", &flag_pcc_struct_return, 0}, {"delayed-branch", &flag_delayed_branch, 1}, {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1}, + {"rerun-loop-opt", &flag_rerun_loop_opt, 1}, {"pretend-float", &flag_pretend_float, 1}, {"schedule-insns", &flag_schedule_insns, 1}, {"schedule-insns2", &flag_schedule_insns_after_reload, 1}, @@ -3262,6 +3267,27 @@ rest_of_compilation (decl) { TIMEVAR (loop_time, { + int save_flag_unroll_loops; + int save_flag_unroll_all_loops; + + if (flag_rerun_loop_opt) + { + /* We only want to perform unrolling once. */ + save_flag_unroll_loops = flag_unroll_loops; + save_flag_unroll_all_loops = flag_unroll_all_loops; + flag_unroll_loops = 0; + flag_unroll_all_loops = 0; + + loop_optimize (insns, loop_dump_file); + + /* The regscan pass may not be necessary, but let's + be safe until we can prove otherwise. */ + reg_scan (insns, max_reg_num (), 1); + + /* Restore loop unrolling flags. */ + flag_unroll_loops = save_flag_unroll_loops; + flag_unroll_all_loops = save_flag_unroll_all_loops; + } loop_optimize (insns, loop_dump_file); }); } @@ -3819,6 +3845,7 @@ main (argc, argv, envp) flag_expensive_optimizations = 1; flag_strength_reduce = 1; flag_rerun_cse_after_loop = 1; + flag_rerun_loop_opt = 1; flag_caller_saves = 1; flag_force_mem = 1; #ifdef INSN_SCHEDULING -- 2.11.0