From 776c12f6b524bb77dfe77affd757fe1fe2cd4104 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 23 Mar 2026 00:26:58 +0300 Subject: [PATCH] Update plans --- libs/ir/source/compiler.cpp | 6 ++++-- plans.txt | 11 ++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libs/ir/source/compiler.cpp b/libs/ir/source/compiler.cpp index 9bb651c..150955c 100644 --- a/libs/ir/source/compiler.cpp +++ b/libs/ir/source/compiler.cpp @@ -4,7 +4,6 @@ #include #include -#include namespace pslang::ir { @@ -268,7 +267,10 @@ namespace pslang::ir return last(); } - // TODO: struct_definition + node_ref apply(ast::struct_definition const & node) + { + return last(); + } // Statement list diff --git a/plans.txt b/plans.txt index 94522ca..8ad6084 100644 --- a/plans.txt +++ b/plans.txt @@ -21,15 +21,8 @@ Aarch64 compiler backlog: * Struct function arguments & return values * Arrays -IR outline: -* Doubly-linked list (std::list will do) of instruction nodes -* Nodes reference other nodes for input data or branching target -* No temporary variables, nodes themselves represent data flow -* Assignment expressions turn into nodes that assign to previously-defined nodes -* Jump targets (first `while` node, node after an `if`, etc) are generated as nop nodes, to prevent them from being removed by the optimizer -* Structs & arrays can be split into several independent nodes per-field (before pointers are introduced) - -IR optimizations: +IR backlog: +* Structs & arrays: structs indexed by field index, make sure the representation allows for SROA * Inlining: track function IR size (number of nodes will do), substitute its code instead of calling if it is small enough (pay attention to recursion) * Constant folding & propagation: if all node arguments are `const` nodes, replace the current node with the computed value * Arithmetic simplification: replace a+0 with a, etc