bollu / simplexhc-cpp

optimising compiler for Haskell's intermediate representation (STG) to LLVM IR
31 stars 4 forks source link

reuse of llvmng? #1

Open robstewart57 opened 6 years ago

robstewart57 commented 6 years ago

Hi,

This is an exciting alternative approach for compiling Haskell!

Are you also aware of the llvmng work?

https://mail.haskell.org/pipermail/ghc-devs/2017-September/014689.html

Moritz hopes that it may be possible for simplexhc-cpp to reuse some of the llvmng framework. Context:

https://twitter.com/angerman_io/status/917662618243940352

bollu commented 6 years ago

Thanks for the kind words :)

Ah, I was not aware of this! Thank you for the link, I'll ping @angerman to see how I can reuse code.

@angerman: Could you chip in here as to how code reuse could occur across these projects?

angerman commented 6 years ago

Well... as this is now a c++ project, I assume there's less reuse. The llvmng stack essentially offers there packages which provide a high-level EDSL into building LLVM Bitcode IR. As such when targeting llvm via it's Bitcode IR from Haskell, it provides a convenient way to construct the LLVM modules. The Data.BitCode modules could be reused. The Cmm to LLVM part (llvmng code gen) essentially translates Cmm to LLVM IR via the EDSL, and then that is serialized and handed over to llvm. The EDSL can be used independent of Cmm.

I wasn't aware that the STG to LLVM project moved to c++, and as such can just link and use llvm directly.

bollu commented 6 years ago

I moved because I felt that I was more productive in C++ than in haskell when wrangling LLVM.

However, my long-term goal is to keep this in haskell :) So, at that point, llvm-ng should definitely come in handy!