From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- tiger-compiler/src/inlining/libinlining.hh | 42 ++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tiger-compiler/src/inlining/libinlining.hh (limited to 'tiger-compiler/src/inlining/libinlining.hh') 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 +#include + +/// 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 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 A* prune(const A& tree); + +} // namespace inlining -- cgit v1.2.3