summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-26 06:37:54 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-26 06:37:54 +0000
commitcbdc514458fcaec4bfa83f251f6f86a6abcbf5f7 (patch)
tree4631f76b691a31987ec823d1a90b14bcfe88c1d6
parentd9b696826b2824400143c12ad57bc3948c46d7a5 (diff)
downloadgcc-cbdc514458fcaec4bfa83f251f6f86a6abcbf5f7.tar.gz
gcc/
* lra-constraints.c (valid_address_p): New function, split out from... (process_address): ...here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192834 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/lra-constraints.c71
2 files changed, 42 insertions, 34 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf574852999..f24eae362ce 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2012-10-26 Richard Sandiford <rdsandiford@googlemail.com>
+ * lra-constraints.c (valid_address_p): New function, split out from...
+ (process_address): ...here.
+
+2012-10-26 Richard Sandiford <rdsandiford@googlemail.com>
+
* lra-constraints.c (process_address): Describe the kinds of address
that we might see.
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c
index fad1bbd3d46..13d7a3de034 100644
--- a/gcc/lra-constraints.c
+++ b/gcc/lra-constraints.c
@@ -2377,6 +2377,41 @@ valid_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
#endif
}
+/* Return whether address X, described by AD, is valid for mode MODE
+ and address space AS. */
+
+static bool
+valid_address_p (struct address *ad, enum machine_mode mode, rtx x,
+ addr_space_t as)
+{
+ /* Some ports do not check displacements for eliminable registers,
+ so we replace them temporarily with the elimination target. */
+ rtx saved_base_reg = NULL_RTX;
+ rtx saved_index_reg = NULL_RTX;
+ if (ad->base_reg_loc != NULL)
+ {
+ saved_base_reg = *ad->base_reg_loc;
+ lra_eliminate_reg_if_possible (ad->base_reg_loc);
+ if (ad->base_reg_loc2 != NULL)
+ *ad->base_reg_loc2 = *ad->base_reg_loc;
+ }
+ if (ad->index_reg_loc != NULL)
+ {
+ saved_index_reg = *ad->index_reg_loc;
+ lra_eliminate_reg_if_possible (ad->index_reg_loc);
+ }
+ bool ok_p = valid_address_p (mode, x, as);
+ if (saved_base_reg != NULL_RTX)
+ {
+ *ad->base_reg_loc = saved_base_reg;
+ if (ad->base_reg_loc2 != NULL)
+ *ad->base_reg_loc2 = saved_base_reg;
+ }
+ if (saved_index_reg != NULL_RTX)
+ *ad->index_reg_loc = saved_index_reg;
+ return ok_p;
+}
+
/* Make reload base reg + disp from address AD in space AS of memory
with MODE into a new pseudo. Return the new pseudo. */
static rtx
@@ -2518,8 +2553,7 @@ process_address (int nop, rtx *before, rtx *after)
{
struct address ad;
enum machine_mode mode;
- rtx new_reg, *addr_loc, saved_index_reg, saved_base_reg;
- bool ok_p;
+ rtx new_reg, *addr_loc;
addr_space_t as;
rtx op = *curr_id->operand_loc[nop];
const char *constraint = curr_static_id->operand[nop].constraint;
@@ -2585,38 +2619,7 @@ process_address (int nop, rtx *before, rtx *after)
All these cases involve a displacement, so there is no point
revalidating when there is no displacement. */
- if (ad.disp_loc == NULL)
- return change_p;
-
- /* See whether the address is still valid. Some ports do not check
- displacements for eliminable registers, so we replace them
- temporarily with the elimination target. */
- saved_base_reg = saved_index_reg = NULL_RTX;
- if (ad.base_reg_loc != NULL)
- {
- saved_base_reg = *ad.base_reg_loc;
- lra_eliminate_reg_if_possible (ad.base_reg_loc);
- if (ad.base_reg_loc2 != NULL)
- *ad.base_reg_loc2 = *ad.base_reg_loc;
- }
- if (ad.index_reg_loc != NULL)
- {
- saved_index_reg = *ad.index_reg_loc;
- lra_eliminate_reg_if_possible (ad.index_reg_loc);
- }
- /* Some ports do not check displacements for virtual registers -- so
- we substitute them temporarily by real registers. */
- ok_p = valid_address_p (mode, *addr_loc, as);
- if (saved_base_reg != NULL_RTX)
- {
- *ad.base_reg_loc = saved_base_reg;
- if (ad.base_reg_loc2 != NULL)
- *ad.base_reg_loc2 = saved_base_reg;
- }
- if (saved_index_reg != NULL_RTX)
- *ad.index_reg_loc = saved_index_reg;
-
- if (ok_p)
+ if (ad.disp_loc == NULL || valid_address_p (&ad, mode, *addr_loc, as))
return change_p;
/* Any index existed before LRA started, so we can assume that the