[dataflow] partial register handling

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Fri May 11 13:38:00 GMT 2007


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;

Paolo



More information about the Gcc mailing list