Changes between Version 1 and Version 2 of Commentary/Compiler/Backends/LLVM


Ignore:
Timestamp:
Feb 20, 2010 4:31:11 PM (5 years ago)
Author:
dmp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/Backends/LLVM

    v1 v2  
    1414
    1515Finally 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.
     16
     17= Installing =
     18
     19
     20http://www.cse.unsw.edu.au/~davidt/downloads/ghc-llvmbackend-full.gz
     21
     22Apply 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'.
     23
     24To build GHC you need to add two flags to build.mk, they are:
     25
     26{{{
     27GhcWithLlvmCodeGen = YES
     28GhcEnableTablesNextToCode = NO
     29}}}
     30
     31The llvm code generator doesn't support at this time the {{{TABLES_NEXT_TO_CODE}}} optimisation due to limitations with LLVM.
     32
     33You will also need LLVM installed on your computer to use the back-end. Version 2.6 or SVN trunk is supported. If you want to use the back-end in an unregistered ghc build, then you can use a vanilla build of LLVM. However if you want to use a registered ghc build (very likely) then you need to patch LLVM for this to work. The patch for llvm can be found here:
     34
     35http://www.cse.unsw.edu.au/~davidt/downloads/llvm-ghc.patch
     36
     37LLVM is very easy to build and install. It can be done as follows:
     38
     39{{{
     40$ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
     41$ cd llvm
     42$ patch -p0 -i ~/llvm-ghc.patch
     43$ ./configure --enable-optimized # probably also want to set --prefix
     44$ make
     45$ make install
     46}}}
     47
     48Just make sure this modified version of LLVM is on your path and takes precedence over any other builds.
     49
     50= Using =
     51
     52
     53Once 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).
     54
     55{{{ghc --info}}} should also now report that it includes the llvm code generator.
     56
    1657
    1758= Performance =
     
    96137All of the test failures fail for me with a unmodified GHC head build as well as when the llvm patch is included, so the llvm patch isn't introducing any new failures.
    97138
    98 = Installing =
    99 
    100 
    101 http://www.cse.unsw.edu.au/~davidt/downloads/ghc-llvmbackend-full.gz
    102 
    103 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'.
    104 
    105 To build GHC you need to add two flags to build.mk, they are:
    106 
    107 {{{
    108 GhcWithLlvmCodeGen = YES
    109 GhcEnableTablesNextToCode = NO
    110 }}}
    111 
    112 The llvm code generator doesn't support at this time the {{{TABLES_NEXT_TO_CODE}}} optimisation due to limitations with LLVM.
    113 
    114 You will also need LLVM installed on your computer to use the back-end. Version 2.6 or SVN trunk is supported. If you want to use the back-end in an unregistered ghc build, then you can use a vanilla build of LLVM. However if you want to use a registered ghc build (very likely) then you need to patch LLVM for this to work. The patch for llvm can be found here:
    115 
    116 http://www.cse.unsw.edu.au/~davidt/downloads/llvm-ghc.patch
    117 
    118 LLVM is very easy to build and install. It can be done as follows:
    119 
    120 {{{
    121 $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
    122 $ cd llvm
    123 $ patch -p0 -i ~/llvm-ghc.patch
    124 $ ./configure --enable-optimized # probably also want to set --prefix
    125 $ make
    126 $ make install
    127 }}}
    128 
    129 Just make sure this modified version of LLVM is on your path and takes precedence over any other builds.
    130 
    131 = Using =
    132 
    133 
    134 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).
    135 
    136 {{{ghc --info}}} should also now report that it includes the llvm code generator.
    137 
    138139= Issues =
    139140