mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Data Structures | Namespaces | Concepts | Macros | Typedefs | Enumerations | Functions | Variables
WasmDSL.hpp File Reference
#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>
Include dependency graph for WasmDSL.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  m::wasm::primitive_expr< T >
 Specialization for decayable. More...
 
struct  m::wasm::primitive_expr< PrimitiveExpr< T, L > >
 Specialization for. More...
 
struct  m::wasm::primitive_expr< Variable< T, Kind, false, L > >
 Specialization for. More...
 
struct  m::wasm::primitive_expr< Parameter< T, L > >
 Specialization for. More...
 
struct  m::wasm::primitive_expr< detail::the_reference< T, L, IsConst > >
 Specialization for. More...
 
struct  m::wasm::expr< T >
 Specialization for decayable. More...
 
struct  m::wasm::expr< PrimitiveExpr< T, L > >
 Specialization for. More...
 
struct  m::wasm::expr< Expr< T, L > >
 Specialization for. More...
 
struct  m::wasm::expr< Variable< T, Kind, CanBeNull, L > >
 Specialization for. More...
 
struct  m::wasm::expr< Parameter< T, L > >
 Specialization for. More...
 
struct  m::wasm::expr< detail::the_reference< T, L, IsConst > >
 Specialization for. More...
 
struct  m::wasm::detail::wasm_type_helper< T, 1 >
 Specialization for. More...
 
struct  m::wasm::detail::wasm_type_helper< T, L >
 Specialization for. More...
 
struct  m::wasm::detail::wasm_type_helper< PrimitiveExpr< T, L >, 1 >
 Specialization for. More...
 
struct  m::wasm::detail::wasm_type_helper< ReturnType(ParamTypes...), 1 >
 Specialization for. More...
 
struct  m::wasm::_int< 1 >
 
struct  m::wasm::_int< 2 >
 
struct  m::wasm::_int< 4 >
 
struct  m::wasm::_int< 8 >
 
struct  m::wasm::uint< 1 >
 
struct  m::wasm::uint< 2 >
 
struct  m::wasm::uint< 4 >
 
struct  m::wasm::uint< 8 >
 
struct  m::wasm::branch_target_t
 Stores the "branch targets" introduced by control flow structures, i.e. More...
 
struct  m::wasm::print_types< param_pack_t< T, Ts... >, L, Ls... >
 Prints the Wasm type for. More...
 
struct  m::wasm::print_types< param_pack_t< T >, L >
 Prints the Wasm type for. More...
 
struct  m::wasm::exception
 
struct  m::wasm::GarbageCollectedData
 Helper struct for garbage collection done by the Module. More...
 
struct  m::wasm::ConstantFolding
 Helper struct to perform constant folding at compile time. More...
 
struct  m::wasm::Module
 
struct  m::wasm::Block
 Represents a code block, i.e. More...
 
struct  m::wasm::BlockUser
 A helper class to use a Block, thereby setting the Block active for code generation. More...
 
struct  m::wasm::Function< void(PrimitiveExpr< ParamTypes, ParamLs >...)>
 
struct  m::wasm::FunctionProxy< void(PrimitiveExpr< ParamTypes, ParamLs >...)>
 
struct  m::wasm::detail::ptr_helper< void >
 
struct  m::wasm::detail::ptr_helper< PrimitiveExpr< T, L > >
 
struct  m::wasm::Expr< T, L >
 An Expr<T, L> combines a PrimitiveExpr<T, L> value with a PrimitiveExpr<bool, L>, called NULL information, to implement a value with three-valued logic (3VL). More...
 
struct  m::wasm::Variable< T, Kind, CanBeNull, L >
 
struct  m::wasm::detail::var_helper< PrimitiveExpr< T, L > >
 
struct  m::wasm::detail::var_helper< Expr< T, L > >
 
struct  m::wasm::detail::_var_helper< PrimitiveExpr< T, L > >
 
struct  m::wasm::detail::_var_helper< Expr< T, L > >
 
struct  m::wasm::detail::global_helper< PrimitiveExpr< T, L > >
 
struct  m::wasm::Parameter< T, L >
 A type to access function parameters. More...
 
