diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:09:48 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:09:48 +0000 |
commit | 5c20c4af29da29d2bb74b1fdf3c116f564431878 (patch) | |
tree | 7e03f2635a9fe715b2717872ffe1afc0cc1cfde8 /gcc/fortran/trans-types.c | |
parent | 857c7b46875bdcf9d889543baad54977034d57ef (diff) | |
download | gcc-5c20c4af29da29d2bb74b1fdf3c116f564431878.zip gcc-5c20c4af29da29d2bb74b1fdf3c116f564431878.tar.gz gcc-5c20c4af29da29d2bb74b1fdf3c116f564431878.tar.bz2 |
[12/77] Use opt_scalar_float_mode when iterating over float modes
This means that we know when accessing the modes that the size is
a compile-time constant, even for SVE. It also enables stricter
type safety in later patches.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* machmode.h (mode_iterator::start): Provide overload for opt_modes.
(mode_iterator::iterate_p): Likewise.
(mode_iterator::get_wider): Likewise.
* expr.c (init_expr_target): Use opt_scalar_float_mode.
gcc/ada/
* gcc-interface/misc.c (fp_prec_to_size): Use opt_scalar_float_mode.
(fp_size_to_prec): Likewise.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Use opt_scalar_float_mode.
gcc/fortran/
* trans-types.c (gfc_init_kinds): Use opt_scalar_float_mode
and FOR_EACH_MODE_IN_CLASS.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251464
Diffstat (limited to 'gcc/fortran/trans-types.c')
-rw-r--r-- | gcc/fortran/trans-types.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 7d2d274..282218f 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -364,6 +364,7 @@ void gfc_init_kinds (void) { machine_mode mode; + opt_scalar_float_mode float_mode_iter; int i_index, r_index, kind; bool saw_i4 = false, saw_i8 = false; bool saw_r4 = false, saw_r8 = false, saw_r10 = false, saw_r16 = false; @@ -419,11 +420,11 @@ gfc_init_kinds (void) /* Set the maximum integer kind. Used with at least BOZ constants. */ gfc_max_integer_kind = gfc_integer_kinds[i_index - 1].kind; - for (r_index = 0, mode = MIN_MODE_FLOAT; mode <= MAX_MODE_FLOAT; - mode = (machine_mode) ((int) mode + 1)) + r_index = 0; + FOR_EACH_MODE_IN_CLASS (float_mode_iter, MODE_FLOAT) { - const struct real_format *fmt = - REAL_MODE_FORMAT (mode); + scalar_float_mode mode = float_mode_iter.require (); + const struct real_format *fmt = REAL_MODE_FORMAT (mode); int kind; if (fmt == NULL) @@ -434,8 +435,7 @@ gfc_init_kinds (void) /* Only let float, double, long double and __float128 go through. Runtime support for others is not provided, so they would be useless. */ - if (!targetm.libgcc_floating_mode_supported_p ((machine_mode) - mode)) + if (!targetm.libgcc_floating_mode_supported_p (mode)) continue; if (mode != TYPE_MODE (float_type_node) && (mode != TYPE_MODE (double_type_node)) |