public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Optimization docs part 2
@ 2002-12-16 22:09 Jerry Quinn
  0 siblings, 0 replies; 3+ messages in thread
From: Jerry Quinn @ 2002-12-16 22:09 UTC (permalink / raw)
  To: gcc-patches

This patch adds the list of -O levels that each flag is active
at. Hopefully there aren't any bugs here.

2002-12-17  Jerry Quinn  <jlquinn@optonline.net>

	* gcc/doc/invoke.texi (Optimization Options): List -O levels
	  for each optimization flag.

--- gcc/doc/invoke.texi.p2	Tue Dec 17 00:32:16 2002
+++ gcc/doc/invoke.texi	Tue Dec 17 01:01:29 2002
@@ -3517,13 +3517,17 @@
 the compiler normally lets arguments accumulate on the stack for several
 function calls and pops them all at once.
 
+Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fforce-mem
 @opindex fforce-mem
 Force memory operands to be copied into registers before doing
 arithmetic on them.  This produces better code by making all memory
 references potential common subexpressions.  When they are not common
 subexpressions, instruction combination should eliminate the separate
-register-load.  The @option{-O2} option turns on this option.
+register-load.
+
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
 
 @item -fforce-addr
 @opindex fforce-addr
@@ -3546,10 +3550,14 @@
 whether a target machine supports this flag.  @xref{Registers,,Register
 Usage, gccint, GNU Compiler Collection (GCC) Internals}.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -foptimize-sibling-calls
 @opindex foptimize-sibling-calls
 Optimize sibling and tail recursive calls.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -ftrapv
 @opindex ftrapv
 This option generates traps for signed overflow on addition, subtraction,
@@ -3571,6 +3579,8 @@
 declared @code{static}, then the function is normally not output as
 assembler code in its own right.
 
+Enabled at level @option{-O3}.
+
 @item -finline-limit=@var{n}
 @opindex finline-limit
 By default, gcc limits the size of functions that can be inlined.  This flag
@@ -3614,6 +3624,8 @@
 linker support it.  Use @option{-fno-merge-constants} to inhibit this
 behavior.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fmerge-all-constants
 Attempt to merge identical constants and identical variables.
 
@@ -3638,6 +3650,9 @@
 This option is only meaningful on architectures that support such
 instructions, which include x86, PowerPC, IA-64 and S/390.
 
+The default is @option{-fbranch-count-reg}, enabled when
+@option{-fstrength-reduce} is enabled.
+
 @item -fno-function-cse
 @opindex fno-function-cse
 Do not put function addresses in registers; make each instruction that
@@ -3647,6 +3662,8 @@
 that alter the assembler output may be confused by the optimizations
 performed when this option is not used.
 
+The default is @option{-ffunction-cse}
+
 @item -ffast-math
 @opindex ffast-math
 Sets @option{-fno-math-errno}, @option{-funsafe-math-optimizations}, @*
@@ -3770,6 +3787,8 @@
 Perform the optimizations of loop strength reduction and
 elimination of iteration variables.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fthread-jumps
 @opindex fthread-jumps
 Perform optimizations where we check to see if a jump branches to a
@@ -3778,6 +3797,8 @@
 second branch or a point immediately following it, depending on whether
 the condition is known to be true or false.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fcse-follow-jumps
 @opindex fcse-follow-jumps
 In common subexpression elimination, scan through jump instructions
@@ -3786,6 +3807,8 @@
 @code{else} clause, CSE will follow the jump when the condition
 tested is false.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fcse-skip-blocks
 @opindex fcse-skip-blocks
 This is similar to @option{-fcse-follow-jumps}, but causes CSE to
@@ -3794,15 +3817,21 @@
 @option{-fcse-skip-blocks} causes CSE to follow the jump around the
 body of the @code{if}.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -frerun-cse-after-loop
 @opindex frerun-cse-after-loop
 Re-run common subexpression elimination after loop optimizations has been
 performed.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -frerun-loop-opt
 @opindex frerun-loop-opt
 Run the loop optimizer twice.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fgcse
 @opindex fgcse
 Perform a global common subexpression elimination pass.
@@ -3813,6 +3842,8 @@
 the global common subexpression elimination pass by adding
 @option{-fno-gcse} to the command line.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fgcse-lm
 @opindex fgcse-lm
 When @option{-fgcse-lm} is enabled, global common subexpression elimination will
