aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-11-23 16:09:03 -0800
committerRichard Henderson <rth@gcc.gnu.org>2004-11-23 16:09:03 -0800
commitbeb72684810c1ae42dfc2051de1967ec972162c7 (patch)
treef29afe08ac5b976db829029ba56f881700677e6e /gcc/simplify-rtx.c
parent4e55a16271ec5ef8a17b2f95cbf9341fc3f392f4 (diff)
downloadgcc-beb72684810c1ae42dfc2051de1967ec972162c7.zip
gcc-beb72684810c1ae42dfc2051de1967ec972162c7.tar.gz
gcc-beb72684810c1ae42dfc2051de1967ec972162c7.tar.bz2
rtl.h (validate_subreg): Declare.
* rtl.h (validate_subreg): Declare. * emit-rtl.c (validate_subreg): New. (gen_rtx_SUBREG): Use it. * simplify-rtx.c (simplify_subreg): Likewise. (simplify_gen_subreg): Likewise. Remove duplicate asserts. * expr.c (emit_move_insn_1): Tidy complex move code. Use memory fallback whenever gen_realpart/gen_imagpart would not be able to create SUBREGs. From-SVN: r91126
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 8ecd8fc..52c0cff 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -3642,12 +3642,14 @@ simplify_subreg (enum machine_mode outermode, rtx op,
}
/* Recurse for further possible simplifications. */
- newx = simplify_subreg (outermode, SUBREG_REG (op),
- GET_MODE (SUBREG_REG (op)),
- final_offset);
+ newx = simplify_subreg (outermode, SUBREG_REG (op), innermostmode,
+ final_offset);
if (newx)
return newx;
- return gen_rtx_SUBREG (outermode, SUBREG_REG (op), final_offset);
+ if (validate_subreg (outermode, innermostmode,
+ SUBREG_REG (op), final_offset))
+ return gen_rtx_SUBREG (outermode, SUBREG_REG (op), final_offset);
+ return NULL_RTX;
}
/* SUBREG of a hard register => just change the register number
@@ -3725,9 +3727,9 @@ simplify_subreg (enum machine_mode outermode, rtx op,
res = simplify_subreg (outermode, part, GET_MODE (part), final_offset);
if (res)
return res;
- /* We can at least simplify it by referring directly to the
- relevant part. */
- return gen_rtx_SUBREG (outermode, part, final_offset);
+ if (validate_subreg (outermode, GET_MODE (part), part, final_offset))
+ return gen_rtx_SUBREG (outermode, part, final_offset);
+ return NULL_RTX;
}
/* Optimize SUBREG truncations of zero and sign extended values. */
@@ -3775,17 +3777,6 @@ simplify_gen_subreg (enum machine_mode outermode, rtx op,
enum machine_mode innermode, unsigned int byte)
{
rtx newx;
- /* Little bit of sanity checking. */
- gcc_assert (innermode != VOIDmode);
- gcc_assert (outermode != VOIDmode);
- gcc_assert (innermode != BLKmode);
- gcc_assert (outermode != BLKmode);
-
- gcc_assert (GET_MODE (op) == innermode
- || GET_MODE (op) == VOIDmode);
-
- gcc_assert ((byte % GET_MODE_SIZE (outermode)) == 0);
- gcc_assert (byte < GET_MODE_SIZE (innermode));
newx = simplify_subreg (outermode, op, innermode, byte);
if (newx)
@@ -3795,8 +3786,12 @@ simplify_gen_subreg (enum machine_mode outermode, rtx op,
|| (REG_P (op) && REGNO (op) < FIRST_PSEUDO_REGISTER))
return NULL_RTX;
- return gen_rtx_SUBREG (outermode, op, byte);
+ if (validate_subreg (outermode, innermode, op, byte))
+ return gen_rtx_SUBREG (outermode, op, byte);
+
+ return NULL_RTX;
}
+
/* Simplify X, an rtx expression.
Return the simplified expression or NULL if no simplifications