| 1 |
= Inline |
| 2 |
|
| 3 |
<<Inline#>> is an optimization pass for the <<SSA#>> |
| 4 |
<<IntermediateLanguage#>>, invoked from <<SSASimplify#>>. |
| 5 |
|
| 6 |
== Description |
| 7 |
|
| 8 |
This pass inlines <<SSA#>> functions using a size-based metric. |
| 9 |
|
| 10 |
== Implementation |
| 11 |
|
| 12 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/inline.sig[`inline.sig`] |
| 13 |
* https://github.com/MLton/mlton/blob/master/mlton/ssa/inline.fun[`inline.fun`] |
| 14 |
|
| 15 |
== Details and Notes |
| 16 |
|
| 17 |
The <<Inline#>> pass can be invoked to use one of three metrics: |
| 18 |
|
| 19 |
* `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. |
| 20 |
* `Leaf(size)` -- inline any leaf function smaller than `size` |
| 21 |
* `LeafNoLoop(size)` -- inline any leaf function without loops smaller than `size` |