Wax_wasm.SimdSourceShared registry mapping wax SIMD intrinsic names to WebAssembly Vec* instructions and back. Single source of truth for to_wasm (forward), from_wasm (reverse) and Wax_lang.Typing (signatures).
Surface convention: vector ops are method intrinsics with the lane shape in the name (a.add_i32x4(b), v.extract_lane_s_i8x16(0)); the wax name is the WAT mnemonic A.B rewritten as B_A. Constants and bitselect are free functions; loads/stores are methods on a memory object.
Operand / result valtype of an intrinsic, abstract from the wax/wasm valtype representations.
Number of lanes in a shape (e.g. I32x4 -> 4); also the exclusive upper bound for a lane index of that shape.
Scalar type of one lane (splat operand, extract result, replace value).
The namespace of the free-function intrinsics, spelled v128::<member>.
free_full member is the registry key v128_<member> for a v128::member path (the inverse of free_member).
free_member "v128_bitselect" = "bitselect": the v128:: member name for a full registry key (the inverse of free_full).
Every v128:: free-function member: bitselect and one const constructor per shape (i8x16 … f64x2). For completion after v128::.
type imm = | No_imm| Lane of Ast.vec_shapeone index, 0 <= n < lane_count shape
| Shuffleexactly 16 indices, each 0 <= n < 32
Trailing constant lane immediates (memory ops handled by mem_method).
type intrinsic = {operands : ty list;receiver-first stack operand types
*)result : ty option;imm : imm;free : bool;true: free function; false: method on the receiver
build : int list -> Ast.location Text.instr_desc;lane immediates (source order) -> instruction
*)}Recognise a method or free-function SIMD intrinsic by name.
The names of every SIMD *method* intrinsic (not a free function) whose receiver — its first stack operand — is ty, sorted. method_names TV128 is the vector ops written v.add_i32x4(w); the scalar-receiver splats live under their lane type (e.g. TI32 for splat_i32x4). For member completion after . on a value of that type.
A reserved free-function name (a v128_<shape> constant, v128_bitselect); these shadow a user function of the same name only when it is unbound.
Number of lane literals in a v128_<shape> const call.
mem.loadv128, mem.load8_lane, …)type mem_intrinsic = {m_operands : ty list;address first, then the vector for store/lane ops
*)m_result : ty option;m_lane : bool;a trailing constant lane immediate is present
*)m_nat_align : int;m_make : Text.idx -> Ast.memarg -> int -> Ast.location Text.instr_desc;memory index, memarg, lane (0 when not m_lane) -> instruction
}Every SIMD memory-access method name (loadv128 … store64_lane), for completion after mem.. The names mem_method recognises.
The plain vector instructions are those the WAT lexer emits as a single INSTR token (splat, unop, binop, shift, test, bitmask); the single source of their WAT mnemonics, shared by output.ml and the WAT lexer.
The WAT mnemonic of a plain vector instruction; None for anything else.
Every plain vector instruction, for the WAT lexer's keyword table.