Changes between Version 3 and Version 4 of Commentary/Compiler/NewCodeGen
- Timestamp:
- 11/02/07 04:38:55 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Commentary/Compiler/NewCodeGen
v3 v4 2 2 3 3 This page summarises work that Norman Ramsey, Simon M, and Simon PJ are doing on re-architecting GHC's back end. 4 5 Status: 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? 4 22 5 23 == The new Cmm data type == … … 14 32 * '''`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`. 15 33 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`.19 34 35 20 36 == The pipeline == 21 37 22 * Code generator converts STG to `CmmGraph`.38 * '''Code generator''' converts STG to `CmmGraph`. Implemented in `StgCmm*` modules (in directory `codeGen`). 23 39 24 40 * '''Simple control flow optimisation''', implemented in `CmmContFlowOpt`: … … 27 43 * TODO: block concatenation. branch to K; and this is the only use of K. 28 44 * 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?). 29 46 30 47 * '''The Adams optimisation'''. Given: … … 46 63 Invariant: (something like) all variables in a block are gotten from `CopyIn` or `Reload`. 47 64 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
