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