| 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 | |