diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-08-30 11:10:11 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-08-30 11:10:11 +0000 |
commit | 501623d42404843e3b737db24bbd575db937ce1d (patch) | |
tree | 721c0b46dec4b883eb0047dd6aeb86ff1aaf7175 /gcc/emit-rtl.c | |
parent | 7c5bd57a753528f8a612d3e63d3cd0d53f99e71d (diff) | |
download | gcc-501623d42404843e3b737db24bbd575db937ce1d.zip gcc-501623d42404843e3b737db24bbd575db937ce1d.tar.gz gcc-501623d42404843e3b737db24bbd575db937ce1d.tar.bz2 |
[15/77] Add scalar_int_mode
Similar to the previous scalar_float_mode patch, but for modes that
satisfy SCALAR_INT_MODE_P. There are very many uses of scalar integers,
so this patch only makes a token change to the types of byte_mode,
word_mode, ptr_mode and rs6000_pmode. The next patches in the series
gradually replace more uses.
The patch also removes and adds casts to some target-specific code
due to the new types of SImode, DImode and Pmode.
The as_a <scalar_int_mode> goes away in a later patch.
2017-08-30 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* config/powerpcspe/powerpcspe.h (rs6000_pmode): Change type from
machine_mode to scalar_int_mode.
* config/powerpcspe/powerpcspe.c (rs6000_pmode): Likewise.
(rs6000_option_override_internal): Remove cast to int.
* config/rs6000/rs6000.h (rs6000_pmode): Change type from
machine_mode to scalar_int_mode.
* config/rs6000/rs6000.c (rs6000_pmode): Likewise.
(rs6000_option_override_internal): Remove cast to int.
* config/s390/s390.h (Pmode): Remove cast to machine_mode.
* config/epiphany/epiphany.h (RTX_OK_FOR_OFFSET_P): Add cast
to machine_mode.
* config/s390/s390.c (s390_expand_builtin): Likewise.
* coretypes.h (scalar_int_mode): New type.
(opt_scalar_int_mode): New typedef.
* machmode.h (scalar_int_mode): New class.
(scalar_int_mode::includes_p): New function.
(byte_mode): Change type to scalar_int_mode.
(word_mode): Likewise.
(ptr_mode): Likewise.
* emit-rtl.c (byte_mode): Likewise.
(word_mode): Likewise.
(ptr_mode): Likewise.
(init_derived_machine_modes): Update accordingly.
* genmodes.c (get_mode_class): Return scalar_int_mode for MODE_INT
and MODE_PARTIAL_INT.
* gdbhooks.py (build_pretty_printer): Handle scalar_int_mode and
opt_scalar_int_mode.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251467
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r-- | gcc/emit-rtl.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index eaae009..399c5d6 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -70,9 +70,9 @@ struct target_rtl *this_target_rtl = &default_target_rtl; /* Commonly used modes. */ -machine_mode byte_mode; /* Mode whose width is BITS_PER_UNIT. */ -machine_mode word_mode; /* Mode whose width is BITS_PER_WORD. */ -machine_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ +scalar_int_mode byte_mode; /* Mode whose width is BITS_PER_UNIT. */ +scalar_int_mode word_mode; /* Mode whose width is BITS_PER_WORD. */ +scalar_int_mode ptr_mode; /* Mode whose width is POINTER_SIZE. */ /* Datastructures maintained for currently processed function in RTL form. */ @@ -5863,22 +5863,24 @@ init_emit_regs (void) void init_derived_machine_modes (void) { - byte_mode = VOIDmode; - word_mode = VOIDmode; - - machine_mode mode; - FOR_EACH_MODE_IN_CLASS (mode, MODE_INT) + opt_scalar_int_mode mode_iter, opt_byte_mode, opt_word_mode; + FOR_EACH_MODE_IN_CLASS (mode_iter, MODE_INT) { + scalar_int_mode mode = mode_iter.require (); + if (GET_MODE_BITSIZE (mode) == BITS_PER_UNIT - && byte_mode == VOIDmode) - byte_mode = mode; + && !opt_byte_mode.exists ()) + opt_byte_mode = mode; if (GET_MODE_BITSIZE (mode) == BITS_PER_WORD - && word_mode == VOIDmode) - word_mode = mode; + && !opt_word_mode.exists ()) + opt_word_mode = mode; } - ptr_mode = mode_for_size (POINTER_SIZE, GET_MODE_CLASS (Pmode), 0); + byte_mode = opt_byte_mode.require (); + word_mode = opt_word_mode.require (); + ptr_mode = as_a <scalar_int_mode> (mode_for_size (POINTER_SIZE, + MODE_INT, 0)); } /* Create some permanent unique rtl objects shared between all functions. */ |