[LLVMdev] Defining/Accessing Structs Dynamically

Nyx mcheva at cs.mcgill.ca
Wed Jun 10 10:02:49 PDT 2009

Sorry for the high number of questions I've been posting lately!

I'm currently facing a design problem. I'm making a JIT for a subset of the
MATLAB language and in that language, functions can return many parameters.
The issue is that they will not necessarily return *all* the parameters they
could return. The actual number of returned parameters is defined at

For speed, I have been thinking it might be possible to create a struct
containing entries for all the values a function could return, as well as an
integer telling me how many of those values were actually returned (some of
them may not be written to). The issue is that this struct needs to be
defined separately for each function I will JIT compile.

Thus, I need to know how I can define a struct dynamically without having to
write LLVM assembly (is there an API for doing this?), whether or not LLVM
functions can actually return those on the stack, as well as how I can read
and write values to the struct.

Another issue I have is that I need to interface this with C code. Thus, I
will need to be able to know at what address specific values in the struct

Thank you for your help.

- Max
View this message in context: http://www.nabble.com/Defining-Accessing-Structs-Dynamically-tp23966736p23966736.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list