simplify_subreg fix take 2
Jan Hubicka
jh@suse.cz
Thu May 24 08:01:00 GMT 2001
Hi,
bootstrapping with -fomit-frame-pointer has found another problem in the same
simplification. If we eliminate frame_pointer, after reload the subregs of
frame pointer can be simplified, as it is normal register.
In the testcase I have, gen_lowpart was called by add to lea splitter and
it resulted in (subreg:SI (reg:QI bpl)), that got refused by
address_operand, as we prohibit SUBREGs in addresses.
bootstrapped -fomit-frame-pointer and without, regression tested
on the i386 together with my previous patches.
Honza
Thu May 24 15:01:13 CEST 2001 Jan Hubicka <jh@suse.cz>
* 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.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/simplify-rtx.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 simplify-rtx.c
*** simplify-rtx.c 2001/05/22 07:40:26 1.54
--- simplify-rtx.c 2001/05/24 14:57:32
*************** simplify_subreg (outermode, op, innermod
*** 2346,2357 ****
suppress this simplification. If the hard register is the stack,
frame, or argument pointer, leave this as a SUBREG. */
! if (REG_P (op) == REG
&& REGNO (op) < FIRST_PSEUDO_REGISTER
! && REGNO (op) != FRAME_POINTER_REGNUM
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
! && REGNO (op) != HARD_FRAME_POINTER_REGNUM
#endif
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
&& REGNO (op) != ARG_POINTER_REGNUM
#endif
--- 2346,2369 ----
suppress this simplification. If the hard register is the stack,
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
! && ((reload_completed && !frame_pointer_needed)
! || (REGNO (op) != FRAME_POINTER_REGNUM
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
! && REGNO (op) != HARD_FRAME_POINTER_REGNUM
#endif
+ ))
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
&& REGNO (op) != ARG_POINTER_REGNUM
#endif
*************** simplify_subreg (outermode, op, innermod
*** 2360,2366 ****
int final_regno = subreg_hard_regno (gen_rtx_SUBREG (outermode, op, byte),
0);
! if (HARD_REGNO_MODE_OK (final_regno, outermode))
return gen_rtx_REG (outermode, final_regno);
}
--- 2372,2382 ----
int final_regno = subreg_hard_regno (gen_rtx_SUBREG (outermode, op, byte),
0);
! /* ??? We do allow it if the current REG is not valid for
! it's mode. It 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);
}
More information about the Gcc-patches
mailing list