| 1 |
= SSA |
| 2 |
|
| 3 |
<<SSA#>> is an <<IntermediateLanguage#>>, translated from <<SXML#>> by |
| 4 |
<<ClosureConvert#>>, optimized by <<SSASimplify#>>, and translated by |
| 5 |
<<ToSSA2#>> to <<SSA2#>>. |
| 6 |
|
| 7 |
== Description |
| 8 |
|
| 9 |
<<SSA#>> is a <<FirstOrder#>>, <<SimplyTyped#>> <<IntermediateLanguage#>>. |
| 10 |
It is the main <<IntermediateLanguage#>> used for optimizations. |
| 11 |
|
| 12 |
An <<SSA#>> program consists of a collection of datatype declarations, |
| 13 |
a sequence of global statements, and a collection of functions, along |
| 14 |
with a distinguished "main" function. Each function consists of a |
| 15 |
collection of basic blocks, where each basic block is a sequence of |
| 16 |
statements ending with some control transfer. |
| 17 |
|
| 18 |
== Implementation |
| 19 |
|
| 20 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa.sig[`ssa.sig`] |
| 21 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa.fun[`ssa.fun`] |
| 22 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree.sig[`ssa-tree.sig`] |
| 23 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree.fun[`ssa-tree.fun`] |
| 24 |
|
| 25 |
== Type Checking |
| 26 |
|
| 27 |
Type checking (https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check.sig[`type-check.sig`], |
| 28 |
https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check.fun[`type-check.fun`]) of a <<SSA#>> program |
| 29 |
verifies the following: |
| 30 |
|
| 31 |
* no duplicate definitions (tycons, cons, vars, labels, funcs) |
| 32 |
* no out of scope references (tycons, cons, vars, labels, funcs) |
| 33 |
* variable definitions dominate variable uses |
| 34 |
* case transfers are exhaustive and irredundant |
| 35 |
* `Enter`/`Leave` profile statements match |
| 36 |
* "traditional" well-typedness |
| 37 |
|
| 38 |
== Details and Notes |
| 39 |
|
| 40 |
SSA is an abbreviation for Static Single Assignment. |
| 41 |
|
| 42 |
For some initial design discussion, see the thread at: |
| 43 |
|
| 44 |
* http://mlton.org/pipermail/mlton/2001-August/019689.html |
| 45 |
|
| 46 |
For some retrospectives, see the threads at: |
| 47 |
|
| 48 |
* http://mlton.org/pipermail/mlton/2003-January/023054.html |
| 49 |
* http://mlton.org/pipermail/mlton/2007-February/029597.html |