mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Data Fields | Static Public Attributes | Private Member Functions | Private Attributes | Friends
m::wasm::Expr< T, L > Struct Template Reference

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

#include <WasmDSL.hpp>

Collaboration diagram for m::wasm::Expr< T, L >:
[legend]

Public Types

using type = T
 
using primitive_type = PrimitiveExpr< T, L >
 

Public Member Functions

 Expr (PrimitiveExpr< T, L > value)
 

Implicitly constructs an Expr from a value.


 
 Expr (PrimitiveExpr< T, L > value, PrimitiveExpr< bool, L > is_null)
 

‍Constructs an Expr from a value and NULL information is_null.


 
 Expr (std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > > value)
 

‍Constructs an Expr from a std::pair value of value and NULL info.


 
 Expr (Us... value)
 
template<decayable... Us>
requires (sizeof...(Us) > 0) (Us... us)
 and (dsl_primitive< std::decay_t< Us > > and ...) and
 Constructs an Expr from a decayable constant value.
 
 Expr (Us... value)
 
 Expr (const Expr &)=delete
 
 Expr (Expr &other)
 

‍Constructs a new Expr by moving the underlying value_ and is_null_ of other to this.


 
 Expr (Expr &&other)
 

‍Constructs a new Expr by moving the underlying value_ and is_null_ of other to this.


 
Exproperator= (Expr &&)=delete
 
 ~Expr ()
 
 operator bool () const
 Returns true if this Expr actually holds a value (Binaryen AST), false otherwise.
 
PrimitiveExpr< T, Linsist_not_null ()
 Moves the current value_ out of this.
 
std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > > split ()
 Splits this Expr into a PrimitiveExpr<T, L> with the value and a PrimitiveExpr<bool, L> with the NULL information.
 
Expr clone () const
 Returns a deep copy of this.
 
void discard ()
 Discards this.
 
bool can_be_null () const
 Returns true if this may be NULL, false otherwise.
 
PrimitiveExpr< bool, Lis_null ()
 Returns true if this is NULL, false otherwise.
 
PrimitiveExpr< bool, Lnot_null ()
 Returns true if this is NOT NULL, false otherwise.
 
PrimitiveExpr< bool, Lis_true_and_not_null ()
 Returns true if the value is true and NOT NULL.
 
PrimitiveExpr< bool, Lis_false_and_not_null ()
 Returns true if the value is false and NOT NULL.
 
template<dsl_primitive To, std::size_t ToL = L>
requires requires { static_cast<PrimitiveExpr<To, ToL>>(value_); }
 operator Expr< To, ToL > ()
 Implicitly converts an Expr<T, L> to an Expr<To, ToL>.
 
template<dsl_primitive To, std::size_t ToL = L>
requires requires { value_.template to<To, ToL>(); }
Expr< To, ToLto ()
 Explicitly converts an Expr<T, L> to an Expr<To, ToL>.
 
template<dsl_primitive To, std::size_t ToL = L>
requires requires { value_.template reinterpret<To, ToL>(); }
Expr< To, ToLreinterpret ()
 Reinterpret an Expr<T, L> to an Expr<To, ToL>.
 
template<std::size_t ToL>
requires requires { value_.template broadcast<ToL>(); is_null_.template broadcast<ToL>(); }
Expr< T, ToLbroadcast ()
 Broadcasts a PrimitiveExpr<T, 1> to a PrimitiveExpr<T, ToL>.
 
 UNARY_LIST (UNARY) auto add_pairwise()
 
Expr< uint32_t, 1 > bitmask ()
 
Expr< bool, 1 > any_true ()
 
Expr< bool, 1 > all_true ()
 
