Aarch64 compiler wip: properly handle scopes
This commit is contained in:
parent
716d51221f
commit
43f2d4531a
1 changed files with 10 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "pslang/ast/statement_fwd.hpp"
|
||||||
#include <pslang/jit/arch/aarch64/compiler.hpp>
|
#include <pslang/jit/arch/aarch64/compiler.hpp>
|
||||||
#include <pslang/jit/arch/aarch64/instruction_builder.hpp>
|
#include <pslang/jit/arch/aarch64/instruction_builder.hpp>
|
||||||
#include <pslang/jit/executable.hpp>
|
#include <pslang/jit/executable.hpp>
|
||||||
|
|
@ -342,9 +343,17 @@ namespace pslang::jit::aarch64
|
||||||
// Don't handle internal functions
|
// Don't handle internal functions
|
||||||
}
|
}
|
||||||
|
|
||||||
void do_apply(ast::function_definition const & node)
|
void apply(ast::statement_list const & node)
|
||||||
{
|
{
|
||||||
scopes.emplace_back();
|
scopes.emplace_back();
|
||||||
|
for (auto const & statement : node.statements)
|
||||||
|
apply(*statement);
|
||||||
|
builder.add_imm(31, 31, scopes.back().stack_offset);
|
||||||
|
scopes.pop_back();
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_apply(ast::function_definition const & node)
|
||||||
|
{
|
||||||
// TODO: arguments
|
// TODO: arguments
|
||||||
apply(*node.statements);
|
apply(*node.statements);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue