Changes between Version 11 and Version 12 of Commentary/Compiler/NewCodeGenPipeline

Aug 27, 2008 7:40:26 AM (7 years ago)



  • Commentary/Compiler/NewCodeGenPipeline

    v11 v12  
    1 --------------------------------------
     1= Design of the new code generator =
     3This page contains notes about the design of the new code generator
     5== The new Cmm data type ==
     7There is a new Cmm data type:
     9 * [[GhcFile(compiler/cmm/ZipCfg.hs)]] contains a generic zipper-based control-flow graph data type.  It is generic in the sense that it's polymorphic in the type of '''middle nodes''' and '''last nodes''' of a block.  (Middle nodes don't do control transfers; last nodes only do control transfers.)  There are extensive notes at the start of the module.[[BR]][[BR]]
     10 The key types it defines are:
     11   * Block identifiers: `BlockId`, `BlockEnv`, `BlockSet`
     12   * Control-flow blocks: `Block`
     13   * Control-flow graphs: `Graph`[[BR]][[BR]]
     14 * '''`ZipDataFlow`''' contains a generic framework for solving dataflow problems over `ZipCfg`.[[BR]][[BR]]
     15 * '''[[GhcFile(compiler/cmm/ZipCfgCmmRep.hs)]]''' instantiates `ZipCfg` for Cmm, by defining types `Middle` and `Last` and using these to instantiate the polymorphic fields of `ZipCfg`.  It also defines a bunch of smart constructor (`mkJump`, `mkAssign`, `mkCmmIfThenElse` etc) which make it easy to build `CmmGraph`.[[BR]][[BR]]
     16 * '''`CmmExpr`''' contains the data types for Cmm expressions, registers, and the like.  It does not depend on the dataflow framework at all.
    218== The pipeline: Make the new code generator work with the existing native codeGen ==
    4864 ''and'' move `CopyOut` into L's other predecessors.  !ToDo: explain why this is a good thing.  In fact Common Block Elimination does this, we think.
     68== Runtime system ==
     70 * '''Garbage collector entry points''': see `Note [Heap checks]` in `StgCmmHeapery`.
     72 * '''PAPs'''
     74 * '''Update frames''' and '''exception handling'''.  Also STM frames.
     76 * '''Primitives''' can be rewritten:
     77   * Use parameters
     78   * In a few cases, use native calls (notably eval)