Aarch64 jit compiler wip: support bool function arguments

This commit is contained in:
Nikita Lisitsa 2026-01-04 13:52:53 +03:00
parent f28138e5b9
commit e5b11fd707

View file

@ -1,3 +1,4 @@
#include "pslang/types/type_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>
@ -409,7 +410,14 @@ namespace pslang::jit::aarch64
scopes.emplace_back(); scopes.emplace_back();
for (std::size_t i = 0; i < node.arguments.size(); ++i) for (std::size_t i = 0; i < node.arguments.size(); ++i)
{ {
extend(i, ast::get_type(*node.arguments[i].type)); auto type = ast::get_type(*node.arguments[i].type);
if (types::is_bool_type(*type))
{
builder.tst(i, i);
builder.csetm(i, 0b0001);
}
else if (types::is_integer_type(*type))
extend(i, type);
push(i); push(i);
scopes.back().variables[node.arguments[i].name] = {.frame_offset = stack_offset}; scopes.back().variables[node.arguments[i].name] = {.frame_offset = stack_offset};
} }