aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Hayes <m.hayes@elec.canterbury.ac.nz>1998-12-03 01:32:23 +0000
committerMichael Hayes <m.hayes@gcc.gnu.org>1998-12-03 01:32:23 +0000
commit39cec1ac5ac3dec3a6f22dc60587326f5f5dc4ef (patch)
tree784e2a2f3a4aa6bf5c9f17a4f251a307531cf5b0
parent5cf068b168182de3a080a3ec60abfb564b9262b9 (diff)
downloadgcc-39cec1ac5ac3dec3a6f22dc60587326f5f5dc4ef.zip
gcc-39cec1ac5ac3dec3a6f22dc60587326f5f5dc4ef.tar.gz
gcc-39cec1ac5ac3dec3a6f22dc60587326f5f5dc4ef.tar.bz2
alias.c (addr_side_effect_eval): New function.
* alias.c (addr_side_effect_eval): New function. (memrefs_conflict_p): Use it. * rtl.h (addr_side_effect_eval): Prototype it. From-SVN: r24068
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/alias.c43
-rw-r--r--gcc/rtl.h1
3 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2134c4e..2481c16 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+Thu Dec 3 22:30:18 1998 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
+ * alias.c (addr_side_effect_eval): New function.
+ (memrefs_conflict_p): Use it.
+ * rtl.h (addr_side_effect_eval): Prototype it.
+
+
1998-12-02 Joseph S. Myers <jsm28@cam.ac.uk>
* pdp11.md (extendsfdf2): Fix mode mismatch in SET.
diff --git a/gcc/alias.c b/gcc/alias.c
index 719b890..909176e 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -860,6 +860,45 @@ base_alias_check (x, y, x_mode, y_mode)
return ! (GET_MODE (x_base) == VOIDmode && GET_MODE (y_base) == VOIDmode);
}
+/* Return the address of the (N_REFS + 1)th memory reference to ADDR
+ where SIZE is the size in bytes of the memory reference. If ADDR
+ is not modified by the memory reference then ADDR is returned. */
+
+rtx
+addr_side_effect_eval (addr, size, n_refs)
+ rtx addr;
+ int size;
+ int n_refs;
+{
+ int offset = 0;
+
+ switch (GET_CODE (addr))
+ {
+ case PRE_INC:
+ offset = (n_refs + 1) * size;
+ break;
+ case PRE_DEC:
+ offset = -(n_refs + 1) * size;
+ break;
+ case POST_INC:
+ offset = n_refs * size;
+ break;
+ case POST_DEC:
+ offset = -n_refs * size;
+ break;
+
+ default:
+ return addr;
+ }
+
+ if (offset)
+ addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), GEN_INT (offset));
+ else
+ addr = XEXP (addr, 0);
+
+ return addr;
+}
+
/* Return nonzero if X and Y (memory addresses) could reference the
same location in memory. C is an offset accumulator. When
C is nonzero, we are testing aliases between X and Y + C.
@@ -889,13 +928,13 @@ memrefs_conflict_p (xsize, x, ysize, y, c)
else if (GET_CODE (x) == LO_SUM)
x = XEXP (x, 1);
else
- x = canon_rtx (x);
+ x = canon_rtx (addr_side_effect_eval (x, xsize, 0));
if (GET_CODE (y) == HIGH)
y = XEXP (y, 0);
else if (GET_CODE (y) == LO_SUM)
y = XEXP (y, 1);
else
- y = canon_rtx (y);
+ y = canon_rtx (addr_side_effect_eval (y, ysize, 0));
if (rtx_equal_for_memref_p (x, y))
{
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 93e7842..da22adb 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -1521,5 +1521,6 @@ extern void end_alias_analysis PROTO ((void));
extern void record_base_value PROTO ((int, rtx, int));
extern void record_alias_subset PROTO ((int, int));
+extern rtx addr_side_effect_eval PROTO ((rtx, int, int));
#endif /* _RTL_H */