@@ -3820,6 +3851,8 @@
 allows a loop containing a load/store sequence to be changed to a load outside
 the loop, and a copy/store within the loop.
 
+Enabled by default when gcse is enabled.
+
 @item -fgcse-sm
 @opindex fgcse-sm
 When @option{-fgcse-sm} is enabled, A store motion pass is run after global common
@@ -3827,17 +3860,23 @@
 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.
 
+Enabled by default when gcse is enabled.
+
 @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.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @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.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fif-conversion
 @opindex if-conversion
 Attempt to transform conditional jumps into branch-less equivalents.  This
@@ -3845,11 +3884,15 @@
 some tricks doable by standard arithmetics.  The use of conditional execution
 on chips where it is available is controlled by @code{if-conversion2}.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fif-conversion2
 @opindex if-conversion2
 Use conditional execution (where available) to transform conditional jumps into
 branch-less equivalents.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fdelete-null-pointer-checks
 @opindex fdelete-null-pointer-checks
 Use global dataflow analysis to identify and eliminate useless checks
@@ -3862,10 +3905,14 @@
 @option{-fno-delete-null-pointer-checks} to disable this optimization
 for programs which depend on that behavior.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fexpensive-optimizations
 @opindex fexpensive-optimizations
 Perform a number of minor optimizations that are relatively expensive.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -foptimize-register-move
 @itemx -fregmove
 @opindex foptimize-register-move
@@ -3873,18 +3920,21 @@
 Attempt to reassign register numbers in move instructions and as
 operands of other simple instructions in order to maximize the amount of
 register tying.  This is especially helpful on machines with two-operand
-instructions.  GCC enables this optimization by default with @option{-O2}
-or higher.
+instructions.
 
 Note @option{-fregmove} and @option{-foptimize-register-move} are the same
 optimization.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fdelayed-branch
 @opindex fdelayed-branch
 If supported for the target machine, attempt to reorder instructions
 to exploit instruction slots available after delayed branch
 instructions.
 
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fschedule-insns
 @opindex fschedule-insns
 If supported for the target machine, attempt to reorder instructions to
@@ -3893,6 +3943,8 @@
 by allowing other instructions to be issued until the result of the load
 or floating point instruction is required.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fschedule-insns2
 @opindex fschedule-insns2
 Similar to @option{-fschedule-insns}, but requests an additional pass of
@@ -3900,6 +3952,8 @@
 especially useful on machines with a relatively small number of
 registers and where memory load instructions take more than one cycle.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fno-sched-interblock
 @opindex fno-sched-interblock
 Don't schedule instructions across basic blocks.  This is normally
@@ -3956,8 +4010,7 @@
 This option is always enabled by default on certain machines, usually
 those which have no call-preserved registers to use instead.
 
-For all machines, optimization level 2 and higher enables this flag by
-default.
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
 
 @item -ftracer
 @opindex ftracer
@@ -3984,6 +4037,8 @@
 If supported by the target machine, generate instructions to prefetch
 memory to improve the performance of loops that access large arrays.
 
+Disabled at level @option{-Os}.
+
 @item -fmove-all-movables
 @opindex fmove-all-movables
 Forces all invariant computations in loops to be moved
@@ -4020,6 +4075,9 @@
 are implemented in the compiler; some targets use one, some use the
 other, a few use both.
 
+@option{-fpeephole} is enabled by default.
+@option{-fpeephole2} enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fbranch-probabilities
 @opindex fbranch-probabilities
 After running a program compiled with @option{-fprofile-arcs}
@@ -4057,11 +4115,16 @@
 reduce non-determinism, possibly at the expense of inferior
 optimization.
 
+The default is @option{-fguess-branch-probability} at levels
+@option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -freorder-blocks
 @opindex freorder-blocks
 Reorder basic blocks in the compiled function in order to reduce number of
 taken branches and improve code locality.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -freorder-functions
 @opindex freorder-functions
 Reorder basic blocks in the compiled function in order to reduce number of
@@ -4074,6 +4137,8 @@
 Also profile feedback must be available in to make this option effective.  See
 @option{-fprofile-arcs} for details.
 
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fstrict-aliasing
 @opindex fstrict-aliasing
 Allows the compiler to assume the strictest aliasing rules applicable to
