diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:17:29 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:17:29 +0000 |
commit | 59b5118623ad2e755fbb16b03f2ea122bceebdd2 (patch) | |
tree | d8a02d6a9315b50f067bce1643d4b753a588251f /gcc/expr.c | |
parent | 5e4e37bff76a3fbaf4f6e18a343f7c484eeb642e (diff) | |
download | gcc-59b5118623ad2e755fbb16b03f2ea122bceebdd2.zip gcc-59b5118623ad2e755fbb16b03f2ea122bceebdd2.tar.gz gcc-59b5118623ad2e755fbb16b03f2ea122bceebdd2.tar.bz2 |
[51/77] Use opt_scalar_int_mode when iterating over integer modes
This patch uses opt_scalar_int_mode rather than machine_mode
when iterating over scalar_int_modes, in cases where that helps
with future patches. (Using machine_mode is still OK in places
that don't really care about the mode being a scalar integer.)
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* cse.c (cse_insn): Use opt_scalar_int_mode for the mode iterator.
* explow.c (hard_function_value): Likewise.
* expmed.c (extract_fixed_bit_field_1): Likewise. Move the
convert_to_mode call outside the loop.
* expr.c (alignment_for_piecewise_move): Use opt_scalar_int_mode
for the mode iterator. Require the mode specified by max_pieces
to exist.
(emit_block_move_via_movmem): Use opt_scalar_int_mode for the
mode iterator.
(copy_blkmode_to_reg): Likewise.
(set_storage_via_setmem): Likewise.
* optabs.c (prepare_cmp_insn): Likewise.
* rtlanal.c (init_num_sign_bit_copies_in_rep): Likewise.
* stor-layout.c (finish_bitfield_representative): Likewise.
gcc/fortran/
* trans-types.c (gfc_init_kinds): Use opt_scalar_int_mode for
the mode iterator.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251503
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -699,18 +699,18 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp) static unsigned int alignment_for_piecewise_move (unsigned int max_pieces, unsigned int align) { - machine_mode tmode; + scalar_int_mode tmode + = int_mode_for_size (max_pieces * BITS_PER_UNIT, 1).require (); - tmode = mode_for_size (max_pieces * BITS_PER_UNIT, MODE_INT, 1); if (align >= GET_MODE_ALIGNMENT (tmode)) align = GET_MODE_ALIGNMENT (tmode); else { - machine_mode tmode, xmode; - - xmode = NARROWEST_INT_MODE; - FOR_EACH_MODE_IN_CLASS (tmode, MODE_INT) + scalar_int_mode xmode = NARROWEST_INT_MODE; + opt_scalar_int_mode mode_iter; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) { + tmode = mode_iter.require (); if (GET_MODE_SIZE (tmode) > max_pieces || SLOW_UNALIGNED_ACCESS (tmode, align)) break; @@ -1707,7 +1707,6 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align, unsigned HOST_WIDE_INT probable_max_size) { int save_volatile_ok = volatile_ok; - machine_mode mode; if (expected_align < align) expected_align = align; @@ -1726,8 +1725,10 @@ emit_block_move_via_movmem (rtx x, rtx y, rtx size, unsigned int align, including more than one in the machine description unless the more limited one has some advantage. */ - FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) + opt_scalar_int_mode mode_iter; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) { + scalar_int_mode mode = mode_iter.require (); enum insn_code code = direct_optab_handler (movmem_optab, mode); if (code != CODE_FOR_nothing @@ -2791,13 +2792,13 @@ copy_blkmode_to_reg (machine_mode mode, tree src) { /* Find the smallest integer mode large enough to hold the entire structure. */ - FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) - /* Have we found a large enough mode? */ - if (GET_MODE_SIZE (mode) >= bytes) + opt_scalar_int_mode mode_iter; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) + if (GET_MODE_SIZE (mode_iter.require ()) >= bytes) break; /* A suitable mode should have been found. */ - gcc_assert (mode != VOIDmode); + mode = mode_iter.require (); } if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (word_mode)) @@ -3035,8 +3036,6 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align, including more than one in the machine description unless the more limited one has some advantage. */ - machine_mode mode; - if (expected_align < align) expected_align = align; if (expected_size != -1) @@ -3047,8 +3046,10 @@ set_storage_via_setmem (rtx object, rtx size, rtx val, unsigned int align, expected_size = min_size; } - FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) + opt_scalar_int_mode mode_iter; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) { + scalar_int_mode mode = mode_iter.require (); enum insn_code code = direct_optab_handler (setmem_optab, mode); if (code != CODE_FOR_nothing |