This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFA:] Fix PR rtl-optimization/17933: parallel set destinations unhandled by dead_or_set_regno_p.
- From: Richard Henderson <rth at redhat dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 3 Nov 2004 13:00:40 -0800
- Subject: Re: [RFA:] Fix PR rtl-optimization/17933: parallel set destinations unhandled by dead_or_set_regno_p.
- References: <Pine.BSF.4.58.0410311951290.42092@dair.pair.com>
On Sun, Oct 31, 2004 at 07:54:27PM -0500, Hans-Peter Nilsson wrote:
> +static bool
> +covers_regno_p (rtx dest, unsigned int test_regno)
> +{
> + unsigned int regno, endregno;
> +
> + if (GET_CODE (dest) == SUBREG
> + && (((GET_MODE_SIZE (GET_MODE (dest))
> + + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
> + == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (dest)))
> + + UNITS_PER_WORD - 1) / UNITS_PER_WORD)))
> + dest = SUBREG_REG (dest);
> + else if (GET_CODE (dest) == PARALLEL)
> + {
> + /* Some targets place small structures in registers for return
> + values of functions, and those registers are wrapped in
> + PARALLELs that we may see as the destination of a SET. */
> + int i;
> +
> + for (i = XVECLEN (dest, 0) - 1; i >= 0; i--)
> + {
> + rtx inner = XEXP (XVECEXP (dest, 0, i), 0);
> + if (inner != NULL_RTX && REG_P (inner)
> + && covers_regno_p (inner, test_regno))
> + return true;
> + }
> + }
> +
> + if (!REG_P (dest))
> + return false;
> +
> + regno = REGNO (dest);
> + endregno = (regno >= FIRST_PSEUDO_REGISTER ? regno + 1
> + : regno + hard_regno_nregs[regno][GET_MODE (dest)]);
> + return (test_regno >= regno && test_regno < endregno);
> +}
This can be restructured as
static bool
covers_regno_no_parallel_p (rtx dest, unsigned int test_regno)
{
if (GET_CODE (dest) == SUBREG ...)
...
if (!REG_P (dest))
...
}
static bool
covers_regno_p (rtx dest, unsigned int test_regno)
{
if (GET_CODE (dest) == PARALLEL)
{
loop calling covers_regno_no_parallel_p.
return false;
}
else
return covers_regno_no_parallel_p (dest, test_regno);
}
which will avoid the recursion.
Otherwise ok.
r~