[LLVMdev] Structure Types and ABI sizes

David A. Greene greened at obbligato.org
Wed Feb 23 11:12:11 PST 2011


Jochen Wilhelmy <j.wilhelmy at arcor.de> writes:

>> Yes, the padding is required.  I believe %J = type { %I, i16, i8 } would
>> work just as well as long as %I = type { i32, i8 } as in your example.

> Yes but given the ABI requires the last member to be at offset 5,
> which may happen
> (i.e. no tail padding if I is derived from), then your solution

No, this is not true for this example.  This is getting into extremely
delicate areas of the Itanium C++ ABI.

In this example, %I is a "POD for the purposes of layout" type.  Such
types cannot have their tail padding overlapped when they are inherited
from.  So %I is eight bytes in all contexts.

If %I is not a "POD for the purposes of layout" type, that it's tail
padding MUST be overlapped when inherited from.  In this case, we
end up creating two types for %I, %I and %I' and use %I' as the
type when it is inherited from.

Fun, eh?  :-/

                           -Dave



More information about the llvm-dev mailing list