Oliver Gerlach
Oliver Gerlach

Reputation: 373

How can I integrate Haskell LLVM passes with C++ LLVM passes (if at all)?

I have a set of custom LLVM passes written in C++. Know I am up to add some new passes with analysis algorithms to be tested. To speed things up, I'd like to write these passes in Haskell. I know that LLVM-hs exists and has a FFI. However, I could not find a way to pass the IR preprocessed by the C++ passes to Haskell and vice versa. Can it be done and if yes, how?

Upvotes: 3

Views: 162

Answers (1)

arrowd
arrowd

Reputation: 34421

As there seem no way to register passes via C interface, there is no way to do it via Haskell either. So the problem is not even in writing a pass in a foreign language, but with its registration.

I think you can achieve what you want by creating a stub pass (say, HaskellPass), which would hand a Module to Haskell side. You'd also need to compile Haskell code into a foreign library, so you can link to it from C++.

Upvotes: 1

Related Questions