aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-constraints.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-12-20 12:53:35 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-12-20 12:53:35 +0000
commit73ca989cb823c3857336ada13446bc5c04cec3eb (patch)
treefc42b0612019e3b1e83163506a633ce5c28f801e /gcc/lra-constraints.c
parentd05d755107df11e675a57ac4371fd0031c7d68a4 (diff)
downloadgcc-73ca989cb823c3857336ada13446bc5c04cec3eb.zip
gcc-73ca989cb823c3857336ada13446bc5c04cec3eb.tar.gz
gcc-73ca989cb823c3857336ada13446bc5c04cec3eb.tar.bz2
poly_int: lra frame offsets
This patch makes LRA use poly_int64s rather than HOST_WIDE_INTs to store a frame offset (including in things like eliminations). 2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * lra-int.h (lra_reg): Change offset from int to poly_int64. (lra_insn_recog_data): Change sp_offset from HOST_WIDE_INT to poly_int64. (lra_eliminate_regs_1, eliminate_regs_in_insn): Change update_sp_offset from a HOST_WIDE_INT to a poly_int64. (lra_update_reg_val_offset, lra_reg_val_equal_p): Take the offset as a poly_int64 rather than an int. * lra-assigns.c (find_hard_regno_for_1): Handle poly_int64 offsets. (setup_live_pseudos_and_spill_after_risky_transforms): Likewise. * lra-constraints.c (equiv_address_substitution): Track offsets as poly_int64s. (emit_inc): Check poly_int_rtx_p instead of CONST_INT_P. (curr_insn_transform): Handle the new form of sp_offset. * lra-eliminations.c (lra_elim_table): Change previous_offset and offset from HOST_WIDE_INT to poly_int64. (print_elim_table, update_reg_eliminate): Update accordingly. (self_elim_offsets): Change from HOST_WIDE_INT to poly_int64_pod. (get_elimination): Update accordingly. (form_sum): Check poly_int_rtx_p instead of CONST_INT_P. (lra_eliminate_regs_1, eliminate_regs_in_insn): Change update_sp_offset from a HOST_WIDE_INT to a poly_int64. Handle poly_int64 offsets generally. (curr_sp_change): Change from HOST_WIDE_INT to poly_int64. (mark_not_eliminable, init_elimination): Update accordingly. (remove_reg_equal_offset_note): Return a bool and pass the new offset back by pointer as a poly_int64. * lra-remat.c (change_sp_offset): Take sp_offset as a poly_int64 rather than a HOST_WIDE_INT. (do_remat): Track offsets poly_int64s. * lra.c (lra_update_insn_recog_data, setup_sp_offset): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r255876
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r--gcc/lra-constraints.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 4adf4bf..0681a4c 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -3084,7 +3084,8 @@ static bool
equiv_address_substitution (struct address_info *ad)
{
rtx base_reg, new_base_reg, index_reg, new_index_reg, *base_term, *index_term;
- HOST_WIDE_INT disp, scale;
+ poly_int64 disp;
+ HOST_WIDE_INT scale;
bool change_p;
base_term = strip_subreg (ad->base_term);
@@ -3115,6 +3116,7 @@ equiv_address_substitution (struct address_info *ad)
}
if (base_reg != new_base_reg)
{
+ poly_int64 offset;
if (REG_P (new_base_reg))
{
*base_term = new_base_reg;
@@ -3122,10 +3124,10 @@ equiv_address_substitution (struct address_info *ad)
}
else if (GET_CODE (new_base_reg) == PLUS
&& REG_P (XEXP (new_base_reg, 0))
- && CONST_INT_P (XEXP (new_base_reg, 1))
+ && poly_int_rtx_p (XEXP (new_base_reg, 1), &offset)
&& can_add_disp_p (ad))
{
- disp += INTVAL (XEXP (new_base_reg, 1));
+ disp += offset;
*base_term = XEXP (new_base_reg, 0);
change_p = true;
}
@@ -3134,6 +3136,7 @@ equiv_address_substitution (struct address_info *ad)
}
if (index_reg != new_index_reg)
{
+ poly_int64 offset;
if (REG_P (new_index_reg))
{
*index_term = new_index_reg;
@@ -3141,16 +3144,16 @@ equiv_address_substitution (struct address_info *ad)
}
else if (GET_CODE (new_index_reg) == PLUS
&& REG_P (XEXP (new_index_reg, 0))
- && CONST_INT_P (XEXP (new_index_reg, 1))
+ && poly_int_rtx_p (XEXP (new_index_reg, 1), &offset)
&& can_add_disp_p (ad)
&& (scale = get_index_scale (ad)))
{
- disp += INTVAL (XEXP (new_index_reg, 1)) * scale;
+ disp += offset * scale;
*index_term = XEXP (new_index_reg, 0);
change_p = true;
}
}
- if (disp != 0)
+ if (maybe_ne (disp, 0))
{
if (ad->disp != NULL)
*ad->disp = plus_constant (GET_MODE (*ad->inner), *ad->disp, disp);
@@ -3630,9 +3633,10 @@ emit_inc (enum reg_class new_rclass, rtx in, rtx value, int inc_amount)
register. */
if (plus_p)
{
- if (CONST_INT_P (inc))
+ poly_int64 offset;
+ if (poly_int_rtx_p (inc, &offset))
emit_insn (gen_add2_insn (result,
- gen_int_mode (-INTVAL (inc),
+ gen_int_mode (-offset,
GET_MODE (result))));
else
emit_insn (gen_sub2_insn (result, inc));
@@ -4000,10 +4004,13 @@ curr_insn_transform (bool check_only_p)
if (INSN_CODE (curr_insn) >= 0
&& (p = get_insn_name (INSN_CODE (curr_insn))) != NULL)
fprintf (lra_dump_file, " {%s}", p);
- if (curr_id->sp_offset != 0)
- fprintf (lra_dump_file, " (sp_off=%" HOST_WIDE_INT_PRINT "d)",
- curr_id->sp_offset);
- fprintf (lra_dump_file, "\n");
+ if (maybe_ne (curr_id->sp_offset, 0))
+ {
+ fprintf (lra_dump_file, " (sp_off=");
+ print_dec (curr_id->sp_offset, lra_dump_file);
+ fprintf (lra_dump_file, ")");
+ }
+ fprintf (lra_dump_file, "\n");
}
/* Right now, for any pair of operands I and J that are required to