@@ -4119,8 +4184,7 @@
 allowed to alias.  For an example, see the C front-end function
 @code{c_get_alias_set}.
 
-For all machines, optimization level 2 and higher enables this flag by
-default.
+Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
 
 @item -falign-functions
 @itemx -falign-functions=@var{n}
@@ -4139,6 +4203,8 @@
 
 If @var{n} is not specified, use a machine-dependent default.
 
+Enabled at levels @option{-O2}, @option{-O3}.
+
 @item -falign-labels
 @itemx -falign-labels=@var{n}
 @opindex falign-labels
@@ -4153,6 +4219,8 @@
 If @var{n} is not specified, use a machine-dependent default which is
 very likely to be @samp{1}, meaning no alignment.
 
+Enabled at levels @option{-O2}, @option{-O3}.
+
 @item -falign-loops
 @itemx -falign-loops=@var{n}
 @opindex falign-loops
@@ -4163,6 +4231,8 @@
 
 If @var{n} is not specified, use a machine-dependent default.
 
+Enabled at levels @option{-O2}, @option{-O3}.
+
 @item -falign-jumps
 @itemx -falign-jumps=@var{n}
 @opindex falign-jumps
@@ -4173,6 +4243,8 @@
 
 If @var{n} is not specified, use a machine-dependent default.
 
+Enabled at levels @option{-O2}, @option{-O3}.
+
 @item -fssa
 @opindex fssa
 Perform optimizations in static single assignment form.  Each function's
@@ -4203,11 +4275,15 @@
 make debugging impossible, since variables will no longer stay in
 a ``home register''.
 
+Enabled at levels @option{-O3}.
+
 @item -fno-cprop-registers
 @opindex fno-cprop-registers
 After register allocation and post-register allocation instruction splitting,
 we perform a copy-propagation pass to try to reduce scheduling dependencies
 and occasionally eliminate the copy.
+
+Disabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
 
 @item --param @var{name}=@var{value}
 @opindex param

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] optimization docs part 2
  2002-08-30  8:50 [PATCH] optimization " Jerome L Quinn
@ 2002-09-16 10:39 ` Geoff Keating
  0 siblings, 0 replies; 3+ messages in thread
From: Geoff Keating @ 2002-09-16 10:39 UTC (permalink / raw)
  To: Jerome L Quinn; +Cc: gcc-patches


Jerome L Quinn <jlquinn@us.ibm.com> writes:

> Here's the flag listing for the -O flags.  I scanned the sources to try to
> get these lists right, but there may still be errors.  Please let me know
> and I'll fix up the lists to match reality.

This patch also requires an assignment.

> 2002-08-30 Jerry Quinn <jlquinn@us.ibm.com>
>       * gcc/gcc/doc/invoke.texi (Optimization Options): List the options
> enabled by each -O flag.

Please make sure that the ChangeLog entry you finally commit is
properly formatted: two spaces after the date and between the name and
the e-mail address, one blank line after the header line, and one tab
before every line of the body.

> --- gcc/gcc/doc/invoke.texi.safe           2002-08-25 01:03:45.000000000
> -0400
> +++ gcc/gcc/doc/invoke.texi          2002-08-25 01:05:21.000000000 -0400
> @@ -3196,6 +3196,22 @@
>  time, without performing any optimizations that take a great deal of
>  compilation time.
> 
> +@option{-O} turns on the following optimizations:

I would say "turns on the following optimization flags", instead,
since this isn't a complete list of optimizations that are switched on by
-O1, only those that have separate flags.

> +@gccoptlist{-fdefer-pop
> +-fmerge-constants
> +-fthread-jumps
> +-floop-optimize
> +-fcrossjumping
> +-fif-conversion
> +-fif-conversion2
> +-fdelayed-branch
> +-fguess-branch-probability
> +-fcprop-registers}
> +
> +@option{-O} also turns on @option{-fomit-frame-pointer} on machines
> +where doing so does not interfere with debugging.
> +
> +

Why the two new blank lines here?

>  @item -O0
>  @opindex O0
> -Do not optimize.
> +Do not optimize.  This is equivalent to not using any optimization flags.

I think it would be clearer to write "This is the default.".  -O0 is
not the same as -O1 followed by -fno-defer-pop and so on.

>  @item -Os
>  @opindex Os
> @@ -3229,6 +3258,11 @@
>  do not typically increase code size.  It also performs further
>  optimizations designed to reduce code size.
> 
> +@option{-Os} disables the following optimization flags:
> +@gccoptlist{-falign-functions  -falign-jumps  -falign-loops
> +-falign-labels  -fprefetch-loop-arrays}
> +
> +

Should this also say something like "This enables the following
optimisation flags" (plus a list of the flags)?

Thank you for trying to do this, I find the existing structure (where
flags are listed in order according to what -Ox flag enables them)
confusing myself, and I know others also find it confusing because they
keep putting new flags in the wrong place.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] optimization docs part 2
@ 2002-08-30  8:50 Jerome L Quinn
  2002-09-16 10:39 ` Geoff Keating
  0 siblings, 1 reply; 3+ messages in thread
