aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2014-12-19 04:43:11 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2014-12-19 04:43:11 +0000
commit14133a4d8ab6d9ccd7e7e2e827f4451180a7e17a (patch)
treed3eb5c21dfd81a4058b594337113d83becb21397 /gcc/lra-constraints.c
parentd6220b11a7d208c4713bd4da4bbec792a25ffde9 (diff)
downloadgcc-14133a4d8ab6d9ccd7e7e2e827f4451180a7e17a.zip
gcc-14133a4d8ab6d9ccd7e7e2e827f4451180a7e17a.tar.gz
gcc-14133a4d8ab6d9ccd7e7e2e827f4451180a7e17a.tar.bz2
* Add TARGET_LEGITIMIZE_ADDRESS_DISPLACEMENT target macro.
From-SVN: r218887
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 9e9539c..382281c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3015,6 +3015,32 @@ process_address_1 (int nop, bool check_only_p,
delete_insns_since (PREV_INSN (last_insn));
}
}
+ /* Try if target can split displacement into legitimite new disp
+ and offset. If it's the case, we replace the last insn with
+ insns for base + offset => new_reg and set new_reg + new disp
+ to *ad.inner. */
+ last_insn = get_last_insn ();
+ if ((set = single_set (last_insn)) != NULL_RTX
+ && GET_CODE (SET_SRC (set)) == PLUS
+ && REG_P (XEXP (SET_SRC (set), 0))
+ && REGNO (XEXP (SET_SRC (set), 0)) < FIRST_PSEUDO_REGISTER
+ && CONST_INT_P (XEXP (SET_SRC (set), 1)))
+ {
+ rtx addend, disp = XEXP (SET_SRC (set), 1);
+ if (targetm.legitimize_address_displacement (&disp, &addend,
+ ad.mode))
+ {
+ rtx_insn *new_insns;
+ start_sequence ();
+ lra_emit_add (new_reg, XEXP (SET_SRC (set), 0), addend);
+ new_insns = get_insns ();
+ end_sequence ();
+ new_reg = gen_rtx_PLUS (Pmode, new_reg, disp);
+ delete_insns_since (PREV_INSN (last_insn));
+ add_insn (new_insns);
+ insns = get_insns ();
+ }
+ }
end_sequence ();
emit_insn (insns);
*ad.inner = new_reg;