aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-10-13 09:32:29 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-10-13 09:32:29 +0000
commit90f2b7e220df8ce298b2cd8f853a02aaecdbff0b (patch)
treee6e6b7a6cd37b119b1118babd9d53aa30d191bde /gcc/dwarf2out.c
parent610c45fcbfff43176beefefcea74c6137a432220 (diff)
downloadgcc-90f2b7e220df8ce298b2cd8f853a02aaecdbff0b.zip
gcc-90f2b7e220df8ce298b2cd8f853a02aaecdbff0b.tar.gz
gcc-90f2b7e220df8ce298b2cd8f853a02aaecdbff0b.tar.bz2
Make more use of byte_lowpart_offset
This patch uses byte_lowpart_offset in places that open-coded the calculation. 2017-10-13 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * caller-save.c (replace_reg_with_saved_mem): Use byte_lowpart_offset. * combine.c (gen_lowpart_for_combine): Likewise. * dwarf2out.c (rtl_for_decl_location): Likewise. * final.c (alter_subreg): Likewise. * rtlhooks.c (gen_lowpart_general): Likewise. (gen_lowpart_if_possible): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r253714
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 528c185..beab5e4 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19077,12 +19077,11 @@ rtl_for_decl_location (tree decl)
else if (VAR_P (decl)
&& rtl
&& MEM_P (rtl)
- && GET_MODE (rtl) != TYPE_MODE (TREE_TYPE (decl))
- && BYTES_BIG_ENDIAN)
+ && GET_MODE (rtl) != TYPE_MODE (TREE_TYPE (decl)))
{
machine_mode addr_mode = get_address_mode (rtl);
- int rsize = GET_MODE_SIZE (GET_MODE (rtl));
- int dsize = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (decl)));
+ HOST_WIDE_INT offset = byte_lowpart_offset (TYPE_MODE (TREE_TYPE (decl)),
+ GET_MODE (rtl));
/* If a variable is declared "register" yet is smaller than
a register, then if we store the variable to memory, it
@@ -19090,10 +19089,9 @@ rtl_for_decl_location (tree decl)
fact we are not. We need to adjust the offset of the
storage location to reflect the actual value's bytes,
else gdb will not be able to display it. */
- if (rsize > dsize)
+ if (offset != 0)
rtl = gen_rtx_MEM (TYPE_MODE (TREE_TYPE (decl)),
- plus_constant (addr_mode, XEXP (rtl, 0),
- rsize - dsize));
+ plus_constant (addr_mode, XEXP (rtl, 0), offset));
}
/* A variable with no DECL_RTL but a DECL_INITIAL is a compile-time constant,