| 33 | | '''Update (30/06/2010):''' The current TNTC solution doesn't work on Mac OS X. So we need to implement an LLVM based solution. |
| 34 | | |
| 35 | | === Optimise the output of the LLVM Back-end === |
| 36 | | |
| 37 | | The LLVM back-end at the moment generally takes the most straight-forward approach to compiling Haskell (Cmm really) to LLVM. LLVM is designed in such a way that this is how things should be by and large done. Its instruction set is designed to be simple and generally have one way to approach a problem (especially when coming from fairly similar Cmm), you are encouraged to rely on the optimisation passes of LLVM to handle fixing things up. However, this doesn't mean there isn't potentially some room for improvement, especially since we simply don't know if there is or isn't. The LLVM back-end is new and experiments and benchmarks need to be done to figure out its limits and places it can be improved. Some quick ideas: |
| 38 | | |
| 39 | | * Update the back-end to use some of the new features of LLVM 2.6 and 2.7. Currently it only uses features of 2.5. (e.g could maybe use the new LLVM integer specific add operation to detect overflow rather then the current custom code to do it). One quick improvement is that as of 2.7 the LLVM assembler ('llvm-as') stage in the LLVM back-end pipeline isn't needed now at the LLVM optimiser tool ('opt') can be directly given LLVM assembly now as well as LLVM bitcode. |
| 40 | | * All the STG registers are passed around at the moment as just words. Some really should be passed as pointer type (e.g Sp, Hp). We can then use the noalias attribute on them which is useful. Also the nocapture attribute |
| 41 | | * Look into the various [http://llvm.org/docs/LangRef.html#paramattrs parameter attributes] and [http://llvm.org/docs/LangRef.html#fnattrs function attributes] that LLVM supports and how they should be used by the LLVM back-end. (e.g the noalias parameter attribute should probably be used). |
| 42 | | * Look at the various [http://llvm.org/docs/LangRef.html#intrinsics intrinsic functions] supported by LLVM. Some of them could maybe be used to replace existing code in LLVM or calls to the rts. (e.g Cmm expects support of a fair number of basic math operations [e.g sin], for which LLVM intrinsic functions exists. However the back-end currently calls the C library for them). |
| | 28 | '''Update (30/06/2010):''' The current TNTC solution doesn't work on Mac OS X. So we need to implement an LLVM based solution. We currently support OS X by post processing the assembly. Pure LLVM is a nicer way forward. |
| 53 | | |
| 54 | | === Stabilise / Bug Fixing === |
| 55 | | |
| 56 | | The back-end needs a fair amount of love and care just to get it into a state where it could be used as the default back-end by GHC if desired. |
| 57 | | |
| 58 | | * '''Platform support''': Only supports x86 Linux. There are a number of serious bugs on Mac OS X. Windows hasn't been tested. SPARC also hasn't been tested and would need to have changes made in LLVM so that the SPARC LLVM back-end supported the GHC calling convention. |
| 59 | | * Has been a report the back-end interacts badly with the '-dynamic' GHC flag. |
| 60 | | * Back-end hasn't been thoroughly tested across the full range of GHC configurations (e.g threaded...) |
| 61 | | * LLVM back-end is out of tree currently. |
| 62 | | * Back-end can be reduced in size and use faster data structures (FastString instead of String, OrdList instead of List, might be able to get rid of the environment used by the back-end as I believe the label naming convention stores may store enough information for the back-ends uses). |