[Haskell-cafe] LLVM, type-level?

Lally Singh lally.singh at gmail.com
Tue Dec 7 20:10:16 CET 2010

On Tue, Dec 7, 2010 at 1:31 PM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
> 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.

Yeah, the program will take in a declaration of a (basic) struct, with
doubles, floats, and integer members.  It'll generate an LLVM program
that'll read that sort of struct from a shared memory segment.

>> 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?

I'd like to get the runtime arguments of a function.  In my case,
main()'s command-line arguments to get the shared-memory ID.

More information about the Haskell-Cafe mailing list