[llvm-dev] How to change CLang struct alignment behaviour?
Joan Lluch via llvm-dev
llvm-dev at lists.llvm.org
Sun May 12 13:02:30 PDT 2019
My target implementation has 2 byte (16 bit ints)
For my target implementation I would want that Clang would always use 2 byte aligned padding for Structs, which would match the size of an int.
The current situation is that for this struct:
I get it aligned by 1:
%a = alloca %struct.AA, align 1
I would want it to implicitly use 4 bytes instead of 3, (or it be aligned by 2 bytes instead of 1).
If I replace the above struct by this
I correctly get it aligned by 2:
%a = alloca %struct.AA, align 2
(note that my architecture is 16 bit, so ints are 16 bits)
In summary, I noticed that Clang will compute struct alignments as the max of the alignment of the individual members.
How do I change that behaviour to get structs always (at least) 2 byte aligned ?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev