Changes between Version 15 and Version 16 of Commentary/Compiler/Backends/LLVM/WIP


Ignore:
Timestamp:
Nov 15, 2010 3:50:26 AM (4 years ago)
Author:
dterei
Comment:

Add some more ideas

Legend:

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

    v15 v16  
    22= Work in Progress on the LLVM Backend = 
    33 
    4 This page is meant to collect together information about people working on (or interested in working on) LLVM in GHC, and the projects they are looking at.  See also the [wiki:Commentary/Compiler/NewCodeGen state of play of the whole back end]. 
     4This page is meant to collect together information about people working on (or interested in working on) LLVM in GHC, and the projects they are looking at.  See also the [wiki:Commentary/Compiler/NewCodeGen state of play of the whole back end]. This is more a page of ideas for improvements to the LLVM backend and less so an indication of actual work going on. 
    55 
    66=== LLVM IR Representation === 
     
    4242 
    4343It would also be interesting to looking into improving GHC to support cross compiling and doing this through the LLVM back-end as it should be easier to fix up to support this feature than the C or NCG back-ends. 
     44 
     45=== Get rid of Proc Point Splitting === 
     46 
     47When Cmm code is first generated a single Haskell function will be mostly compiled to one Cmm function. This Cmm function isn't passed to the backends though as the CPS style used in it requires that the backends be able to take the address of labels in a function since they're used as return points. The C backend can't support this. While there is a GNU C extension allowing the address of a label to be taken, the address can only be used locally (in the same function). So what proc point splitting does is cut a single Cmm function into multiple top level Cmm functions so that instead of needing to take the address of a label, we now take the address of a function. 
     48 
     49It would be nice to get rid of proc point splitting. This is one of the goals for the new code generator. This will give us much bigger Cmm functions which should give more room for LLVM to optimise. There is an issue though that LLVM doesn't support taking the address of a local label either. So will need to add support to LLVM for taking label addresses or convert CPS style into something more direct if thats possible. 
     50 
     51=== Don't Pass Around Dead STG Registers === 
     52 
     53At the moment in the LLVM backend we always pass around the pinned STG registers as arguments for every Cmm function. A huge amount of the time though we aren't storing anything in the STG registers, they are dead really. If we can treat the correctly as dead then LLVM will have more free registers and the allocator should do a better job. We need to change the STG -> Cmm code generator to attach register liveness information at function exit points (e.g calls, jumps, returns).