diff options
author | Jan Hubicka <jh@suse.cz> | 2003-03-18 19:24:07 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-03-18 18:24:07 +0000 |
commit | 45183e0380cf0cb4c9d3f3e1f514bd0beb2739a1 (patch) | |
tree | 3b38a67ade57d53e9487e33073b52abb24091408 /gcc | |
parent | 897db4af51cf3c7abccb0dfa75d957304671c7cf (diff) | |
download | gcc-45183e0380cf0cb4c9d3f3e1f514bd0beb2739a1.zip gcc-45183e0380cf0cb4c9d3f3e1f514bd0beb2739a1.tar.gz gcc-45183e0380cf0cb4c9d3f3e1f514bd0beb2739a1.tar.bz2 |
alias.c (rtx_equal_for_memref_p): Assume that X and Y has been canonicalized.
* alias.c (rtx_equal_for_memref_p): Assume that X and Y has been
canonicalized.
(memrefs_conflict_p): Likewise.
(addr_side_effect_eval): Canonicalize the constructed address.
From-SVN: r64540
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/alias.c | 56 |
2 files changed, 45 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 46daf27..c259d56 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +Tue Mar 18 19:22:57 CET 2003 Jan Hubicka <jh@suse.cz> + + * alias.c (rtx_equal_for_memref_p): Assume that X and Y has been + canonicalized. + (memrefs_conflict_p): Likewise. + (addr_side_effect_eval): Canonicalize the constructed address. + Tue Mar 18 13:15:08 CET 2003 Jan Hubicka <jh@suse.cz> * i386.md (cvtts?2si peep2): New. diff --git a/gcc/alias.c b/gcc/alias.c index f1b0530..ba8fcee 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -1118,6 +1118,7 @@ canon_rtx (x) } /* Return 1 if X and Y are identical-looking rtx's. + Expect that X and Y has been already canonicalized. We use the data in reg_known_value above to see if two registers with different numbers are, in fact, equivalent. */ @@ -1136,9 +1137,6 @@ rtx_equal_for_memref_p (x, y) if (x == 0 || y == 0) return 0; - x = canon_rtx (x); - y = canon_rtx (y); - if (x == y) return 1; @@ -1177,24 +1175,42 @@ rtx_equal_for_memref_p (x, y) case ADDRESSOF: return (XINT (x, 1) == XINT (y, 1) - && rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0))); + && rtx_equal_for_memref_p (XEXP (x, 0), + XEXP (y, 0))); default: break; } - /* For commutative operations, the RTX match if the operand match in any - order. Also handle the simple binary and unary cases without a loop. */ - if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') + /* canon_rtx knows how to handle plus. No need to canonicalize. */ + if (code == PLUS) return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))) || (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 1)) && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 0)))); + /* For commutative operations, the RTX match if the operand match in any + order. Also handle the simple binary and unary cases without a loop. */ + if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c') + { + rtx xop0 = canon_rtx (XEXP (x, 0)); + rtx yop0 = canon_rtx (XEXP (y, 0)); + rtx yop1 = canon_rtx (XEXP (y, 1)); + + return ((rtx_equal_for_memref_p (xop0, yop0) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), yop1)) + || (rtx_equal_for_memref_p (xop0, yop1) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), yop0))); + } else if (GET_RTX_CLASS (code) == '<' || GET_RTX_CLASS (code) == '2') - return (rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) - && rtx_equal_for_memref_p (XEXP (x, 1), XEXP (y, 1))); + { + return (rtx_equal_for_memref_p (canon_rtx (XEXP (x, 0)), + canon_rtx (XEXP (y, 0))) + && rtx_equal_for_memref_p (canon_rtx (XEXP (x, 1)), + canon_rtx (XEXP (y, 1)))); + } else if (GET_RTX_CLASS (code) == '1') - return rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)); + return rtx_equal_for_memref_p (canon_rtx (XEXP (x, 0)), + canon_rtx (XEXP (y, 0))); /* Compare the elements. If any pair of corresponding elements fail to match, return 0 for the whole things. @@ -1218,13 +1234,14 @@ rtx_equal_for_memref_p (x, y) /* And the corresponding elements must match. */ for (j = 0; j < XVECLEN (x, i); j++) - if (rtx_equal_for_memref_p (XVECEXP (x, i, j), - XVECEXP (y, i, j)) == 0) + if (rtx_equal_for_memref_p (canon_rtx (XVECEXP (x, i, j)), + canon_rtx (XVECEXP (y, i, j))) == 0) return 0; break; case 'e': - if (rtx_equal_for_memref_p (XEXP (x, i), XEXP (y, i)) == 0) + if (rtx_equal_for_memref_p (canon_rtx (XEXP (x, i)), + canon_rtx (XEXP (y, i))) == 0) return 0; break; @@ -1549,9 +1566,11 @@ addr_side_effect_eval (addr, size, n_refs) } if (offset) - addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), GEN_INT (offset)); + addr = gen_rtx_PLUS (GET_MODE (addr), XEXP (addr, 0), + GEN_INT (offset)); else addr = XEXP (addr, 0); + addr = canon_rtx (addr); return addr; } @@ -1561,6 +1580,7 @@ addr_side_effect_eval (addr, size, n_refs) C is nonzero, we are testing aliases between X and Y + C. XSIZE is the size in bytes of the X reference, similarly YSIZE is the size in bytes for Y. + Expect that canon_rtx has been already called for X and Y. If XSIZE or YSIZE is zero, we do not know the amount of memory being referenced (the reference was BLKmode), so make the most pessimistic @@ -1588,13 +1608,13 @@ memrefs_conflict_p (xsize, x, ysize, y, c) else if (GET_CODE (x) == LO_SUM) x = XEXP (x, 1); else - x = canon_rtx (addr_side_effect_eval (x, xsize, 0)); + x = 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 (addr_side_effect_eval (y, ysize, 0)); + y = addr_side_effect_eval (y, ysize, 0); if (rtx_equal_for_memref_p (x, y)) { @@ -1717,7 +1737,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) { if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1))) xsize = -1; - return memrefs_conflict_p (xsize, XEXP (x, 0), ysize, y, c); + return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), ysize, y, c); } if (GET_CODE (y) == AND && GET_CODE (XEXP (y, 1)) == CONST_INT) { @@ -1727,7 +1747,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) a following reference, so we do nothing with that for now. */ if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1))) ysize = -1; - return memrefs_conflict_p (xsize, x, ysize, XEXP (y, 0), c); + return memrefs_conflict_p (xsize, x, ysize, canon_rtx (XEXP (y, 0)), c); } if (GET_CODE (x) == ADDRESSOF) |