This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: PR 11271 Handle reloading of R+R+CONST for any reg
- From: Richard Earnshaw <rearnsha at arm dot com>
- To: Ulrich Weigand <weigand at i1 dot informatik dot uni-erlangen dot de>
- Cc: rearnsha at arm dot com, gcc-patches at gcc dot gnu dot org
- Date: Thu, 06 Nov 2003 01:39:56 +0000
- Subject: Re: [PATCH]: PR 11271 Handle reloading of R+R+CONST for any reg
- Organization: ARM Ltd.
- Reply-to: Richard dot Earnshaw at arm dot com
> Richard Earnshaw wrote:
>
> >*************** find_reloads_address (enum machine_mode
> >*** 4884,4890 ****
> > && GET_CODE (XEXP (ad, 0)) == PLUS
> > && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
> > && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
> >- && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
> > && ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 1)))
> > {
> > *loc = ad = gen_rtx_PLUS (GET_MODE (ad),
>
> This causes a bootstrap failure on s390.
>
> If we have an address like
>
> (plus:SI (plus:SI (reg:SI 0) (reg:SI 1)) (const_int 16))
>
> which is invalid since reg 0 is not a valid base register on s390,
> the right thing to do would be to just reload reg 0 into another
> register -- this is what used to happen before this patch.
>
> With this patch, however, reload now tries to load
>
> (plus:SI (reg:SI 0) (const_int 16))
>
> into a base register and add that to (reg:SI 1),
> however this fails as well because reg 0 is not a valid
> base register and hence cannot be used in a load-address
> type pattern.
>
> As I understand it, this was exactly what that REG_OK_FOR_BASE
> check was supposed to ensure: that the sum that is generated
> here is certain to be computable via a load-address pattern ...
>
> I do not understand the reason for removing that check in order
> to fix a bug: this whole if is just an optimization, so even
> with the if completely disabled everything should work.
No, it's an essential part of recovering from register elimination, and
was causing a bootstrap failure when building the Thumb libraries for
gcc/ARM
I'm travelling this week and only have limited access, so I'll look into
this when I'm back in the office.
R.