aboutsummaryrefslogtreecommitdiff
path: root/gcc/simplify-rtx.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-06-04 16:52:14 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2001-06-04 14:52:14 +0000
commite0e08ac26c828bca4b9323d3139eba9293f3ecf4 (patch)
treed351d9b0c5c56ead3c8dc57fbda5329e9a5df46f /gcc/simplify-rtx.c
parent95307c8e0167e5460471eecb7056913b63d6043a (diff)
downloadgcc-e0e08ac26c828bca4b9323d3139eba9293f3ecf4.zip
gcc-e0e08ac26c828bca4b9323d3139eba9293f3ecf4.tar.gz
gcc-e0e08ac26c828bca4b9323d3139eba9293f3ecf4.tar.bz2
simplify_rtx.c (simplify_subreg): Keep subregs on return values...
* simplify_rtx.c (simplify_subreg): Keep subregs on return values, check CLASS_CANNOT_CHANGE_MODE before avoiding subreg on hard reg, in case register wasn't OK previously, accept it now; allow subregs of frame pointer if reload completed and frame pointer is not needed. * combine.c (sombine_simplify_rtx): Fix comment; use subreg_lowpart_offset instead of subreg_lowpart_p (gen_lowpart_for_combine): Use subreg_lowpart_offset. * rtl.h (subreg_lowpart_parts_p): Kill. (subreg_lowpart_offset, subreg_highpart_offset): Declare. * simplify-rtx.c (simplify_subreg): Use subreg_lowpart_offset. * emit-rtl.c (gen_lowpart_SUBREG): Use subreg_lowpart_offset; (gen_lowpart_common): Likewise. (subreg_lowpart_p): Likewise. (subreg_lowpart_parts_p): Kill. (subreg_lowpart_offset, subreg_highpart_offset): New function. * emit-rtl.c (gen_lowpart_common): Use simplify_gen_subreg to simplify SUBREG and REG. (gen_highpart): Use simplify_gen_subreg for all simplifications. * emit-rtl.c (gen_realpart, gen_imagpart): Do not handle CONCAT specially. * rtlanal.c (replace_regs): Use simplify_gen_subreg From-SVN: r42850
Diffstat (limited to 'gcc/simplify-rtx.c')
-rw-r--r--gcc/simplify-rtx.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index 621bd90..aef9b55 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -2215,7 +2215,7 @@ simplify_subreg (outermode, op, innermode, byte)
Later it we should move all simplification code here and rewrite
GEN_LOWPART_IF_POSSIBLE, GEN_HIGHPART, OPERAND_SUBWORD and friends
using SIMPLIFY_SUBREG. */
- if (subreg_lowpart_parts_p (outermode, innermode, byte))
+ if (subreg_lowpart_offset (outermode, innermode) == byte)
{
rtx new = gen_lowpart_if_possible (outermode, op);
if (new)
@@ -2347,11 +2347,23 @@ simplify_subreg (outermode, op, innermode, byte)
frame, or argument pointer, leave this as a SUBREG. */
if (REG_P (op)
+ && (! REG_FUNCTION_VALUE_P (op)
+ || ! rtx_equal_function_value_matters)
+#ifdef CLASS_CANNOT_CHANGE_MODE
+ && ! (CLASS_CANNOT_CHANGE_MODE_P (outermode, innermode)
+ && GET_MODE_CLASS (innermode) != MODE_COMPLEX_INT
+ && GET_MODE_CLASS (innermode) != MODE_COMPLEX_FLOAT
+ && (TEST_HARD_REG_BIT
+ (reg_class_contents[(int) CLASS_CANNOT_CHANGE_MODE],
+ REGNO (op))))
+#endif
&& REGNO (op) < FIRST_PSEUDO_REGISTER
- && REGNO (op) != FRAME_POINTER_REGNUM
+ && ((reload_completed && !frame_pointer_needed)
+ || (REGNO (op) != FRAME_POINTER_REGNUM
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- && REGNO (op) != HARD_FRAME_POINTER_REGNUM
+ && REGNO (op) != HARD_FRAME_POINTER_REGNUM
#endif
+ ))
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
&& REGNO (op) != ARG_POINTER_REGNUM
#endif
@@ -2360,7 +2372,11 @@ simplify_subreg (outermode, op, innermode, byte)
int final_regno = subreg_hard_regno (gen_rtx_SUBREG (outermode, op, byte),
0);
- if (HARD_REGNO_MODE_OK (final_regno, outermode))
+ /* ??? We do allow it if the current REG is not valid for
+ its mode. This is a kludge to work around how float/complex
+ arguments are passed on 32-bit Sparc and should be fixed. */
+ if (HARD_REGNO_MODE_OK (final_regno, outermode)
+ || ! HARD_REGNO_MODE_OK (REGNO (op), innermode))
return gen_rtx_REG (outermode, final_regno);
}