Debian Codegraph @

doc/guide/src/SSA2.adoc

raw
1 = SSA2
2
3 <<SSA2#>> is an <<IntermediateLanguage#>>, translated from <<SSA#>> by
4 <<ToSSA2#>>, optimized by <<SSA2Simplify#>>, and translated by
5 <<ToRSSA#>> to <<RSSA#>>.
6
7 == Description
8
9 <<SSA2#>> is a <<FirstOrder#>>, <<SimplyTyped#>>
10 <<IntermediateLanguage#>>, a slight variant of the <<SSA#>>
11 <<IntermediateLanguage#>>,
12
13 Like <<SSA#>>, an <<SSA2#>> program consists of a collection of datatype
14 declarations, a sequence of global statements, and a collection of
15 functions, along with a distinguished "main" function. Each function
16 consists of a collection of basic blocks, where each basic block is a
17 sequence of statements ending with some control transfer.
18
19 Unlike <<SSA#>>, <<SSA2#>> includes mutable fields in objects and makes
20 the vector type constructor n-ary instead of unary. This allows
21 optimizations like <<RefFlatten#>> and <<DeepFlatten#>> to be expressed.
22
23 == Implementation
24
25 * https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.sig[`ssa2.sig`]
26 * https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa2.fun[`ssa2.fun`]
27 * https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.sig[`ssa-tree2.sig`]
28 * https://github.com/MLton/mlton/blob/master/mlton/ssa/ssa-tree2.fun[`ssa-tree2.fun`]
29
30 == Type Checking
31
32 Type checking (https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check2.sig[`type-check2.sig`],
33 https://github.com/MLton/mlton/blob/master/mlton/ssa/type-check2.fun[`type-check2.fun`]) of a <<SSA2#>>
34 program verifies the following:
35
36 * no duplicate definitions (tycons, cons, vars, labels, funcs)
37 * no out of scope references (tycons, cons, vars, labels, funcs)
38 * variable definitions dominate variable uses
39 * case transfers are exhaustive and irredundant
40 * `Enter`/`Leave` profile statements match
41 * "traditional" well-typedness
42
43 == Details and Notes
44
45 SSA is an abbreviation for Static Single Assignment.