[Haskell-cafe] Problems with high-level interface to LLVM

Henning Thielemann lemming at henning-thielemann.de
Mon May 16 20:20:14 CEST 2011

Николай Кудасов wrote:

> Problem becomes much more complex when I want to add function calls into 
> my language. Type class CallArgs has an instance CallArgs (IO a) 
> (CodeGenFunction r (Value a)), which can't be given as a constraint in 
> typed AST because of free variable r. For a long time I have had no idea 
> of how I can add function calls into my language.


First I was also annoyed by this 'r' type parameter. But I think it is 
there in order to assert that LLVM code blocks have the same return type 
in 'ret' instructions when composing them.

> The only solution I see at the moment is to reject high-level llvm 
> interface provided by llvm library and use directly FFI bindings to C.

I have not tried, but I would also think that the strongly typed llvm 
binding makes writing a compiler hard. However I enjoy it for 
just-in-time compilation and building an embedded domain specific 
language. For writing a compiler you might prefer the LLVM bindings that 
are created by David Terei for GHC's LLVM backend.

PS: Also posted to haskell-llvm mailing list.

More information about the Haskell-Cafe mailing list