Changes between Version 3 and Version 4 of Commentary/Compiler/NewCodeGen


Ignore:
Timestamp:
Nov 2, 2007 11:38:55 AM (8 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGen

    v3 v4  
    22
    33This page summarises work that Norman Ramsey, Simon M, and Simon PJ are doing on re-architecting GHC's back end.
     4
     5Status:
     6 * Code generator: first draft done.
     7 * Control-flow opt: simple ones done
     8   * Common block elmination: to do
     9   * Block concatenation: to do
     10 * Adams optimisation: currently done somewhere but not modularly.  I think.
     11 * Proc-point analysis and transformation: done?
     12 * Add spill/reload: done?
     13 * Stack slot alloction?
     14 * Make stack explicit: to do
     15 * Split into multiple !CmmProcs: to do
     16
     17
     18!ToDo list
     19 * Get rid of `CmmFormals` on `LastJump` and `LastCall` in `ZipCfgCmm` in favour of `CopyIn` and `CopyOut`.
     20 * Change the C-- parser (which parses RTS .cmm files) to directly construct `CmmGraph`. 
     21 * Was there something about sinking spills and hoisting reloads?
    422
    523== The new Cmm data type ==
     
    1432 * '''`ZipCfgCmm`''' 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`.
    1533
    16 Todo list:
    17   * Get rid of `CmmFormals` on `LastJump` and `LastCall` in `ZipCfgCmm` in favour of `CopyIn` and `CopyOut`.
    18   * Change the C-- parser (which parses RTS .cmm files) to directly construct `CmmGraph`. 
    1934
     35 
    2036== The pipeline ==
    2137
    22  * Code generator converts STG to `CmmGraph`.
     38 * '''Code generator''' converts STG to `CmmGraph`.  Implemented in `StgCmm*` modules (in directory `codeGen`).
    2339
    2440 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`:
     
    2743   * TODO: block concatenation.  branch to K; and this is the only use of K.
    2844   * Consider: block duplication.  branch to K; and K is a short block.  Branch chain elimination is just a special case of this.
     45   * TODO: Common block elimination (like CSE). This makes something else significantly simpler.  ('''!ToDo''': what?).
    2946
    3047 * '''The Adams optimisation'''.  Given:
     
    4663 Invariant: (something like) all variables in a block are gotten from `CopyIn` or `Reload`.
    4764
     65 * '''Stack slot layout'''.  Build inteference graph for variables live across calls, and allocate a stack slot for such variables.  That is, stack slot allocation is very like register allocation.
     66
     67 * '''Make the stack explicit'''.
     68   * Convert `CopyIn`, `CopyOut`, `Spill`, `Reload` to hardware-register and stack traffic.
     69   * Add stack-pointer adjustment instructions.
     70   * Avoid memory traffic at joins. (What does this mean?)
     71
     72 * '''Split into multiple !CmmProcs'''.
     73