[dataflow RFA] Remove DF_SUBREGS scanning flag

Paolo Bonzini paolo.bonzini@lu.unisi.ch
Fri Oct 20 10:18:00 GMT 2006


As mentioned in Kenny's other e-mail, this patch removes the DF_SUBREGS 
scanning flag.  The flag allows the caller to see all subregs; by 
default df would only show word-extraction subregs and strip all the 
others.  After this patch, all subregs are visible.

The DF_SUBREGS flag only affects the way the ->reg and ->loc fields are 
filled, so it is useless on passes that don't look at these fields.  
These are the schedulers (and ddg.c) and sign-extension elimination.  
Such passes used to specify DF_SUBREGS, Kenny just removed it because 
there was no behavioral change.  This patch reverts their dataflow info 
to what it was before Kenny's patch, but again without behavioral changes.

fwprop needed DF_SUBREGS, now it achieves the goal without passing it.  
Nothing spectacular here, either.

The more interesting ones are loop optimizations, and the dataflow 
scanning itself.  In fact all the passes were more or less ready to 
handle subregs because *some* subregs were already returned by df, as I 
said.  Therefore, the changes are rather simple there.

web is already distinguishing DF_REF_REG and DF_REF_REAL_REG, so it 
accepts the new subregs correctly.

For dataflow, I actually found a couple of places where DF_REF_REAL_LOC 
was "inlined" in the code.  In one case, I replaced DF_REF_LOC with 
DF_REF_REAL_LOC.

In two other cases (when dealing with REG_DEAD/REG_UNUSED notes for 
multiword hard registers), DF_REF_LOC is used to create the 
REG_DEAD/REG_UNUSED notes.  I believe that in this case we will not see 
a subreg, but on the other hand I don't see any harm if we see one.  So 
I left DF_REF_LOC there.

For loop optimizations, loop-invariant.c analyzes uses and just needs to 
always see the REG and never the enclosing SUBREG.  This is easily done 
with DF_REF_REAL_LOC.  It was already doing the same -- this patch is 
just a cleanup for that case.

loop-iv.c dealt with subregs like this:

  rtx reg = DF_REF_REG (def);
  ...
  set = single_set (insn);
  if (!set || SET_DEST (set) != reg)
    return false;

This shows why the old behavior without DF_SUBREGS is pretty much 
broken.  We get the DEF (which is not artificial, it is taken from an 
insn), and it may not be the SET_DEST of the insn!  From my analysis, 
this actually happened when the SET_DEST was a subreg, but I'm CCing 
Zdenek in case this rings a bell.  After this patch, we have this code 
which is more clear:

  rtx reg = DF_REF_REG (def);
  ...
  if (!REG_P (reg))
    return false;

  set = single_set (insn);
  if (!set)
     return false;

  gcc_assert (SET_DEST (set) == reg);

This simply rejects all subregs, and is able to perform a consistency 
check on the dataflow info.

I will apply the patch sometime next week (I have to rebootstrap/retest 
after Kenny's changes) if I don't hear from anybody, and will prepare a 
backport to mainline when 4.3 opens.  I'll bootstrap/test with web 
enabled at -O2.  Does it looks ok?

Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: no-df-subregs.patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20061020/89d73168/attachment.ksh>


More information about the Gcc-patches mailing list