// The instructions that carry no immediate.
//
// Their text names follow from their constructor names by one rule -- a type
// prefix, a dot, the rest in snake case -- because both are spellings of the
// same spec mnemonic. A handful do not follow it and are named explicitly:
// `RefEqInstr` avoids a collision with the `Eq` trait, `AtomicFence` groups
// with the atomics it is not otherwise like, and `i31.get_s`/`i31.get_u` take
// `i31` as the type prefix even though the constructor runs the digits into
// the name -- which the rule read as one word, and spelled `i31_get_s` -- and
// `i16x8.q15mulr_sat_s`, where the spec runs `q15` into `mulr` and the rule
// read `Q15Mulr` as two. `extadd`, `extmul` and `andnot` run together the same
// way.
//
// These were found by comparing the mnemonics the reference PRINTS over the
// whole corpus against the ones this prints -- a check that needs no reading
// of the spec, and one worth repeating after any addition here:
//
//   find test/corpus -name '*.wax' | xargs -P8 -I{} sh -c \
//     'tools/wax-ref "{}" -f wat 2>/dev/null' \
//     | grep -oE '\([a-z][a-z0-9_]*\.[a-z0-9_.]+ ' | sort -u > ref.txt
//   ... the same with tools/wax-mb ... > ours.txt; diff ref.txt ours.txt

