On Thu, Sep 1, 2011 at 5:19 PM, Jason Merrill <ja...@redhat.com> wrote: > On 09/01/2011 11:10 AM, Aldy Hernandez wrote: >>> >>> Basically you can only touch the size of the CLASSTYPE_AS_BASE variant. >>> For many classes this will be the same as the size of the class itself. >> >> All this code is in the middle end, so we're language agnostic. >> >> What do we need here, a hook to query the front-end, or is it too late? >> Or will we have to play it conservative and never touch the padding >> (regardless of language)? > > I think it would make sense to expose this information to the back end > somehow. A hook would do the trick: call it type_data_size or type_min_size > or some such, which in the C++ front end would return TYPE_SIZE > (CLASSTYPE_AS_BASE (t)) for classes or just TYPE_SIZE for other types.
That's too late to work with LTO, you'd need to store that information permanently somewhere. Maybe move this whole C++ specific bitfield handling where it belongs, namely to the C++ frontend? I suggest to always not re-use tail padding for now (I believe if your parent object is a COMPONENT_REF, thus, x.parent.bitfield, you can use the TYPE_SIZE vs. field-decl DECL_SIZE discrepance to decide about whether the tail-padding was reused, but please double-check that ;))) Richard. > Jason > >