
On Tue, 7 Dec 2010, Lally Singh wrote:
Hey all,
I'm generating a structure definition from input, and would like to generate some LLVM code that can use it. I see an 'alloca' function in LLVM.Core that may do the trick, but takes a static type (Ptr a), which I wouldn't have. Is there a dynamic variant? I'm currently generating a TypeDesc Struct type.
How much flexibility do you need? Is the user really allowed to specify an arbitrary 'struct' declaration? This could be a security hole. If you really want it, I think you would have to use existential quantification in order to construct a user defined type at runtime.
Also, is everything under LLVM.Core.* private (not LLVM.Core, but LLVM.Core.Util,etc)? I saw from some blog posts that Core.Util has a function for (I think) getting the a function's parameters, but I can't seem to find a way to access it. Is there another way to get the arguments to a function?
I do not understand. The example you posted recently, was a function with parameters. Isn't that what you need?