[cfe-dev] Alignment of bitfield structs
Renato Golin
renato.golin at linaro.org
Wed Apr 22 03:16:54 PDT 2015
On 22 April 2015 at 03:09, Richard Smith <richard at metafoo.co.uk> wrote:
>> The type does matter, for instance, on a big vs little endian issue, as to
>> where the final bits will end up. Literal i40 may work for big endian, but
>> has to be converted to i32 + i32 for little endian.
>
> That depends on the type used for loads and stores, not on the type used for
> the global, no?
Yes. I agree that having "{ i40 } align 4" will probably do the trick,
this is why I proposed it back then. I just think we should try both
solutions and use what's better.
Making the back-end understand subtleties of types and alignments due
to bitfield ABI may not be the right place, but it can work. And Clang
already knows about ABI issues and bitfields, this is why I think it's
a better place to fix that. But I'm not against doing it in the
back-end and add align 4 to int bitfields types, at least on ARM.
cheers,
--renato
More information about the cfe-dev
mailing list