///|
/// The text name of an instruction with no immediate, or `None` when it takes
/// one and so belongs in the table that knows its shape.
pub fn nullary(i : @wasm_bin.Instruction) -> String? {
  match i {
    Unreachable => Some("unreachable")
    Nop => Some("nop")
    Return => Some("return")
    ThrowRef => Some("throw_ref")
    Drop => Some("drop")
    Select => Some("select")
    AtomicFence => Some("atomic.fence")
    RefIsNull => Some("ref.is_null")
    RefAsNonNull => Some("ref.as_non_null")
    RefEqInstr => Some("ref.eq")
    I32Eqz => Some("i32.eqz")
    I32Eq => Some("i32.eq")
    I32Ne => Some("i32.ne")
    I32LtS => Some("i32.lt_s")
    I32LtU => Some("i32.lt_u")
    I32GtS => Some("i32.gt_s")
    I32GtU => Some("i32.gt_u")
    I32LeS => Some("i32.le_s")
    I32LeU => Some("i32.le_u")
    I32GeS => Some("i32.ge_s")
    I32GeU => Some("i32.ge_u")
    I32Clz => Some("i32.clz")
    I32Ctz => Some("i32.ctz")
    I32Popcnt => Some("i32.popcnt")
    I32Add => Some("i32.add")
    I32Sub => Some("i32.sub")
    I32Mul => Some("i32.mul")
    I32DivS => Some("i32.div_s")
    I32DivU => Some("i32.div_u")
    I32RemS => Some("i32.rem_s")
    I32RemU => Some("i32.rem_u")
    I32And => Some("i32.and")
    I32Or => Some("i32.or")
    I32Xor => Some("i32.xor")
    I32Shl => Some("i32.shl")
    I32ShrS => Some("i32.shr_s")
    I32ShrU => Some("i32.shr_u")
    I32Rotl => Some("i32.rotl")
    I32Rotr => Some("i32.rotr")
    I32Extend8S => Some("i32.extend8_s")
    I32Extend16S => Some("i32.extend16_s")
    I64Eqz => Some("i64.eqz")
    I64Eq => Some("i64.eq")
    I64Ne => Some("i64.ne")
    I64LtS => Some("i64.lt_s")
    I64LtU => Some("i64.lt_u")
    I64GtS => Some("i64.gt_s")
    I64GtU => Some("i64.gt_u")
    I64LeS => Some("i64.le_s")
    I64LeU => Some("i64.le_u")
    I64GeS => Some("i64.ge_s")
    I64GeU => Some("i64.ge_u")
    I64Clz => Some("i64.clz")
    I64Ctz => Some("i64.ctz")
    I64Popcnt => Some("i64.popcnt")
    I64Add => Some("i64.add")
    I64Sub => Some("i64.sub")
    I64Mul => Some("i64.mul")
    I64MulWideS => Some("i64.mul_wide_s")
    I64MulWideU => Some("i64.mul_wide_u")
    I64Add128 => Some("i64.add128")
    I64Sub128 => Some("i64.sub128")
    I64DivS => Some("i64.div_s")
    I64DivU => Some("i64.div_u")
    I64RemS => Some("i64.rem_s")
    I64RemU => Some("i64.rem_u")
    I64And => Some("i64.and")
    I64Or => Some("i64.or")
    I64Xor => Some("i64.xor")
    I64Shl => Some("i64.shl")
    I64ShrS => Some("i64.shr_s")
    I64ShrU => Some("i64.shr_u")
    I64Rotl => Some("i64.rotl")
    I64Rotr => Some("i64.rotr")
    I64Extend8S => Some("i64.extend8_s")
    I64Extend16S => Some("i64.extend16_s")
    I64Extend32S => Some("i64.extend32_s")
    F32Eq => Some("f32.eq")
    F32Ne => Some("f32.ne")
    F32Lt => Some("f32.lt")
    F32Gt => Some("f32.gt")
    F32Le => Some("f32.le")
    F32Ge => Some("f32.ge")
    F32Abs => Some("f32.abs")
    F32Neg => Some("f32.neg")
    F32Ceil => Some("f32.ceil")
    F32Floor => Some("f32.floor")
    F32Trunc => Some("f32.trunc")
    F32Nearest => Some("f32.nearest")
    F32Sqrt => Some("f32.sqrt")
    F32Add => Some("f32.add")
    F32Sub => Some("f32.sub")
    F32Mul => Some("f32.mul")
    F32Div => Some("f32.div")
    F32Min => Some("f32.min")
    F32Max => Some("f32.max")
    F32Copysign => Some("f32.copysign")
    F64Eq => Some("f64.eq")
    F64Ne => Some("f64.ne")
    F64Lt => Some("f64.lt")
    F64Gt => Some("f64.gt")
    F64Le => Some("f64.le")
    F64Ge => Some("f64.ge")
    F64Abs => Some("f64.abs")
    F64Neg => Some("f64.neg")
    F64Ceil => Some("f64.ceil")
    F64Floor => Some("f64.floor")
    F64Trunc => Some("f64.trunc")
    F64Nearest => Some("f64.nearest")
    F64Sqrt => Some("f64.sqrt")
    F64Add => Some("f64.add")
    F64Sub => Some("f64.sub")
    F64Mul => Some("f64.mul")
    F64Div => Some("f64.div")
    F64Min => Some("f64.min")
    F64Max => Some("f64.max")
    F64Copysign => Some("f64.copysign")
    I32WrapI64 => Some("i32.wrap_i64")
    I32TruncF32S => Some("i32.trunc_f32_s")
    I32TruncF32U => Some("i32.trunc_f32_u")
    I32TruncF64S => Some("i32.trunc_f64_s")
    I32TruncF64U => Some("i32.trunc_f64_u")
    I64ExtendI32S => Some("i64.extend_i32_s")
    I64ExtendI32U => Some("i64.extend_i32_u")
    I64TruncF32S => Some("i64.trunc_f32_s")
    I64TruncF32U => Some("i64.trunc_f32_u")
    I64TruncF64S => Some("i64.trunc_f64_s")
    I64TruncF64U => Some("i64.trunc_f64_u")
    F32ConvertI32S => Some("f32.convert_i32_s")
    F32ConvertI32U => Some("f32.convert_i32_u")
    F32ConvertI64S => Some("f32.convert_i64_s")
    F32ConvertI64U => Some("f32.convert_i64_u")
    F32DemoteF64 => Some("f32.demote_f64")
    F64ConvertI32S => Some("f64.convert_i32_s")
    F64ConvertI32U => Some("f64.convert_i32_u")
    F64ConvertI64S => Some("f64.convert_i64_s")
    F64ConvertI64U => Some("f64.convert_i64_u")
    F64PromoteF32 => Some("f64.promote_f32")
    I32ReinterpretF32 => Some("i32.reinterpret_f32")
    I64ReinterpretF64 => Some("i64.reinterpret_f64")
    F32ReinterpretI32 => Some("f32.reinterpret_i32")
    F64ReinterpretI64 => Some("f64.reinterpret_i64")
    I32TruncSatF32S => Some("i32.trunc_sat_f32_s")
    I32TruncSatF32U => Some("i32.trunc_sat_f32_u")
    I32TruncSatF64S => Some("i32.trunc_sat_f64_s")
    I32TruncSatF64U => Some("i32.trunc_sat_f64_u")
    I64TruncSatF32S => Some("i64.trunc_sat_f32_s")
    I64TruncSatF32U => Some("i64.trunc_sat_f32_u")
    I64TruncSatF64S => Some("i64.trunc_sat_f64_s")
    I64TruncSatF64U => Some("i64.trunc_sat_f64_u")
    ArrayLen => Some("array.len")
    RefI31 => Some("ref.i31")
    I31GetS => Some("i31.get_s")
    I31GetU => Some("i31.get_u")
    AnyConvertExtern => Some("any.convert_extern")
    ExternConvertAny => Some("extern.convert_any")
    I8x16Swizzle => Some("i8x16.swizzle")
    I8x16Splat => Some("i8x16.splat")
    I16x8Splat => Some("i16x8.splat")
    I32x4Splat => Some("i32x4.splat")
    I64x2Splat => Some("i64x2.splat")
    F32x4Splat => Some("f32x4.splat")
    F64x2Splat => Some("f64x2.splat")
    I8x16Eq => Some("i8x16.eq")
    I8x16Ne => Some("i8x16.ne")
    I8x16LtS => Some("i8x16.lt_s")
    I8x16LtU => Some("i8x16.lt_u")
    I8x16GtS => Some("i8x16.gt_s")
    I8x16GtU => Some("i8x16.gt_u")
    I8x16LeS => Some("i8x16.le_s")
    I8x16LeU => Some("i8x16.le_u")
    I8x16GeS => Some("i8x16.ge_s")
    I8x16GeU => Some("i8x16.ge_u")
    I16x8Eq => Some("i16x8.eq")
    I16x8Ne => Some("i16x8.ne")
    I16x8LtS => Some("i16x8.lt_s")
    I16x8LtU => Some("i16x8.lt_u")
    I16x8GtS => Some("i16x8.gt_s")
    I16x8GtU => Some("i16x8.gt_u")
    I16x8LeS => Some("i16x8.le_s")
    I16x8LeU => Some("i16x8.le_u")
    I16x8GeS => Some("i16x8.ge_s")
    I16x8GeU => Some("i16x8.ge_u")
    I32x4Eq => Some("i32x4.eq")
    I32x4Ne => Some("i32x4.ne")
    I32x4LtS => Some("i32x4.lt_s")
    I32x4LtU => Some("i32x4.lt_u")
    I32x4GtS => Some("i32x4.gt_s")
    I32x4GtU => Some("i32x4.gt_u")
    I32x4LeS => Some("i32x4.le_s")
    I32x4LeU => Some("i32x4.le_u")
    I32x4GeS => Some("i32x4.ge_s")
    I32x4GeU => Some("i32x4.ge_u")
    I64x2Eq => Some("i64x2.eq")
    I64x2Ne => Some("i64x2.ne")
    I64x2LtS => Some("i64x2.lt_s")
    I64x2GtS => Some("i64x2.gt_s")
    I64x2LeS => Some("i64x2.le_s")
    I64x2GeS => Some("i64x2.ge_s")
    F32x4Eq => Some("f32x4.eq")
    F32x4Ne => Some("f32x4.ne")
    F32x4Lt => Some("f32x4.lt")
    F32x4Gt => Some("f32x4.gt")
    F32x4Le => Some("f32x4.le")
    F32x4Ge => Some("f32x4.ge")
    F64x2Eq => Some("f64x2.eq")
    F64x2Ne => Some("f64x2.ne")
    F64x2Lt => Some("f64x2.lt")
    F64x2Gt => Some("f64x2.gt")
    F64x2Le => Some("f64x2.le")
    F64x2Ge => Some("f64x2.ge")
    V128Not => Some("v128.not")
    V128And => Some("v128.and")
    V128AndNot => Some("v128.andnot")
    V128Or => Some("v128.or")
    V128Xor => Some("v128.xor")
    V128Bitselect => Some("v128.bitselect")
    V128AnyTrue => Some("v128.any_true")
    I8x16Abs => Some("i8x16.abs")
    I8x16Neg => Some("i8x16.neg")
    I8x16Popcnt => Some("i8x16.popcnt")
    I8x16AllTrue => Some("i8x16.all_true")
    I8x16Bitmask => Some("i8x16.bitmask")
    I8x16NarrowI16x8S => Some("i8x16.narrow_i16x8_s")
    I8x16NarrowI16x8U => Some("i8x16.narrow_i16x8_u")
    I8x16Shl => Some("i8x16.shl")
    I8x16ShrS => Some("i8x16.shr_s")
    I8x16ShrU => Some("i8x16.shr_u")
    I8x16Add => Some("i8x16.add")
    I8x16AddSatS => Some("i8x16.add_sat_s")
    I8x16AddSatU => Some("i8x16.add_sat_u")
    I8x16Sub => Some("i8x16.sub")
    I8x16SubSatS => Some("i8x16.sub_sat_s")
    I8x16SubSatU => Some("i8x16.sub_sat_u")
    I8x16MinS => Some("i8x16.min_s")
    I8x16MinU => Some("i8x16.min_u")
    I8x16MaxS => Some("i8x16.max_s")
    I8x16MaxU => Some("i8x16.max_u")
    I8x16AvgrU => Some("i8x16.avgr_u")
    I16x8ExtAddPairwiseI8x16S => Some("i16x8.extadd_pairwise_i8x16_s")
    I16x8ExtAddPairwiseI8x16U => Some("i16x8.extadd_pairwise_i8x16_u")
    I16x8Abs => Some("i16x8.abs")
    I16x8Neg => Some("i16x8.neg")
    I16x8Q15MulrSatS => Some("i16x8.q15mulr_sat_s")
    I16x8AllTrue => Some("i16x8.all_true")
    I16x8Bitmask => Some("i16x8.bitmask")
    I16x8NarrowI32x4S => Some("i16x8.narrow_i32x4_s")
    I16x8NarrowI32x4U => Some("i16x8.narrow_i32x4_u")
    I16x8ExtendLowI8x16S => Some("i16x8.extend_low_i8x16_s")
    I16x8ExtendHighI8x16S => Some("i16x8.extend_high_i8x16_s")
    I16x8ExtendLowI8x16U => Some("i16x8.extend_low_i8x16_u")
    I16x8ExtendHighI8x16U => Some("i16x8.extend_high_i8x16_u")
    I16x8Shl => Some("i16x8.shl")
    I16x8ShrS => Some("i16x8.shr_s")
    I16x8ShrU => Some("i16x8.shr_u")
    I16x8Add => Some("i16x8.add")
    I16x8AddSatS => Some("i16x8.add_sat_s")
    I16x8AddSatU => Some("i16x8.add_sat_u")
    I16x8Sub => Some("i16x8.sub")
    I16x8SubSatS => Some("i16x8.sub_sat_s")
    I16x8SubSatU => Some("i16x8.sub_sat_u")
    I16x8Mul => Some("i16x8.mul")
    I16x8MinS => Some("i16x8.min_s")
    I16x8MinU => Some("i16x8.min_u")
    I16x8MaxS => Some("i16x8.max_s")
    I16x8MaxU => Some("i16x8.max_u")
    I16x8AvgrU => Some("i16x8.avgr_u")
    I16x8ExtMulLowI8x16S => Some("i16x8.extmul_low_i8x16_s")
    I16x8ExtMulHighI8x16S => Some("i16x8.extmul_high_i8x16_s")
    I16x8ExtMulLowI8x16U => Some("i16x8.extmul_low_i8x16_u")
    I16x8ExtMulHighI8x16U => Some("i16x8.extmul_high_i8x16_u")
    I32x4ExtAddPairwiseI16x8S => Some("i32x4.extadd_pairwise_i16x8_s")
    I32x4ExtAddPairwiseI16x8U => Some("i32x4.extadd_pairwise_i16x8_u")
    I32x4Abs => Some("i32x4.abs")
    I32x4Neg => Some("i32x4.neg")
    I32x4AllTrue => Some("i32x4.all_true")
    I32x4Bitmask => Some("i32x4.bitmask")
    I32x4ExtendLowI16x8S => Some("i32x4.extend_low_i16x8_s")
    I32x4ExtendHighI16x8S => Some("i32x4.extend_high_i16x8_s")
    I32x4ExtendLowI16x8U => Some("i32x4.extend_low_i16x8_u")
    I32x4ExtendHighI16x8U => Some("i32x4.extend_high_i16x8_u")
    I32x4Shl => Some("i32x4.shl")
    I32x4ShrS => Some("i32x4.shr_s")
    I32x4ShrU => Some("i32x4.shr_u")
    I32x4Add => Some("i32x4.add")
    I32x4Sub => Some("i32x4.sub")
    I32x4Mul => Some("i32x4.mul")
    I32x4MinS => Some("i32x4.min_s")
    I32x4MinU => Some("i32x4.min_u")
    I32x4MaxS => Some("i32x4.max_s")
    I32x4MaxU => Some("i32x4.max_u")
    I32x4DotI16x8S => Some("i32x4.dot_i16x8_s")
    I32x4ExtMulLowI16x8S => Some("i32x4.extmul_low_i16x8_s")
    I32x4ExtMulHighI16x8S => Some("i32x4.extmul_high_i16x8_s")
    I32x4ExtMulLowI16x8U => Some("i32x4.extmul_low_i16x8_u")
    I32x4ExtMulHighI16x8U => Some("i32x4.extmul_high_i16x8_u")
    I64x2Abs => Some("i64x2.abs")
    I64x2Neg => Some("i64x2.neg")
    I64x2AllTrue => Some("i64x2.all_true")
    I64x2Bitmask => Some("i64x2.bitmask")
    I64x2ExtendLowI32x4S => Some("i64x2.extend_low_i32x4_s")
    I64x2ExtendHighI32x4S => Some("i64x2.extend_high_i32x4_s")
    I64x2ExtendLowI32x4U => Some("i64x2.extend_low_i32x4_u")
    I64x2ExtendHighI32x4U => Some("i64x2.extend_high_i32x4_u")
    I64x2Shl => Some("i64x2.shl")
    I64x2ShrS => Some("i64x2.shr_s")
    I64x2ShrU => Some("i64x2.shr_u")
    I64x2Add => Some("i64x2.add")
    I64x2Sub => Some("i64x2.sub")
    I64x2Mul => Some("i64x2.mul")
    I64x2ExtMulLowI32x4S => Some("i64x2.extmul_low_i32x4_s")
    I64x2ExtMulHighI32x4S => Some("i64x2.extmul_high_i32x4_s")
    I64x2ExtMulLowI32x4U => Some("i64x2.extmul_low_i32x4_u")
    I64x2ExtMulHighI32x4U => Some("i64x2.extmul_high_i32x4_u")
    F32x4Ceil => Some("f32x4.ceil")
    F32x4Floor => Some("f32x4.floor")
    F32x4Trunc => Some("f32x4.trunc")
    F32x4Nearest => Some("f32x4.nearest")
    F32x4Abs => Some("f32x4.abs")
    F32x4Neg => Some("f32x4.neg")
    F32x4Sqrt => Some("f32x4.sqrt")
    F32x4Add => Some("f32x4.add")
    F32x4Sub => Some("f32x4.sub")
    F32x4Mul => Some("f32x4.mul")
    F32x4Div => Some("f32x4.div")
    F32x4Min => Some("f32x4.min")
    F32x4Max => Some("f32x4.max")
    F32x4Pmin => Some("f32x4.pmin")
    F32x4Pmax => Some("f32x4.pmax")
    F64x2Ceil => Some("f64x2.ceil")
    F64x2Floor => Some("f64x2.floor")
    F64x2Trunc => Some("f64x2.trunc")
    F64x2Nearest => Some("f64x2.nearest")
    F64x2Abs => Some("f64x2.abs")
    F64x2Neg => Some("f64x2.neg")
    F64x2Sqrt => Some("f64x2.sqrt")
    F64x2Add => Some("f64x2.add")
    F64x2Sub => Some("f64x2.sub")
    F64x2Mul => Some("f64x2.mul")
    F64x2Div => Some("f64x2.div")
    F64x2Min => Some("f64x2.min")
    F64x2Max => Some("f64x2.max")
    F64x2Pmin => Some("f64x2.pmin")
    F64x2Pmax => Some("f64x2.pmax")
    I32x4TruncSatF32x4S => Some("i32x4.trunc_sat_f32x4_s")
    I32x4TruncSatF32x4U => Some("i32x4.trunc_sat_f32x4_u")
    F32x4ConvertI32x4S => Some("f32x4.convert_i32x4_s")
    F32x4ConvertI32x4U => Some("f32x4.convert_i32x4_u")
    I32x4TruncSatF64x2SZero => Some("i32x4.trunc_sat_f64x2_s_zero")
    I32x4TruncSatF64x2UZero => Some("i32x4.trunc_sat_f64x2_u_zero")
    F64x2ConvertLowI32x4S => Some("f64x2.convert_low_i32x4_s")
    F64x2ConvertLowI32x4U => Some("f64x2.convert_low_i32x4_u")
    F32x4DemoteF64x2Zero => Some("f32x4.demote_f64x2_zero")
    F64x2PromoteLowF32x4 => Some("f64x2.promote_low_f32x4")
    I8x16RelaxedSwizzle => Some("i8x16.relaxed_swizzle")
    I32x4RelaxedTruncF32x4S => Some("i32x4.relaxed_trunc_f32x4_s")
    I32x4RelaxedTruncF32x4U => Some("i32x4.relaxed_trunc_f32x4_u")
    I32x4RelaxedTruncF64x2SZero => Some("i32x4.relaxed_trunc_f64x2_s_zero")
    I32x4RelaxedTruncF64x2UZero => Some("i32x4.relaxed_trunc_f64x2_u_zero")
    F32x4RelaxedMadd => Some("f32x4.relaxed_madd")
    F32x4RelaxedNmadd => Some("f32x4.relaxed_nmadd")
    F64x2RelaxedMadd => Some("f64x2.relaxed_madd")
    F64x2RelaxedNmadd => Some("f64x2.relaxed_nmadd")
    I8x16RelaxedLaneselect => Some("i8x16.relaxed_laneselect")
    I16x8RelaxedLaneselect => Some("i16x8.relaxed_laneselect")
    I32x4RelaxedLaneselect => Some("i32x4.relaxed_laneselect")
    I64x2RelaxedLaneselect => Some("i64x2.relaxed_laneselect")
    F32x4RelaxedMin => Some("f32x4.relaxed_min")
    F32x4RelaxedMax => Some("f32x4.relaxed_max")
    F64x2RelaxedMin => Some("f64x2.relaxed_min")
    F64x2RelaxedMax => Some("f64x2.relaxed_max")
    I16x8RelaxedQ15mulrS => Some("i16x8.relaxed_q15mulr_s")
    I16x8RelaxedDotI8x16I7x16S => Some("i16x8.relaxed_dot_i8x16_i7x16_s")
    I32x4RelaxedDotI8x16I7x16AddS => Some("i32x4.relaxed_dot_i8x16_i7x16_add_s")
    _ => None
  }
}