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


Ignore:
Timestamp:
Nov 2, 2007 11:17:48 AM (7 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGen

    v2 v3  
    1212   * Control-flow blocks: `Block` 
    1313   * Control-flow graphs: `Graph`[[BR]][[BR]] 
    14  * '''`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 Cmm. 
     14 * '''`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`. 
    1515 
    1616Todo list: 
    17   * Get rid of `CmmFormals` on `LastJump` and `LastCall` in `ZipCfgCmm` 
     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`.   
    1819 
    1920== The pipeline == 
    2021 
    21  * Code generator converts STG to Cmm. 
     22 * Code generator converts STG to `CmmGraph`. 
    2223 
    23  * '''Simple control flow optimisation''' (implemented in `CmmContFlowOpt`) 
    24    *  
     24 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`: 
     25   * Branch chain elimination 
     26   * Remove unreachable blocks 
     27   * TODO: block concatenation.  branch to K; and this is the only use of K. 
     28   * Consider: block duplication.  branch to K; and K is a short block.  Branch chain elimination is just a special case of this. 
     29 
     30 * '''The Adams optimisation'''.  Given: 
     31{{{ 
     32  call f returns to K 
     33  K: CopyIn retvals; goto L 
     34  L: <code> 
     35}}} 
     36 transform to  
     37{{{ 
     38  call f returns to L 
     39  L : CopyIn retvals; <code> 
     40}}} 
     41 ''and'' move `CopyOut` into L's other predecessors.  !ToDo: explain why this is a good thing. 
     42 
     43 * '''Proc-point analysis''' and '''transformation''', implemented in `CmmProcPointZ`.  (Adams version is `CmmProcPoint`.) The transfomation part adds a `CopyIn` to the front of each proc-point, which expresses the idea that proc-points use a standard entry convention.  
     44 
     45 * '''Add spill/reload''', implemented in `CmmSpillReload`, to spill live C-- variables before a call and reload them afterwards.  The middle node of the result is `Middle` (from `ZipCfgCmm` extended with `Spill` and `Reload` constructors.   
     46 Invariant: (something like) all variables in a block are gotten from `CopyIn` or `Reload`.  
     47