aboutsummaryrefslogtreecommitdiff
path: root/gcc/rtl.h
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2016-11-23 14:31:13 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2016-11-23 14:31:13 +0000
commit33951763a85087927068d553be6709cd03953a09 (patch)
tree4bfd3e1a9778ceec5f17a57b1b4e198e8b97acb9 /gcc/rtl.h
parentcbb88345e10ffb70e289408303c58aa01b1a059c (diff)
downloadgcc-33951763a85087927068d553be6709cd03953a09.zip
gcc-33951763a85087927068d553be6709cd03953a09.tar.gz
gcc-33951763a85087927068d553be6709cd03953a09.tar.bz2
Add more subreg offset helpers
Provide versions of subreg_lowpart_offset and subreg_highpart_offset that work on mode sizes rather than modes. Also provide a routine that converts an lsb position to a subreg offset. The intent (in combination with later patches) is to move the handling of the BYTES_BIG_ENDIAN != WORDS_BIG_ENDIAN case into just two places, so that for other combinations we don't have to split offsets into words and subwords. gcc/ 2016-11-15 Richard Sandiford <richard.sandiford@arm.com> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> * rtl.h (subreg_size_offset_from_lsb): Declare. (subreg_offset_from_lsb): New function. (subreg_size_lowpart_offset): Declare. (subreg_lowpart_offset): Turn into an inline function. (subreg_size_highpart_offset): Declare. (subreg_highpart_offset): Turn into an inline function. * emit-rtl.c (subreg_size_lowpart_offset): New function. (subreg_size_highpart_offset): Likewise * rtlanal.c (subreg_size_offset_from_lsb): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r242755
Diffstat (limited to 'gcc/rtl.h')
-rw-r--r--gcc/rtl.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 21f4860..660d381 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -2178,6 +2178,24 @@ extern void get_full_rtx_cost (rtx, machine_mode, enum rtx_code, int,
extern unsigned int subreg_lsb (const_rtx);
extern unsigned int subreg_lsb_1 (machine_mode, machine_mode,
unsigned int);
+extern unsigned int subreg_size_offset_from_lsb (unsigned int, unsigned int,
+ unsigned int);
+
+/* Return the subreg byte offset for a subreg whose outer mode is
+ OUTER_MODE, whose inner mode is INNER_MODE, and where there are
+ LSB_SHIFT *bits* between the lsb of the outer value and the lsb of
+ the inner value. This is the inverse of subreg_lsb_1 (which converts
+ byte offsets to bit shifts). */
+
+inline unsigned int
+subreg_offset_from_lsb (machine_mode outer_mode,
+ machine_mode inner_mode,
+ unsigned int lsb_shift)
+{
+ return subreg_size_offset_from_lsb (GET_MODE_SIZE (outer_mode),
+ GET_MODE_SIZE (inner_mode), lsb_shift);
+}
+
extern unsigned int subreg_regno_offset (unsigned int, machine_mode,
unsigned int, machine_mode);
extern bool subreg_offset_representable_p (unsigned int, machine_mode,
@@ -2764,10 +2782,28 @@ extern rtx operand_subword (rtx, unsigned int, int, machine_mode);
extern rtx operand_subword_force (rtx, unsigned int, machine_mode);
extern bool paradoxical_subreg_p (const_rtx);
extern int subreg_lowpart_p (const_rtx);
-extern unsigned int subreg_lowpart_offset (machine_mode,
- machine_mode);
-extern unsigned int subreg_highpart_offset (machine_mode,
- machine_mode);
+extern unsigned int subreg_size_lowpart_offset (unsigned int, unsigned int);
+
+/* Return the SUBREG_BYTE for an OUTERMODE lowpart of an INNERMODE value. */
+
+inline unsigned int
+subreg_lowpart_offset (machine_mode outermode, machine_mode innermode)
+{
+ return subreg_size_lowpart_offset (GET_MODE_SIZE (outermode),
+ GET_MODE_SIZE (innermode));
+}
+
+extern unsigned int subreg_size_highpart_offset (unsigned int, unsigned int);
+
+/* Return the SUBREG_BYTE for an OUTERMODE highpart of an INNERMODE value. */
+
+inline unsigned int
+subreg_highpart_offset (machine_mode outermode, machine_mode innermode)
+{
+ return subreg_size_highpart_offset (GET_MODE_SIZE (outermode),
+ GET_MODE_SIZE (innermode));
+}
+
extern int byte_lowpart_offset (machine_mode, machine_mode);
extern rtx make_safe_from (rtx, rtx);
extern rtx convert_memory_address_addr_space_1 (machine_mode, rtx,