GHC Haskell switches to an LLVM backend


Recommended Posts

Hi all,

Over the last 6 months I've been working on a new code generator for GHC which targets the LLVM compiler infrastructure. Most of the work was done as part of an honours thesis at the University of New South Wales under the supervision of Manuel Chakravarty. This ended at the start of November but I have continued to work on the code generator since (although at a much reduced pace since I'm back at full time work). It's now at a stage where I feel pretty confident in its correctness and would love to see it merged into GHC mainline.

The patch for the llvm back-end can be found here (should apply cleanly to GHC head):

http://www.cse.unsw.edu.au/~davidt/downloads/ghc-llvmbackend-full.gz

This is what I would like/am requesting merged into GHC head.

The thesis paper which offers a detailed performance evaluation, as well as the motivation and design of the back-end can be found at:

http://www.cse.unsw.edu.au/~pls/thesis/davidt-thesis.pdf

Below I'll quickly detail out the important points though. There are also instructions on how to get started with the back-end. Finally there are also some issues that I think may need to be sorted

out before a merge could be done. They are at the end.

...

Source

tl;dr:

  • The LLVM backend is simpler than both the C and the NCG backends - we outsource backend work from busy GHC devs to LLVM devs.
  • The LLVM code is faster for DPH code, that suggests it will also be faster for bytestring and vector code - this hypothesis remains to be tested.
  • LLVM supports architectures that GHC doesn't at the moment - LLVM should make porting easier for those.
  • This is just the first cut implemented by one person in effectively 3 months. I believe there is plenty of scope to improve on the current implementation and to move beyond the performance of the current NCG.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.