This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA: New option: --optimizers-help
- From: Nick Clifton <nickc at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 02 May 2006 17:44:55 +0100
- Subject: RFA: New option: --optimizers-help
Hi Guys,
I am looking for approval to apply the following patch. It was
developed as part of the work on supporting per-function
optimizations but it is a self contained enhancement so I am
submitting it separately.
The patch adds a new option to GCC: --optimizers-help. This option
reports the command line options which can be used to enable
optimizations. The catch is that it only lists those optimizations
which have not already been enabled by previous options on the
command line. Thus for example a tool that wants to discover the
list of optimizations which could be enabled above and beyond -O3
might use this:
gcc -O3 --optimizers-help
Since the output of this command is just a list of options, one per
line with no descriptive text, it is easy for the tool to parse and
use in whatever fashion it so desires.
Another use might be to discover which specific optimizations are
enabled at a particular optimization level. For example:
gcc -Q -O2 --optimizers-help > /tmp/O2-opts
gcc -Q -O3 --optimizers-help > /tmp/O3-opts
diff /tmp/O2-opts /tmp/O3-opts
will provide an annotated list of those options enabled at -O3.
[Note - I feel that there ought to be a way to do this as a single
command without generating temporary files, but I do not know how].
The patch does rely upon options being labelled as optimizations in
the .opt file where they are defined. Thus if the new "Optimizer"
attribute is omitted for a particular option it will not be reported
by --optimizers-help. The current version of the patch includes
changes to the common.opt and c.opt files to add this new attribute
to the relevant options. If the patch is accepted I plan to submit
a further patch which adds the attribute to the relevant target
specific options files.
The patch includes documentation of the new option in the
gcc/invoke.texi file and also an addition to the changes.html file
in the wwwdocs/htdocs/gcc-4.2 directory.
Tested by building an x86 native toolchain and running the gcc
testsuite - there were no regressions.
May I apply this patch ?
Cheers
Nick
gcc/ChangeLog
2006-05-02 Nick Clifton <nickc@redhat.com>
* opts.h (CL_OPTIMIZER): New option flag.
* opt-function.awk (switch_flags): Translate an "Optimzer"
attribute into a CL_OPTIMIZER flag.
* c.opt: Add "Optimizer" attribute to options which enable
optimizations.
* common.opt: Likewise.
* opts.c (print_optimizers_help): New function: Handle the
--optimizers-help option, displaying any documented option
with the CL_OPTIMIZER attribute which has not already been
enabled.
(common_handle_option): Handle case OPT__optimizers_help.
* doc/invoke.texi: Document --optimizers-help.
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 113452)
+++ gcc/doc/invoke.texi (working copy)
@@ -160,7 +160,8 @@ in the following sections.
@item Overall Options
@xref{Overall Options,,Options Controlling the Kind of Output}.
@gccoptlist{-c -S -E -o @var{file} -combine -pipe -pass-exit-codes @gol
--x @var{language} -v -### --help --target-help --version @@@var{file}}
+-x @var{language} -v -### --help --target-help --optimizers-help @gol
+--version @@@var{file}}
@item C Language Options
@xref{C Dialect Options,,Options Controlling C Dialect}.
@@ -1066,6 +1067,28 @@ be displayed.
Print (on the standard output) a description of target specific command
line options for each tool.
+@item --optimizers-help
+@opindex optimizers-help
+Print (on the standard output) a list of the option-controlled
+optimizations supported by the compiler, but which have not been
+enabled by previous options on the command line. The descriptive
+text for these options is @emph{not} dispalyed by default, but it will
+be if the @option{-Q} option is used. The intention is that the
+default output of this option can be parsed by an external tool and
+used in some fashion.
+
+This option can be used to discover which optimizations are enabled by
+@command{gcc} at different @option{-O} levels. For example:
+
+@smallexample
+gcc -O3 --optimizers-help > /tmp/O3-opts
+gcc -O2 --optimizers-help > /tmp/O2-opts
+diff /tmp/O2-opts /tmp/O3-opts
+@end smallexample
+
+will show those opitmizations enabled by @option{-O3} which are not
+enabled at @option{-O2}.
+
@item --version
@opindex version
Display the version number and copyrights of the invoked GCC@.
Index: gcc/opts.c
===================================================================
--- gcc/opts.c (revision 113452)
+++ gcc/opts.c (working copy)
@@ -716,6 +716,78 @@ decode_options (unsigned int argc, const
}
}
+/* Like print_target_help() except that options which enable optimizations
+ are displayed. If -quiet is in effect then only the name of the option
+ is displayed, not its descriptive text, as it is assumed that the output
+ is going to be parsed by some external program.
+
+ The code only displays those optimizations which can be enabled in addition
+ to ones which have already been activated. In this way a user can use type:
+
+ gcc -O3 --optimizers-help
+
+ to find out what extra optimizations GCC supports but does not routinely
+ enable, or:
+
+ cc1 -quiet -O3 --optimizers-help > /tmp/O3-opts
+ cc1 -quiet -O2 --optimizers-help > /tmp/O2-opts
+ diff /tmp/O2-opts /tmp/O3-opts
+
+ in order to find out which optimizations are enabled by -O2, or:
+
+ cc1 -quiet -O3 --optimizer-help > /tmp/cc1-opts
+ ccplus1 -quiet -O3 --optimizer-help > /tmp/cc1plus-opts
+ diff /tmp/cc1-opts /tmp/cc1plus-opts
+
+ in order to find out which optimizations are specific to C and which
+ are specific to C++. */
+
+static void
+print_optimizers_help (void)
+{
+ unsigned int i;
+
+ for (i = 0; i < cl_options_count; i++)
+ {
+ unsigned int len;
+ const char *help;
+ const char *opt;
+ const char *tab;
+ const struct cl_option * option = cl_options + i;
+
+ if ((option->flags & (CL_OPTIMIZER | CL_UNDOCUMENTED)) != CL_OPTIMIZER)
+ continue;
+
+ if (option_enabled (i) != 0)
+ continue;
+
+ help = option->help;
+ if (!help)
+ help = undocumented_msg;
+
+ /* Get the translation. */
+ help = _(help);
+
+ tab = strchr (help, '\t');
+ if (tab)
+ {
+ len = tab - help;
+ opt = help;
+ help = tab + 1;
+ }
+ else
+ {
+ opt = option->opt_text;
+ len = strlen (opt);
+ }
+
+ if (quiet_flag)
+ wrap_help ("", opt, len);
+ else
+ wrap_help (help, opt, len);
+ }
+}
+
/* Handle target- and language-independent options. Return zero to
generate an "unknown option" message. Only options that need
extra handling need to be listed here; if you simply want
@@ -743,6 +815,11 @@ common_handle_option (size_t scode, cons
exit_after_options = true;
break;
+ case OPT__optimizers_help:
+ print_optimizers_help ();
+ exit_after_options = true;
+ break;
+
case OPT__version:
print_version (stderr, "");
exit_after_options = true;
Index: gcc/opts.h
===================================================================
--- gcc/opts.h (revision 113452)
+++ gcc/opts.h (working copy)
@@ -65,6 +65,7 @@ extern const unsigned int cl_options_cou
extern const char *const lang_names[];
extern bool no_unit_at_a_time_default;
+#define CL_OPTIMIZER (1 << 20) /* Enables an (optional) optimization. */
#define CL_DISABLED (1 << 21) /* Disabled in this configuration. */
#define CL_TARGET (1 << 22) /* Target-specific option. */
#define CL_REPORT (1 << 23) /* Report argument with -fverbose-asm */
Index: gcc/c.opt
===================================================================
--- gcc/c.opt (revision 113452)
+++ gcc/c.opt (working copy)
@@ -536,7 +536,7 @@ fguiding-decls
C++ ObjC++
fhandle-exceptions
-C++ ObjC++
+C++ ObjC++ Optimizer
fhonor-std
C++ ObjC++
@@ -653,19 +653,19 @@ C++ ObjC++
Enable automatic template instantiation
frtti
-C++ ObjC++
+C++ ObjC++ Optimizer
Generate run time type descriptor information
fshort-double
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Optimizer
Use the same size for double as for float
fshort-enums
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Optimizer
Use the narrowest integer type possible for enumeration types
fshort-wchar
-C ObjC C++ ObjC++
+C ObjC C++ ObjC++ Optimizer
Force the underlying type for \"wchar_t\" to be \"unsigned short\"
fsigned-bitfields
@@ -698,7 +698,7 @@ fthis-is-variable
C++ ObjC++
fthreadsafe-statics
-C++ ObjC++
+C++ ObjC++ Optimizer
-fno-threadsafe-statics Do not generate thread-safe code for initializing local statics
funsigned-bitfields
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 113452)
+++ gcc/common.opt (working copy)
@@ -34,6 +34,11 @@ Common Separate
-target-help
Common
+-optimizers-help
+Common
+Display a list of command line switches which enable optimizations
+which have not already been enabled.
+
-version
Common
@@ -236,21 +241,21 @@ falign-functions=
Common RejectNegative Joined UInteger
falign-jumps
-Common Report Var(align_jumps,0)
+Common Report Var(align_jumps,0) Optimizer
Align labels which are only reached by jumping
falign-jumps=
Common RejectNegative Joined UInteger
falign-labels
-Common Report Var(align_labels,0)
+Common Report Var(align_labels,0) Optimizer
Align all labels
falign-labels=
Common RejectNegative Joined UInteger
falign-loops
-Common Report Var(align_loops)
+Common Report Var(align_loops) Optimizer
Align the start of loops
falign-loops=
@@ -265,23 +270,23 @@ Common RejectNegative Joined UInteger
; 3 if pointer arguments may not alias anything. True in Fortran.
; Set by the front end.
fargument-alias
-Common Report Var(flag_argument_noalias,0)
+Common Report Var(flag_argument_noalias,0) Optimizer
Specify that arguments may alias each other and globals
fargument-noalias
-Common Report Var(flag_argument_noalias,1) VarExists
+Common Report Var(flag_argument_noalias,1) VarExists Optimizer
Assume arguments may alias globals but not each other
fargument-noalias-global
-Common Report Var(flag_argument_noalias,2) VarExists
+Common Report Var(flag_argument_noalias,2) VarExists Optimizer
Assume arguments alias neither each other nor globals
fargument-noalias-anything
-Common Report Var(flag_argument_noalias,3) VarExists
+Common Report Var(flag_argument_noalias,3) VarExists Optimizer
Assume arguments alias no other storage
fasynchronous-unwind-tables
-Common Report Var(flag_asynchronous_unwind_tables)
+Common Report Var(flag_asynchronous_unwind_tables) Optimizer
Generate unwind tables that are exact at each instruction boundary
; -fcheck-bounds causes gcc to generate array bounds checks.
@@ -293,23 +298,23 @@ Common Report Var(flag_bounds_check)
Generate code to check bounds before indexing arrays
fbranch-count-reg
-Common Report Var(flag_branch_on_count_reg) Init(1)
+Common Report Var(flag_branch_on_count_reg) Init(1) Optimizer
Replace add, compare, branch with branch on count register
fbranch-probabilities
-Common Report Var(flag_branch_probabilities)
+Common Report Var(flag_branch_probabilities) Optimizer
Use profiling information for branch probabilities
fbranch-target-load-optimize
-Common Report Var(flag_branch_target_load_optimize)
+Common Report Var(flag_branch_target_load_optimize) Optimizer
Perform branch target load optimization before prologue / epilogue threading
fbranch-target-load-optimize2
-Common Report Var(flag_branch_target_load_optimize2)
+Common Report Var(flag_branch_target_load_optimize2) Optimizer
Perform branch target load optimization after prologue / epilogue threading
fbtr-bb-exclusive
-Common Report Var(flag_btr_bb_exclusive)
+Common Report Var(flag_btr_bb_exclusive) Optimizer
Restrict target load migration not to re-use registers in any basic block
fcall-saved-
@@ -324,49 +329,49 @@ Common Joined RejectNegative
; be saved across function calls, if that produces overall better code.
; Optional now, so people can test it.
fcaller-saves
-Common Report Var(flag_caller_saves)
+Common Report Var(flag_caller_saves) Optimizer
Save registers around function calls
fcommon
-Common Report Var(flag_no_common,0)
+Common Report Var(flag_no_common,0) Optimizer
Do not put uninitialized globals in the common section
fcprop-registers
-Common Report Var(flag_cprop_registers)
+Common Report Var(flag_cprop_registers) Optimizer
Perform a register copy-propagation optimization pass
fcrossjumping
-Common Report Var(flag_crossjumping)
+Common Report Var(flag_crossjumping) Optimizer
Perform cross-jumping optimization
fcse-follow-jumps
-Common Report Var(flag_cse_follow_jumps)
+Common Report Var(flag_cse_follow_jumps) Optimizer
When running CSE, follow jumps to their targets
fcse-skip-blocks
-Common Report Var(flag_cse_skip_blocks)
+Common Report Var(flag_cse_skip_blocks) Optimizer
When running CSE, follow conditional jumps
fcx-limited-range
-Common Report Var(flag_cx_limited_range)
+Common Report Var(flag_cx_limited_range) Optimizer
Omit range reduction step when performing complex division
fdata-sections
-Common Report Var(flag_data_sections)
+Common Report Var(flag_data_sections) Optimizer
Place data items into their own section
; Nonzero for -fdefer-pop: don't pop args after each function call
; instead save them up to pop many calls' args with one insns.
fdefer-pop
-Common Report Var(flag_defer_pop)
+Common Report Var(flag_defer_pop) Optimizer
Defer popping functions args from stack until later
fdelayed-branch
-Common Report Var(flag_delayed_branch)
+Common Report Var(flag_delayed_branch) Optimizer
Attempt to fill delay slots of branch instructions
fdelete-null-pointer-checks
-Common Report Var(flag_delete_null_pointer_checks)
+Common Report Var(flag_delete_null_pointer_checks) Optimizer
Delete useless null pointer checks
fdiagnostics-show-location=
@@ -386,7 +391,7 @@ Common Report Var(flag_dump_unnumbered)
Suppress output of instruction numbers and line number notes in debugging dumps
fearly-inlining
-Common Report Var(flag_early_inlining) Init(1)
+Common Report Var(flag_early_inlining) Init(1) Optimizer
Perform early inlining
feliminate-dwarf2-dups
@@ -406,18 +411,18 @@ Common Report Var(flag_emit_class_debug_
Do not suppress C++ class debug information.
fexceptions
-Common Report Var(flag_exceptions)
+Common Report Var(flag_exceptions) Optimizer
Enable exception handling
fexpensive-optimizations
-Common Report Var(flag_expensive_optimizations)
+Common Report Var(flag_expensive_optimizations) Optimizer
Perform a number of minor, expensive optimizations
ffast-math
Common
ffinite-math-only
-Common Report Var(flag_finite_math_only)
+Common Report Var(flag_finite_math_only) Optimizer
Assume no NaNs or infinities are generated
ffixed-
@@ -425,19 +430,19 @@ Common Joined RejectNegative
-ffixed-<register> Mark <register> as being unavailable to the compiler
ffloat-store
-Common Report Var(flag_float_store)
+Common Report Var(flag_float_store) Optimizer
Don't allocate floats and doubles in extended-precision registers
; Nonzero for -fforce-addr: load memory address into a register before
; reference to memory. This makes better cse but slower compilation.
fforce-addr
-Common Report Var(flag_force_addr)
+Common Report Var(flag_force_addr) Optimizer
Copy memory address constants into registers before use
; Nonzero for -fforce-mem: load memory value into a register
; before arithmetic on it. This makes better cse but slower compilation.
fforce-mem
-Common Report Var(flag_force_mem)
+Common Report Var(flag_force_mem) Optimizer
Copy memory operands into registers before use
; Nonzero means don't put addresses of constant functions in registers.
@@ -452,29 +457,29 @@ Common Report Var(flag_function_sections
Place each function into its own section
fgcse
-Common Report Var(flag_gcse)
+Common Report Var(flag_gcse) Optimizer
Perform global common subexpression elimination
fgcse-lm
-Common Report Var(flag_gcse_lm) Init(1)
+Common Report Var(flag_gcse_lm) Init(1) Optimizer
Perform enhanced load motion during global common subexpression elimination
fgcse-sm
-Common Report Var(flag_gcse_sm) Init(0)
+Common Report Var(flag_gcse_sm) Init(0) Optimizer
Perform store motion after global common subexpression elimination
fgcse-las
-Common Report Var(flag_gcse_las) Init(0)
+Common Report Var(flag_gcse_las) Init(0) Optimizer
Perform redundant load after store elimination in global common subexpression
elimination
fgcse-after-reload
-Common Report Var(flag_gcse_after_reload)
+Common Report Var(flag_gcse_after_reload) Optimizer
Perform global common subexpression elimination after register allocation
has finished
fguess-branch-probability
-Common Report Var(flag_guess_branch_prob)
+Common Report Var(flag_guess_branch_prob) Optimizer
Enable guessing of branch probabilities
; Nonzero means ignore `#ident' directives. 0 means handle them.
@@ -486,11 +491,11 @@ Common Report Var(flag_no_ident,0)
Process #ident directives
fif-conversion
-Common Report Var(flag_if_conversion)
+Common Report Var(flag_if_conversion) Optimizer
Perform conversion of conditional jumps to branchless equivalents
fif-conversion2
-Common Report Var(flag_if_conversion2)
+Common Report Var(flag_if_conversion2) Optimizer
Perform conversion of conditional jumps to conditional execution
; -finhibit-size-directive inhibits output of .size for ELF.
@@ -507,15 +512,15 @@ Do not generate .size directives
; only when actually used. Used in conjunction with -g. Also
; does the right thing with #pragma interface.
finline
-Common Report Var(flag_no_inline,0) Init(2)
+Common Report Var(flag_no_inline,0) Init(2) Optimizer
Pay attention to the \"inline\" keyword
finline-functions
-Common Report Var(flag_inline_functions)
+Common Report Var(flag_inline_functions) Optimizer
Integrate simple functions into their callers
finline-functions-called-once
-Common Report Var(flag_inline_functions_called_once) Init(1)
+Common Report Var(flag_inline_functions_called_once) Init(1) Optimizer
Integrate functions called once into their callers
finline-limit-
@@ -530,31 +535,31 @@ Common Report Var(flag_instrument_functi
Instrument function entry and exit with profiling calls
fipa-cp
-Common Report Var(flag_ipa_cp)
+Common Report Var(flag_ipa_cp) Optimizer
Perform Interprocedural constant propagation
fipa-pure-const
-Common Report Var(flag_ipa_pure_const) Init(0)
+Common Report Var(flag_ipa_pure_const) Init(0) Optimizer
Discover pure and const functions
fipa-pta
-Common Report Var(flag_ipa_pta) Init(0)
+Common Report Var(flag_ipa_pta) Init(0) Optimizer
Perform interprocedural points-to analysis
fipa-reference
-Common Report Var(flag_ipa_reference) Init(0)
+Common Report Var(flag_ipa_reference) Init(0) Optimizer
Discover readonly and non addressable static variables
fipa-type-escape
-Common Report Var(flag_ipa_type_escape) Init(0)
+Common Report Var(flag_ipa_type_escape) Init(0) Optimizer
Type based escape and alias analysis
fivopts
-Common Report Var(flag_ivopts) Init(1)
+Common Report Var(flag_ivopts) Init(1) Optimizer
Optimize induction variables on trees
fjump-tables
-Common Var(flag_jump_tables) Init(1)
+Common Var(flag_jump_tables) Init(1) Optimizer
Use jump tables for sufficiently large switch statements
fkeep-inline-functions
@@ -585,11 +590,11 @@ Report on permanent memory allocation
; string constants and constants from constant pool, if 2 also constant
; variables.
fmerge-all-constants
-Common Report Var(flag_merge_constants,2) Init(1)
+Common Report Var(flag_merge_constants,2) Init(1) Optimizer
Attempt to merge identical constants and constant variables
fmerge-constants
-Common Report Var(flag_merge_constants,1) VarExists
+Common Report Var(flag_merge_constants,1) VarExists Optimizer
Attempt to merge identical constants across compilation units
fmessage-length=
@@ -597,11 +602,11 @@ Common RejectNegative Joined UInteger
-fmessage-length=<number> Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping
fmodulo-sched
-Common Report Var(flag_modulo_sched)
+Common Report Var(flag_modulo_sched) Optimizer
Perform SMS based modulo scheduling before the first scheduling pass
fmove-loop-invariants
-Common Report Var(flag_move_loop_invariants) Init(1)
+Common Report Var(flag_move_loop_invariants) Init(1) Optimizer
Move loop invariant computations out of loops
fmudflap
@@ -617,31 +622,31 @@ Common RejectNegative Report Var(flag_mu
Ignore read operations when inserting mudflap instrumentation
freschedule-modulo-scheduled-loops
-Common Report Var(flag_resched_modulo_sched)
+Common Report Var(flag_resched_modulo_sched) Optimizer
Enable/Disable the traditional scheduling in loops that already passed modulo scheduling
fnon-call-exceptions
-Common Report Var(flag_non_call_exceptions)
+Common Report Var(flag_non_call_exceptions) Optimizer
Support synchronous non-call exceptions
fomit-frame-pointer
-Common Report Var(flag_omit_frame_pointer)
+Common Report Var(flag_omit_frame_pointer) Optimizer
When possible do not generate stack frames
foptimize-register-move
-Common Report Var(flag_regmove)
+Common Report Var(flag_regmove) Optimizer
Do the full register move optimization pass
foptimize-sibling-calls
-Common Report Var(flag_optimize_sibling_calls)
+Common Report Var(flag_optimize_sibling_calls) Optimizer
Optimize sibling and tail recursive calls
fpack-struct
-Common Report Var(flag_pack_struct)
+Common Report Var(flag_pack_struct) Optimizer
Pack structure members together without holes
fpack-struct=
-Common RejectNegative Joined UInteger
+Common RejectNegative Joined UInteger Optimizer
-fpack-struct=<number> Set initial maximum structure member alignment
fpcc-struct-return
@@ -649,15 +654,15 @@ Common Report Var(flag_pcc_struct_return
Return small aggregates in memory, not registers
fpeel-loops
-Common Report Var(flag_peel_loops)
+Common Report Var(flag_peel_loops) Optimizer
Perform loop peeling
fpeephole
-Common Report Var(flag_no_peephole,0)
+Common Report Var(flag_no_peephole,0) Optimizer
Enable machine specific peephole optimizations
fpeephole2
-Common Report Var(flag_peephole2)
+Common Report Var(flag_peephole2) Optimizer
Enable an RTL peephole pass before sched2
fPIC
@@ -677,7 +682,7 @@ Common Report Var(flag_pie,1) VarExists
Generate position-independent code for executables if possible (small mode)
fprefetch-loop-arrays
-Common Report Var(flag_prefetch_loop_arrays)
+Common Report Var(flag_prefetch_loop_arrays) Optimizer
Generate prefetch instructions, if available, for arrays in loops
fprofile
@@ -708,31 +713,31 @@ Common Joined RejectNegative
-frandom-seed=<string> Make compile reproducible using <string>
freg-struct-return
-Common Report Var(flag_pcc_struct_return,0) VarExists
+Common Report Var(flag_pcc_struct_return,0) VarExists Optimizer
Return small aggregates in registers
fregmove
-Common Report Var(flag_regmove)
+Common Report Var(flag_regmove) Optimizer
Enables a register move optimization
frename-registers
-Common Report Var(flag_rename_registers) Init(2)
+Common Report Var(flag_rename_registers) Init(2) Optimizer
Perform a register renaming optimization pass
freorder-blocks
-Common Report Var(flag_reorder_blocks)
+Common Report Var(flag_reorder_blocks) Optimizer
Reorder basic blocks to improve code placement
freorder-blocks-and-partition
-Common Report Var(flag_reorder_blocks_and_partition)
+Common Report Var(flag_reorder_blocks_and_partition) Optimizer
Reorder basic blocks and partition into hot and cold sections
freorder-functions
-Common Report Var(flag_reorder_functions)
+Common Report Var(flag_reorder_functions) Optimizer
Reorder functions to improve code placement
frerun-cse-after-loop
-Common Report Var(flag_rerun_cse_after_loop) Init(2)
+Common Report Var(flag_rerun_cse_after_loop) Init(2) Optimizer
Add a common subexpression elimination pass after loop optimizations
frerun-loop-opt
@@ -740,23 +745,23 @@ Common
Does nothing. Preserved for backward compatibility.
frounding-math
-Common Report Var(flag_rounding_math)
+Common Report Var(flag_rounding_math) Optimizer
Disable optimizations that assume default FP rounding behavior
fsched-interblock
-Common Report Var(flag_schedule_interblock) Init(1)
+Common Report Var(flag_schedule_interblock) Init(1) Optimizer
Enable scheduling across basic blocks
fsched-spec
-Common Report Var(flag_schedule_speculative) Init(1)
+Common Report Var(flag_schedule_speculative) Init(1) Optimizer
Allow speculative motion of non-loads
fsched-spec-load
-Common Report Var(flag_schedule_speculative_load)
+Common Report Var(flag_schedule_speculative_load) Optimizer
Allow speculative motion of some loads
fsched-spec-load-dangerous
-Common Report Var(flag_schedule_speculative_load_dangerous)
+Common Report Var(flag_schedule_speculative_load_dangerous) Optimizer
Allow speculative motion of more loads
fsched-verbose=
@@ -764,25 +769,25 @@ Common RejectNegative Joined
-fsched-verbose=<number> Set the verbosity level of the scheduler
fsched2-use-superblocks
-Common Report Var(flag_sched2_use_superblocks)
+Common Report Var(flag_sched2_use_superblocks) Optimizer
If scheduling post reload, do superblock scheduling
fsched2-use-traces
-Common Report Var(flag_sched2_use_traces)
+Common Report Var(flag_sched2_use_traces) Optimizer
If scheduling post reload, do trace scheduling
fschedule-insns
-Common Report Var(flag_schedule_insns)
+Common Report Var(flag_schedule_insns) Optimizer
Reschedule instructions before register allocation
fschedule-insns2
-Common Report Var(flag_schedule_insns_after_reload)
+Common Report Var(flag_schedule_insns_after_reload) Optimizer
Reschedule instructions after register allocation
; sched_stalled_insns means that insns can be moved prematurely from the queue
; of stalled insns into the ready list.
fsched-stalled-insns
-Common Report Var(flag_sched_stalled_insns)
+Common Report Var(flag_sched_stalled_insns) Optimizer
Allow premature scheduling of queued insns
fsched-stalled-insns=
@@ -794,7 +799,7 @@ Common RejectNegative Joined UInteger
; premature removal from the queue of stalled insns into the ready list (has
; an effect only if the flag 'sched_stalled_insns' is set).
fsched-stalled-insns-dep
-Common Report Var(flag_sched_stalled_insns_dep,1) Init(1)
+Common Report Var(flag_sched_stalled_insns_dep,1) Init(1) Optimizer
Set dependence distance checking in premature scheduling of queued insns
fsched-stalled-insns-dep=
@@ -802,11 +807,11 @@ Common RejectNegative Joined UInteger
-fsched-stalled-insns-dep=<number> Set dependence distance checking in premature scheduling of queued insns
fsection-anchors
-Common Report Var(flag_section_anchors)
+Common Report Var(flag_section_anchors) Optimizer
Access data in the same section from shared anchor points
frtl-abstract-sequences
-Common Report Var(flag_rtl_seqabstr)
+Common Report Var(flag_rtl_seqabstr) Optimizer
Perform sequence abstraction optimization on RTL
fshow-column
@@ -814,19 +819,19 @@ Common C ObjC C++ ObjC++ Report Var(flag
Show column numbers in diagnostics, when available. Default on
fsignaling-nans
-Common Report Var(flag_signaling_nans)
+Common Report Var(flag_signaling_nans) Optimizer
Disable optimizations observable by IEEE signaling NaNs
fsingle-precision-constant
-Common Report Var(flag_single_precision_constant)
+Common Report Var(flag_single_precision_constant) Optimizer
Convert floating point constants to single precision constants
fsplit-ivs-in-unroller
-Common Report Var(flag_split_ivs_in_unroller) Init(1)
+Common Report Var(flag_split_ivs_in_unroller) Init(1) Optimizer
Split lifetimes of induction variables when loops are unrolled
fvariable-expansion-in-unroller
-Common Report Var(flag_variable_expansion_in_unroller)
+Common Report Var(flag_variable_expansion_in_unroller) Optimizer
Apply variable expansion when loops are unrolled
; Emit code to probe the stack, to help detect stack overflow; also
@@ -863,7 +868,7 @@ Does nothing. Preserved for backward co
; types do not alias expressions of certain other types. Only used
; if alias analysis (in general) is enabled.
fstrict-aliasing
-Common Report Var(flag_strict_aliasing)
+Common Report Var(flag_strict_aliasing) Optimizer
Assume strict aliasing rules apply
fsyntax-only
@@ -875,7 +880,7 @@ Common Report Var(flag_test_coverage)
Create data files needed by \"gcov\"
fthread-jumps
-Common Report Var(flag_thread_jumps)
+Common Report Var(flag_thread_jumps) Optimizer
Perform jump threading optimizations
ftime-report
@@ -887,7 +892,7 @@ Common Joined RejectNegative
-ftls-model=[global-dynamic|local-dynamic|initial-exec|local-exec] Set the default thread-local storage code generation model
ftoplevel-reorder
-Common Report Var(flag_toplevel_reorder) Init(1)
+Common Report Var(flag_toplevel_reorder) Init(1) Optimizer
Reorder top level functions, variables, and asms
ftracer
@@ -898,118 +903,118 @@ Perform superblock formation via tail du
; (user-visible) trap. This is the case, for example, in nonstop
; IEEE 754 arithmetic.
ftrapping-math
-Common Report Var(flag_trapping_math) Init(1)
+Common Report Var(flag_trapping_math) Init(1) Optimizer
Assume floating-point operations can trap
ftrapv
-Common Report Var(flag_trapv)
+Common Report Var(flag_trapv) Optimizer
Trap for signed overflow in addition, subtraction and multiplication
ftree-ccp
-Common Report Var(flag_tree_ccp)
+Common Report Var(flag_tree_ccp) Optimizer
Enable SSA-CCP optimization on trees
ftree-store-ccp
-Common Report Var(flag_tree_store_ccp)
+Common Report Var(flag_tree_store_ccp) Optimizer
Enable SSA-CCP optimization for stores and loads
ftree-ch
-Common Report Var(flag_tree_ch)
+Common Report Var(flag_tree_ch) Optimizer
Enable loop header copying on trees
ftree-combine-temps
-Common Report Var(flag_tree_combine_temps)
+Common Report Var(flag_tree_combine_temps) Optimizer
Coalesce memory temporaries in the SSA->normal pass
ftree-copyrename
-Common Report Var(flag_tree_copyrename)
+Common Report Var(flag_tree_copyrename) Optimizer
Replace SSA temporaries with better names in copies
ftree-copy-prop
-Common Report Var(flag_tree_copy_prop)
+Common Report Var(flag_tree_copy_prop) Optimizer
Enable copy propagation on trees
ftree-store-copy-prop
-Common Report Var(flag_tree_store_copy_prop)
+Common Report Var(flag_tree_store_copy_prop) Optimizer
Enable copy propagation for stores and loads
ftree-dce
-Common Report Var(flag_tree_dce)
+Common Report Var(flag_tree_dce) Optimizer
Enable SSA dead code elimination optimization on trees
ftree-dominator-opts
-Common Report Var(flag_tree_dom)
+Common Report Var(flag_tree_dom) Optimizer
Enable dominator optimizations
ftree-dse
-Common Report Var(flag_tree_dse)
+Common Report Var(flag_tree_dse) Optimizer
Enable dead store elimination
ftree-fre
-Common Report Var(flag_tree_fre)
+Common Report Var(flag_tree_fre) Optimizer
Enable Full Redundancy Elimination (FRE) on trees
ftree-loop-im
-Common Report Var(flag_tree_loop_im) Init(1)
+Common Report Var(flag_tree_loop_im) Init(1) Optimizer
Enable loop invariant motion on trees
ftree-loop-linear
-Common Report Var(flag_tree_loop_linear)
+Common Report Var(flag_tree_loop_linear) Optimizer
Enable linear loop transforms on trees
ftree-loop-ivcanon
-Common Report Var(flag_tree_loop_ivcanon) Init(1)
+Common Report Var(flag_tree_loop_ivcanon) Init(1) Optimizer
Create canonical induction variables in loops
ftree-loop-optimize
-Common Report Var(flag_tree_loop_optimize) Init(1)
+Common Report Var(flag_tree_loop_optimize) Init(1) Optimizer
Enable loop optimizations on tree level
ftree-pre
-Common Report Var(flag_tree_pre)
+Common Report Var(flag_tree_pre) Optimizer
Enable SSA-PRE optimization on trees
ftree-salias
-Common Report Var(flag_tree_salias)
+Common Report Var(flag_tree_salias) Optimizer
Perform structural alias analysis
ftree-sink
-Common Report Var(flag_tree_sink)
+Common Report Var(flag_tree_sink) Optimizer
Enable SSA code sinking on trees
ftree-sra
-Common Report Var(flag_tree_sra)
+Common Report Var(flag_tree_sra) Optimizer
Perform scalar replacement of aggregates
ftree-ter
-Common Report Var(flag_tree_ter)
+Common Report Var(flag_tree_ter) Optimizer
Replace temporary expressions in the SSA->normal pass
ftree-lrs
-Common Report Var(flag_tree_live_range_split)
+Common Report Var(flag_tree_live_range_split) Optimizer
Perform live range splitting during the SSA->normal pass
ftree-vrp
-Common Report Var(flag_tree_vrp) Init(0)
+Common Report Var(flag_tree_vrp) Init(0) Optimizer
Perform Value Range Propagation on trees
funit-at-a-time
-Common Report Var(flag_unit_at_a_time)
+Common Report Var(flag_unit_at_a_time) Optimizer
Compile whole compilation unit at a time
funroll-loops
-Common Report Var(flag_unroll_loops)
+Common Report Var(flag_unroll_loops) Optimizer
Perform loop unrolling when iteration count is known
funroll-all-loops
-Common Report Var(flag_unroll_all_loops)
+Common Report Var(flag_unroll_all_loops) Optimizer
Perform loop unrolling for all loops
; Nonzero means that loop optimizer may assume that the induction variables
; that control loops do not overflow and that the loops with nontrivial
; exit condition are not infinite
funsafe-loop-optimizations
-Common Report Var(flag_unsafe_loop_optimizations)
+Common Report Var(flag_unsafe_loop_optimizations) Optimizer
Allow loop optimizations to assume that the loops behave in normal way
; Nonzero means that unsafe floating-point math optimizations are allowed
@@ -1017,27 +1022,27 @@ Allow loop optimizations to assume that
; are allowed to assume that their arguments and results are "normal"
; (e.g., nonnegative for SQRT).
funsafe-math-optimizations
-Common Report Var(flag_unsafe_math_optimizations)
+Common Report Var(flag_unsafe_math_optimizations) Optimizer
Allow math optimizations that may violate IEEE or ISO standards
funswitch-loops
-Common Report Var(flag_unswitch_loops)
+Common Report Var(flag_unswitch_loops) Optimizer
Perform loop unswitching
funwind-tables
-Common Report Var(flag_unwind_tables)
+Common Report Var(flag_unwind_tables) Optimizer
Just generate unwind tables for exception handling
fvar-tracking
-Common Report Var(flag_var_tracking) VarExists
+Common Report Var(flag_var_tracking) VarExists Optimizer
Perform variable tracking
ftree-vectorize
-Common Report Var(flag_tree_vectorize)
+Common Report Var(flag_tree_vectorize) Optimizer
Enable loop vectorization on trees
ftree-vect-loop-version
-Common Report Var(flag_tree_vect_loop_version) Init(1)
+Common Report Var(flag_tree_vect_loop_version) Init(1) Optimizer
Enable loop versioning when doing loop vectorization on trees
ftree-vectorizer-verbose=
@@ -1060,19 +1065,19 @@ Common Joined RejectNegative
fvpt
-Common Report Var(flag_value_profile_transformations)
+Common Report Var(flag_value_profile_transformations) Optimizer
Use expression value profiles in optimizations
fweb
-Common Report Var(flag_web) Init(2)
+Common Report Var(flag_web) Init(2) Optimizer
Construct webs and split unrelated uses of single variable
fwhole-program
-Common Report Var(flag_whole_program) Init(0)
+Common Report Var(flag_whole_program) Init(0) Optimizer
Perform whole program optimizations
fwrapv
-Common Report Var(flag_wrapv)
+Common Report Var(flag_wrapv) Optimizer
Assume signed arithmetic overflow wraps around
fzero-initialized-in-bss
Index: gcc/opt-functions.awk
===================================================================
--- gcc/opt-functions.awk (revision 113452)
+++ gcc/opt-functions.awk (working copy)
@@ -77,7 +77,8 @@ function switch_flags (flags)
test_flag("RejectNegative", flags, " | CL_REJECT_NEGATIVE") \
test_flag("UInteger", flags, " | CL_UINTEGER") \
test_flag("Undocumented", flags, " | CL_UNDOCUMENTED") \
- test_flag("Report", flags, " | CL_REPORT")
+ test_flag("Report", flags, " | CL_REPORT") \
+ test_flag("Optimizer", flags, " | CL_OPTIMIZER")
sub( "^0 \\| ", "", result )
return result
}
Index: htdocs/gcc-4.2/changes.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/gcc-4.2/changes.html,v
retrieving revision 1.9
diff -c -3 -p -r1.9 changes.html
*** htdocs/gcc-4.2/changes.html 11 Apr 2006 22:28:43 -0000 1.9
--- htdocs/gcc-4.2/changes.html 2 May 2006 15:35:29 -0000
***************
*** 15,20 ****
--- 15,61 ----
<h2>General Optimizer Improvements</h2>
+ <ul>
+ <li>
+ A new command line option <code>--optimizers-help</code> has been added
+ to GCC. This option lists the set of command line options that enable
+ optimizations and which have not yet been enabled by previous options on the
+ command line. Thus for example an external tool which wanted to find out
+ which optimization switches are supported by GCC could invoke:
+
+ <pre>
+ gcc --optimizers-help
+ </pre>
+
+ to get this list. If the list is being read by a human instead of being
+ parsed by a tool the <code>-Q</code> switch can be added to get a more
+ descriptive output:
+
+ <pre>
+ gcc -Q --optimizers-help
+ </pre>
+
+ A more sophisticated example involves discovering which optimizations
+ supported by GCC but which have to be explicitly mentioned on the command
+ line:
+
+ <pre>
+ gcc -O3 --optimizers-help
+ </pre>
+
+ Alternatively it is possible to discover which optimizations are enabled
+ at a specific optimization level. For example to see the list of
+ optimizations enabled at -O3 use:
+
+ <pre>
+ gcc -O3 --optimizers-help > /tmp/O3-opts
+ gcc -O2 --optimizers-help > /tmp/O2-opts
+ diff /tmp/O2-opts /tmp/O3-opts
+ </pre>
+
+ </li>
+ </ul>
+
<h2>New Languages and Language specific improvements</h2>
<h3>C family</h3>