[PATCH] make LABEL_DECL has its own rtx field for its associated CODE_LABEL

Michael Matz matz@suse.de
Thu Apr 21 16:34:00 GMT 2011


Hi,

On Wed, 20 Apr 2011, Richard Guenther wrote:

> > I had occasion to try this today; this inheritance structure doesn't
> > work.  The truncated inheritance tree looks like:
> >
> > * decl_common
> >  * field_decl
> >  * const_decl
> >  * decl_with_rtl
> >    * label_decl
> >    * result_decl
> >    * parm_decl
> >    * decl_with_vis...
> >
> > In particular, FIELD_DECLs have a size, but they have no RTL associated
> > with them.  And LABEL_DECLs have RTL, but no size.

Blaeh.  So far about nice clean ideas :)  One hacky idea: change my 
proposal to this:

 decl_common {}  # no size, no rtl, no align, no pt_uid
 decl_with_rtl_or_size : decl_common {
   # add align, pt_uid
   union {
     rtx rtl;
     tree size;
   } u;
 }
 decl_with_size : decl_with_rtl_or_size {
   # add size, size_unit
 }

Use the rtl_or_size struct primarily for the current _with_rtl things that 
don't naturally have a size, but use it also for FIELD_DECLs via the 
union.

Alternatively I could also envision making a new tree_ struct for just 
field_decls, that would contain the size and other fields that currently 
are in decl_common just for fields (in particular the off_align) member.
The various accessors like DECL_SIZE would then need to dispatch based on 
tree code.

Also doesn't sound terribly sexy.

FWIW I'm usually against on the side mappings A->B if most As will most of 
the time be associated with a B.  A size _is_ associated with the entity 
always (for entities where it makes sense to talk about sizes), so that's 
exactly where I would find on the side tables strange.  For DECL_RTL it's 
less clear.


Ciao,
Michael.


More information about the Gcc-patches mailing list