[llvm-dev] Building aggregate types with dynamically sized elements

Christer Swahn via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 14 01:12:08 PDT 2017


Hi,

I'm looking into ways to represent complex aggregate types whose members
and/or sub-members may be dynamically sized. This would conceptually
correspond to a C struct containing other structs and arrays, and some of
those arrays would have a length that is not known in compile time.

LLVM IR allows me to do this for a top-level array (using 0 as its LLVM
data type length and manually computing its needed allocation size).

As far as I understand, if I want to represent structs containing dynamic
arrays containing structs and so on, I will have to roll my own data size
computation, element pointer computation and so on. This however seems to
be a significant risk to portability and alignment handling.

Does anyone here have any experience with similar use cases, or any advice
on how to handle this?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170714/e2415bb2/attachment.html>


More information about the llvm-dev mailing list