struct  m::wasm::detail::the_reference< T, L, IsConst >
 
struct  m::wasm::LocalBitmap
 
struct  m::wasm::LocalBitvector
 
struct  m::wasm::Bit
 
class  m::wasm::detail::local_bit_storage< L >
 Helper class to select appropriate storage for a LocalBit. More...
 
class  m::wasm::detail::local_bit_storage< 1 >
 Specialization for a single bit. More...
 
struct  m::wasm::If
 
struct  m::wasm::Loop
 Implements a loop which iterates exactly once unless explicitly continue-ed. More...
 
struct  m::wasm::DoWhile
 
struct  m::wasm::While
 
struct  m::wasm::Allocator
 

Namespaces

namespace  m
 

‍mutable namespace


 
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)>
 

‍the type of a single fully utilized vector


 
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
 

‍Constructs an empty PrimitiveExpr, for which operator bool() returns false.


 
 m::wasm::PrimitiveExpr (::wasm::Expression *expr, std::list< std::shared_ptr< Bit > > referenced_bits={})
 

‍Constructs a PrimitiveExpr from a Binaryen ::wasm::Expression expr and the 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::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)
 

‍Constructs a PrimitiveExpr from an array of fully utilized PrimitiveExprs vectors.


 
 m::wasm::PrimitiveExpr (std::initializer_list< vector_type > vectors)
 

‍Constructs a PrimitiveExpr from an initializer list of fully utilized PrimitiveExprs 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
 

