[LLVMdev] creating an empty struct field / maximally aligned end of struct

edA-qa mort-ora-y eda-qa at disemia.com
Wed May 22 20:41:50 PDT 2013


I have a variable length struct where an arbitrary struct will be at the
end of the first one. I'm trying to find the best way to deal with this
at the LLVM API level without needing to do all the alignment
calculations myself.

My first approach is to just put a pointer at the end of the structure,
but then I can't calculate the "base" size from this structure. The
other approach is to leave off this final field and then calculate the
maximum alignment offset myself (it works, but doesn't take advantage of
LLVM's struct calculations).

Is there perhaps a way to add a maximally aligned zero-sized element to
the struct? I could add this to the end and then get what I want: the
size would be of the base, and the address of this final element would
be the variable part.

-- 
edA-qa mort-ora-y
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Sign: Please digitally sign your emails.
Encrypt: I'm also happy to receive encrypted mail.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130523/a0cde387/attachment.sig>


More information about the llvm-dev mailing list