• Peter Wortmann's avatar
    Major Llvm refactoring · a948fe83
    Peter Wortmann authored
    This combined patch reworks the LLVM backend in a number of ways:
    
    1. Most prominently, we introduce a LlvmM monad carrying the contents of
       the old LlvmEnv around. This patch completely removes LlvmEnv and
       refactors towards standard library monad combinators wherever possible.
    
    2. Support for streaming - we can now generate chunks of Llvm for Cmm as
       it comes in. This might improve our speed.
    
    3. To allow streaming, we need a more flexible way to handle forward
       references. The solution (getGlobalPtr) unifies LlvmCodeGen.Data
       and getHsFunc as well.
    
    4. Skip alloca-allocation for registers that are actually never written.
       LLVM will automatically eliminate these, but output is smaller and
       friendlier to human eyes this way.
    
    5. We use LlvmM to collect references for llvm.used. This allows places
       other than cmmProcLlvmGens to generate entries.
    a948fe83
LlvmCodeGen.hs 6.26 KB