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: Eliminate write-only variables


> > +	if (!address_taken)
> >  	  {
> > -	    if (dump_file)
> > +	    if (TREE_ADDRESSABLE (vnode->decl) && dump_file)
> >  	      fprintf (dump_file, " %s (addressable)", vnode->name ());
> 
> I know it is technically not a part of the patch... but surely this is
> supposed to dump not addressable and might be quite a bit confusing,
> so if you are already changing this, correcting the dump would be
> great.

Yep, the original logic was that the variables appear in list of flags removed,
so we are removing addressable flag.  The other two flags do not follow the
practice.  I plan to cleanup this code in general (it has gathered quite some
clutter), so I will look into it next and get dumps more readable.

Honza
> 
> Martin
> 
> > -	    TREE_ADDRESSABLE (vnode->decl) = 0;
> > +	    varpool_for_node_and_aliases (vnode, clear_addressable_bit, NULL, true);
> >  	  }
> > -	if (!TREE_READONLY (vnode->decl) && !address_taken && !written
> > +	if (!address_taken && !written
> >  	    /* Making variable in explicit section readonly can cause section
> >  	       type conflict. 
> >  	       See e.g. gcc.c-torture/compile/pr23237.c */
> >  	    && DECL_SECTION_NAME (vnode->decl) == NULL)
> >  	  {
> > -	    if (dump_file)
> > +	    if (!TREE_READONLY (vnode->decl) && dump_file)
> >  	      fprintf (dump_file, " %s (read-only)", vnode->name ());
> > -	    TREE_READONLY (vnode->decl) = 1;
> > +	    varpool_for_node_and_aliases (vnode, set_readonly_bit, NULL, true);
> > +	  }
> > +	if (!vnode->writeonly && !read && !address_taken)
> > +	  {
> > +	    if (dump_file)
> > +	      fprintf (dump_file, " %s (write-only)", vnode->name ());
> > +	    varpool_for_node_and_aliases (vnode, set_writeonly_bit, NULL, true);
> >  	  }
> >        }
> >    if (dump_file)


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