This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [dataflow] partial register handling
Hi,
On Fri, 11 May 2007, Paolo Bonzini wrote:
> First of all, scrap my other message...
>
> > There was a debate several months ago on this issue: how much should the
> > df scanner be a theorem prover with respect to how many bits survive an
> > operation.
> > For instance, I could easily add to your list, anding and oring
> > operations which also preserve bits.
>
> The rules should be simple. Bits of the dest reg survive only if one of the
> following is true.
>
> - there is a STRICT_LOW_PART (of a SUBREG)
>
> - there is a ZERO_EXTRACT (not necessarily of a SUBREG!)
>
> - the subreg is part of a multiword subreg
>
> The last point is decided in other parts of the code than the one Roman is
> touching. So, Roman's change to df_read_modify_subreg_p is wrong; other
> subregs, in particular (subreg:HI (reg:SI 123) 2), should not be affected. At
> most, we might want there the more pedantic
>
> return (isize > osize
> && isize > REGMODE_NATURAL_SIZE (GET_MODE (isize));
>
>
> It seems to me that all is missing is setting DF_REF_PARTIAL for ZERO_EXTRACT.
> That is
>
> - if (GET_CODE (dst) == STRICT_LOW_PART)
> - dst_in_strict_lowpart = true;
> + if (GET_CODE (dst) == STRICT_LOW_PART
> + || GET_CODE (dst) == ZERO_EXTRACT)
> + flags |= DF_REF_PARTIAL;
That clears up about df_read_modify_subreg_p, thanks.
But I don't think that's enough, with the current loop it would strip the
subreg of a multiword subreg and there is some logic in df_ref_record,
which wouldn't see it. An alternative might be:
while (GET_CODE (dst) == STRICT_LOW_PART
|| GET_CODE (dst) == ZERO_EXTRACT)
{
flags |= DF_REF_READ_WRITE | DF_REF_PARTIAL;
loc = &XEXP (dst, 0);
dst = *loc;
}
if (df_read_modify_subreg_p (dst))
flags |= DF_REF_READ_WRITE | DF_REF_PARTIAL;
That would only leave singleword subreg and paradoxical subreg, if they
should require anything.
One could also restrict STRICT_LOW_PART to subregs, as after reload the
subreg part is usually gone.
bye, Roman