| | 14 | |
| | 15 | == Simple Design == |
| | 16 | * Split blocks into multiple blocks at function calls |
| | 17 | * Do liveness analysis |
| | 18 | * Split every block into a separate function |
| | 19 | * Pass all live values as parameters (probably slow) |
| | 20 | * Must arrange for both the caller and callee to know argument order |
| | 21 | * Simple design: callee just chooses some order and all callers must comply |
| | 22 | * Eventually could be passed implicitly but keeping things explicit makes things easier |
| | 23 | * Evantually could use a custom calling convention |
| | 24 | * Save live values before a call in the continuation |
| | 25 | * Must arrange for bot the caller and callee to know field order |
| | 26 | * Simple design: callee just chooses some order and all callers must comply |
| | 27 | * Eventually needs to be optimized to reduce continuation shuffling |
| | 28 | * Can register allocation algorithms be unified with this into one framework? |
| | 29 | |
| | 30 | == Pipeline == |
| | 31 | * CPS |
| | 32 | * Make closures and stacks manifest |
| | 33 | * Makes all calls are tail calls |
| | 34 | * Parameter Elimination |
| | 35 | * Makes calling convention explicit |
| | 36 | * For externally visible functions calling conventions is machine specific, but not backend specific because functions compiled from different backends must be be able to call eachother |
| | 37 | * Lor local functions calling convention can be left up to the backend because, it can take advantage of register allocation. |
| | 38 | * However, the first first draft will specify the standard calling convention for all functions even local ones because: |
| | 39 | * It's simpler |
| | 40 | * The C code generator can't handle function parameters because of the Evil Mangler |
| | 41 | * The NCG doesn't yet understand parameters |