‍this is neither signed nor unsigned char (see https://en.cppreference.com/w/cpp/language/types, Character types)


 
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
 

‍the number of SIMD lanes of the represented expression, i.e. 1 for scalar and at least 2 for vectorial ones


 
::wasm::Expression * m::wasm::expr_ = nullptr
 

‍the referenced Binaryen expression (AST)


 
std::list< std::shared_ptr< Bit > > m::wasm::referenced_bits_
 

‍a list of 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
 

‍the number of SIMD vectors needed for the represented expression


 
std::array< vector_type, num_vectors > m::wasm::vectors_
 

‍the fully utilized SIMD vectors represented as PrimitiveExprs


 
for(std::size_t idx=1;idx< num_vectors;++idx) res.emplace((vectors_[idx].bitmask()<< uint32_t(idx *vector_type return * m::wasm::res
 

Macro Definition Documentation

◆ ASSIGNOP [1/2]

#define ASSIGNOP (   SYMBOL)
Value:
template<typename U> \
requires requires { typename dependent_expr_t<U>; } and \
requires (U &&u) { dependent_expr_t<U>(std::forward<U>(u)); } and \
requires (dependent_expr_type var_value, dependent_expr_t<U> other_value) \
{ var_value SYMBOL other_value; } and \
requires (Variable var, \
decltype(std::declval<dependent_expr_type>() SYMBOL std::declval<dependent_expr_t<U>>()) value) \
{ var = value; } \
Variable & operator SYMBOL##= (U &&value) { \
dependent_expr_t<U> _value(std::forward<U>(value)); \
this->operator=(dependent_expr_type(*this) SYMBOL _value); \
return *this; \
}
PrimitiveExpr & operator=(PrimitiveExpr other)
Assigns other to this.
Definition: WasmDSL.hpp:1546
Bool< L > value
Definition: WasmUtil.hpp:1317
and arithmetic< U > and same_signedness< T, U > U
Definition: concepts.hpp:90

Definition at line 5862 of file WasmDSL.hpp.

◆ ASSIGNOP [2/2]

#define ASSIGNOP (   SYMBOL)
Value:
template<typename U> \
requires requires (the_reference ref, U &&u) { ref SYMBOL std::forward<U>(u); } and \
requires (the_reference ref, decltype(ref SYMBOL std::declval<U>()) value) \
{ ref = value; } \
void operator SYMBOL##= (U &&value) { \
this->operator=(the_reference(ptr_.clone()) SYMBOL std::forward<U>(value)); \
}

Definition at line 5862 of file WasmDSL.hpp.

◆ ASSIGNOP_LIST

#define ASSIGNOP_LIST (   X)
Value:
X(+) \
X(-) \
X(*) \
X(/) \
X(%) \
X(&) \
X(|) \
X(^) \
X(<<) \
X(>>)
#define X(Kind)
Definition: Operator.hpp:621

◆ BINARY [1/2]

#define BINARY (   OP)
Value:
template<dsl_primitive U> \
requires arithmetically_combinable<T, U, L> and \
requires (typename PrimitiveExpr<common_type_t<T, U>, L>::vector_type left, \
typename PrimitiveExpr<common_type_t<T, U>, L>::vector_type right) \
{ left.OP(right); } \
auto OP(PrimitiveExpr<U, L> other) { \
using To = common_type_t<T, U>; \
using OpT = decltype(to<To, L>()); \
using ResVecT = \
decltype(std::declval<typename OpT::vector_type>().OP(std::declval<typename OpT::vector_type>())); \
static_assert(ResVecT::num_simd_lanes * sizeof(typename ResVecT::type) == 16, \
"result vectors must be fully utilized"); \
auto this_converted = this->template to<To, L>(); \
auto other_converted = other.template to<To, L>(); \
std::array<ResVecT, OpT::num_vectors> vectors; \
for (std::size_t idx = 0; idx < OpT::num_vectors; ++idx) \
vectors[idx] = this_converted.vectors_[idx].OP(other_converted.vectors_[idx]); \
return PrimitiveExpr<typename ResVecT::type, ResVecT::num_simd_lanes * OpT::num_vectors>(std::move(vectors)); \
}

Definition at line 4804 of file WasmDSL.hpp.

◆ BINARY [2/2]

#define BINARY (   OP)
Value:
template<dsl_primitive U> \
auto OP(Expr<U, L> other) requires requires { this->value_.OP(other.value_); } { \
const unsigned idx = (other.can_be_null() << 1U) | this->can_be_null(); \
auto result = this->value_.OP(other.value_); \
using ReturnType = typename decltype(result)::type; \
constexpr std::size_t ReturnLength = decltype(result)::num_simd_lanes; \
switch (idx) { \
default: M_unreachable("invalid index"); \
case 0b00: /* neither `this` nor `other` can be `NULL` */ \
return Expr<ReturnType, ReturnLength>(result); \
case 0b01: /* `this` can be `NULL` */ \
return Expr<ReturnType, ReturnLength>(result, this->is_null_); \
case 0b10: /* `other` can be `NULL` */ \
return Expr<ReturnType, ReturnLength>(result, other.is_null_); \
case 0b11: /* both `this` and `other` can be `NULL` */ \
return Expr<ReturnType, ReturnLength>(result, this->is_null_ or other.is_null_); \
} \
}
#define M_unreachable(MSG)
Definition: macro.hpp:146

Definition at line 4804 of file WasmDSL.hpp.

◆ BINARY_LIST

#define BINARY_LIST (   X)
Value:
X(operator +) \
X(operator -) \
X(operator *) \
X(operator /) \
X(operator %) \
X(operator bitand) \
X(operator bitor) \
X(operator xor) \
X(operator <<) \
X(operator >>) \
X(operator ==) \
X(operator !=) \
X(operator <) \
X(operator <=) \
X(operator >) \
X(operator >=) \
X(operator and) \
X(operator or) \
X(copy_sign) \
X(min) \
X(max) \
X(avg) \
X(rotl) \
X(rotr) \
X(and_not)
and(sizeof(T)==4) U64x1 reinterpret_to_U64(m
Definition: WasmAlgo.cpp:266

List of supported binary operators on PrimitiveExpr, Expr, Variable, etc.

Definition at line 4100 of file WasmDSL.hpp.

◆ BINARY_OP

#define BINARY_OP (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (std::integral<To>) \
return BINIOP_(NAME, SIGN); \
else if constexpr (std::floating_point<To>) \
return BINFOP_(NAME); \
else \
M_unreachable("unsupported operation"); \
} ()
#define BINIOP_(NAME, SIGN)
#define BINFOP_(NAME)

◆ BINARY_VOP [1/2]

#define BINARY_VOP (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (std::integral<To>) \
return BINIVOP_(NAME, SIGN); \
else if constexpr (std::floating_point<To>) \
return BINFVOP_(NAME); \
else \
M_unreachable("unsupported operation"); \
} ()
#define BINFVOP_(NAME)
#define BINIVOP_(NAME, SIGN)

◆ BINARY_VOP [2/2]

#define BINARY_VOP (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (std::integral<To>) \
return BINIVOP_(NAME, SIGN); \
else if constexpr (std::floating_point<To>) \
return BINFVOP_(NAME); \
else \
M_unreachable("unsupported operation"); \
} ()

