diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8bd67b992d2..10aa03adc2f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +Wed Aug 27 21:32:20 1997 Jeffrey A Law (law@cygnus.com) + + * flags.h (flag_move_all_movables): Declare. + (flag_reduce_all_givs): Likewise. + * loop.c (move_movables): Handle flag_move_all_movables. + (strength_reduce): Handle flag_reduce_all_givs. + * toplev.c (flag_move_all_movables): Define. + (flag_reduce_all_givs): Likewise. + (f_options): Add -fmove-all-movables and -freduce-all-givs. + * invoke.texi: Document new options, including alias stuff that + wasn't included last time. + Wed Aug 27 18:08:51 1997 Bob Manson (manson@cygnus.com) * t-h8300: Use TARGET_LIBGCC2_CFLAGS instead of LIBGCC2_CFLAGS. diff --git a/gcc/flags.h b/gcc/flags.h index 58f5bc0af1c..5b3c7639e06 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -216,6 +216,16 @@ extern int flag_unroll_loops; extern int flag_unroll_all_loops; +/* Nonzero forces all invariant computations in loops to be moved + outside the loop. */ + +extern int flag_move_all_movables; + +/* Nonzero forces all general induction variables in loops to be + strength reduced. */ + +extern int flag_reduce_all_givs; + /* Nonzero for -fcse-follow-jumps: have cse follow jumps to do a more extensive job. */ diff --git a/gcc/invoke.texi b/gcc/invoke.texi index 2c7ae54b993..68b21aca9d2 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -151,6 +151,7 @@ in the following sections. -frerun-cse-after-loop -fschedule-insns -fschedule-insns2 -fstrength-reduce -fthread-jumps -funroll-all-loops -funroll-loops +-fmove-all-movables -freduce-all-givs -O -O0 -O1 -O2 -O3 @end smallexample @@ -354,6 +355,8 @@ in the following sections. -freg-struct-return -fshared-data -fshort-enums -fshort-double -fvolatile -fvolatile-global -fverbose-asm -fpack-struct -fstack-check +e0 +e1 +-fargument-alias -fargument-noalias +-fargument-noalias-global @end smallexample @end table @@ -2176,6 +2179,31 @@ Perform the optimization of loop unrolling. This is done for all loops and usually makes programs run more slowly. @samp{-funroll-all-loops} implies @samp{-fstrength-reduce} as well as @samp{-frerun-cse-after-loop}. +@item -fmove-all-movables +Forces all invariant computations in loops to be moved +outside the loop. + +@item -freduce-all-givs +Forces all general-induction variables in loops to be +strength-reduced. + +@emph{Note:} When compiling programs written in Fortran, +@samp{-fmove-all-moveables} and @samp{-freduce-all-givs} are enabled +by default when you use the optimizer. + +These options may generate better or worse code; results are highly +dependent on the structure of loops within the source code. + +These two options are intended to be removed someday, once +they have helped determine the efficacy of various +approaches to improving loop optimizations. + +Please let us (@code{egcs@cygnus.com and fortran@@gnu.ai.mit.edu}) +know how use of these options affects +the performance of your production code. +We're very interested in code that runs @emph{slower} +when these options are @emph{enabled}. + @item -fno-peephole Disable any machine-specific peephole optimizations. @@ -5138,6 +5166,24 @@ compilation). With @samp{+e1}, G++ actually generates the code implementing virtual functions defined in the code, and makes them publicly visible. + +@cindex aliasing of parameters +@cindex parameters, aliased +@item -fargument-alias +@item -fargument-noalias +@item -fargument-noalias-global +Specify the possible relationships among parameters and between +parameters and global data. + +@samp{-fargument-alias} specifies that arguments (parameters) may +alias each other and may alias global storage. +@samp{-fargument-noalias} specifies that arguments do not alias +each other, but may alias global storage. +@samp{-fargument-noalias-global} specifies that arguments do not +alias each other and do not alias global storage. + +Each language will automatically use whatever option is required by +the language standard. You should not need to use these options yourself. @end table @node Environment Variables diff --git a/gcc/loop.c b/gcc/loop.c index 5e0d1d1dac6..2b4af61b574 100644 --- a/gcc/loop.c +++ b/gcc/loop.c @@ -1722,6 +1722,7 @@ move_movables (movables, threshold, insn_count, loop_start, end, nregs) extra cost because something else was already moved. */ if (already_moved[regno] + || flag_move_all_movables || (threshold * savings * m->lifetime) >= insn_count || (m->forces && m->forces->done && n_times_used[m->forces->regno] == 1)) @@ -3991,8 +3992,8 @@ strength_reduce (scan_start, end, loop_top, insn_count, of such giv's whether or not we know they are used after the loop exit. */ - if (v->lifetime * threshold * benefit < insn_count - && ! bl->reversed) + if ( ! flag_reduce_all_givs && v->lifetime * threshold * benefit < insn_count + && ! bl->reversed ) { if (loop_dump_stream) fprintf (loop_dump_stream, diff --git a/gcc/toplev.c b/gcc/toplev.c index 821dab62158..bd22ff00b33 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -446,6 +446,16 @@ int flag_unroll_loops; int flag_unroll_all_loops; +/* Nonzero forces all invariant computations in loops to be moved + outside the loop. */ + +int flag_move_all_movables = 0; + +/* Nonzero forces all general induction variables in loops to be + strength reduced. */ + +int flag_reduce_all_givs = 0; + /* Nonzero for -fwritable-strings: store string constants in data segment and don't uniquize them. */ @@ -679,6 +689,8 @@ struct { char *string; int *variable; int on_value;} f_options[] = {"strength-reduce", &flag_strength_reduce, 1}, {"unroll-loops", &flag_unroll_loops, 1}, {"unroll-all-loops", &flag_unroll_all_loops, 1}, + {"move-all-movables", &flag_move_all_movables, 1}, + {"reduce-all-givs", &flag_reduce_all_givs, 1}, {"writable-strings", &flag_writable_strings, 1}, {"peephole", &flag_no_peephole, 0}, {"force-mem", &flag_force_mem, 1},