summaryrefslogtreecommitdiff
path: root/gcc/rtlanal.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-21 19:21:35 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-21 19:21:35 +0000
commit11896b36e4b2f9e10262da593c8430b7ba6b4cb7 (patch)
treefe34e2b2c1ebf766d03406df39c4a33246595dfd /gcc/rtlanal.c
parentddac7e16fa4b446a62e39f995a0485d336219c97 (diff)
downloadgcc-11896b36e4b2f9e10262da593c8430b7ba6b4cb7.tar.gz
* rtlanal.c (replace_rtx): Don't make a CONST_INT the operand of
SUBREG or ZERO_EXTEND. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49935 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/rtlanal.c')
-rw-r--r--gcc/rtlanal.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 37f1e64910a..5f338e86e2f 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -2417,6 +2417,40 @@ replace_rtx (x, from, to)
if (x == 0)
return 0;
+ if (GET_CODE (x) == SUBREG)
+ {
+ rtx new = replace_rtx (SUBREG_REG (x), from, to);
+
+ if (GET_CODE (new) == CONST_INT)
+ {
+ x = simplify_subreg (GET_MODE (x), new,
+ GET_MODE (SUBREG_REG (x)),
+ SUBREG_BYTE (x));
+ if (! x)
+ abort ();
+ }
+ else
+ SUBREG_REG (x) = new;
+
+ return x;
+ }
+ else if (GET_CODE (x) == ZERO_EXTEND)
+ {
+ rtx new = replace_rtx (XEXP (x, 0), from, to);
+
+ if (GET_CODE (new) == CONST_INT)
+ {
+ x = simplify_unary_operation (ZERO_EXTEND, GET_MODE (x),
+ new, GET_MODE (XEXP (x, 0)));
+ if (! x)
+ abort ();
+ }
+ else
+ XEXP (x, 0) = new;
+
+ return x;
+ }
+
fmt = GET_RTX_FORMAT (GET_CODE (x));
for (i = GET_RTX_LENGTH (GET_CODE (x)) - 1; i >= 0; i--)
{