diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-01-13 18:00:59 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-01-13 18:00:59 +0000 |
commit | 9005477f2552a411974c12299f627f80473e17d9 (patch) | |
tree | 923ea4cad9f4eac45c16ec2f88e594968f305011 /gcc/config/sh | |
parent | 5cce817119cd31d18fbfc1c8245519d86b5e9480 (diff) | |
download | gcc-9005477f2552a411974c12299f627f80473e17d9.zip gcc-9005477f2552a411974c12299f627f80473e17d9.tar.gz gcc-9005477f2552a411974c12299f627f80473e17d9.tar.bz2 |
Rework the legitimize_address_displacement hook
This patch:
- tweaks the handling of legitimize_address_displacement
so that it gets called before rather than after the address has
been expanded. This means that we're no longer at the mercy
of LRA being able to interpret the expanded instructions.
- passes the original offset to legitimize_address_displacement.
- adds SVE support to the AArch64 implementation of
legitimize_address_displacement.
2018-01-13 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* target.def (legitimize_address_displacement): Take the original
offset as a poly_int.
* targhooks.h (default_legitimize_address_displacement): Update
accordingly.
* targhooks.c (default_legitimize_address_displacement): Likewise.
* doc/tm.texi: Regenerate.
* lra-constraints.c (base_plus_disp_to_reg): Take the displacement
as an argument, moving assert of ad->disp == ad->disp_term to...
(process_address_1): ...here. Update calls to base_plus_disp_to_reg.
Try calling targetm.legitimize_address_displacement before expanding
the address rather than afterwards, and adjust for the new interface.
* config/aarch64/aarch64.c (aarch64_legitimize_address_displacement):
Match the new hook interface. Handle SVE addresses.
* config/sh/sh.c (sh_legitimize_address_displacement): Make the
new hook interface.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256637
Diffstat (limited to 'gcc/config/sh')
-rw-r--r-- | gcc/config/sh/sh.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 67d6d33..48e99a3 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -269,7 +269,8 @@ static bool sh_legitimate_address_p (machine_mode, rtx, bool); static rtx sh_legitimize_address (rtx, rtx, machine_mode); static rtx sh_delegitimize_address (rtx); static bool sh_cannot_substitute_mem_equiv_p (rtx); -static bool sh_legitimize_address_displacement (rtx *, rtx *, machine_mode); +static bool sh_legitimize_address_displacement (rtx *, rtx *, + poly_int64, machine_mode); static int scavenge_reg (HARD_REG_SET *s); static rtx sh_struct_value_rtx (tree, int); @@ -11395,20 +11396,21 @@ sh_cannot_substitute_mem_equiv_p (rtx) return true; } -/* Return true if DISP can be legitimized. */ +/* Implement TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT. */ static bool -sh_legitimize_address_displacement (rtx *disp, rtx *offs, +sh_legitimize_address_displacement (rtx *offset1, rtx *offset2, + poly_int64 orig_offset, machine_mode mode) { if ((TARGET_FPU_DOUBLE && mode == DFmode) || (TARGET_SH2E && mode == SFmode)) return false; - struct disp_adjust adj = sh_find_mov_disp_adjust (mode, INTVAL (*disp)); + struct disp_adjust adj = sh_find_mov_disp_adjust (mode, orig_offset); if (adj.offset_adjust != NULL_RTX && adj.mov_disp != NULL_RTX) { - *disp = adj.mov_disp; - *offs = adj.offset_adjust; + *offset1 = adj.offset_adjust; + *offset2 = adj.mov_disp; return true; } |