Add a fixed_size_mode class

Programming / Compilers / GCC - rsandifo [138bc75d-0d04-0410-961f-82ee72b054a4] - 1 November 2017 11:49 EDT

This patch adds a fixed_size_mode machine_mode wrapper for modes that are known to have a fixed size. That applies to all current modes, but future patches will add support for
variable-sized modes.

The use of this class should be pretty restricted. One important use case is to hold the mode of static data, which can never be
variable-sized with current file formats. Another is to hold the modes of registers involved in __builtin_apply and __builtin_result, since those interfaces don't cope well with
variable-sized data.

The class can also be useful when reinterpreting the contents of a fixed-length bit string as a different kind of value.

2017-11-01 Richard Sandiford Alan Hayward David Sherwood

gcc/
- machmode.h (fixed_size_mode): New class.
- rtl.h (get_pool_mode): Return fixed_size_mode.
- gengtype.c (main): Add fixed_size_mode.
- target.def (get_raw_result_mode): Return a fixed_size_mode. (get_raw_arg_mode): Likewise.
- doc/tm.texi: Regenerate.
- targhooks.h (default_get_reg_raw_mode): Return a fixed_size_mode.
- targhooks.c (default_get_reg_raw_mode): Likewise.
- config/ia64/ia64.c (ia64_get_reg_raw_mode): Likewise.
- config/mips/mips.c (mips_get_reg_raw_mode): Likewise.
- config/msp430/msp430.c (msp430_get_raw_arg_mode): Likewise. (msp430_get_raw_result_mode): Likewise.
- config/avr/avr-protos.h (regmask): Use as_a
- dbxout.c (dbxout_parms): Require fixed-size modes.
- expr.c (copy_blkmode_from_reg, copy_blkmode_to_reg): Likewise.
- gimple-ssa-store-merging.c (encode_tree_to_bitpos): Likewise.
- omp-low.c (lower_oacc_reductions): Likewise.
- simplify-rtx.c (simplify_immed_subreg): Take fixed_size_modes. (simplify_subreg): Update accordingly.
- varasm.c (constant_descriptor_rtx::mode): Change to fixed_size_mode. (force_const_mem): Update accordingly. Return NULL_RTX for modes that aren't fixed-size. (get_pool_mode): Return a fixed_size_mode. (output_constant_pool_2): Take a fixed_size_mode.

d2401312be0 Add a fixed_size_mode class
gcc/ChangeLog | 29 +++++++++++++++++++++++++++++
gcc/config/avr/avr-protos.h | 2 +-
gcc/config/ia64/ia64.c | 4 ++--
gcc/config/mips/mips.c | 3 +--
gcc/config/msp430/msp430.c | 7 ++++---
gcc/dbxout.c | 13 ++++++++-----
gcc/doc/tm.texi | 4 ++--
gcc/expr.c | 15 +++++++++------
gcc/gengtype.c | 1 +
gcc/gimple-ssa-store-merging.c | 5 ++++-
gcc/machmode.h | 33 +++++++++++++++++++++++++++++++++
gcc/omp-low.c | 6 ++++--
gcc/rtl.h | 2 +-
gcc/simplify-rtx.c | 19 ++++++++++++++-----
gcc/target.def | 4 ++--
gcc/targhooks.c | 6 ++++--
gcc/targhooks.h | 2 +-
gcc/varasm.c | 16 +++++++++++-----
18 files changed, 131 insertions(+), 40 deletions(-)

Upstream: gcc.gnu.org


  • Share