Commit 45183e03 by Jan Hubicka Committed by Jan Hubicka

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
parent 897db4af
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> Tue Mar 18 13:15:08 CET 2003 Jan Hubicka <jh@suse.cz>
* i386.md (cvtts?2si peep2): New. * i386.md (cvtts?2si peep2): New.
......
...@@ -1118,6 +1118,7 @@ canon_rtx (x) ...@@ -1118,6 +1118,7 @@ canon_rtx (x)
} }
/* Return 1 if X and Y are identical-looking rtx's. /* 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 We use the data in reg_known_value above to see if two registers with
different numbers are, in fact, equivalent. */ different numbers are, in fact, equivalent. */
...@@ -1136,9 +1137,6 @@ rtx_equal_for_memref_p (x, y) ...@@ -1136,9 +1137,6 @@ rtx_equal_for_memref_p (x, y)
if (x == 0 || y == 0) if (x == 0 || y == 0)
return 0; return 0;
x = canon_rtx (x);
y = canon_rtx (y);
if (x == y) if (x == y)
return 1; return 1;
...@@ -1177,24 +1175,42 @@ rtx_equal_for_memref_p (x, y) ...@@ -1177,24 +1175,42 @@ rtx_equal_for_memref_p (x, y)
case ADDRESSOF: case ADDRESSOF:
return (XINT (x, 1) == XINT (y, 1) 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: default:
break; break;
} }
/* For commutative operations, the RTX match if the operand match in any /* canon_rtx knows how to handle plus. No need to canonicalize. */
order. Also handle the simple binary and unary cases without a loop. */ if (code == PLUS)
if (code == EQ || code == NE || GET_RTX_CLASS (code) == 'c')
return ((rtx_equal_for_memref_p (XEXP (x, 0), XEXP (y, 0)) 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, 1), XEXP (y, 1)))
|| (rtx_equal_for_memref_p (XEXP (x, 0), 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)))); && 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') 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') 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 /* Compare the elements. If any pair of corresponding elements
fail to match, return 0 for the whole things. fail to match, return 0 for the whole things.
...@@ -1218,13 +1234,14 @@ rtx_equal_for_memref_p (x, y) ...@@ -1218,13 +1234,14 @@ rtx_equal_for_memref_p (x, y)
/* And the corresponding elements must match. */ /* And the corresponding elements must match. */
for (j = 0; j < XVECLEN (x, i); j++) for (j = 0; j < XVECLEN (x, i); j++)
if (rtx_equal_for_memref_p (XVECEXP (x, i, j), if (rtx_equal_for_memref_p (canon_rtx (XVECEXP (x, i, j)),
XVECEXP (y, i, j)) == 0) canon_rtx (XVECEXP (y, i, j))) == 0)
return 0; return 0;
break; break;
case 'e': 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; return 0;
break; break;
...@@ -1549,9 +1566,11 @@ addr_side_effect_eval (addr, size, n_refs) ...@@ -1549,9 +1566,11 @@ addr_side_effect_eval (addr, size, n_refs)
} }
if (offset) 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 else
addr = XEXP (addr, 0); addr = XEXP (addr, 0);
addr = canon_rtx (addr);
return addr; return addr;
} }
...@@ -1561,6 +1580,7 @@ addr_side_effect_eval (addr, size, n_refs) ...@@ -1561,6 +1580,7 @@ addr_side_effect_eval (addr, size, n_refs)
C is nonzero, we are testing aliases between X and Y + C. C is nonzero, we are testing aliases between X and Y + C.
XSIZE is the size in bytes of the X reference, XSIZE is the size in bytes of the X reference,
similarly YSIZE is the size in bytes for Y. 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 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 referenced (the reference was BLKmode), so make the most pessimistic
...@@ -1588,13 +1608,13 @@ memrefs_conflict_p (xsize, x, ysize, y, c) ...@@ -1588,13 +1608,13 @@ memrefs_conflict_p (xsize, x, ysize, y, c)
else if (GET_CODE (x) == LO_SUM) else if (GET_CODE (x) == LO_SUM)
x = XEXP (x, 1); x = XEXP (x, 1);
else else
x = canon_rtx (addr_side_effect_eval (x, xsize, 0)); x = addr_side_effect_eval (x, xsize, 0);
if (GET_CODE (y) == HIGH) if (GET_CODE (y) == HIGH)
y = XEXP (y, 0); y = XEXP (y, 0);
else if (GET_CODE (y) == LO_SUM) else if (GET_CODE (y) == LO_SUM)
y = XEXP (y, 1); y = XEXP (y, 1);
else 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)) if (rtx_equal_for_memref_p (x, y))
{ {
...@@ -1717,7 +1737,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) ...@@ -1717,7 +1737,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c)
{ {
if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1))) if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1)))
xsize = -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) if (GET_CODE (y) == AND && GET_CODE (XEXP (y, 1)) == CONST_INT)
{ {
...@@ -1727,7 +1747,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c) ...@@ -1727,7 +1747,7 @@ memrefs_conflict_p (xsize, x, ysize, y, c)
a following reference, so we do nothing with that for now. */ a following reference, so we do nothing with that for now. */
if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1))) if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1)))
ysize = -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) if (GET_CODE (x) == ADDRESSOF)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment