[LLVMdev] LLVMdev Digest, Vol 81, Issue 5

Peter Lawrence peterl95124 at sbcglobal.net
Fri Mar 4 10:21:30 PST 2011


Renato,

On Mar 4, 2011, at 10:00 AM, llvmdev-request at cs.uiuc.edu wrote:

> That's what the packed is for.
>
> %Base = type { i32, i8 }; // size = 8
> %POSDerived = type { %Base, i8 }; // i8 offset = 8, size 12
>
> %Basep = packed type { i32, i8 }; // size = 5
> %nonPOSDerived = type { %Basep, i8 }; // i8 offset = 5, size 8
>
> cheers,
> --renato


does't  the %nonPOSDerived type have to be packed for its non-Natural  
size 5 member to
end up with only 5 bytes within its encompassing struct...

sure the i8 can be on any boundary, but %Basep can only be accessed  
within %nonPOSDerived
as a non-Natural sized object if %nonPOSDerived is itself declared as  
packed, otherwise if
%nonPOSDerived is not packed then it can contain only Natural sized  
fields.

so it seems that both structs need to be declared packed, one so the  
size can be known as less than
a whole Natural size, and the other so that its fields can be fit  
together tightly without padding.

seems like two different but related meanings for the word "packed".


am I confused ?

Peter Lawrence.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110304/9b2cd2b6/attachment.html>


More information about the llvm-dev mailing list