[LLVMdev] Matching struct layouts.

Mahadevan R mdevan.foobar at gmail.com
Fri May 16 01:40:18 PDT 2008


On Fri, May 16, 2008 at 12:31 PM, Duncan Sands <baldrick at free.fr> wrote:
>> > If this is an arbitrary struct, it can be quite tricky.  Do you have
>> > to worry about bitfields and variable sized fields (for example a
>> > variable length array at the end)?  What about unions?
>>
>> There are no bitfields, but it does have a variable length array at the end.
>> There are no unions.
>
> You could use llvm-gcc to convert the struct to an LLVM type.
> Otherwise, it wouldn't be too hard to convert the struct by
> hand as long as it doesn't have any exotic types in it.  A
> VLA at the end (with element type T) is currently represented
> by placing a field of type T at the end (i.e. just one element).

But can I assume that both gcc and LLVM will layout the structure
in the same way (member alignment, padding)?

Regards,
-Mahadevan.



More information about the llvm-dev mailing list