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: RFC: LRA for x86/x86-64 [1/9]


Hi Vlad,

Vladimir Makarov <vmakarov@redhat.com> writes:
> @@ -2973,11 +2973,11 @@ cleanup_subreg_operands (rtx insn)
>      df_insn_rescan (insn);
>  }
>  
> -/* If X is a SUBREG, replace it with a REG or a MEM,
> -   based on the thing it is a subreg of.  */
> +/* If X is a SUBREG, try to replace it with a REG or a MEM, based on
> +   the thing it is a subreg of.  Do it anyway if FINAL_P.  */
>  
>  rtx
> -alter_subreg (rtx *xp)
> +alter_subreg (rtx *xp, bool final_p)
>  {
>    rtx x = *xp;
>    rtx y = SUBREG_REG (x);
> @@ -3001,16 +3001,19 @@ alter_subreg (rtx *xp)
>              offset += difference % UNITS_PER_WORD;
>          }
>  
> -      *xp = adjust_address (y, GET_MODE (x), offset);
> +      if (final_p)
> +	*xp = adjust_address (y, GET_MODE (x), offset);
> +      else
> +	*xp = adjust_address_nv (y, GET_MODE (x), offset);
>      }
>    else
>      {
>        rtx new_rtx = simplify_subreg (GET_MODE (x), y, GET_MODE (y),
> -				 SUBREG_BYTE (x));
> +				     SUBREG_BYTE (x));
>  
>        if (new_rtx != 0)
>  	*xp = new_rtx;
> -      else if (REG_P (y))
> +      else if (final_p && REG_P (y))
>  	{
>  	  /* Simplify_subreg can't handle some REG cases, but we have to.  */
>  	  unsigned int regno;

Could you add a bit more commentary to explain the MEM case?
The REG handling obviously matches the comment at the head of the function:
if FINAL_P, we replace a (subreg (reg)) with a (reg) even in cases where
simplify_subreg wouldn't.  If !FINAL_P we leave things be.

But in the MEM case it's more a verify vs. don't verify thing.  I assume
the idea is that LRA wants to see the rtl for invalid addresses and have
an opportunity to make them valid (because LRA works on rtl rather an
internal representation, like you said elsewhere).  It would be nice to
make that more explicit here.

Thanks,
Richard


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