From: Jerome L Quinn @ 2002-08-30  8:50 UTC (permalink / raw)
  To: gcc-patches





Here's the flag listing for the -O flags.  I scanned the sources to try to
get these lists right, but there may still be errors.  Please let me know
and I'll fix up the lists to match reality.

2002-08-30 Jerry Quinn <jlquinn@us.ibm.com>
      * gcc/gcc/doc/invoke.texi (Optimization Options): List the options
enabled by each -O flag.

--- gcc/gcc/doc/invoke.texi.safe           2002-08-25 01:03:45.000000000
-0400
+++ gcc/gcc/doc/invoke.texi          2002-08-25 01:05:21.000000000 -0400
@@ -3196,6 +3196,22 @@
 time, without performing any optimizations that take a great deal of
 compilation time.

+@option{-O} turns on the following optimizations:
+@gccoptlist{-fdefer-pop
+-fmerge-constants
+-fthread-jumps
+-floop-optimize
+-fcrossjumping
+-fif-conversion
+-fif-conversion2
+-fdelayed-branch
+-fguess-branch-probability
+-fcprop-registers}
+
+@option{-O} also turns on @option{-fomit-frame-pointer} on machines
+where doing so does not interfere with debugging.
+
+
 @item -O2
 @opindex O2
 Optimize even more.  GCC performs nearly all supported optimizations
@@ -3204,11 +3220,24 @@
 As compared to @option{-O}, this option increases both compilation time
 and the performance of the generated code.

-@option{-O2} turns on all optional optimizations except for loop
-unrolling, function inlining, and register renaming.  It also turns on
-the @option{-fforce-mem} and @option{-fstrict-aliasing} option on all
-machines and frame pointer elimination on machines where doing so does
-not interfere with debugging.
+@option{-O2} turns on all optimizations specified by @option{-O}.  It
+also turns on the following optimizations:
+@gccoptlist{-fforce-mem
+-foptimize-sibling-calls
+-fstrength-reduce
+-fcse-follow-jumps  -fcse-skip-blocks
+-frerun-cse-after-loop  -frerun-loop-opt
+-fgcse   -fgcse-lm   -fgcse-sm
+-fdelete-null-pointer-checks
+-fexpensive-optimizations
+-fregmove
+-fschedule-insns  -fschedule-insns2
+-fcaller-saves
+-fpeephole2
+-freorder-blocks  -freorder-functions
+-fstrict-aliasing
+-falign-functions  -falign-jumps
+-falign-loops  -falign-labels}

 Please note the warning under @option{-fgcse} about
 invoking @option{-O2} on programs that use computed gotos.
@@ -3221,7 +3250,7 @@

 @item -O0
 @opindex O0
-Do not optimize.
+Do not optimize.  This is equivalent to not using any optimization flags.

 @item -Os
 @opindex Os
@@ -3229,6 +3258,11 @@
 do not typically increase code size.  It also performs further
 optimizations designed to reduce code size.

+@option{-Os} disables the following optimization flags:
+@gccoptlist{-falign-functions  -falign-jumps  -falign-loops
+-falign-labels  -fprefetch-loop-arrays}
+
+
 If you use multiple @option{-O} options, with or without level numbers,
 the last such option is the one that is effective.
 @end table

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-12-17  6:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-16 22:09 [PATCH] Optimization docs part 2 Jerry Quinn
  -- strict thread matches above, loose matches on Subject: below --
2002-08-30  8:50 [PATCH] optimization " Jerome L Quinn
2002-09-16 10:39 ` Geoff Keating

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).