![]() |
mutable
A Database System for Research and Fast Prototyping
|
Compiles AST expressions m::Expr
to Wasm ASTs m::wasm::Expr<T>
.
More...
#include <WasmUtil.hpp>
Public Member Functions | |
ExprCompiler (const Environment &env) | |
SQL_t | compile (const m::ast::Expr &e) |
| |
template<sql_type T> | |
T | compile (const m::ast::Expr &e) |
| |
SQL_boolean_t | compile (const cnf::CNF &cnf) |
| |
template<sql_boolean_type T> | |
T | compile (const cnf::CNF &cnf) |
| |
Private Member Functions | |
void | operator() (const ast::ErrorExpr &) override |
void | operator() (const ast::Designator &op) override |
void | operator() (const ast::Constant &op) override |
void | operator() (const ast::UnaryExpr &op) override |
void | operator() (const ast::BinaryExpr &op) override |
void | operator() (const ast::FnApplicationExpr &op) override |
void | operator() (const ast::QueryExpr &op) override |
SQL_t | get () |
template<sql_type T> | |
T | get () |
void | set (SQL_t &&value) |
template<sql_type T> | |
void | set (T &&value) |
Private Attributes | |
SQL_t | intermediate_result_ |
| |
const Environment & | env_ |
| |
Compiles AST expressions m::Expr
to Wasm ASTs m::wasm::Expr<T>
.
Also supports compiling m::cnf::CNF
s.
Definition at line 494 of file WasmUtil.hpp.
|
inline |
Definition at line 503 of file WasmUtil.hpp.
SQL_boolean_t ExprCompiler::compile | ( | const cnf::CNF & | cnf | ) |
Compile a
m::cnf::CNF
cnf
of statically unknown type to aSQL_t
.
Definition at line 505 of file WasmUtil.cpp.
References m::cnf::CNF::can_be_null(), m::wasm::CodeGenContext::Get(), M_unreachable, and m::wasm::num_simd_lanes.
Compile a
m::cnf::CNF
cnf
of statically known type to
T. |
Definition at line 523 of file WasmUtil.hpp.
|
inline |
Compiles a
m::Expr
e
of statically unknown type to aSQL_t
.
Definition at line 506 of file WasmUtil.hpp.
References intermediate_result_.
Referenced by compile(), m::wasm::Environment::compile(), and compile_cnf().
|
inline |
Compile a
m::Expr
e
of statically known type to
T. |
Definition at line 512 of file WasmUtil.hpp.
References intermediate_result_, M_insist, and m::T().
|
inlineprivate |
Definition at line 539 of file WasmUtil.hpp.
References intermediate_result_.
Referenced by operator()().
|
inlineprivate |
Definition at line 542 of file WasmUtil.hpp.
References intermediate_result_, M_insist, and m::T().
|
overrideprivate |
Definition at line 284 of file WasmUtil.cpp.
References m::wasm::Module::Allocator, m::wasm::and, BINOP, CMPOP, m::ast::BinaryExpr::common_operand_type, convert_in_place(), ELSE, m::wasm::EQ, m::wasm::GE, m::Catalog::Get(), get(), m::wasm::CodeGenContext::Get(), m::wasm::GT, IF, m::interpret(), m::wasm::LE, m::ast::BinaryExpr::lhs, m::wasm::like(), m::wasm::like_contains(), m::wasm::like_prefix(), m::wasm::like_suffix(), m::wasm::LT, M_insist, M_unreachable, m::wasm::NE, m::wasm::num_simd_lanes, m::ast::BinaryExpr::op(), m::Catalog::pool(), m::wasm::res, m::ast::BinaryExpr::rhs, set(), m::wasm::strncpy(), and m::ast::Token::type.
|
overrideprivate |
Definition at line 175 of file WasmUtil.cpp.
References m::wasm::CodeGenContext::Get(), m::Type::is_none(), m::wasm::L, M_insist, M_unreachable, m::wasm::n, m::wasm::num_simd_lanes, m::wasm::CodeGenContext::num_simd_lanes(), set(), m::T(), m::ast::Expr::type(), m::wasm::value, and m::visit().
|
overrideprivate |
Definition at line 155 of file WasmUtil.cpp.
References m::Pooled< T, Pool, CanBeNone >::assert_not_none(), m::ast::Designator::attr_name, env_, m::wasm::CodeGenContext::Get(), m::wasm::Environment::get(), id, m::Type::is_none(), M_unreachable, m::wasm::num_simd_lanes, set(), m::ast::Designator::table_name, m::ast::Token::text, and m::ast::Expr::type().
|
overrideprivate |
Definition at line 153 of file WasmUtil.cpp.
References M_unreachable.
|
overrideprivate |
Definition at line 450 of file WasmUtil.cpp.
References m::ast::FnApplicationExpr::args, env_, m::Function::FN_UDF, m::Function::fnid, m::Catalog::Get(), get(), m::wasm::Environment::get(), m::ast::FnApplicationExpr::get_function(), id, M_unreachable, set(), and m::T().
|
overrideprivate |
Definition at line 498 of file WasmUtil.cpp.
References m::ast::QueryExpr::alias(), env_, m::Catalog::Get(), m::wasm::Environment::get(), id, m::Catalog::pool(), and set().
|
overrideprivate |
Definition at line 250 of file WasmUtil.cpp.
References m::ast::UnaryExpr::expr, get(), M_unreachable, m::ast::UnaryExpr::op(), set(), m::ast::Token::type, and UNOP.
|
inlineprivate |
Definition at line 547 of file WasmUtil.hpp.
References intermediate_result_, and m::wasm::value.
Referenced by operator()().
|
inlineprivate |
Definition at line 553 of file WasmUtil.hpp.
References set(), and m::wasm::value.
Referenced by set().
|
private |
the environment to use for resolving designators to
Expr<T>
s
Definition at line 500 of file WasmUtil.hpp.
Referenced by operator()().
|
private |
current intermediate results during AST traversal and compilation
Definition at line 498 of file WasmUtil.hpp.