common.opt (fcx-limited-range): Add SetByCombined flag.
* common.opt (fcx-limited-range): Add SetByCombined flag. (ffinite-math-only, fmath-errno, frounding-math): Likewise. (fsignaling-nans, fsigned-zeros, ftrapping-math): Likewise. (fassociative-math, freciprocal-math): Likewise. (funsafe-math-optimizations): Likewise. * opth-gen.awk: Handle SetByCombined. * optc-gen.awk: Likewise. * opts.c (set_fast_math_flags): Don't override flag if set by frontend. (set_unsafe_math_optimizations_flags): Likewise. * doc/options.texi (Option properties): Document SetByCombined. From-SVN: r169930
This commit is contained in:
parent
32243d4670
commit
5e46b0c65b
6 changed files with 76 additions and 26 deletions
|
@ -1,3 +1,17 @@
|
|||
2011-02-08 Ian Lance Taylor <iant@google.com>
|
||||
|
||||
* common.opt (fcx-limited-range): Add SetByCombined flag.
|
||||
(ffinite-math-only, fmath-errno, frounding-math): Likewise.
|
||||
(fsignaling-nans, fsigned-zeros, ftrapping-math): Likewise.
|
||||
(fassociative-math, freciprocal-math): Likewise.
|
||||
(funsafe-math-optimizations): Likewise.
|
||||
* opth-gen.awk: Handle SetByCombined.
|
||||
* optc-gen.awk: Likewise.
|
||||
* opts.c (set_fast_math_flags): Don't override flag if set by
|
||||
frontend.
|
||||
(set_unsafe_math_optimizations_flags): Likewise.
|
||||
* doc/options.texi (Option properties): Document SetByCombined.
|
||||
|
||||
2011-02-08 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* config.gcc (arc-*, alpha*-*-gnu*, arm*-*-netbsd*, arm-*-pe*,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
; Options for the language- and target-independent parts of the compiler.
|
||||
|
||||
; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
; Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
; Free Software Foundation, Inc.
|
||||
;
|
||||
; This file is part of GCC.
|
||||
|
@ -878,7 +878,7 @@ Common Ignore
|
|||
Does nothing. Preserved for backward compatibility.
|
||||
|
||||
fcx-limited-range
|
||||
Common Report Var(flag_cx_limited_range) Optimization
|
||||
Common Report Var(flag_cx_limited_range) Optimization SetByCombined
|
||||
Omit range reduction step when performing complex division
|
||||
|
||||
fcx-fortran-rules
|
||||
|
@ -1024,7 +1024,7 @@ ffast-math
|
|||
Common
|
||||
|
||||
ffinite-math-only
|
||||
Common Report Var(flag_finite_math_only) Optimization
|
||||
Common Report Var(flag_finite_math_only) Optimization SetByCombined
|
||||
Assume no NaNs or infinities are generated
|
||||
|
||||
ffixed-
|
||||
|
@ -1340,7 +1340,7 @@ Common Report Var(flag_lto_report) Init(0) Optimization
|
|||
Report various link-time optimization statistics
|
||||
|
||||
fmath-errno
|
||||
Common Report Var(flag_errno_math) Init(1) Optimization
|
||||
Common Report Var(flag_errno_math) Init(1) Optimization SetByCombined
|
||||
Set errno after built-in math functions
|
||||
|
||||
fmax-errors=
|
||||
|
@ -1577,7 +1577,7 @@ Common Ignore
|
|||
Does nothing. Preserved for backward compatibility.
|
||||
|
||||
frounding-math
|
||||
Common Report Var(flag_rounding_math) Optimization
|
||||
Common Report Var(flag_rounding_math) Optimization SetByCombined
|
||||
Disable optimizations that assume default FP rounding behavior
|
||||
|
||||
fsched-interblock
|
||||
|
@ -1706,11 +1706,11 @@ Common Report Var(flag_show_column) Init(1)
|
|||
Show column numbers in diagnostics, when available. Default on
|
||||
|
||||
fsignaling-nans
|
||||
Common Report Var(flag_signaling_nans) Optimization
|
||||
Common Report Var(flag_signaling_nans) Optimization SetByCombined
|
||||
Disable optimizations observable by IEEE signaling NaNs
|
||||
|
||||
fsigned-zeros
|
||||
Common Report Var(flag_signed_zeros) Init(1) Optimization
|
||||
Common Report Var(flag_signed_zeros) Init(1) Optimization SetByCombined
|
||||
Disable floating point optimizations that ignore the IEEE signedness of zero
|
||||
|
||||
fsingle-precision-constant
|
||||
|
@ -1827,7 +1827,7 @@ Perform superblock formation via tail duplication
|
|||
; (user-visible) trap. This is the case, for example, in nonstop
|
||||
; IEEE 754 arithmetic.
|
||||
ftrapping-math
|
||||
Common Report Var(flag_trapping_math) Init(1) Optimization
|
||||
Common Report Var(flag_trapping_math) Init(1) Optimization SetByCombined
|
||||
Assume floating-point operations can trap
|
||||
|
||||
ftrapv
|
||||
|
@ -1978,12 +1978,12 @@ Common Report Var(flag_unsafe_loop_optimizations) Optimization
|
|||
Allow loop optimizations to assume that the loops behave in normal way
|
||||
|
||||
fassociative-math
|
||||
Common Report Var(flag_associative_math)
|
||||
Common Report Var(flag_associative_math) SetByCombined
|
||||
Allow optimization for floating-point arithmetic which may change the
|
||||
result of the operation due to rounding.
|
||||
|
||||
freciprocal-math
|
||||
Common Report Var(flag_reciprocal_math)
|
||||
Common Report Var(flag_reciprocal_math) SetByCombined
|
||||
Same as -fassociative-math for expressions which include division.
|
||||
|
||||
; Nonzero means that unsafe floating-point math optimizations are allowed
|
||||
|
@ -1991,7 +1991,7 @@ Same as -fassociative-math for expressions which include division.
|
|||
; 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) Optimization
|
||||
Common Report Var(flag_unsafe_math_optimizations) Optimization SetByCombined
|
||||
Allow math optimizations that may violate IEEE or ISO standards
|
||||
|
||||
funswitch-loops
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@c Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
@c Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
@c Free Software Foundation, Inc.
|
||||
@c This is part of the GCC manual.
|
||||
@c For copying conditions, see the file gcc.texi.
|
||||
|
@ -436,4 +436,17 @@ the @option{--help} output.
|
|||
Build the @code{cl_target_option} structure to hold a copy of the
|
||||
option, add the functions @code{cl_target_option_save} and
|
||||
@code{cl_target_option_restore} to save and restore the options.
|
||||
|
||||
@item SetByCombined
|
||||
The option may also be set by a combined option such as
|
||||
@option{-ffast-math}. This causes the @code{gcc_options} struct to
|
||||
have a field @code{frontend_set_@var{name}}, where @code{@var{name}}
|
||||
is the name of the field holding the value of this option (without the
|
||||
leading @code{x_}). This gives the front end a way to indicate that
|
||||
the value has been set explicitly and should not be changed by the
|
||||
combined option. For example, some front ends use this to prevent
|
||||
@option{-ffast-math} and @option{-fno-fast-math} from changing the
|
||||
value of @option{-fmath-errno} for languages that do not use
|
||||
@code{errno}.
|
||||
|
||||
@end table
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010
|
||||
# Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
|
||||
# Free Software Foundation, Inc.
|
||||
# Contributed by Kelley Cook, June 2004.
|
||||
# Original code from Neil Booth, May 2003.
|
||||
|
@ -250,6 +250,10 @@ for (i = 0; i < n_opts; i++) {
|
|||
print "#undef x_" name
|
||||
}
|
||||
}
|
||||
for (i = 0; i < n_opts; i++) {
|
||||
if (flag_set_p("SetByCombined", flags[i]))
|
||||
print " false, /* frontend_set_" var_name(flags[i]) " */"
|
||||
}
|
||||
print "};"
|
||||
print ""
|
||||
print "struct gcc_options global_options;"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (C) 2003,2004,2005,2006,2007,2008, 2010
|
||||
# Copyright (C) 2003,2004,2005,2006,2007,2008, 2010, 2011
|
||||
# Free Software Foundation, Inc.
|
||||
# Contributed by Kelley Cook, June 2004.
|
||||
# Original code from Neil Booth, May 2003.
|
||||
|
@ -193,6 +193,13 @@ for (i = 0; i < n_opts; i++) {
|
|||
print "#endif"
|
||||
}
|
||||
}
|
||||
for (i = 0; i < n_opts; i++) {
|
||||
if (flag_set_p("SetByCombined", flags[i])) {
|
||||
print "#ifndef GENERATOR_FILE"
|
||||
print " bool frontend_set_" var_name(flags[i]) ";"
|
||||
print "#endif"
|
||||
}
|
||||
}
|
||||
print "#ifndef GENERATOR_FILE"
|
||||
print "};"
|
||||
print "extern struct gcc_options global_options;"
|
||||
|
|
36
gcc/opts.c
36
gcc/opts.c
|
@ -1,5 +1,5 @@
|
|||
/* Command line option handling.
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Neil Booth.
|
||||
|
||||
|
@ -1757,15 +1757,23 @@ set_Wstrict_aliasing (struct gcc_options *opts, int onoff)
|
|||
static void
|
||||
set_fast_math_flags (struct gcc_options *opts, int set)
|
||||
{
|
||||
opts->x_flag_unsafe_math_optimizations = set;
|
||||
set_unsafe_math_optimizations_flags (opts, set);
|
||||
opts->x_flag_finite_math_only = set;
|
||||
opts->x_flag_errno_math = !set;
|
||||
if (!opts->frontend_set_flag_unsafe_math_optimizations)
|
||||
{
|
||||
opts->x_flag_unsafe_math_optimizations = set;
|
||||
set_unsafe_math_optimizations_flags (opts, set);
|
||||
}
|
||||
if (!opts->frontend_set_flag_finite_math_only)
|
||||
opts->x_flag_finite_math_only = set;
|
||||
if (!opts->frontend_set_flag_errno_math)
|
||||
opts->x_flag_errno_math = !set;
|
||||
if (set)
|
||||
{
|
||||
opts->x_flag_signaling_nans = 0;
|
||||
opts->x_flag_rounding_math = 0;
|
||||
opts->x_flag_cx_limited_range = 1;
|
||||
if (!opts->frontend_set_flag_signaling_nans)
|
||||
opts->x_flag_signaling_nans = 0;
|
||||
if (!opts->frontend_set_flag_rounding_math)
|
||||
opts->x_flag_rounding_math = 0;
|
||||
if (!opts->frontend_set_flag_cx_limited_range)
|
||||
opts->x_flag_cx_limited_range = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1774,10 +1782,14 @@ set_fast_math_flags (struct gcc_options *opts, int set)
|
|||
static void
|
||||
set_unsafe_math_optimizations_flags (struct gcc_options *opts, int set)
|
||||
{
|
||||
opts->x_flag_trapping_math = !set;
|
||||
opts->x_flag_signed_zeros = !set;
|
||||
opts->x_flag_associative_math = set;
|
||||
opts->x_flag_reciprocal_math = set;
|
||||
if (!opts->frontend_set_flag_trapping_math)
|
||||
opts->x_flag_trapping_math = !set;
|
||||
if (!opts->frontend_set_flag_signed_zeros)
|
||||
opts->x_flag_signed_zeros = !set;
|
||||
if (!opts->frontend_set_flag_associative_math)
|
||||
opts->x_flag_associative_math = set;
|
||||
if (!opts->frontend_set_flag_reciprocal_math)
|
||||
opts->x_flag_reciprocal_math = set;
|
||||
}
|
||||
|
||||
/* Return true iff flags in OPTS are set as if -ffast-math. */
|
||||
|
|
Loading…
Add table
Reference in a new issue