Changes between Version 34 and Version 35 of Commentary/Compiler/NewCodeGenPipeline


Ignore:
Timestamp:
Jun 10, 2011 12:56:38 PM (4 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGenPipeline

    v34 v35  
    1919 
    2020 * '''Code generator''' converts STG to `CmmGraph`.  Implemented in `StgCmm*` modules (in directory `codeGen`).  
    21    * Parameter passing is made explicit.  Parameters are passed in virtual registers R1, R2 etc. Overflow parameters are passed on the stack using explicit memory stores, to locations described abstractly using the [wiki:Commentary/Compiler/StackAreas ''Stack Area'' abstraction.].    
    22    * That includes a store of the return address, which is stored explicitly on the stack in the same way as overflow parameters. 
    23    * No `CopyIn`, `CopyOut` nodes any more; instead "smart constructors" lower the calling convention to loads/stores/register transfers, using stack area abstraction. 
    24    * But we still have `LastCall`, `LastReturn`, `LastBranch`, `LastJump` as `Last` nodes. 
     21   * `Cmm.CmmGraph` is pretty much a Hoopl graph of `CmmNode.CmmNode` nodes. Control transfer instructions are always the last node of a basic block. 
     22   * Parameter passing is made explicit; the calling convention depends on the target architecture.  The key function is `CmmCallConv.assignArgumentsPos`.  
     23     * Parameters are passed in virtual registers R1, R2 etc. [These map 1-1 to real registers.]  
     24     * Overflow parameters are passed on the stack using explicit memory stores, to locations described abstractly using the [wiki:Commentary/Compiler/StackAreas ''Stack Area'' abstraction.].    
     25   * Making the calling convention explicit includes an explicit store instruction of the return address, which is stored explicitly on the stack in the same way as overflow parameters. This is done (obscurely) in `MkGraph.mkCall`. 
    2526 
    26  * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`, called from `HscMain` (weirdly).  It's called both at the beginning and end of the pipeline. 
     27 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`, called from `HscMain.tryNewCodeGen` (weirdly).  It's called both at the beginning and end of the pipeline. 
    2728   * Branch chain elimination. 
    2829   * Remove unreachable blocks. 
    2930   * Block concatenation.  branch to K; and this is the only use of K.   
     31 
     32 * AT THIS POINT CONTROL MOVES TO `CmmCps.cpsTop` for the rest of the pipeline 
     33 
     34 * '''More control flow optimisations''' in `CmmCps.cpsTop`. 
    3035   * Common Block Elimination (like CSE). This essentially implements the Adams optimisation, we believe. 
    3136   * Consider (sometime): block duplication.  branch to K; and K is a short block.  Branch chain elimination is just a special case of this. 
     
    5762   * Find each safe `MidForeignCall` node, "lowers" it into the suspend/call/resume sequence (see `Note [Foreign calls]` in `CmmNode.hs`.), and build an info table for them. 
    5863   * Convert the `CmmInfo` for each `CmmProc` into a `[CmmStatic]`, using the live variable information computed just before "Figure out stack layout".   
     64 
     65 * AT THIS POINT CONTROL MOVES BACK TO `HscMain.tryNewCodeGen` where a final control-flow optimisation pass takes place. 
    5966 
    6067=== Branches to continuations and the "Adams optimisation" ===