Import Upstream version 20180207
[hcoop/debian/mlton.git] / doc / guide / src / Inline.adoc
1 Inline
2 ======
3
4 <:Inline:> is an optimization pass for the <:SSA:>
5 <:IntermediateLanguage:>, invoked from <:SSASimplify:>.
6
7 == Description ==
8
9 This pass inlines <:SSA:> functions using a size-based metric.
10
11 == Implementation ==
12
13 * <!ViewGitFile(mlton,master,mlton/ssa/inline.sig)>
14 * <!ViewGitFile(mlton,master,mlton/ssa/inline.fun)>
15
16 == Details and Notes ==
17
18 The <:Inline:> pass can be invoked to use one of three metrics:
19
20 * `NonRecursive(product, small)` -- inline any function satisfying `(numCalls - 1) * (size - small) <= product`, where `numCalls` is the static number of calls to the function and `size` is the size of the function.
21 * `Leaf(size)` -- inline any leaf function smaller than `size`
22 * `LeafNoLoop(size)` -- inline any leaf function without loops smaller than `size`