Changes between Version 36 and Version 37 of Commentary/Compiler/NewCodeGenPipeline
- Timestamp:
- 06/14/11 05:32:14 (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Compiler/NewCodeGenPipeline
v36 v37 9 9 1. Convert STG to Cmm, with implicit stack implicit, and native Cmm calls. 10 10 2. Optimise the Cmm, and CPS-convert it to have an explicit stack, and no native calls. 11 This part of the pipeline is stitched together in `cmm/Cmm CPSZ.hs`.11 This part of the pipeline is stitched together in `cmm/CmmPipeline.hs`. 12 12 3. Feed the CPS-converted Cmm to the existing, unmodified native code generators. 13 13 … … 25 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`. 26 26 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.27 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`. It's called both at the beginning and end of the pipeline. 28 28 * Branch chain elimination. 29 29 * Remove unreachable blocks. 30 30 * Block concatenation. branch to K; and this is the only use of K. 31 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`. 32 * '''More control flow optimisations'''. 35 33 * Common Block Elimination (like CSE). This essentially implements the Adams optimisation, we believe. 36 34 * Consider (sometime): block duplication. branch to K; and K is a short block. Branch chain elimination is just a special case of this. 37 35 38 * '''Proc-point analysis''' and '''transformation''', implemented in `CmmProcPoint Z`. (Adams version is `CmmProcPoint`.)The transformation part adds a function prologue to the front of each proc-point, following a standard entry convention.36 * '''Proc-point analysis''' and '''transformation''', implemented in `CmmProcPoint`. The transformation part adds a function prologue to the front of each proc-point, following a standard entry convention. 39 37 * The analysis produces a set of `BlockId` that should become proc-points 40 38 * 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. … … 49 47 50 48 * '''Rewrite assignments''' (assignments to local regs, that is, not stores). 51 * Convert graph to annotated graph whose nodes are `Cmm SpillReload.WithRegUsage`. Specifically, `CmmAssign` is decorated with a flag `RegUsage` saying whether it is used once or many times.49 * Convert graph to annotated graph whose nodes are `CmmRewriteAssignments.WithRegUsage`. Specifically, `CmmAssign` is decorated with a flag `RegUsage` saying whether it is used once or many times. 52 50 * Sink or inline assignments nearer their use points 53 51 … … 67 65 * 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. 68 66 * Convert the `CmmInfo` for each `CmmProc` into a `[CmmStatic]`, using the live variable information computed just before "Figure out stack layout". 69 70 * AT THIS POINT CONTROL MOVES BACK TO `HscMain.tryNewCodeGen` where a final control-flow optimisation pass takes place.71 67 72 68 === Branches to continuations and the "Adams optimisation" ===