◆ BINFOP_

#define BINFOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINOP_(NAME,,Float64); \
else if constexpr (sizeof(To) == 4) \
return BINOP_(NAME,,Float32); \
else \
M_unreachable("unsupported operation"); \
} ()
#define BINOP_(NAME, SIGN, TYPE)

◆ BINFVOP_ [1/2]

#define BINFVOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINVOP_(NAME,,F64x2); \
else if constexpr (sizeof(To) == 4) \
return BINVOP_(NAME,,F32x4); \
else \
M_unreachable("unsupported operation"); \
} ()
#define BINVOP_(NAME, SIGN, TYPE)

◆ BINFVOP_ [2/2]

#define BINFVOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINVOP_(NAME,,F64x2); \
else if constexpr (sizeof(To) == 4) \
return BINVOP_(NAME,,F32x4); \
else \
M_unreachable("unsupported operation"); \
} ()

◆ BINIOP_

#define BINIOP_ (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINOP_(NAME,SIGN,Int64); \
else if constexpr (sizeof(To) <= 4) \
return BINOP_(NAME,SIGN,Int32); \
else \
M_unreachable("unsupported operation"); \
} ()

◆ BINIVOP_ [1/2]

#define BINIVOP_ (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINVOP_(NAME,SIGN,I64x2); \
else if constexpr (sizeof(To) == 4) \
return BINVOP_(NAME,SIGN,I32x4); \
else if constexpr (sizeof(To) == 2) \
return BINVOP_(NAME,SIGN,I16x8); \
else if constexpr (sizeof(To) == 1) \
return BINVOP_(NAME,SIGN,I8x16); \
else \
M_unreachable("unsupported operation"); \
} ()

◆ BINIVOP_ [2/2]

#define BINIVOP_ (   NAME,
  SIGN 
)
Value:
[] { \
if constexpr (sizeof(To) == 8) \
return BINVOP_(NAME,SIGN,I64x2); \
else if constexpr (sizeof(To) == 4) \
return BINVOP_(NAME,SIGN,I32x4); \
else if constexpr (sizeof(To) == 2) \
return BINVOP_(NAME,SIGN,I16x8); \
else if constexpr (sizeof(To) == 1) \
return BINVOP_(NAME,SIGN,I8x16); \
else \
M_unreachable("unsupported operation"); \
} ()

◆ BINOP_

#define BINOP_ (   NAME,
  SIGN,
  TYPE 
)    (::wasm::BinaryOp::NAME##SIGN##TYPE)

◆ BINVOP_ [1/2]

#define BINVOP_ (   NAME,
  SIGN,
  TYPE 
)    (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE)

◆ BINVOP_ [2/2]

#define BINVOP_ (   NAME,
  SIGN,
  TYPE 
)    (::wasm::BinaryOp::NAME##SIGN##Vec##TYPE)

◆ CALLBACK

#define CALLBACK (   NAME,
  FUNC 
)    { NAME, FUNC },

◆ CMP_OP

#define CMP_OP (   SYMBOL)
Value:
\
PrimitiveExpr<bool, 1> operator SYMBOL(PrimitiveExpr other) { \
return this->to<uint32_t>() SYMBOL other.to<uint32_t>(); \
}

◆ DECLARE_ENUM

#define DECLARE_ENUM (   TYPE)    TYPE,

Definition at line 555 of file WasmDSL.hpp.

◆ DECLARE_NAMES

#define DECLARE_NAMES (   TYPE)    #TYPE,

Definition at line 561 of file WasmDSL.hpp.

