Legend:

'''Update (24/03/2010)''': The changes required to LLVM for it to work with the back-end have been accepted upstream. You now just need to grab a recent 2.7 (since Pre-release1) build of LLVM or build your own copy from SVN.

9

9

10

= Installing =

10

== Installing ==

11

11

12

12

Apply the darcs patch linked above to GHC head. This will make some changes across GHC, with the bulk of the new code ending up in 'compiler/llvmGen'.

The LLVM code generator doesn't support at this time the {{{TABLES_NEXT_TO_CODE}}} optimisation due to limitations with LLVM.

22

22

23

== LLVM ==

23

=== LLVM ===

24

24

25

25

You will also need LLVM installed on your computer to use the back-end. If you wish to simply use an unregistered build of GHC, then the back-end should work with any standard LLVM version. If you wish to use a registered build of GHC however, then you may need to apply a patch to LLVM and build it yourself:

Once GHC is built, you can trigger GHC to use the LLVM back-end with the {{{-fllvm}}} flag. There is also a new {{{-ddump-llvm}}} which will dump out the LLVM IR code generated (must be used in combination with the {{{-fllvm}}} flag. (or use the {{{-keep-tmp-files}}} flag).

A nice demonstration of the improvements the LLVM back-end can bring to some code though can be see at http://donsbot.wordpress.com/2010/02/21/smoking-fast-haskell-code-using-ghcs-new-llvm-codegen/

75

75

76

= Validate =

76

== Validate ==

77

77

78

78

The GHC patch has been validated to make sure it won't break anything. This is just compiling and running GHC normally but with the LLVM back-end code included. It doesn't actually test the LLVM code generator, just makes sure it hasn't broken the NCG or C code generator.