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/pruner.hh | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tiger-compiler/src/inlining/pruner.hh (limited to 'tiger-compiler/src/inlining/pruner.hh') diff --git a/tiger-compiler/src/inlining/pruner.hh b/tiger-compiler/src/inlining/pruner.hh new file mode 100644 index 0000000..30a0609 --- /dev/null +++ b/tiger-compiler/src/inlining/pruner.hh @@ -0,0 +1,42 @@ +/** + ** \file inlining/pruner.hh + ** \brief Declaration of inlining::Pruner. + */ + +#pragma once + +#include + +#include +#include + +namespace inlining +{ + /// Prune useless function declarations within an AST. + class Pruner : public astclone::Cloner + { + public: + using super_type = astclone::Cloner; + + // Import overloaded virtual functions. + using super_type::operator(); + + using func_vect = std::vector; + using func_count = std::map; + + /// \name Visit methods. + /// \{ + // FIXME: Some code was deleted here. + /// \} + + ast::FunctionChunk* prune(ast::FunctionChunk& e); + + private: + // Keep track of current nested functions + std::vector current_functions_; + + // Associate function dec with the number of CallExp calling it + func_count called_functions_; + }; + +} // namespace inlining -- cgit v1.2.3