[LLVMdev] Re: variable sized structs in LLVM

Ed Cogburn edcogburn at hotpop.com
Sat Jun 25 07:05:05 PDT 2005


Chris Lattner wrote:

> On Fri, 24 Jun 2005, Aaron Gray wrote:
>>> As you mention above, you should use malloc and cast the return value. 
>>> If you want to get the desired size in a target-independent way (always
>>> good), you should do something like this:
> 
> ...
> 
>> Chris you should maybe add this example to the getelementptr
>> documentation.
> 
> This isn't really appropriate for the reference manual, but I added it to
> the "Source Language Implementation Notes" of my web page here:
> 
> http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt
> 
> Hope this helps!


Bingo, it does help!  Thanks Chris!  However, I'm with Aaron on where this
belongs, your link above really should be integrated into or at least an
addendum to the IR Language Reference,

http://llvm.cs.uiuc.edu/docs/LangRef.html

unless you're keeping it out of the official IR docs for now because you
will/might handle this more directly or differently in a future revision of
the IR.  If that's the case then the IR Lang Ref should at least for now
provide a link to the above from within itself, IMHO.  In any case,
thanks! :)

Ed





More information about the llvm-dev mailing list