[LLVMdev] Structure Types and ABI sizes
Jochen Wilhelmy
j.wilhelmy at arcor.de
Fri Mar 4 06:13:17 PST 2011
>> why would it break C code? of course a C frontend should generate only
>> tailpadded types.
>>
> It's not about the size, but the offset. If you had a char field in
> the inherited class:
>
> %I' = type { %I, i8, tailpad};
>
> The offset of that i8 has to be 8, not 5. If all structures are
> packed, that would be 5, which is correct for non-POD in C++ but wrong
> for everything else.
>
I know therefore in this case %I has to tailpadded. but packing and
tailpadding are different
things, aren't they? in a packet type {i8, i32} the i32 type has offset
1 while in a non-tailpadded
type it still has offset 4.
>> %J = type { inherit %I, i8 }
>>
>> the inherit keyword before %I removes the tailpadding
>>
> That's what the packed is for.
>
I don't think so because packing removes alignment constraints of all
members.
-Jochen
More information about the llvm-dev
mailing list