Debian Codegraph @

doc/guide/src/Flatten.adoc

raw
1 = Flatten
2
3 <<Flatten#>> is an optimization pass for the <<SSA#>>
4 <<IntermediateLanguage#>>, invoked from <<SSASimplify#>>.
5
6 == Description
7
8 This pass flattens arguments to <<SSA#>> constructors, blocks, and
9 functions.
10
11 If a tuple is explicitly available at all uses of a function
12 (resp. block), then:
13
14 * The formals and call sites are changed so that the components of the
15 tuple are passed.
16
17 * The tuple is reconstructed at the beginning of the body of the
18 function (resp. block).
19
20 Similarly, if a tuple is explicitly available at all uses of a
21 constructor, then:
22
23 * The constructor argument datatype is changed to flatten the tuple
24 type.
25
26 * The tuple is passed flat at each `ConApp`.
27
28 * The tuple is reconstructed at each `Case` transfer target.
29
30 == Implementation
31
32 * https://github.com/MLton/mlton/blob/master/mlton/ssa/flatten.fun[`flatten.fun`]
33
34 == Details and Notes
35
36 {empty}