[haskell-llvm] llvm-general FFI dependencies

Scott West scott.west at inf.ethz.ch
Tue Aug 20 12:01:02 BST 2013


On 08/20/2013 11:31 AM, Henning Thielemann wrote:
> Am 20.08.2013 10:55, schrieb Scott West:
> 
>>> Is Template Haskell used for parsing
>>> the C stuff? It sounds crazy to me. So far I have used HSC for
>>> interfacing from Haskell to C. However I have no experience with
>>> automatic generation of FFI declarations using HSC.
>>>
>>
>> No it doesn't parse the C stuff.
>>
>> The LLVM headers include a Instruction.def file that allows a caller to
>> #define some macros to help generate structures. TH is used from there
>> to generate some Haskell foreign declarations.
> 
> LLVM has this mysterious TableGen system for generating all kinds of
> files from Def files. It seems to be undocumented and LLVM people claim
> it is easy to understand. I tried to use it for automatically generating
> Haskell declarations for vector instruction intrinsics. Unfortunately I
> did not understand this TableGen system.
> 
> Maybe one should try harder to use that system since it is what the
> def-files are made for.
> 
> 
>> I admit that this is not a huge concern for me. In particular, the time
>> is already invested in the TH solution, so switching away from it will
>> cost now or later, probably about the same. Given that so far there
>> isn't a great call to get it working on the other compilers, its hard to
>> justify putting in the effort.
> 
> The question for me is, whether I should invest into porting my code to
> llvm-general-ffi. In the current state I would prefer to stay with
> llvm-base as is.
> 

It could be that there is another working solution without using TH.
However, given the little amount of time I have I can only handle the
first-level reorganization that we are now discussing; not entirely
rewriting the generation system to phase out TH (I'm indifferent to TH
itself).

The benefit of having an automated way to generate the bindings will
ease the maintenance burden over the existing llvm-base, and luckily we
have llvm-general that's already hard work put into it.

Of course you know your own needs best, if llvm-base solves your
problems better than I can't say you're wrong to use it :).

Regards,
Scott




More information about the Haskell-llvm mailing list