Remove old aarch64 compiler and update plans

This commit is contained in:
Nikita Lisitsa 2026-03-29 23:22:29 +03:00
parent e771542773
commit 138bddf187
6 changed files with 935 additions and 2383 deletions

View file

@ -6,8 +6,6 @@
namespace pslang::jit::aarch64 namespace pslang::jit::aarch64
{ {
void compile(program_context & context, ast::statement_list_ptr const & statements);
void compile(program_context & pcontext, ir::module_context const & mcontext); void compile(program_context & pcontext, ir::module_context const & mcontext);
} }

View file

@ -7,7 +7,6 @@
namespace pslang::jit namespace pslang::jit
{ {
void compile(program_context & context, ast::statement_list_ptr const & statements);
void compile(program_context & pcontext, ir::module_context const & mcontext); void compile(program_context & pcontext, ir::module_context const & mcontext);
} }

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -6,20 +6,6 @@
namespace pslang::jit namespace pslang::jit
{ {
void compile(program_context & context, ast::statement_list_ptr const & statements)
{
switch (context.abi)
{
case abi::itanium:
throw std::runtime_error("Itanium ABI JIT not implemented");
case abi::msvc:
throw std::runtime_error("MSVC ABI JIT not implemented");
case abi::armv8:
aarch64::compile(context, statements);
break;
}
}
void compile(program_context & pcontext, ir::module_context const & mcontext) void compile(program_context & pcontext, ir::module_context const & mcontext)
{ {
switch (pcontext.abi) switch (pcontext.abi)

View file

@ -1,7 +1,5 @@
Future plans: Future plans:
* Split compiler into IR generation, IR optimization, and target-specific bytecode emitter
* Globals (requires a separate mmaped segment in JIT compiler) * Globals (requires a separate mmaped segment in JIT compiler)
* Pointers: pointer types, address-of operator (&), dereferencing, scope-based lifetime tracking in interpreter
* Function overloading: separate functions from values (again) in interpreter, allow casting to specific function type to take function value * Function overloading: separate functions from values (again) in interpreter, allow casting to specific function type to take function value
* Const propagation: annotate expression AST nodes that are computable in compile-time * Const propagation: annotate expression AST nodes that are computable in compile-time
* Generic parameters: can be either values or `t : type`, but always compile-time * Generic parameters: can be either values or `t : type`, but always compile-time
@ -13,19 +11,15 @@ Future plans:
Interpreter backlog: Interpreter backlog:
* Fix identifier resolution for functions & variables * Fix identifier resolution for functions & variables
* Replace tree-walking interpreter with IR-based interpreter (invalidates the previous item)
* C FFI (foreign functions) * C FFI (foreign functions)
Aarch64 compiler backlog: Aarch64 compiler backlog: (empty!)
* Rewrite using IR (compiler_v2.cpp first, then swap with the old one)
* Struct fields in structs (initialization & field access)
* Struct function arguments & return values
* Arrays
IR backlog: Optimizer plans:
* 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) * 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 * 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 * Arithmetic simplification: replace a+0 with a, etc (maybe also replace `var+const+const` with `var+const` for array/struct access)
* Branch removal: `if` nodes with condition nodes being `const` are replaced with unconditional jumps * Branch removal: `if` nodes with condition nodes being `const` are replaced with unconditional jumps
* Jump removal: `jump` that jumps to the immediate successor node is removed * Jump removal: `jump` that jumps to the immediate successor node is removed
* Dead code elimination: DFS from function `return` nodes & impure function calls, remove all nodes not visited (make sure to not remove function arguments) * Dead code elimination: DFS from function `return` nodes & impure function calls, remove all nodes not visited (make sure to not remove function arguments)