◆ M_EXCEPTION_LIST

#define M_EXCEPTION_LIST (   X)
Value:
X(invalid_escape_sequence) \
X(unreachable) \
X(failed_unittest_check)

Definition at line 548 of file WasmDSL.hpp.

◆ M_insist_no_ternary_logic

#define M_insist_no_ternary_logic ( )

Definition at line 45 of file WasmDSL.hpp.

◆ MAKE_BINARY [1/2]

#define MAKE_BINARY (   OP)
Value:
template<primitive_convertible T, primitive_convertible U> \
requires requires (primitive_expr_t<T> t, primitive_expr_t<U> u) { t.OP(u); } \
auto OP(T &&t, U &&u) \
{ \
return primitive_expr_t<T>(std::forward<T>(t)).OP(primitive_expr_t<U>(std::forward<U>(u))); \
}

Definition at line 5098 of file WasmDSL.hpp.

◆ MAKE_BINARY [2/2]

#define MAKE_BINARY (   OP)
Value:
template<expr_convertible T, expr_convertible U> \
requires (not primitive_convertible<T> or not primitive_convertible<U>) and \
requires (expr_t<T> t, expr_t<U> u) { t.OP(u); } \
auto OP(T &&t, U &&u) \
{ \
return expr_t<T>(std::forward<T>(t)).OP(expr_t<U>(std::forward<U>(u))); \
}

Definition at line 5098 of file WasmDSL.hpp.

◆ REGISTER_USE

#define REGISTER_USE (   VAR)

Definition at line 5522 of file WasmDSL.hpp.

◆ SHIFT

#define SHIFT (   OP)
Value:
template<dsl_primitive U> \
PrimitiveExpr OP(PrimitiveExpr<U, 1> other) requires requires (vector_type v) { v.OP(other); } { \
std::array<vector_type, num_vectors> vectors; \
for (std::size_t idx = 0; idx < num_vectors; ++idx) \
vectors[idx] = vectors_[idx].OP(other.clone()); \
other.discard(); \
return PrimitiveExpr(std::move(vectors)); \
}

◆ UNARY [1/3]

#define UNARY (   OP)
Value:
auto OP() requires requires (vector_type v) { v.OP(); } { \
using ResVecT = decltype(std::declval<vector_type>().OP()); \
static_assert(ResVecT::num_simd_lanes * sizeof(typename ResVecT::type) == 16, \
"result vectors must be fully utilized"); \
std::array<ResVecT, num_vectors> vectors; \
for (std::size_t idx = 0; idx < num_vectors; ++idx) \
vectors[idx] = vectors_[idx].OP(); \
return PrimitiveExpr<typename ResVecT::type, ResVecT::num_simd_lanes * num_vectors>(std::move(vectors)); \
}

Definition at line 5642 of file WasmDSL.hpp.

◆ UNARY [2/3]

#define UNARY (   OP)
Value:
auto OP() requires requires { value_.OP(); } { \
using PrimExprT = decltype(value_.OP()); \
using ExprT = expr_t<PrimExprT>; \
return ExprT(value_.OP(), is_null_); \
}

Definition at line 5642 of file WasmDSL.hpp.

◆ UNARY [3/3]

#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.

◆ UNARY_LIST

#define UNARY_LIST (   X)
Value:
X(make_signed) \
X(make_unsigned) \
X(operator +) \
X(operator -) \
X(abs) \
X(ceil) \
X(floor) \
X(trunc) \
X(nearest) \
X(sqrt) \
X(operator ~) \
X(clz) \
X(ctz) \
X(popcnt) \
X(eqz) \
X(operator not)

List of supported unary operators on PrimitiveExpr.

Definition at line 4726 of file WasmDSL.hpp.

◆ UNARY_VOP

#define UNARY_VOP (   NAME)
Value:
[] { \
if constexpr (std::integral<T>) \
return UNIVOP_(NAME); \
else if constexpr (std::floating_point<T>) \
return UNFVOP_(NAME); \
else \
M_unreachable("unsupported operation"); \
} ()
#define UNIVOP_(NAME)
Definition: WasmDSL.hpp:2111
#define UNFVOP_(NAME)
Definition: WasmDSL.hpp:2123

Definition at line 2131 of file WasmDSL.hpp.

◆ UNFOP_

#define UNFOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(T) == 8) \
return UNOP_(NAME,Float64); \
else if constexpr (sizeof(T) == 4) \
return UNOP_(NAME,Float32); \
else \
M_unreachable("unsupported operation"); \
} ()
#define UNOP_(NAME, TYPE)
Definition: WasmDSL.hpp:2093

Definition at line 2102 of file WasmDSL.hpp.

◆ UNFVOP_

#define UNFVOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(T) == 8) \
return UNVOP_(NAME,F64x2); \
else if constexpr (sizeof(T) == 4) \
return UNVOP_(NAME,F32x4); \
else \
M_unreachable("unsupported operation"); \
} ()
#define UNVOP_(NAME, TYPE)
Definition: WasmDSL.hpp:2110

Definition at line 2123 of file WasmDSL.hpp.

◆ UNIOP_

#define UNIOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(T) == 8) \
return UNOP_(NAME,Int64); \
else if constexpr (sizeof(T) <= 4) \
return UNOP_(NAME,Int32); \
else \
M_unreachable("unsupported operation"); \
} ()

Definition at line 2094 of file WasmDSL.hpp.

◆ UNIVOP_

#define UNIVOP_ (   NAME)
Value:
[] { \
if constexpr (sizeof(T) == 8) \
return UNVOP_(NAME,I64x2); \
else if constexpr (sizeof(T) == 4) \
return UNVOP_(NAME,I32x4); \
else if constexpr (sizeof(T) == 2) \
return UNVOP_(NAME,I16x8); \
else if constexpr (sizeof(T) == 1) \
return UNVOP_(NAME,I8x16); \
else \
M_unreachable("unsupported operation"); \
} ()

Definition at line 2111 of file WasmDSL.hpp.

◆ UNOP_

#define UNOP_ (   NAME,
  TYPE 
)    (::wasm::UnaryOp::NAME##TYPE)

Definition at line 2093 of file WasmDSL.hpp.

◆ UNVOP_

#define UNVOP_ (   NAME,
  TYPE 
)    (::wasm::UnaryOp::NAME##Vec##TYPE)

Definition at line 2110 of file WasmDSL.hpp.

◆ USING

#define USING (   TYPE,
  NAME 
)
Value:
template<std::size_t L> using NAME = PrimitiveExpr<TYPE, L>; \
template<std::size_t L> using _ ## NAME = Expr<TYPE, L>; \
USING_N(TYPE, 1, NAME ## x1) \
USING_N(TYPE, 2, NAME ## x2) \
USING_N(TYPE, 4, NAME ## x4) \
USING_N(TYPE, 8, NAME ## x8) \
USING_N(TYPE, 16, NAME ## x16) \
USING_N(TYPE, 32, NAME ## x32)

◆ USING_N

#define USING_N (   TYPE,
  LENGTH,
  NAME 
)
Value:
using NAME = PrimitiveExpr<TYPE, LENGTH>; \
using _ ## NAME = Expr<TYPE, LENGTH>;

◆ WASM_GET_INSIST_

#define WASM_GET_INSIST_ (   XXX,
  _1,
  _2,
  NAME,
  ... 
)    NAME

Definition at line 372 of file WasmDSL.hpp.

◆ Wasm_insist

#define Wasm_insist (   ...)    WASM_GET_INSIST_(XXX, ##__VA_ARGS__, WASM_INSIST2_, WASM_INSIST1_)(__VA_ARGS__)

Definition at line 373 of file WasmDSL.hpp.

◆ WASM_INSIST1_

#define WASM_INSIST1_ (   COND)    WASM_INSIST2_((COND), nullptr)

Definition at line 364 of file WasmDSL.hpp.

◆ WASM_INSIST2_

#define WASM_INSIST2_ (   COND,
  MSG 
)
Value:
({ \
m::wasm::Module::Get().emit_insist((COND), __FILE__, __LINE__, (MSG)); \
})

Definition at line 359 of file WasmDSL.hpp.