[haskell-llvm] [Haskell-cafe] LLVM, type-level?

Lally Singh lally.singh at gmail.com
Tue Dec 7 19:39:32 EST 2010


On Tue, Dec 7, 2010 at 6:54 PM, Nathan Howell <nathan.d.howell at gmail.com> wrote:
> On Tue, Dec 7, 2010 at 2:27 PM, Lally Singh <lally.singh at gmail.com> wrote:
>> I'm writing a haskell program that takes in a text file describing a
>> structure.  It will generate an llvm bytecode'd program defining
>> main(), that will read its first argument to be a shared memory
>> handle, attach that handle to its own address space, and read one of
>> those structures out of it, dumping it to the console via printf().
>>
>> So, I need to figure out how to read the arguments passed to my
>> llvm-generated main.
>
> The emitted bitcode 'main' function will need a standard looking main signature:
>
> i32 @main(i32 %argc, i8** %argv)
>
> then you can use getelementptr to index into argv
>
> -n

Cool, so how do I:
- declare main's signature?  I'm using createNamedFunction "main"
- access those arguments inside main's body?



More information about the Haskell-llvm mailing list