This is the mail archive of the
mailing list for the GCC project.
Re: reverse bitfield patch
- From: DJ Delorie <dj at redhat dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 7 Jul 2014 14:10:06 -0400
- Subject: Re: reverse bitfield patch
- Authentication-results: sourceware.org; auth=none
- References: <201210022207 dot q92M7NSk032449 at greed dot delorie dot com> <CAFiYyc2sCvqJhMh5nFjjdBJUJhRW_EiX5_iOyt1m=3zEZ+anzQ at mail dot gmail dot com> <201210041838 dot q94Icl9V012730 at greed dot delorie dot com> <CAFiYyc1EMf-u+QdExXFXAbm-vaR6iECKdBqgKndCzKeywaq3mA at mail dot gmail dot com> <201210051815 dot q95IFgOQ011559 at greed dot delorie dot com> <CAFiYyc07_wcJdeOUygDcGVhrfw=CcTaZ8jgCAqHPUM6g=CWbbA at mail dot gmail dot com> <201407020510 dot s625AD8f000432 at greed dot delorie dot com> <CAFiYyc3RjWpY364PMOQGtf2-XHPgqgEJYbOn2YULOuP-mHZDYQ at mail dot gmail dot com>
> Ok, but as we are dealing exclusively with bitfields there is
> already output_constructor_bitfield which uses an intermediate
> state to "pack" bits into units that are then emitted. It shouldn't
> be hard to change that to make it pack into the appropriate bits
That assumes that the output unit is only emitted once per string of
bitfields. If the total amount of data to output is larger than the
unit size, then the units themselves need to be output in the other
> Note that code expects that representatives are byte-aligned so better
> would be to not assign representatives or make the code work with
> the swapped layout (I see no reason why that shouldn't work - maybe
> it works doing before swapping the layout)?
I'm OK with not assigning them, but I couldn't figure out from the
code what they were for.
> I'm still not happy about the idea in general (why is this a bitfield
> exclusive thing? If a piece of HW is big/little-endian then even
> regular fields would have that property.
A bi-endian MCU with memory-mapped peripherals needs this to properly
and portably describe the fields within the peripheral's registers.
Without this patch, there's no way (short of two independent
definitions) of assigning a name to, for example, the LSB of such a
> Your patch comes with no testcase - testcases should cover all
> attribute variants, multiple bitfield (group) sizes and mixed
> initializations / reads / writes and be best execute testcases.
I wrote testcases, perhaps I just forgot to attach them.