This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix subreg in memory addresses regression
> On Thu, Jan 22, 2004 at 09:38:27PM +0100, Jan Hubicka wrote:
> > operands[1] = gen_lowpart (Pmode, operands[1]);
> > operands[2] = gen_lowpart (Pmode, operands[2]);
> > operands[3] = gen_lowpart (Pmode, operands[3]);
> > + if (GET_CODE (operands[1]) == SUBREG)
> > + alter_subreg (&operands[1]);
> > + if (GET_CODE (operands[2]) == SUBREG)
> > + alter_subreg (&operands[2]);
> > + if (GET_CODE (operands[3]) == SUBREG)
> > + alter_subreg (&operands[3]);
>
> Either gen_lowpart should do this, or some other common
> function should; repeating this 100 times is silly.
I think we don't have function for that. gen_lowpart knows taht it is
no-go to produce invalid subreg and one of invalid subregs is mode
change of stack pointers.
I can either invent really_gen_lowpart or x86_gen_lowpart for doing that
or we can go with the attached patch in case it seems to be safe.
I am just testing it.
2004-01-22 Jan Hubicka <jh@suse.cz>
* simplify-rtx.c (simplify_subreg): Allow simplifying of
frame/arg/stack pointers that are already in wrong mode.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.174
diff -c -3 -p -r1.174 simplify-rtx.c
*** simplify-rtx.c 22 Jan 2004 12:44:54 -0000 1.174
--- simplify-rtx.c 22 Jan 2004 22:45:00 -0000
*************** simplify_subreg (enum machine_mode outer
*** 3318,3332 ****
&& GET_MODE_CLASS (innermode) != MODE_COMPLEX_FLOAT)
#endif
&& ((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
! && REGNO (op) != STACK_POINTER_REGNUM
&& subreg_offset_representable_p (REGNO (op), innermode,
byte, outermode))
{
--- 3318,3332 ----
&& GET_MODE_CLASS (innermode) != MODE_COMPLEX_FLOAT)
#endif
&& ((reload_completed && !frame_pointer_needed)
! || (op != frame_pointer_rtx
#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
! && op != hard_frame_pointer_rtx
#endif
))
#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
! && op != arg_pointer_rtx
#endif
! && op != stack_pointer_rtx
&& subreg_offset_representable_p (REGNO (op), innermode,
byte, outermode))
{