This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA:] Fix PR rtl-optimization/17933: parallel set destinations unhandled by dead_or_set_regno_p.


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]