Repository: dotnet/runtime
File: src/coreclr/jit/instrswasm.h (C/C++)

Code before:
 *
 *          id          -- the enum name for the instruction
 *          nm          -- textual name (for assembly display)
 *          info        -- miscellaneous instruction info
 *          fmt         -- instruction format
 *          opcode      -- encoding (modulo operands)
 *
 ******************************************************************************/

#ifndef TARGET_WASM
#error Unexpected target type
#endif

#ifndef INST
#error INST must be defined before including this file.
#endif

// clang-format off

// control flow
//
INST(invalid,     "INVALID",     0, IF_NONE,    BAD_CODE)
INST(unreachable, "unreachable", 0, IF_OPCODE,  0x00)
INST(label,       "label",       0, IF_RAW_ULEB128,   0x00)
INST(local_cnt,   "local.cnt",   0, IF_RAW_ULEB128, 0x00)
INST(local_decl,  "local",       0, IF_LOCAL_DECL, 0x00)
INST(nop,         "nop",         0, IF_OPCODE,  0x01)
INST(block,       "block",       0, IF_BLOCK,   0x02)
INST(loop,        "loop",        0, IF_BLOCK,   0x03)
INST(if,          "if",          0, IF_BLOCK,   0x04)
INST(else,        "else",        0, IF_OPCODE,  0x05)
INST(end,         "end",         0, IF_OPCODE,  0x0B)
INST(br,          "br",          0, IF_ULEB128, 0x0C)
INST(br_if,       "br_if",       0, IF_ULEB128, 0x0D)
INST(br_table,    "br_table",    0, IF_ULEB128, 0x0E)
INST(return,      "return",      0, IF_OPCODE,  0x0F)
INST(drop,        "drop",        0, IF_OPCODE,  0x1A)

INST(local_get,   "local.get",   0, IF_ULEB128, 0x20)
INST(local_set,   "local.set",   0, IF_ULEB128, 0x21)
INST(i32_load,    "i32.load",    0, IF_MEMARG,  0x28)
INST(i64_load,    "i64.load",    0, IF_MEMARG,  0x29)
INST(f32_load,    "f32.load",    0, IF_MEMARG,  0x2A)
INST(f64_load,    "f64.load",    0, IF_MEMARG,  0x2B)
INST(i32_store,   "i32.store",   0, IF_MEMARG,  0x36)
INST(i64_store,   "i64.store",   0, IF_MEMARG,  0x37)
INST(f32_store,   "f32.store",   0, IF_MEMARG,  0x38)
INST(f64_store,   "f64.store",   0, IF_MEMARG,  0x39)

// 5.4.7 Numeric Instructions
// Constants

Review comment (suggestion):
```suggestion
INST(label,       "label",       0, IF_RAW_ULEB128, 0x00)
INST(local_cnt,   "local.cnt",   0, IF_RAW_ULEB128, 0x00)
INST(local_decl,  "local",       0, IF_LOCAL_DECL,  0x00)
```
Technically the ambition is to have all these aligned across all the instructions but we can make that happen after the list settles down a bit.

Code after:
 *
 *          id          -- the enum name for the instruction
 *          nm          -- textual name (for assembly display)
 *          info        -- miscellaneous instruction info
 *          fmt         -- instruction format
 *          opcode      -- encoding (modulo operands)
 *
 ******************************************************************************/

#ifndef TARGET_WASM
#error Unexpected target type
#endif

#ifndef INST
#error INST must be defined before including this file.
#endif

// clang-format off

// control flow
//
INST(invalid,     "INVALID",     0, IF_NONE,    BAD_CODE)
INST(unreachable, "unreachable", 0, IF_OPCODE,  0x00)
INST(label,       "label",       0, IF_RAW_ULEB128, 0x00)
INST(local_cnt,   "local.cnt",   0, IF_RAW_ULEB128, 0x00)
INST(local_decl,  "local",       0, IF_LOCAL_DECL,  0x00)
INST(nop,         "nop",         0, IF_OPCODE,  0x01)
INST(block,       "block",       0, IF_BLOCK,   0x02)
INST(loop,        "loop",        0, IF_BLOCK,   0x03)
INST(if,          "if",          0, IF_BLOCK,   0x04)
INST(else,        "else",        0, IF_OPCODE,  0x05)
INST(end,         "end",         0, IF_OPCODE,  0x0B)
INST(br,          "br",          0, IF_ULEB128, 0x0C)
INST(br_if,       "br_if",       0, IF_ULEB128, 0x0D)
INST(br_table,    "br_table",    0, IF_ULEB128, 0x0E)
INST(return,      "return",      0, IF_OPCODE,  0x0F)
INST(drop,        "drop",        0, IF_OPCODE,  0x1A)

INST(local_get,   "local.get",   0, IF_ULEB128, 0x20)
INST(local_set,   "local.set",   0, IF_ULEB128, 0x21)
INST(i32_load,    "i32.load",    0, IF_MEMARG,  0x28)
INST(i64_load,    "i64.load",    0, IF_MEMARG,  0x29)
INST(f32_load,    "f32.load",    0, IF_MEMARG,  0x2A)
INST(f64_load,    "f64.load",    0, IF_MEMARG,  0x2B)
INST(i32_store,   "i32.store",   0, IF_MEMARG,  0x36)
INST(i64_store,   "i64.store",   0, IF_MEMARG,  0x37)
INST(f32_store,   "f32.store",   0, IF_MEMARG,  0x38)
INST(f64_store,   "f64.store",   0, IF_MEMARG,  0x39)

// 5.4.7 Numeric Instructions
// Constants