feat: Add AST analysis pass for purity and recursion
This commit introduces a new AST analysis pass that identifies function purity and recursion. This information is then used by the optimizer and specializer to make more informed decisions, particularly regarding inlining. The `Analyzer` struct and its associated `Analysis` struct are responsible for traversing the AST and collecting this data. Key changes include: - A new `analyzer` module is added to `ast::compiler`. - `Analyzer::analyze` performs a two-pass traversal to collect global-to-lambda mappings and then analyze purity and recursion. - The `Optimizer` and `Specializer` are updated to accept and utilize the `Analysis` data. - Recursion checks in `Optimizer` and `Specializer` are replaced with checks against the pre-computed `Analysis.is_recursive` set. - The `Environment` now stores and passes the `Analysis` results to the compiler stages.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub mod analyzer;
|
||||
pub mod binder;
|
||||
pub mod bound_nodes;
|
||||
pub mod dumper;
|
||||
|
||||
Reference in New Issue
Block a user