representation of struct field offsets
Daniel Berlin
dberlin@dberlin.org
Fri Sep 29 14:55:00 GMT 2006
On 9/28/06, Richard Kenner <kenner@vlsi1.ultra.nyu.edu> wrote:
> > The only trouble you'll probably run into is with fields whose offset
> > from the start of a structure is variable.
>
> Exactly. That's the reason it's defined the way it is. There is no way
> to synthesize that field from any other in the FIELD_DECL in the most
> general case: it is unique information.
Unique, but uncommon.
Thus, it would make sense to make it a union with the other
information with a discriminator. As a plus, you'd be able to tell
variable offset fields by checking a single bit instead of a load
(TREE_CODE <whatevever>).
IE
unsigned int: offset_is_variable:1;
union {
tree offset_when_variable;
unsigned HOST_WIDE_INT offset_when constant;
}
Most of our optimizers just want to know "is this variable
size/variable offset", not "what is the variable offset".
More information about the Gcc
mailing list