This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: make set_noop_p handle post-reload noops
- To: Jan Hubicka <jh at suse dot cz>
- Subject: Re: make set_noop_p handle post-reload noops
- From: Geoff Keating <geoffk at geoffk dot org>
- Date: 15 Jul 2001 14:58:00 -0700
- CC: gcc-patches at gcc dot gnu dot org
- References: <20010715220712.D5914@atrey.karlin.mff.cuni.cz>
Jan Hubicka <jh@suse.cz> writes:
> Hi,
> this patch moves the dirty hack to cleanup register allocation garbage to
> set_noop_p. The goal is to make flow.c's delete_noop_moves eliminate
> the jump.c's one.
...
> *************** set_noop_p (set)
> *** 998,1012 ****
> if (GET_CODE (dst) == MEM && GET_CODE (src) == MEM)
> return rtx_equal_p (dst, src);
>
> ! if (GET_CODE (dst) == SIGN_EXTRACT
> ! || GET_CODE (dst) == ZERO_EXTRACT)
> return rtx_equal_p (XEXP (dst, 0), src)
> ! && ! BYTES_BIG_ENDIAN && XEXP (dst, 2) == const0_rtx;
>
> if (GET_CODE (dst) == STRICT_LOW_PART)
> dst = XEXP (dst, 0);
>
> ! if (GET_CODE (src) == SUBREG && GET_CODE (dst) == SUBREG)
> {
> if (SUBREG_BYTE (src) != SUBREG_BYTE (dst))
> return 0;
> --- 1001,1017 ----
> if (GET_CODE (dst) == MEM && GET_CODE (src) == MEM)
> return rtx_equal_p (dst, src);
>
> ! if (GET_CODE (dst) == SIGN_EXTRACT || GET_CODE (dst) == ZERO_EXTRACT)
> return rtx_equal_p (XEXP (dst, 0), src)
> ! && !BYTES_BIG_ENDIAN && XEXP (dst, 2) == const0_rtx;
As far as formatting fixes go, this is going the wrong way, I believe
we've tried to standardize on "! BYTES_BIG_ENDIAN".
> if (GET_CODE (dst) == STRICT_LOW_PART)
> dst = XEXP (dst, 0);
>
> !
> ! /* Bypass subregs in case they do have equivalent SUBREG_BYTEs. */
> ! if (GET_CODE (src) == SUBREG && GET_CODE (dst) == SUBREG
> ! && SUBREG_BYTE (src) == SUBREG_BYTE (dst))
> {
> if (SUBREG_BYTE (src) != SUBREG_BYTE (dst))
> return 0;
This code doesn't make much sense any more...
> *************** set_noop_p (set)
> *** 1014,1021 ****
> dst = SUBREG_REG (dst);
> }
>
> ! return (GET_CODE (src) == REG && GET_CODE (dst) == REG
> ! && REGNO (src) == REGNO (dst));
> }
>
> /* Return the last thing that X was assigned from before *PINSN. If VALID_TO
> --- 1019,1104 ----
> dst = SUBREG_REG (dst);
> }
>
> ! /* In case we still didn't eliminated the subregs, try to get around
> ! the hard regs by simplify_subreg. */
> ! if (GET_CODE (src) == SUBREG)
> ! {
> ! rtx tem = simplify_subreg (GET_MODE (src), SUBREG_REG (src),
> ! GET_MODE (SUBREG_REG (src)),
> ! SUBREG_BYTE (src));
> ! if (tem)
> ! src = tem;
> ! }
> ! if (GET_CODE (dst) == SUBREG)
> ! {
> ! rtx tem = simplify_subreg (GET_MODE (dst), SUBREG_REG (dst),
> ! GET_MODE (SUBREG_REG (dst)),
> ! SUBREG_BYTE (dst));
> ! if (tem)
> ! dst = tem;
> ! }
> !
> ! if (GET_CODE (src) == REG && GET_CODE (dst) == REG
> ! && REGNO (src) == REGNO (dst))
> ! return 1;
Wouldn't it be easier to just use something like rtx_equal_p?
--
- Geoffrey Keating <geoffk@geoffk.org>