Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 1004 Bytes

File metadata and controls

10 lines (7 loc) · 1004 Bytes

wasm-gen

This is an internal crate used to generate WebAssembly instructions for blocks. It relies upon HyperQuark's internal types so cannot be used outside of HyperQuark.

Usage

The wasm![] macro produces a Vec<wasm_encoder::Instruction<'static>>. Inputs to the macro are (non-namespaced) wasm_encoder Instructions, or a 'special' instruction. Special instructions are currently:

  • @nanreduce(input_name) - checks the top value on the stack for NaN-ness (and replaces it with a zero if it is), only if input_name (must be an in-scope IrType) could possibly be NaN. Assumes (rightly so) that the top item on the stack is an f64.
  • @boxed(input_name) - boxes the top value on the stack if input_name is a base type
  • @isnan(input_name) - checks if the top value on the stack for NaN-ness, only if input_name could possibly be NaN. Assumes the top item on the stack is an f64.