diff options
| author | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
|---|---|---|
| committer | Martial Simon <msimon_fr@hotmail.com> | 2025-09-15 01:07:58 +0200 |
| commit | 967be9e750221ab2ab783f95df79bb26d290a45e (patch) | |
| tree | 6802900a5e975f9f68b169f0f503f040056d6952 /tiger-compiler/src/inlining/libinlining.hh | |
Diffstat (limited to 'tiger-compiler/src/inlining/libinlining.hh')
| -rw-r--r-- | tiger-compiler/src/inlining/libinlining.hh | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tiger-compiler/src/inlining/libinlining.hh b/tiger-compiler/src/inlining/libinlining.hh new file mode 100644 index 0000000..183349a --- /dev/null +++ b/tiger-compiler/src/inlining/libinlining.hh @@ -0,0 +1,42 @@ +/** + ** \file inlining/libinlining.hh + ** \brief Declare functions exported by the inlining module. + */ + +#pragma once + +#include <ast/fwd.hh> +#include <misc/error.hh> + +/// Inlining functions of an ast::Ast. +namespace inlining +{ + /*-----------. + | Inlining. | + `-----------*/ + + /** Perform inline expansion of function bodies. + + \param tree abstract syntax tree's root, whose bindings and types + have been computed. Each identifier must also be unique + within the AST to avoid name capture. + + \return the AST where the bodies of non recursive functions have + been expanded (inlined), with bindings and type-checked. + */ + template <typename A> A* inline_expand(const A& tree); + + /*-------------------. + | Function pruning. | + `-------------------*/ + + /** Prune unused function from the AST. + + \param tree abstract syntax tree's root, whose bindings and types + have been computed, and whose identifiers are all unique. + + \return the AST whose unused functions have been removed, with + bindings and type-checked. */ + template <typename A> A* prune(const A& tree); + +} // namespace inlining |
