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


Ignore:
Timestamp:
Jun 10, 2011 2:51:03 PM (3 years ago)
Author:
simonpj
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Commentary/Compiler/NewCodeGenPipeline

    v35 v36  
    2323     * Parameters are passed in virtual registers R1, R2 etc. [These map 1-1 to real registers.]  
    2424     * 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`. 
     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`. 
    2626 
    2727 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`, called from `HscMain.tryNewCodeGen` (weirdly).  It's called both at the beginning and end of the pipeline. 
     
    4040    * The transformation inserts a function prologue at the start of each proc-point, and a function epilogue just before each branch to a proc-point. 
    4141 
    42  * '''Add spill/reload''', implemented in `CmmSpillReload`, to spill live C-- variables before a call and reload them afterwards.  The spill and reload instructions are simply memory stores and loads respectively, using symbolic stack offsets (see [wiki:Commentary/Compiler/StackAreas#Layingoutthestack stack layout]).  For example, a spill of variable 'x' would look like `Ptr32[SS(x)] = x`.  There are three stages: 
     42 * '''Add spill/reload''', implemented in `CmmSpillReload`, to spill live C-- variables before a call and reload them afterwards.  The spill and reload instructions are simply memory stores and loads respectively, using symbolic stack offsets (see [wiki:Commentary/Compiler/StackAreas#Layingoutthestack stack layout]).  For example, a spill of variable 'x' would look like `Ptr32[SS(x)] = x`. 
    4343   * `dualLivenessWithInsertion` does two things: 
    4444     * Spills at the definition of any variable that is subequently live across a call (uses a backward analysis) 
    4545     * Adds a reload at each return (or proc) point 
    46    * `insertLateReloads`: Duplicate reloads just before uses, if every path to the use defines the variable by a reload (uses a forward analysis) 
    47    * Remove redundant reloads 
     46   At this point, no (`LocalReg`) variables are live across a call. 
     47   * TODO: avoid  `f();g()` turning into `spill x; f(); reload x; spill x; g(); reload x`. 
     48   * (TODO: delete the "Remove redundant reloads") 
     49 
     50 * '''Rewrite assignments''' (assignments to local regs, that is, not stores).  
     51   * Convert graph to annotated graph whose nodes are `CmmSpillReload.WithRegUsage`.  Specifically, `CmmAssign` is decorated with a flag `RegUsage` saying whether it is used once or many times. 
     52   * Sink or inline assignments nearer their use points 
    4853 
    4954 * '''Figure out the stack layout''', implemented in `CmmStackLayout`.