diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:09:10 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:09:10 +0000 |
commit | e386a52f70c47499fff14a338fe17df691e886e2 (patch) | |
tree | bf21dc05503e220cd0d838c391f028ef314c252b /gcc/dwarf2out.c | |
parent | 490d0f6c91c0c4fef57a5ffe438629b0687113de (diff) | |
download | gcc-e386a52f70c47499fff14a338fe17df691e886e2.zip gcc-e386a52f70c47499fff14a338fe17df691e886e2.tar.gz gcc-e386a52f70c47499fff14a338fe17df691e886e2.tar.bz2 |
[7/77] Add scalar_float_mode
This patch adds a scalar_float_mode class, which wraps a mode enum
that is known to satisfy SCALAR_FLOAT_MODE_P. Things like "SFmode"
now give a scalar_float_mode object instead of a machine_mode.
This in turn needs a change to the real.h format_helper, so that
it can accept both machine_modes and scalar_float_modes.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* coretypes.h (scalar_float_mode): New type.
* machmode.h (mode_traits::from_int): Use machine_mode if
USE_ENUM_MODES is defined.
(is_a): New function.
(as_a): Likewise.
(dyn_cast): Likewise.
(scalar_float_mode): New class.
(scalar_float_mode::includes_p): New function.
(is_float_mode): Likewise.
* gdbhooks.py (MachineModePrinter): New class.
(build_pretty_printer): Use it for scalar_float_mode.
* real.h (FLOAT_MODE_FORMAT): Use as_a <scalar_float_mode>.
(format_helper::format_helper): Turn into a template.
* genmodes.c (get_mode_class): New function.
(emit_insn_modes_h): Give modes the class returned by get_mode_class,
or machine_mode if none.
* config/aarch64/aarch64.c (aarch64_simd_valid_immediate): Use
as_a <scalar_float_mode>.
* dwarf2out.c (mem_loc_descriptor): Likewise.
(insert_float): Likewise.
(add_const_value_attribute): Likewise.
* simplify-rtx.c (simplify_immed_subreg): Likewise.
* optabs.c (expand_absneg_bit): Take a scalar_float_mode.
(expand_unop): Update accordingly.
(expand_abs_nojump): Likewise.
(expand_copysign_absneg): Take a scalar_float_mode.
(expand_copysign_bit): Likewise.
(expand_copysign): Update accordingly.
gcc/ada/
* gcc-interface/utils.c (gnat_type_for_mode): Use is_a
<scalar_float_mode> instead of SCALAR_FLOAT_MODE_P.
gcc/go/
* go-lang.c (go_langhook_type_for_mode): Use is_float_mode.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251458
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r-- | gcc/dwarf2out.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index e17b58a..aafacf4 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -15324,7 +15324,8 @@ mem_loc_descriptor (rtx rtl, machine_mode mode, else #endif { - unsigned int length = GET_MODE_SIZE (mode); + scalar_float_mode float_mode = as_a <scalar_float_mode> (mode); + unsigned int length = GET_MODE_SIZE (float_mode); unsigned char *array = ggc_vec_alloc<unsigned char> (length); insert_float (rtl, array); @@ -18621,11 +18622,12 @@ insert_float (const_rtx rtl, unsigned char *array) { long val[4]; int i; + scalar_float_mode mode = as_a <scalar_float_mode> (GET_MODE (rtl)); - real_to_target (val, CONST_DOUBLE_REAL_VALUE (rtl), GET_MODE (rtl)); + real_to_target (val, CONST_DOUBLE_REAL_VALUE (rtl), mode); /* real_to_target puts 32-bit pieces in each long. Pack them. */ - for (i = 0; i < GET_MODE_SIZE (GET_MODE (rtl)) / 4; i++) + for (i = 0; i < GET_MODE_SIZE (mode) / 4; i++) { insert_int (val[i], 4, array); array += 4; @@ -18669,21 +18671,19 @@ add_const_value_attribute (dw_die_ref die, rtx rtl) floating-point constant. A CONST_DOUBLE is used whenever the constant requires more than one word in order to be adequately represented. */ - { - machine_mode mode = GET_MODE (rtl); - - if (TARGET_SUPPORTS_WIDE_INT == 0 && !SCALAR_FLOAT_MODE_P (mode)) - add_AT_double (die, DW_AT_const_value, - CONST_DOUBLE_HIGH (rtl), CONST_DOUBLE_LOW (rtl)); - else - { - unsigned int length = GET_MODE_SIZE (mode); - unsigned char *array = ggc_vec_alloc<unsigned char> (length); + if (TARGET_SUPPORTS_WIDE_INT == 0 + && !SCALAR_FLOAT_MODE_P (GET_MODE (rtl))) + add_AT_double (die, DW_AT_const_value, + CONST_DOUBLE_HIGH (rtl), CONST_DOUBLE_LOW (rtl)); + else + { + scalar_float_mode mode = as_a <scalar_float_mode> (GET_MODE (rtl)); + unsigned int length = GET_MODE_SIZE (mode); + unsigned char *array = ggc_vec_alloc<unsigned char> (length); - insert_float (rtl, array); - add_AT_vec (die, DW_AT_const_value, length / 4, 4, array); - } - } + insert_float (rtl, array); + add_AT_vec (die, DW_AT_const_value, length / 4, 4, array); + } return true; case CONST_VECTOR: |