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: rtlopt merge part 4 - variable tracking pass


> > > + 	    case CLOBBER:
> > > + 	      old_type = d->type;
> > > + 	      d->type = LT_CLOBBERED;
> > > + 	      for_each_rtx (&SET_DEST (*x), scan_for_locations, data);
> > > + 	      d->type = old_type;
> > > + 	      /* Do not traverse sub-expressions.  */
> > > + 	      return -1;
> > 
> > This is somewhat unsafe, because SETs and CLOBBERs may contain uses in
> > bit non-obvious ways (such as zero_extract expression).  It would be
> > better to use note_stores to notice the outputs from instruction - you
> > will get called always to the toplevel construction (subreg, reg or mem
> > if I remmeber correctly).  Similarry we do have note_uses to get
> > expressions that are only reffered into.  You will get called always for
> > the outermost expression that is just used.
> 
> I do not understand, please could you write an example that it might not
> handle well?
> 
> Here is how it works now, I'll add some well describing comment (if it
> is correct):
> I scan all subexpressions of a given rtx and when I find register or
> memory with MEM_ATTRS I remember the rtx and the attributes from
> MEM_ATTRS (or REG_ATTRS).

I was mostly refering to the types (use versus store).
For instance expression

(set (strict_low_part (reg A) (reg B) (reg C)) (reg D))

Uses regs A,B,C,D and writes into reg A.
> > > + 	}
> > > +       else if (GET_CODE (loc) == MEM
> > > + 	       && MEM_EXPR (loc)
> > > + 	       && track_expr_p (MEM_EXPR (loc)))
> > > + 	{
> > > + 	  int j;
> > > + 	  tree decl = MEM_EXPR (loc);
> > > + 	  HOST_WIDE_INT offset = MEM_OFFSET (loc) ? INTVAL (MEM_OFFSET (loc)) : 0;
> > > + 
> > > + 	  attrs_htab_delete (VTI (bb)->mem_out, loc);
> > > + 	  if (VTI (bb)->locs[i].type == LT_PARAM
> > > + 	      || VTI (bb)->locs[i].type == LT_SET_DEST)
> > > + 	    {
> > > + 	      /* The variable is no longer in any register.  */
> > Why exactly?
> 
> Maybe the comment is confusing. I do not know whether dwarf2 or debug
> info at general can handle that some variable has several equivalent
> locations, for example "int i" is in %eax, %ecx and 8(%ebp),
> so when there is a store of variable to memory I keep only the
> memory location.

I see, that makes sense.
Please add it into the comment :)

Honza
> 
> Josef


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