PrimitiveExpr< uint64_t, Lhash ()
 
 BINARY (operator+)BINARY(operator-)BINARY(operator*)BINARY(operator/)BINARY(operator%)BINARY(operator bitand) BINARY(operator bitor) BINARY(operator xor) BINARY(operator<<) BINARY(operator>>) BINARY(operator
 
L operator and (Expr< bool, L > other)
 
Expr< bool, Land_not (Expr< bool, L > other)
 Implements logical and not according to 3VL of Kleene and Priest's logic.
 
Expr< bool, Loperator or (Expr< bool, L > other)
 Implements logical or according to 3VL of Kleene and Priest's logic.
 
template<std::size_t M>
requires requires { value_.template extract<M>(); }
Expr< T, 1 > extract ()
 Extracts the.
 
template<std::size_t M, expr_convertible U>
requires requires (expr_t<U> u) { Expr<T, 1>(u); } requires (Expr<T, 1> e) { this->value_.template replace<M>(e.value_); }
Expr replace (U &&_value)
 Replaces the.
 
Expr swizzle_bytes (PrimitiveExpr< uint8_t, 16 > indices) and
 Selects lanes of this in byte granularity depending on the indices specified by indices.
 

Static Public Member Functions

static Expr Null ()
 Returns an Expr that is NULL.
 

Data Fields

template<dsl_primitive... Us>
 and { PrimitiveExpr<T, L>(us...)
 Constructs an Expr from a constant value.
 

Static Public Attributes

static constexpr std::size_t num_simd_lanes = L
 

Private Member Functions

std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > > split_unsafe ()
 Splits this Expr into a PrimitiveExpr<T, L> with the value and a PrimitiveExpr<bool, L> with the NULL information.
 

Private Attributes

PrimitiveExpr< T, Lvalue_
 

‍the referenced value expression


 
PrimitiveExpr< bool, Lis_null_ = PrimitiveExpr<bool, L>()
 A boolean expression that evaluates to true at runtime iff this Expr is NULL.
 

Friends

template<typename , std::size_t >
struct Expr
 
template<typename , VariableKind , bool , std::size_t >
class detail::variable_storage
 

Detailed Description

template<dsl_primitive T, std::size_t L>
requires requires { PrimitiveExpr<T, L>(); PrimitiveExpr<bool, 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).

Expr<T, L> provides the same operations as PrimitiveExpr<T, L>. It delegates operations to the underlying value and additionally combines the NULL information of the operand(s) into the new NULL information of the result. Particular exceptions are operator and and operator or, for which Expr<T, L> implements 3VL according to Kleene and Priest's logic.

Definition at line 4514 of file WasmDSL.hpp.

Member Typedef Documentation

◆ primitive_type

template<dsl_primitive T, std::size_t L>
using m::wasm::Expr< T, L >::primitive_type = PrimitiveExpr<T, L>

Definition at line 4518 of file WasmDSL.hpp.

◆ type

template<dsl_primitive T, std::size_t L>
using m::wasm::Expr< T, L >::type = T

Definition at line 4516 of file WasmDSL.hpp.

Constructor & Destructor Documentation

◆ Expr() [1/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( PrimitiveExpr< T, L value)
inline

Implicitly constructs an Expr from a value.

Definition at line 4533 of file WasmDSL.hpp.

References M_insist, and m::wasm::value.

◆ Expr() [2/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( PrimitiveExpr< T, L value,
PrimitiveExpr< bool, L is_null 
)
inline

‍Constructs an Expr from a value and NULL information is_null.

Definition at line 4538 of file WasmDSL.hpp.

References m::wasm::is_null(), M_insist, M_insist_no_ternary_logic, and m::wasm::value.

◆ Expr() [3/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > >  value)
inlineexplicit

‍Constructs an Expr from a std::pair value of value and NULL info.

Definition at line 4548 of file WasmDSL.hpp.

References m::wasm::value.

◆ Expr() [4/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( Us...  value)
inlineexplicit

Definition at line 4555 of file WasmDSL.hpp.

References m::wasm::L, m::T(), and m::wasm::value.

◆ Expr() [5/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( Us...  value)
inlineexplicit

Definition at line 4563 of file WasmDSL.hpp.

References m::wasm::value.

◆ Expr() [6/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( const Expr< T, L > &  )
delete

◆ Expr() [7/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( Expr< T, L > &  other)
inline

‍Constructs a new Expr by moving the underlying value_ and is_null_ of other to this.

Definition at line 4569 of file WasmDSL.hpp.

◆ Expr() [8/8]

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::Expr ( Expr< T, L > &&  other)
inline

‍Constructs a new Expr by moving the underlying value_ and is_null_ of other to this.

Definition at line 4571 of file WasmDSL.hpp.

◆ ~Expr()

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::~Expr ( )
inline

Definition at line 4575 of file WasmDSL.hpp.

References M_insist.

Member Function Documentation

◆ all_true()

template<dsl_primitive T, std::size_t L>
Expr< bool, 1 > m::wasm::Expr< T, L >::all_true ( )
inline

Definition at line 4782 of file WasmDSL.hpp.

◆ and()

template<dsl_primitive T, std::size_t L>
template<decayable... Us>
requires (sizeof...(Us) > 0) (Us... us)
m::wasm::Expr< T, L >::and ( dsl_primitive< std::decay_t< Us > >  and ...)
inline

Constructs an Expr from a decayable constant value.

Definition at line 4561 of file WasmDSL.hpp.

◆ and_not()

template<dsl_primitive T, std::size_t L>
Expr< bool, L > m::wasm::Expr< T, L >::and_not ( Expr< bool, L other)
inline

Implements logical and not according to 3VL of Kleene and Priest's logic.

Definition at line 4940 of file WasmDSL.hpp.

◆ any_true()

template<dsl_primitive T, std::size_t L>
Expr< bool, 1 > m::wasm::Expr< T, L >::any_true ( )
inline

Definition at line 4775 of file WasmDSL.hpp.

◆ BINARY()

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::BINARY ( operator+  )

References m::operator<<().

◆ bitmask()

template<dsl_primitive T, std::size_t L>
Expr< uint32_t, 1 > m::wasm::Expr< T, L >::bitmask ( )
inline

Definition at line 4766 of file WasmDSL.hpp.

◆ broadcast()

template<dsl_primitive T, std::size_t L>
template<std::size_t ToL>
requires requires { value_.template broadcast<ToL>(); is_null_.template broadcast<ToL>(); }
Expr< T, ToL > m::wasm::Expr< T, L >::broadcast ( )
inline

Broadcasts a PrimitiveExpr<T, 1> to a PrimitiveExpr<T, ToL>.

Only applicable if PrimitiveExpr<T, 1> can be broadcasted to PrimitiveExpr<T, ToL>.

Definition at line 4715 of file WasmDSL.hpp.

◆ can_be_null()

template<dsl_primitive T, std::size_t L>
bool m::wasm::Expr< T, L >::can_be_null ( ) const
inline

Returns true if this may be NULL, false otherwise.

Definition at line 4636 of file WasmDSL.hpp.

References m::wasm::bool.

◆ clone()

template<dsl_primitive T, std::size_t L>
Expr m::wasm::Expr< T, L >::clone ( ) const
inline

Returns a deep copy of this.

Definition at line 4614 of file WasmDSL.hpp.

References M_insist.

◆ discard()

template<dsl_primitive T, std::size_t L>
void m::wasm::Expr< T, L >::discard ( )
inline

Discards this.

Definition at line 4623 of file WasmDSL.hpp.

References m::wasm::can_be_null().

◆ extract()

template<dsl_primitive T, std::size_t L>
template<std::size_t M>
requires requires { value_.template extract<M>(); }
Expr< T, 1 > m::wasm::Expr< T, L >::extract ( )
inline

Extracts the.

Template Parameters
M-th value of this.

Definition at line 5022 of file WasmDSL.hpp.

◆ hash()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< uint64_t, L > m::wasm::Expr< T, L >::hash ( )
inline

Definition at line 4791 of file WasmDSL.hpp.

◆ insist_not_null()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< T, L > m::wasm::Expr< T, L >::insist_not_null ( )
inline

Moves the current value_ out of this.

Requires (and insists) that this cannot be NULL.

Definition at line 4595 of file WasmDSL.hpp.

References m::wasm::can_be_null(), M_insist, and Wasm_insist.

◆ is_false_and_not_null()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< bool, L > m::wasm::Expr< T, L >::is_false_and_not_null ( )
inline

Returns true if the value is false and NOT NULL.

Useful to use this Expr<bool, L> for conditional control flow.

Definition at line 4671 of file WasmDSL.hpp.

References and(), and m::wasm::can_be_null().

◆ is_null()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< bool, L > m::wasm::Expr< T, L >::is_null ( )
inline

Returns true if this is NULL, false otherwise.

Definition at line 4639 of file WasmDSL.hpp.

References m::wasm::can_be_null(), and M_insist_no_ternary_logic.

◆ is_true_and_not_null()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< bool, L > m::wasm::Expr< T, L >::is_true_and_not_null ( )
inline

Returns true if the value is true and NOT NULL.

Useful to use this Expr<bool, L> for conditional control flow.

Definition at line 4662 of file WasmDSL.hpp.

References and(), and m::wasm::can_be_null().

◆ not_null()

template<dsl_primitive T, std::size_t L>
PrimitiveExpr< bool, L > m::wasm::Expr< T, L >::not_null ( )
inline

Returns true if this is NOT NULL, false otherwise.

Definition at line 4650 of file WasmDSL.hpp.

References m::wasm::can_be_null(), and M_insist_no_ternary_logic.

◆ Null()

template<dsl_primitive T, std::size_t L>
static Expr m::wasm::Expr< T, L >::Null ( )
inlinestatic

Returns an Expr that is NULL.

Definition at line 4685 of file WasmDSL.hpp.

References m::T().

◆ operator and()

template<dsl_primitive T, std::size_t L>
L m::wasm::Expr< T, L >::operator and ( Expr< bool, L other)
inline

Definition at line 4902 of file WasmDSL.hpp.

References and().

◆ operator bool()

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::operator bool ( ) const
inlineexplicit

Returns true if this Expr actually holds a value (Binaryen AST), false otherwise.

Can be used to test whether this Expr has already been used.

Definition at line 4592 of file WasmDSL.hpp.

References m::wasm::bool.

◆ operator Expr< To, ToL >()

template<dsl_primitive T, std::size_t L>
template<dsl_primitive To, std::size_t ToL = L>
requires requires { static_cast<PrimitiveExpr<To, ToL>>(value_); }
m::wasm::Expr< T, L >::operator Expr< To, ToL > ( )
inline

Implicitly converts an Expr<T, L> to an Expr<To, ToL>.

Only applicable if PrimitiveExpr<T, L> is implicitly convertible to PrimitiveExpr<To, ToL>.

Definition at line 4697 of file WasmDSL.hpp.

◆ operator or()

template<dsl_primitive T, std::size_t L>
Expr< bool, L > m::wasm::Expr< T, L >::operator or ( Expr< bool, L other)
inline

Implements logical or according to 3VL of Kleene and Priest's logic.

Definition at line 4979 of file WasmDSL.hpp.

◆ operator=()

template<dsl_primitive T, std::size_t L>
Expr & m::wasm::Expr< T, L >::operator= ( Expr< T, L > &&  )
delete

◆ reinterpret()

template<dsl_primitive T, std::size_t L>
template<dsl_primitive To, std::size_t ToL = L>
requires requires { value_.template reinterpret<To, ToL>(); }
Expr< To, ToL > m::wasm::Expr< T, L >::reinterpret ( )
inline

Reinterpret an Expr<T, L> to an Expr<To, ToL>.

Only applicable if PrimitiveExpr<T, L> can be reinterpreted to PrimitiveExpr<To, ToL>.

Definition at line 4709 of file WasmDSL.hpp.

◆ replace()

template<dsl_primitive T, std::size_t L>
template<std::size_t M, expr_convertible U>
requires requires (expr_t<U> u) { Expr<T, 1>(u); } requires (Expr<T, 1> e) { this->value_.template replace<M>(e.value_); }
Expr m::wasm::Expr< T, L >::replace ( U &&  _value)
inline

Replaces the.

Template Parameters
M-th value of this with u.

Definition at line 5032 of file WasmDSL.hpp.

◆ split()

template<dsl_primitive T, std::size_t L>
std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > > m::wasm::Expr< T, L >::split ( )
inline

Splits this Expr into a PrimitiveExpr<T, L> with the value and a PrimitiveExpr<bool, L> with the NULL information.

Then, moves these PrimitiveExprs out of this.

Definition at line 4604 of file WasmDSL.hpp.

References m::wasm::is_null(), M_insist, and m::wasm::value.

◆ split_unsafe()

template<dsl_primitive T, std::size_t L>
std::pair< PrimitiveExpr< T, L >, PrimitiveExpr< bool, L > > m::wasm::Expr< T, L >::split_unsafe ( )
inlineprivate

Splits this Expr into a PrimitiveExpr<T, L> with the value and a PrimitiveExpr<bool, L> with the NULL information.

Then, moves these PrimitiveExprs out of this. Special care must be taken as the NULL information may be unusable, i.e. missing AST.

Definition at line 4584 of file WasmDSL.hpp.

References M_insist.

◆ swizzle_bytes()

template<dsl_primitive T, std::size_t L>
Expr m::wasm::Expr< T, L >::swizzle_bytes ( PrimitiveExpr< uint8_t, 16 >  indices)
inline

Selects lanes of this in byte granularity depending on the indices specified by indices.

Indices i in the range [0, 15] select the i-th` lane, indices outside of this range result in the value 0.

Definition at line 5045 of file WasmDSL.hpp.

References m::wasm::indices, and m::T().

◆ to()

template<dsl_primitive T, std::size_t L>
template<dsl_primitive To, std::size_t ToL = L>
requires requires { value_.template to<To, ToL>(); }
Expr< To, ToL > m::wasm::Expr< T, L >::to ( )
inline

Explicitly converts an Expr<T, L> to an Expr<To, ToL>.

Only applicable if PrimitiveExpr<T, L> is explicitly convertible to PrimitiveExpr<To, ToL> (via method to<To, ToL>()).

Definition at line 4703 of file WasmDSL.hpp.

◆ UNARY_LIST()

template<dsl_primitive T, std::size_t L>
m::wasm::Expr< T, L >::UNARY_LIST ( UNARY  )
inline

Definition at line 4750 of file WasmDSL.hpp.

References m::wasm::add_pairwise().

Friends And Related Function Documentation

◆ detail::variable_storage

template<dsl_primitive T, std::size_t L>
template<typename , VariableKind , bool , std::size_t >
friend class detail::variable_storage
friend

Definition at line 4522 of file WasmDSL.hpp.

◆ Expr

template<dsl_primitive T, std::size_t L>
template<typename , std::size_t >
friend struct Expr
friend

Definition at line 4521 of file WasmDSL.hpp.

Field Documentation

◆ and

template<dsl_primitive T, std::size_t L>
template<dsl_primitive... Us>
m::wasm::Expr< T, L >::and { PrimitiveExpr<T, L>(us...)

Constructs an Expr from a constant value.

Definition at line 4554 of file WasmDSL.hpp.

◆ is_null_

template<dsl_primitive T, std::size_t L>
PrimitiveExpr<bool, L> m::wasm::Expr< T, L >::is_null_ = PrimitiveExpr<bool, L>()
private

A boolean expression that evaluates to true at runtime iff this Expr is NULL.

If this Expr cannot be NULL, then is_null_ evaluates to false at compile time, i.e. not is_null_.

Definition at line 4529 of file WasmDSL.hpp.

◆ num_simd_lanes

template<dsl_primitive T, std::size_t L>
constexpr std::size_t m::wasm::Expr< T, L >::num_simd_lanes = L
staticconstexpr

Definition at line 4517 of file WasmDSL.hpp.

◆ value_

template<dsl_primitive T, std::size_t L>
PrimitiveExpr<T, L> m::wasm::Expr< T, L >::value_
private

‍the referenced value expression

Definition at line 4526 of file WasmDSL.hpp.


The documentation for this struct was generated from the following file: