Hi, On Wed, 9 Mar 2011, DJ Delorie wrote:
> To avoid having two completely independent definitions of the > peripheral register structures, would it be acceptable to add a target > hook to tell gcc to reverse the bitfields? This can be done in > finish_record_layout() by adjusting bit offsets, but is only defined > for targets where switching bitfield base types starts a new > allocation (i.e. "long x:4;" and "char x;" can't overlap) or where the > user is careful to avoid such a situation. Not going into the debate about sensibility of such a mean, but IMHO: there is nothing target specific about this, hence no target hook. It should be an attribute on either the struct type, or even on the individual FIELD_DECLs (which doesn't necessarily mean the use has to annotate each field, how that attribute is going to be set via frontends means, i.e. a real attribute on the fields, or on the type, or via pragmas isn't interesting for the design of this thing). And I think the adjustments should not be done after the fact in finish_record_layout, but rather right in place_field, where also the fields alignment and mode are properly tracked. Ciao, Michael.