aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2012-10-26 06:41:33 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2012-10-26 06:41:33 +0000
commitf9d4ecd445d717e0309cec1882ab57f92c2dad6d (patch)
tree47e64177fb2f355e150767c105759155138ccc21 /gcc
parent02ea4bf41e3f4ee1d19f231e1770d7ced2b3f257 (diff)
downloadgcc-f9d4ecd445d717e0309cec1882ab57f92c2dad6d.zip
gcc-f9d4ecd445d717e0309cec1882ab57f92c2dad6d.tar.gz
gcc-f9d4ecd445d717e0309cec1882ab57f92c2dad6d.tar.bz2
lra-constraints.c (process_address): Tighten arguments to base_reg_class.
gcc/ * lra-constraints.c (process_address): Tighten arguments to base_reg_class. Use simplify_gen_binary to generate PLUS rtxes. From-SVN: r192836
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/lra-constraints.c12
2 files changed, 11 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a93aa6..be75b81 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2012-10-26 Richard Sandiford <rdsandiford@googlemail.com>
+ * lra-constraints.c (process_address): Tighten arguments to
+ base_reg_class. Use simplify_gen_binary to generate PLUS rtxes.
+
+2012-10-26 Richard Sandiford <rdsandiford@googlemail.com>
+
* lra-constraints.c (get_index_scale, can_add_disp_p): New functions.
(equiv_address_substitution): Use them.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index 84c9e15..ffc067b 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2722,15 +2722,14 @@ process_address (int nop, rtx *before, rtx *after)
{
/* index * scale + disp => new base + index * scale,
case (1) above. */
- enum reg_class cl = base_reg_class (mode, as, SCRATCH, SCRATCH);
+ enum reg_class cl = base_reg_class (mode, as, PLUS,
+ GET_CODE (*ad.index_loc));
lra_assert (INDEX_REG_CLASS != NO_REGS);
new_reg = lra_create_new_reg (Pmode, NULL_RTX, cl, "disp");
- lra_assert (GET_CODE (*addr_loc) == PLUS);
lra_emit_move (new_reg, *ad.disp_loc);
- if (CONSTANT_P (XEXP (*addr_loc, 1)))
- XEXP (*addr_loc, 1) = XEXP (*addr_loc, 0);
- XEXP (*addr_loc, 0) = new_reg;
+ *addr_loc = simplify_gen_binary (PLUS, GET_MODE (new_reg),
+ new_reg, *ad.index_loc);
}
}
else if (ad.index_reg_loc == NULL)
@@ -2749,7 +2748,8 @@ process_address (int nop, rtx *before, rtx *after)
/* base + scale * index + disp => new base + scale * index,
case (1) above. */
new_reg = base_plus_disp_to_reg (mode, as, &ad);
- *addr_loc = gen_rtx_PLUS (Pmode, new_reg, *ad.index_loc);
+ *addr_loc = simplify_gen_binary (PLUS, GET_MODE (new_reg),
+ new_reg, *ad.index_loc);
}
*before = get_insns ();
end_sequence ();