invoke.texi: Document -Ofast.

2010-05-25  Richard Guenther  <rguenther@suse.de>

	* doc/invoke.texi: Document -Ofast.
	* target.h (struct gcc_target): Add handle_ofast.
	* target-def.h (TARGET_HANDLE_OFAST): Add.
	(TARGET_INITIALIZER): Adjust.
	* opts.c (decode_options): Handle -Ofast.  Enable
	-ffast-math with it.
	* common.opt (Ofast): Add.

From-SVN: r159815
This commit is contained in:
Richard Guenther 2010-05-25 09:43:59 +00:00 committed by Richard Biener
parent ac5eda130d
commit be6d3f0e89
6 changed files with 50 additions and 2 deletions

View File

@ -1,3 +1,13 @@
2010-05-25 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi: Document -Ofast.
* target.h (struct gcc_target): Add handle_ofast.
* target-def.h (TARGET_HANDLE_OFAST): Add.
(TARGET_INITIALIZER): Adjust.
* opts.c (decode_options): Handle -Ofast. Enable
-ffast-math with it.
* common.opt (Ofast): Add.
2010-05-25 Paolo Bonzini <bonzini@gnu.org>
* doc/tm.texi (STORE_FLAG_VALUE): Do not refer to sCC patterns.

View File

@ -69,6 +69,10 @@ Os
Common Optimization
Optimize for space rather than speed
Ofast
Common Optimization
Optimize for speed disregarding exact standards compliance
W
Common RejectNegative Var(extra_warnings) Warning
This switch is deprecated; use -Wextra instead

View File

@ -393,7 +393,7 @@ Objective-C and Objective-C++ Dialects}.
-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
-fwhole-program -fwhopr[=@var{n}] -fwpa -fuse-linker-plugin @gol
--param @var{name}=@var{value}
-O -O0 -O1 -O2 -O3 -Os}
-O -O0 -O1 -O2 -O3 -Os -Ofast}
@item Preprocessor Options
@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
@ -5891,6 +5891,13 @@ optimizations designed to reduce code size.
-falign-labels -freorder-blocks -freorder-blocks-and-partition @gol
-fprefetch-loop-arrays -ftree-vect-loop-version}
@item -Ofast
@opindex Ofast
Disregard strict standards compliance. @option{-Ofast} enables all
@option{-O3} optimizations. It also enables optimizations that are not
valid for all standard compliant programs.
It turns on @option{-ffast-math}.
If you use multiple @option{-O} options, with or without level numbers,
the last such option is the one that is effective.
@end table

View File

@ -63,7 +63,7 @@ bool warn_larger_than;
HOST_WIDE_INT larger_than_size;
/* True to warn about any function whose frame size is larger
* than N bytes. */
than N bytes. */
bool warn_frame_larger_than;
HOST_WIDE_INT frame_larger_than_size;
@ -804,6 +804,7 @@ decode_options (unsigned int argc, const char **argv)
int opt2;
int opt3;
int opt1_max;
int ofast = 0;
if (first_time_p)
{
@ -831,6 +832,7 @@ decode_options (unsigned int argc, const char **argv)
{
optimize = 1;
optimize_size = 0;
ofast = 0;
}
else if (argv[i][0] == '-' && argv[i][1] == 'O')
{
@ -843,6 +845,14 @@ decode_options (unsigned int argc, const char **argv)
/* Optimizing for size forces optimize to be 2. */
optimize = 2;
ofast = 0;
}
else if (strcmp (p, "fast") == 0)
{
/* -Ofast only adds flags to -O3. */
optimize_size = 0;
optimize = 3;
ofast = 1;
}
else
{
@ -853,6 +863,7 @@ decode_options (unsigned int argc, const char **argv)
if ((unsigned int) optimize > 255)
optimize = 255;
optimize_size = 0;
ofast = 0;
}
}
}
@ -967,6 +978,17 @@ decode_options (unsigned int argc, const char **argv)
else
set_param_value ("min-crossjump-insns", initial_min_crossjump_insns);
/* -Ofast adds optimizations to -O3. */
if (ofast)
{
/* Which is -ffast-math for now. */
set_fast_math_flags (1);
/* Allow targets to enable extra options with -Ofast
before general options processing so disabling them
again afterwards works. */
targetm.handle_ofast ();
}
/* Enable -Werror=coverage-mismatch by default */
enable_warning_as_error("coverage-mismatch", 1, lang_mask);

View File

@ -431,6 +431,7 @@
#define TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE hook_void_void
#define TARGET_HANDLE_OPTION hook_bool_size_t_constcharptr_int_true
#define TARGET_HANDLE_OFAST hook_void_void
#define TARGET_HELP NULL
/* In except.c */
@ -939,6 +940,7 @@
TARGET_DEFAULT_TARGET_FLAGS, \
TARGET_OVERRIDE_OPTIONS_AFTER_CHANGE, \
TARGET_HANDLE_OPTION, \
TARGET_HANDLE_OFAST, \
TARGET_HELP, \
TARGET_EH_RETURN_FILTER_MODE, \
TARGET_LIBGCC_CMP_RETURN_MODE, \

View File

@ -531,6 +531,9 @@ struct gcc_target
form was. Return true if the switch was valid. */
bool (* handle_option) (size_t code, const char *arg, int value);
/* Handle target-specific parts of specifying -Ofast. */
void (* handle_ofast) (void);
/* Display extra, target specific information in response to a
--target-help switch. */
void (* target_help) (void);