Properly document FullInliner's prerequisites

This commit is contained in:
Kamil Śliwak 2023-07-11 14:05:04 +02:00
parent ba3f9dd2a2
commit 735326d50d
2 changed files with 8 additions and 3 deletions

View File

@ -1192,7 +1192,7 @@ This component can only be used on sources with unique names.
FullInliner FullInliner
^^^^^^^^^^^ ^^^^^^^^^^^
The Full Inliner replaces certain calls of certain functions The FullInliner replaces certain calls of certain functions
by the function's body. This is not very helpful in most cases, because by the function's body. This is not very helpful in most cases, because
it just increases the code size but does not have a benefit. Furthermore, it just increases the code size but does not have a benefit. Furthermore,
code is usually very expensive and we would often rather have shorter code is usually very expensive and we would often rather have shorter
@ -1216,6 +1216,11 @@ we can run the optimizer on this specialized function. If it
results in heavy gains, the specialized function is kept, results in heavy gains, the specialized function is kept,
otherwise the original function is used instead. otherwise the original function is used instead.
FunctionHoister and ExpressionSplitter are recommended as prerequisites since they make the step
more efficient, but are not required for correctness.
In particular, function calls with other function calls as arguments are not inlined, but running
ExpressionSplitter beforehand ensures that there are no such calls in the input.
Cleanup Cleanup
------- -------

View File

@ -44,10 +44,10 @@ class NameCollector;
* Optimiser component that modifies an AST in place, inlining functions. * Optimiser component that modifies an AST in place, inlining functions.
* Expressions are expected to be split, i.e. the component will only inline * Expressions are expected to be split, i.e. the component will only inline
* function calls that are at the root of the expression and that only contains * function calls that are at the root of the expression and that only contains
* variables as arguments. More specifically, it will inline * variables or literals as arguments. More specifically, it will inline
* - let x1, ..., xn := f(a1, ..., am) * - let x1, ..., xn := f(a1, ..., am)
* - x1, ..., xn := f(a1, ..., am) * - x1, ..., xn := f(a1, ..., am)
* f(a1, ..., am) * - f(a1, ..., am)
* *
* The transform changes code of the form * The transform changes code of the form
* *