![]() |
mutable
A Database System for Research and Fast Prototyping
|
#include <algorithm>
#include "backend/WebAssembly.hpp"
#include <concepts>
#include <cstdlib>
#include <deque>
#include <experimental/type_traits>
#include <functional>
#include <iostream>
#include <list>
#include <memory>
#include <mutable/util/concepts.hpp>
#include <mutable/util/fn.hpp>
#include <mutable/util/macro.hpp>
#include <mutable/util/tag.hpp>
#include <mutable/util/type_traits.hpp>
#include <numeric>
#include <tuple>
#include <type_traits>
#include <utility>
#include <wasm-binary.h>
#include <wasm-builder.h>
#include <wasm-interpreter.h>
#include <wasm-validator.h>
#include <wasm.h>
Go to the source code of this file.
Namespaces | |
namespace | m |
| |
namespace | m::wasm |
namespace | m::wasm::detail |
Concepts | |
concept | m::wasm::dsl_primitive |
Check whether. | |
concept | m::wasm::dsl_pointer_to_primitive |
Check whether. | |
concept | m::wasm::primitive_convertible |
Detects whether a type. | |
concept | m::wasm::expr_convertible |
Detect whether a type. | |
concept | m::wasm::arithmetically_combinable |
Macros | |
#define | M_insist_no_ternary_logic() |
#define | WASM_INSIST2_(COND, MSG) |
#define | WASM_INSIST1_(COND) WASM_INSIST2_((COND), nullptr) |
#define | WASM_GET_INSIST_(XXX, _1, _2, NAME, ...) NAME |
#define | Wasm_insist(...) WASM_GET_INSIST_(XXX, ##__VA_ARGS__, WASM_INSIST2_, WASM_INSIST1_)(__VA_ARGS__) |
#define | M_EXCEPTION_LIST(X) |
#define | DECLARE_ENUM(TYPE) TYPE, |
#define | DECLARE_NAMES(TYPE) #TYPE, |
#define | CALLBACK(NAME, FUNC) { NAME, FUNC }, |
#define | UNOP_(NAME, TYPE) (::wasm::UnaryOp::NAME##TYPE) |
#define | UNIOP_(NAME) |
#define | UNFOP_(NAME) |
#define | UNVOP_(NAME, TYPE) (::wasm::UnaryOp::NAME##Vec##TYPE) |
#define | UNIVOP_(NAME) |
#define | UNFVOP_(NAME) |
#define | UNARY_VOP(NAME) |
#define | BINOP_(NAME, SIGN, TYPE) (::wasm::BinaryOp::NAME##SIGN##TYPE) |
#define | BINIOP_(NAME, SIGN) |
#define | BINFOP_(NAME) |
#define | BINARY_OP(NAME, SIGN) |
#define | BINVOP_(NAME, SIGN, TYPE) (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE) |
#define | BINIVOP_(NAME, SIGN) |
#define | BINFVOP_(NAME) |
#define | BINARY_VOP(NAME, SIGN) |
#define | UNARY(OP) |
#define | BINARY(OP) |
#define | SHIFT(OP) |
#define | BINVOP_(NAME, SIGN, TYPE) (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE) |
#define | BINIVOP_(NAME, SIGN) |
#define | BINFVOP_(NAME) |
#define | BINARY_VOP(NAME, SIGN) |
#define | BINARY_LIST(X) |
List of supported binary operators on PrimitiveExpr , Expr , Variable , etc. | |
#define | MAKE_BINARY(OP) |
#define | CMP_OP(SYMBOL) |
#define | UNARY_LIST(X) |
List of supported unary operators on PrimitiveExpr . | |
#define | UNARY(OP) |
#define | BINARY(OP) |
#define | MAKE_BINARY(OP) |
#define | USING_N(TYPE, LENGTH, NAME) |
#define | USING(TYPE, NAME) |
#define | REGISTER_USE(VAR) |
#define | UNARY(OP) auto OP() const requires requires (dependent_expr_type e) { e.OP(); } { return dependent_expr_type(*this).OP(); } |
#define | ASSIGNOP_LIST(X) |
#define | ASSIGNOP(SYMBOL) |
#define | ASSIGNOP(SYMBOL) |
Typedefs | |
template<typename T , std::size_t L = 1> | |
using | m::wasm::Reference = detail::the_reference< T, L, false > |
template<typename T , std::size_t L = 1> | |
using | m::wasm::ConstReference = detail::the_reference< T, L, true > |
template<typename T > | |
using | m::wasm::primitive_expr_t = typename primitive_expr< T >::type |
Convenience alias for primitive_expr . | |
template<typename T > | |
using | m::wasm::expr_t = typename expr< T >::type |
Convenience alias for expr . | |
template<std::size_t W> | |
using | m::wasm::int_t = typename _int< W >::type |
template<std::size_t W> | |
using | m::wasm::uint_t = typename uint< W >::type |
using | m::wasm::To = std::conditional_t< std::is_signed_v< T >, int16_t, uint16_t > |
using | m::wasm::vector_type = PrimitiveExpr< T, 16/sizeof(T)> |
| |
template<typename T > | |
using | m::wasm::Ptr = typename detail::ptr_helper< T >::type |
Alias to easily declare PrimitiveExpr of pointer to primitive type. | |
template<typename T > | |
using | m::wasm::Var = typename detail::var_helper< T >::type |
Local variable. | |
template<typename T > | |
using | m::wasm::_Var = typename detail::_var_helper< T >::type |
Local variable that can always be NULL . | |
template<typename T > | |
using | m::wasm::Global = typename detail::global_helper< T >::type |
Global variable. | |
Enumerations | |
enum class | m::wasm::VariableKind { m::wasm::Local , m::wasm::Param , m::wasm::Global } |
Declares the kind of a variable: local, parameter, or global. More... | |
Functions | |
template<typename T , std::size_t L> | |
auto | m::wasm::wasm_type () |
std::string | m::wasm::unique (std::string prefix, unsigned &counter) |
Creates a unique name from a given prefix and a counter . | |
template<typename T , std::size_t L, bool = false, typename U > requires (L == 1) | |
and std::floating_point< T > and std::floating_point< U >inline ::wasm::Literal | m::wasm::make_literal (U value) |
Creates a ::wasm::Literal of type. | |
template<typename T , std::size_t L, bool = false, typename U > requires (L == 1) | |
and signed_integral< T > and integral< U >inline ::wasm::Literal | m::wasm::make_literal (U value) |
Creates a ::wasm::Literal of type. | |
template<typename T , std::size_t L, bool = false, typename U > requires (L == 1) | |
and unsigned_integral< T > and integral< U >inline ::wasm::Literal | m::wasm::make_literal (U value) |
Creates a ::wasm::Literal of type. | |
template<typename T , std::size_t L, bool VecRepr = false, typename U > requires (L == 1) | |
and boolean< T > and boolean< U >inline ::wasm::Literal | m::wasm::make_literal (U value) |
Creates a ::wasm::Literal of type. | |
template<typename T , std::size_t L, bool = false> requires (L == 1) | |
and std::is_pointer_v< T >inline ::wasm::Literal | m::wasm::make_literal (uint32_t value) |
Creates a ::wasm::Literal of type. | |
template<typename T , std::size_t L, bool = false, typename U > requires (L > 1) (U value) | |
m::wasm::and (L *sizeof(T)<=16) and | |
Creates a ::wasm::Literal for. | |
inline ::wasm::Literal | m::wasm::make_literal (U value) |
template<typename T , std::size_t L, bool = false, typename U > requires (L > 1) | |
m::wasm::and (L *sizeof(T) > 16) and((L *sizeof(T)) % 16 | |
Creates a ::wasm::Literal for. | |
L * | m::wasm::sizeof (T))/16 > make_literal(U value) |
template<typename T , std::size_t L, bool = false, typename... Us> requires (L > 1) | |
m::wasm::and (L *sizeof(T)<=16) and(L | |
Creates a ::wasm::Literal for. | |
std::size_t typename Us | m::wasm::and (L *sizeof(T) > 16) and((L *sizeof(T)) % 16 |
::wasm::Literals | m::wasm::insist_interpreter (::wasm::Literals &args) |
Reports a runtime error. | |
::wasm::Literals | m::wasm::throw_interpreter (::wasm::Literals &args) |
Throws an exception. | |
template<typename ReturnType , typename... ParamTypes, std::size_t ReturnL, std::size_t... ParamLs> requires ((std::is_void_v<ReturnType> and (ReturnL == 1)) or requires { typename PrimitiveExpr<ReturnType, ReturnL>; }) | |
m::wasm::and (not dsl_primitive< ReturnType > or(ReturnL *sizeof(ReturnType)<=16)) and( | |
and | m::wasm::and ((not dsl_primitive< ParamTypes > or(ParamLs *sizeof(ParamTypes)<=16)) and ...) struct Function< PrimitiveExpr< ReturnType |
and | m::wasm::ReturnL (PrimitiveExpr< ParamTypes, ParamLs >...)> |
template<dsl_primitive T, std::size_t L> requires (L > 0) | |
m::wasm::and (is_pow_2(L)) and(L *sizeof(T)< | |
Specialization of PrimitiveExpr<T, L> for primitive type. | |
m::wasm::PrimitiveExpr ()=default | |
| |
m::wasm::PrimitiveExpr (::wasm::Expression *expr, std::list< std::shared_ptr< Bit > > referenced_bits={}) | |
| |
m::wasm::PrimitiveExpr (std::pair<::wasm::Expression *, std::list< std::shared_ptr< Bit > > > expr) | |
Constructs a PrimitiveExpr from a std::pair of a Binaryen ::wasm::Expression expr and the referenced_bits . | |
m::wasm::PrimitiveExpr (const std::array< uint8_t, 16 > &bytes) | |
Constructs a PrimitiveExpr from a byte array bytes . | |
m::wasm::PrimitiveExpr (std::array< PrimitiveExpr, 1 > vectors) | |
Constructs a PrimitiveExpr from a vector array vectors containing a single PrimitiveExpr . | |
m::wasm::PrimitiveExpr (Us... value) | |
template<decayable... Us> requires (sizeof...(Us) > 0) (Us... us) | |
m::wasm::and (dsl_primitive< std::decay_t< Us > > and ...) and | |
Constructs a new PrimitiveExpr from a decayable constant value . | |
m::wasm::PrimitiveExpr (const PrimitiveExpr &)=delete | |
m::wasm::PrimitiveExpr (PrimitiveExpr &other) | |
Constructs a new PrimitiveExpr by moving the underlying expr_ and referenced_bits_ of other to this . | |
m::wasm::PrimitiveExpr (PrimitiveExpr &&other) | |
Constructs a new PrimitiveExpr by moving the underlying expr_ and referenced_bits_ of other to this . | |
PrimitiveExpr & | m::wasm::operator= (PrimitiveExpr other) |
Assigns other to this . | |
m::wasm::~PrimitiveExpr () | |
::wasm::Expression * | m::wasm::expr () |
Moves the underlying Binaryen ::wasm::Expression out of this . | |
std::list< std::shared_ptr< Bit > > | m::wasm::referenced_bits () |
Moves the referenced bits out of this . | |
template<dsl_primitive U = T, std::size_t M = L> | |
std::pair<::wasm::Expression *, std::list< std::shared_ptr< Bit > > > | m::wasm::move () |
Moves the underlying Binaryen ::wasm::Expression and the referenced bits out of this . | |
m::wasm::operator bool () const | |
Returns true if this PrimitiveExpr actually holds a value (Binaryen AST), false otherwise. | |
PrimitiveExpr | m::wasm::clone () const |
Creates and returns a deep copy of this . | |
void | m::wasm::discard () |
Discards this . | |
template<dsl_primitive ResultType, std::size_t ResultL> | |
PrimitiveExpr< ResultType, ResultL > | m::wasm::unary (::wasm::UnaryOp op) |
Helper function to implement unary operations. | |
template<dsl_primitive ResultType, std::size_t ResultL, dsl_primitive OperandType, std::size_t OperandL> | |
PrimitiveExpr< ResultType, ResultL > | m::wasm::binary (::wasm::BinaryOp op, PrimitiveExpr< OperandType, OperandL > other) |
Helper function to implement binary operations. | |
template<dsl_primitive U, std::size_t M> | |
PrimitiveExpr< U, M > | m::wasm::convert () |
template<dsl_primitive To, std::size_t ToL = L> requires (L == ToL) | |
and same_signedness< T, To > | m::wasm::and (integral< T >==integral< To >) and(sizeof(T)< |
Implicit conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<To, ToL> . | |
template<dsl_primitive To, std::size_t ToL = L> requires (L == ToL) | |
m::wasm::and (same_signedness< T, To > or boolean< T > or std::same_as< T, char > or boolean< To > or std::same_as< To, char >) and((L ! | |
Explicit conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<To, ToL> . | |
To | m::wasm::and ((L==1) or(std::is_convertible_v< T, To > and not(integral< T > and integral< To > and sizeof(T) > sizeof(To)) and not(integral< T > and sizeof(T)==8 and std::floating_point< To >) and not(std::floating_point< T > and integral< To > and sizeof(To)<=2))) PrimitiveExpr< To |
To ToL | m::wasm::to () |
template<dsl_pointer_to_primitive To, std::size_t ToL = L> requires std::same_as<T, uint32_t> | |
PrimitiveExpr< To, ToL > | m::wasm::to () and(L |
Explicit conversion of a PrimitiveExpr<uint32_t, 1> to a PrimitiveExpr<To*, ToL> | |
PrimitiveExpr< To, ToL > std::size_t ToL | m::wasm::reinterpret () |
template<std::size_t ToL> requires (L == 1) | |
m::wasm::and (ToL > 1) and(ToL *sizeof(T)< | |
Broadcasts a PrimitiveExpr<T, 1> to a PrimitiveExpr<T, ToL> . | |
ToL | m::wasm::broadcast () |
PrimitiveExpr | m::wasm::operator+ () |
PrimitiveExpr | m::wasm::operator- () and(L |
PrimitiveExpr L | m::wasm::add_pairwise () and(sizeof(T) |
PrimitiveExpr L L L L | m::wasm::bitmask () and(L > 1) |
Concatenates the most significant bit of each value of this into a single mask. | |
PrimitiveExpr< bool, L > | m::wasm::eqz () and(L |
PrimitiveExpr< bool, L > | m::wasm::any_true () and(L > 1) |
Returns true iff any value is non-zero. | |
PrimitiveExpr< bool, 1 > | m::wasm::all_true () and(L > 1) |
Returns true iff all values are true . | |
PrimitiveExpr< uint64_t, L > | m::wasm::hash () and(L |
PrimitiveExpr< uint64_t, L > L L L L L auto | m::wasm::operator+ (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > |
template<arithmetic U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > auto | m::wasm::operator- (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > |
Subtracts other from this . | |
template<arithmetic U> requires arithmetically_combinable<T, U, L> (L == 1) | |
auto | m::wasm::operator* (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > |
Multiplies this and other . | |
template<arithmetic U> requires arithmetically_combinable<T, U, L> | |
m::wasm::and (sizeof(common_type_t< T, U >) !=1) auto operator*(PrimitiveExpr< U | |
Multiplies this and other . | |
if | m::wasm::constexpr (L *sizeof(To)<=16) return binary< To |
if | m::wasm::L (op, other) |
else return this template | m::wasm::to< To, L > ().operator*(other.template to< To |
template<arithmetic U> requires arithmetically_combinable<T, U, L> | |
m::wasm::and (sizeof(common_type_t< T, U >)==1) auto operator*(PrimitiveExpr< U | |
Multiplies this and other . | |
referenced_bits_low | m::wasm::splice (referenced_bits_low.end(), other_cpy.referenced_bits()) |
referenced_bits_high | m::wasm::splice (referenced_bits_high.end(), other.referenced_bits()) |
return | m::wasm::PrimitiveExpr< common_type_t< T, U >, L > (ShuffleBytes(low, high, indices).move()) |
template<arithmetic U> requires same_signedness<T, U> (L == 1) | |
and arithmetically_combinable< T, U, L > auto | m::wasm::operator/ (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > |
Divides this by other . | |
template<std::floating_point U> requires arithmetically_combinable<T, U, L> | |
auto | m::wasm::operator/ (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > std |
Divides this by other . | |
template<integral U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > auto | m::wasm::operator% (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > integral< T > and(L |
Computes the remainder of dividing this by other . | |
and arithmetically_combinable< T, U, L > auto L auto | m::wasm::copy_sign (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > and(L |
and arithmetically_combinable< T, U, L > auto L auto L auto | m::wasm::min (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > |
L other PrimitiveExpr< common_type_t< T, U >, L > | m::wasm::and (L > 1) |
template<std::floating_point U> requires arithmetically_combinable<T, U, L> | |
auto | m::wasm::max (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > std |
Computes the maximum of this and other . | |
template<unsigned_integral U> requires arithmetically_combinable<T, U, L> | |
m::wasm::and (sizeof(common_type_t< T, U >)<=2) auto avg(PrimitiveExpr< U | |
Computes the (ceiled) average of this and other . | |
template<std::integral U> requires arithmetically_combinable<T, U, L> | |
auto | m::wasm::operator bitand (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > std |
Computes the bitwise and of this and other . | |
template<integral U> requires requires (PrimitiveExpr<U, 1> e) { PrimitiveExpr<std::conditional_t<std::is_signed_v<T>, int32_t, uint32_t>, 1>(e); } | |
PrimitiveExpr | m::wasm::operator<< (PrimitiveExpr< U, 1 > other) integral< T > and(L > 1) |
Shifts this left by other . | |
template<integral U> requires arithmetically_combinable<T, U, L> | |
auto | m::wasm::operator>> (PrimitiveExpr< U, L > other) -> PrimitiveExpr< common_type_t< T, U >, L > integral< T > and(L |
Shifts this right by other . | |
auto L | m::wasm::and (sizeof(common_type_t< T, U >) >=4) auto rotl(PrimitiveExpr< U |
auto L L other PrimitiveExpr< common_type_t< T, U >, L > | m::wasm::and (L==1) |
template<integral U> requires arithmetically_combinable<T, U, L> | |
m::wasm::and (sizeof(common_type_t< T, U >) >=4) auto rotr(PrimitiveExpr< U | |
Rotates this right by other . | |
template<dsl_primitive U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator== (PrimitiveExpr< U, L > other) |
Checks whether this equals other . | |
template<dsl_primitive U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator!= (PrimitiveExpr< U, L > other) |
Checks whether this unequal to other . | |
template<arithmetic U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator< (PrimitiveExpr< U, L > other) arithmetic< T > |
Checks whether this less than other . | |
template<arithmetic U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator<= (PrimitiveExpr< U, L > other) arithmetic< T > |
Checks whether this less than or equals to other . | |
template<arithmetic U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator> (PrimitiveExpr< U, L > other) arithmetic< T > |
Checks whether this greater than to other . | |
template<arithmetic U> requires same_signedness<T, U> | |
and arithmetically_combinable< T, U, L > PrimitiveExpr< bool, L > | m::wasm::operator>= (PrimitiveExpr< U, L > other) arithmetic< T > |
Checks whether this greater than or equals to other . | |
template<boolean U> requires boolean<T> | |
PrimitiveExpr< bool, L > | m::wasm::operator and (PrimitiveExpr< U, L > other) |
Computes the logical conjunction (and ) of this and other . | |
template<boolean U> requires boolean<T> | |
PrimitiveExpr< bool, L > | m::wasm::and_not (PrimitiveExpr< U, L > other) and(L > 1) |
Computes the logical conjunction (and ) of this and the logical negation (not ) of other . | |
template<boolean U> requires boolean<T> | |
PrimitiveExpr< bool, L > | m::wasm::operator or (PrimitiveExpr< U, L > other) |
Computes the logical disjunction (or ) of this and other . | |
template<std::size_t M> requires (M * sizeof(T) < 16) | |
PrimitiveExpr< T, 1 > | m::wasm::extract_unsafe () |
Extracts the. | |
template<std::size_t M> requires (M < L) (L > 1) | |
PrimitiveExpr< T, 1 > | m::wasm::extract () |
Extracts the. | |
PrimitiveExpr | m::wasm::replace (U &&_value) |
PrimitiveExpr | m::wasm::swizzle_bytes (PrimitiveExpr< uint8_t, 16 > indices) |
Selects lanes of this in byte granularity depending on the indices specified by indices . | |
template<std::size_t M> requires (M > 0) | |
m::wasm::and (M<=16) and(M % sizeof(T) | |
Selects lanes of this in byte granularity depending on the indices specified by indices . | |
template<std::size_t M> requires (M > 0) | |
m::wasm::and (is_pow_2(M)) and(M *sizeof(T)< | |
Selects lanes of this in lane granularity depending on the indices specified by indices . | |
M | m::wasm::swizzle_lanes (const std::array< uint8_t, M > &_indices) |
std::ostream & | m::wasm::operator<< (std::ostream &out, const PrimitiveExpr &P) |
void | m::wasm::dump (std::ostream &out) const |
void | m::wasm::dump () const |
template<dsl_primitive T, std::size_t L> requires (L > 1) | |
m::wasm::and (is_pow_2(L)) and(L *sizeof(T) > 16) and((L *sizeof(T)) % 16 | |
Specialization of PrimitiveExpr<T, L> for primitive type. | |
m::wasm::PrimitiveExpr (std::array< vector_type, num_vectors > vectors) | |
| |
m::wasm::PrimitiveExpr (std::initializer_list< vector_type > vectors) | |
| |
PrimitiveExpr & | m::wasm::operator= (PrimitiveExpr &&)=delete |
std::array< vector_type, num_vectors > | m::wasm::vectors () |
Moves the underlying PrimitiveExpr<T, 16 / sizeof(T)> s out of this . | |
template<dsl_primitive U, std::size_t M> requires ((M * sizeof(U)) / 16 == num_vectors) | |
auto | m::wasm::move () |
Moves the underlying vectors as PrimitiveExpr<U, 16 / sizeof(U)> out of this . | |
template<dsl_primitive U, std::size_t M> requires ((M * sizeof(U)) % 16 == 0) | |
PrimitiveExpr< U, M > | m::wasm::convert () |
auto | m::wasm::make_signed () |
Conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<std::make_signed_t<T>, L> . | |
auto | m::wasm::make_unsigned () |
Conversion of a PrimitiveExpr<T, L> to a PrimitiveExpr<std::make_unsigned_t<T>, L> . | |
m::wasm::UNARY (operator+)UNARY(operator-)UNARY(abs) UNARY(ceil) UNARY(floor) UNARY(trunc) UNARY(nearest) UNARY(sqrt) UNARY(add_pairwise) UNARY(operator~)UNARY(popcnt) UNARY(operator not) PrimitiveExpr< uint32_t | |
Concatenates the most significant bit (or the boolean value if this is boolean) of each value of this into a single mask. | |
m::wasm::BINARY (operator+)BINARY(operator-)BINARY(operator*)BINARY(operator/)BINARY(min) BINARY(max) BINARY(avg) BINARY(operator bitand) BINARY(operator bitor) BINARY(operator xor) BINARY(operator and) BINARY(and_not) BINARY(operator or) SHIFT(operator<<) SHIFT(operator>>) private | |
Transforms a comparison result into its boolean representation. | |
template<std::size_t M> requires (M < L) | |
PrimitiveExpr< T, 1 > | m::wasm::extract () |
Extracts the. | |
template<std::size_t M, primitive_convertible U> requires (M < L) requires (vector_type v) { v.replace<0>(std::forward<U>(value)); } | |
PrimitiveExpr | m::wasm::replace (U &&value) |
Replaces the. | |
m::wasm::BINARY_LIST (MAKE_BINARY) template< dsl_pointer_to_primitive T | |
Specialization of PrimitiveExpr<T, L> for pointer to primitive type. | |
std::size_t L | m::wasm::and (is_pow_2(L)) and((L |
template<typename T , std::size_t L> | |
m::wasm::Expr (PrimitiveExpr< T, L >, PrimitiveExpr< bool, L >) -> Expr< T, L > | |
CTAD guide for Expr | |
Bool | m::wasm::USING (int8_t, I8) USING(uint8_t |
Bool U8 | m::wasm::USING (int16_t, I16) USING(uint16_t |
Bool U8 U16 | m::wasm::USING (int32_t, I32) USING(uint32_t |
Bool U8 U16 U32 | m::wasm::USING (int64_t, I64) USING(uint64_t |
Bool U8 U16 U32 U64 | m::wasm::USING (float, Float) USING(double |
Bool U8 U16 U32 U64 Double | m::wasm::USING_N (char, 1, Charx1) USING_N(char |
| |
Bool U8 U16 U32 U64 Double Charx16 | m::wasm::USING_N (char, 32, Charx32) namespace detail |
template<typename T , VariableKind Kind, bool CanBeNull, std::size_t L> requires (not (dsl_pointer_to_primitive<T> and CanBeNull)) | |
m::wasm::and (not(Kind==VariableKind::Global and CanBeNull)) and | |
template<dsl_pointer_to_primitive T, VariableKind Kind, bool CanBeNull, std::size_t L> requires requires (const Variable<T, Kind, CanBeNull, L> &var, typename PrimitiveExpr<T, L>::offset_t delta) { var.val().operator+(delta); } | |
auto | m::wasm::operator+ (const Variable< T, Kind, CanBeNull, L > &var, typename PrimitiveExpr< T, L >::offset_t delta) |
template<dsl_pointer_to_primitive T, VariableKind Kind, bool CanBeNull, std::size_t L> requires requires (const Variable<T, Kind, CanBeNull, L> &var, typename PrimitiveExpr<T, L>::offset_t delta) { var.val().operator-(delta); } | |
auto | m::wasm::operator- (const Variable< T, Kind, CanBeNull, L > &var, typename PrimitiveExpr< T, L >::offset_t delta) |
template<std::size_t L> requires (L > 0) | |
and(L<=16) struct LocalBit< L > void | m::wasm::RETURN_UNSAFE () |
A scalar bit or a vector of bits that is managed by the current function's stack. | |
template<primitive_convertible T> | |
void | m::wasm::RETURN_UNSAFE (T &&t) |
template<expr_convertible T> requires (not primitive_convertible<T>) | |
void | m::wasm::RETURN_UNSAFE (T &&t) |
void | m::wasm::BREAK (std::size_t level=1) |
template<primitive_convertible C> requires requires (C &&c) { PrimitiveExpr<bool, 1>(std::forward<C>(c)); } | |
void | m::wasm::BREAK (C &&_cond, std::size_t level=1) |
void | m::wasm::CONTINUE (std::size_t level=1) |
template<primitive_convertible C> requires requires (C &&c) { PrimitiveExpr<bool, 1>(std::forward<C>(c)); } | |
void | m::wasm::CONTINUE (C &&_cond, std::size_t level=1) |
void | m::wasm::GOTO (const Block &block) |
Jumps to the end of block . | |
template<primitive_convertible C> requires requires (C &&c) { PrimitiveExpr<bool, 1>(std::forward<C>(c)); } | |
void | m::wasm::GOTO (C &&_cond, const Block &block) |
template<primitive_convertible C, primitive_convertible T, primitive_convertible U> requires have_common_type<typename primitive_expr_t<T>::type, typename primitive_expr_t<U>::type> (C &&c) | |
m::wasm::and (primitive_expr_t< T >::num_simd_lanes==primitive_expr_t< U >::num_simd_lanes) and | |
auto | m::wasm::Select (C &&_cond, T &&_tru, U &&_fals) |
template<primitive_convertible C, expr_convertible T, expr_convertible U> requires (not primitive_convertible<T> or not primitive_convertible<U>) (C &&c) | |
and have_common_type< typename expr_t< T >::type, typename expr_t< U >::type > | m::wasm::and (expr_t< T >::num_simd_lanes==expr_t< U >::num_simd_lanes) and |
template<primitive_convertible C, primitive_convertible T, primitive_convertible U> requires have_common_type<typename primitive_expr_t<T>::type, typename primitive_expr_t<U>::type> | |
m::wasm::and (primitive_expr_t< T >::num_simd_lanes==primitive_expr_t< U >::num_simd_lanes) and(primitive_expr_t< T > | |
template<primitive_convertible C, expr_convertible T, expr_convertible U> requires (not primitive_convertible<T> or not primitive_convertible<U>) | |
and have_common_type< typename expr_t< T >::type, typename expr_t< U >::type > | m::wasm::and (expr_t< T >::num_simd_lanes==expr_t< U >::num_simd_lanes) and(expr_t< T > |
template<primitive_convertible T, primitive_convertible U, std::size_t M> requires have_common_type<typename primitive_expr_t<T>::type, typename primitive_expr_t<U>::type> (PrimitiveExpr<common_type_t<typename primitive_expr_t<T>::type, typename primitive_expr_t<U>::type>, primitive_expr_t<T>::num_simd_lanes> e, const std::array<uint8_t, M> &a) | |
m::wasm::and (primitive_expr_t< T >::num_simd_lanes==primitive_expr_t< U >::num_simd_lanes) and | |
auto | m::wasm::ShuffleBytes (T &&_first, U &&_second, const std::array< uint8_t, M > &indices) |
auto | m::wasm::ShuffleLanes (T &&_first, U &&_second, const std::array< uint8_t, M > &indices) |
template<expr_convertible T, expr_convertible U, std::size_t M> requires (not primitive_convertible<T> or not primitive_convertible<U>) (Expr<common_type_t<typename expr_t<T>::type, typename expr_t<U>::type>, expr_t<T>::num_simd_lanes> e, const std::array<uint8_t, M> &a) | |
and have_common_type< typename expr_t< T >::type, typename expr_t< U >::type > | m::wasm::and (expr_t< T >::num_simd_lanes==expr_t< U >::num_simd_lanes) and |
template<std::size_t L> requires (L > 0) | |
m::wasm::and (L<=16) inline LocalBit< L > Module | |
template<typename T , std::size_t L, std::size_t M> requires (L > 1) | |
m::wasm::and (L *sizeof(T)<=16) and(M > 0) and(M< | |
Variables | |
std::size_t | m::wasm::L |
std::size_t | m::wasm::bool = false |
const std::map<::wasm::Name, std::function<::wasm::Literals(::wasm::Literals &)> > | m::wasm::callback_functions |
static constexpr std::size_t | m::wasm::num_simd_lanes = L |
| |
::wasm::Expression * | m::wasm::expr_ = nullptr |
| |
std::list< std::shared_ptr< Bit > > | m::wasm::referenced_bits_ |
| |
template<dsl_primitive... Us> requires (primitive_expr_t<U> u) | |
m::wasm::and { make_literal<T, L>(us...) | |
Constructs a new PrimitiveExpr from a constant value . | |
PrimitiveExpr< To, ToL > std::size_t | m::wasm::ToL |
PrimitiveExpr< uint64_t, L > L L L L | m::wasm::U |
L other | m::wasm::PrimitiveExpr< common_type_t< T, U >, L > |
auto | m::wasm::op |
auto | m::wasm::op_low |
auto | m::wasm::op_high |
auto | m::wasm::this_cpy = this->clone() |
auto | m::wasm::other_cpy = other.clone() |
auto | m::wasm::referenced_bits_low = this_cpy.referenced_bits() |
auto | m::wasm::referenced_bits_high = this->referenced_bits() |
PrimitiveExpr< To, 8 > | m::wasm::low (Module::Builder().makeBinary(op_low, this_cpy.expr(), other_cpy.expr()), std::move(referenced_bits_low)) |
PrimitiveExpr< To, 8 > | m::wasm::high (Module::Builder().makeBinary(op_high, this->expr(), other.expr()), std::move(referenced_bits_high)) |
auto | m::wasm::indices = std::to_array<uint8_t>({ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30 }) |
static constexpr std::size_t | m::wasm::num_vectors = (L * sizeof(T)) / 16 |
| |
std::array< vector_type, num_vectors > | m::wasm::vectors_ |
| |
for(std::size_t idx=1;idx< num_vectors;++idx) res.emplace((vectors_[idx].bitmask()<< uint32_t(idx *vector_type return * | m::wasm::res |
#define ASSIGNOP | ( | SYMBOL | ) |
Definition at line 5862 of file WasmDSL.hpp.
#define ASSIGNOP | ( | SYMBOL | ) |
Definition at line 5862 of file WasmDSL.hpp.
#define ASSIGNOP_LIST | ( | X | ) |
#define BINARY | ( | OP | ) |
Definition at line 4804 of file WasmDSL.hpp.
#define BINARY | ( | OP | ) |
Definition at line 4804 of file WasmDSL.hpp.
#define BINARY_LIST | ( | X | ) |
List of supported binary operators on PrimitiveExpr
, Expr
, Variable
, etc.
Definition at line 4100 of file WasmDSL.hpp.
#define BINARY_OP | ( | NAME, | |
SIGN | |||
) |
#define BINARY_VOP | ( | NAME, | |
SIGN | |||
) |
#define BINARY_VOP | ( | NAME, | |
SIGN | |||
) |
#define BINFOP_ | ( | NAME | ) |
#define BINFVOP_ | ( | NAME | ) |
#define BINFVOP_ | ( | NAME | ) |
#define BINIOP_ | ( | NAME, | |
SIGN | |||
) |
#define BINIVOP_ | ( | NAME, | |
SIGN | |||
) |
#define BINIVOP_ | ( | NAME, | |
SIGN | |||
) |
#define BINOP_ | ( | NAME, | |
SIGN, | |||
TYPE | |||
) | (::wasm::BinaryOp::NAME##SIGN##TYPE) |
#define BINVOP_ | ( | NAME, | |
SIGN, | |||
TYPE | |||
) | (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE) |
#define BINVOP_ | ( | NAME, | |
SIGN, | |||
TYPE | |||
) | (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE) |
#define CALLBACK | ( | NAME, | |
FUNC | |||
) | { NAME, FUNC }, |
#define CMP_OP | ( | SYMBOL | ) |
#define DECLARE_ENUM | ( | TYPE | ) | TYPE, |
Definition at line 555 of file WasmDSL.hpp.
#define DECLARE_NAMES | ( | TYPE | ) | #TYPE, |
Definition at line 561 of file WasmDSL.hpp.
#define M_EXCEPTION_LIST | ( | X | ) |
Definition at line 548 of file WasmDSL.hpp.
#define M_insist_no_ternary_logic | ( | ) |
Definition at line 45 of file WasmDSL.hpp.
#define MAKE_BINARY | ( | OP | ) |
Definition at line 5098 of file WasmDSL.hpp.
#define MAKE_BINARY | ( | OP | ) |
Definition at line 5098 of file WasmDSL.hpp.
#define REGISTER_USE | ( | VAR | ) |
Definition at line 5522 of file WasmDSL.hpp.
#define SHIFT | ( | OP | ) |
#define UNARY | ( | OP | ) |
Definition at line 5642 of file WasmDSL.hpp.
#define UNARY | ( | OP | ) |
Definition at line 5642 of file WasmDSL.hpp.
#define UNARY | ( | OP | ) | auto OP() const requires requires (dependent_expr_type e) { e.OP(); } { return dependent_expr_type(*this).OP(); } |
Definition at line 5642 of file WasmDSL.hpp.
#define UNARY_LIST | ( | X | ) |
List of supported unary operators on PrimitiveExpr
.
Definition at line 4726 of file WasmDSL.hpp.
#define UNARY_VOP | ( | NAME | ) |
Definition at line 2131 of file WasmDSL.hpp.
#define UNFOP_ | ( | NAME | ) |
Definition at line 2102 of file WasmDSL.hpp.
#define UNFVOP_ | ( | NAME | ) |
Definition at line 2123 of file WasmDSL.hpp.
#define UNIOP_ | ( | NAME | ) |
Definition at line 2094 of file WasmDSL.hpp.
#define UNIVOP_ | ( | NAME | ) |
Definition at line 2111 of file WasmDSL.hpp.
#define UNOP_ | ( | NAME, | |
TYPE | |||
) | (::wasm::UnaryOp::NAME##TYPE) |
Definition at line 2093 of file WasmDSL.hpp.
#define UNVOP_ | ( | NAME, | |
TYPE | |||
) | (::wasm::UnaryOp::NAME##Vec##TYPE) |
Definition at line 2110 of file WasmDSL.hpp.
#define USING | ( | TYPE, | |
NAME | |||
) |
#define USING_N | ( | TYPE, | |
LENGTH, | |||
NAME | |||
) |
#define WASM_GET_INSIST_ | ( | XXX, | |
_1, | |||
_2, | |||
NAME, | |||
... | |||
) | NAME |
Definition at line 372 of file WasmDSL.hpp.
#define Wasm_insist | ( | ... | ) | WASM_GET_INSIST_(XXX, ##__VA_ARGS__, WASM_INSIST2_, WASM_INSIST1_)(__VA_ARGS__) |
Definition at line 373 of file WasmDSL.hpp.
#define WASM_INSIST1_ | ( | COND | ) | WASM_INSIST2_((COND), nullptr) |
Definition at line 364 of file WasmDSL.hpp.
#define WASM_INSIST2_ | ( | COND, | |
MSG | |||
) |
Definition at line 359 of file WasmDSL.hpp.