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>
* i386.md (cvtts?2si peep2): New.
......
......@@ -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)
......
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