On Tue, 7 Feb 2012, Hans-Peter Nilsson wrote: > On Tue, 7 Feb 2012, Richard Guenther wrote: > > The following patch rewrites the bitfield handling of the C++ memory > > model and enables it unconditionally to fix PR52080. As I suggested > > earlier at some point this moves computation of what the memory model > > considers the underlying object we may access to the point where we > > lay out a structure type. This allows other passes like for example > > SRA or a new bitfield lowering pass to use a canonical (and correct) > > addressable object to access bitfields. The underlying object is > > represented as a FIELD_DECL that would be a suitable replacement > > for all bitfield FIELD_DECLs if you wrap it inside a BIT_FIELD_REF > > (see the gimplify.c hunk). But the main purpose (for now) is to > > make use of it in get_bit_range which no longer needs to walk > > all fields of a record nor build new trees or use get_inner_reference. > > Please excuse an ignorant question: is there somewhere in that > new code where you should consider target bitfield layout macros > like EMPTY_FIELD_BOUNDARY and PCC_BITFIELD_TYPE_MATTERS? > (Just guessing: alignment.) Or maybe that's a later stage?
No, bitfield layout is unchanged - the only thing that I added is computing a FIELD_DECL that covers the underlying storage of a series of adjacent bitfields (as required for example by the C++ memory model). This computation simply uses the offsets of the FIELD_DECLs of the bitfield fields as layed out previously. Richard.