diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-09-07 00:04:38 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-11-06 14:38:40 +0100 |
| commit | 6d9d80362f9932bbc87e162b8ef7df06c73e27e1 (patch) | |
| tree | e3e228c63fe26f07503f226de7fb5086b3dc2286 /private_include/nw/opcodes.h | |
| download | nanowasm-6d9d80362f9932bbc87e162b8ef7df06c73e27e1.tar.gz | |
First commit
Diffstat (limited to 'private_include/nw/opcodes.h')
| -rw-r--r-- | private_include/nw/opcodes.h | 192 |
1 files changed, 192 insertions, 0 deletions
diff --git a/private_include/nw/opcodes.h b/private_include/nw/opcodes.h new file mode 100644 index 0000000..410bd97 --- /dev/null +++ b/private_include/nw/opcodes.h @@ -0,0 +1,192 @@ +/* + * nanowasm, a tiny WebAssembly/Wasm interpreter + * Copyright (C) 2023-2025 Xavier Del Campo Romero + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#ifndef OPCODES_H +#define OPCODES_H + +enum opcode +{ + OP_UNREACHABLE, + OP_NOP, + OP_BLOCK, + OP_LOOP, + OP_IF, + OP_ELSE, + OP_END = 0xb, + OP_BR, + OP_BR_IF, + OP_BR_TABLE, + OP_RETURN, + OP_CALL, + OP_CALL_INDIRECT, + OP_DROP = 0x1a, + OP_SELECT, + OP_GET_LOCAL = 0x20, + OP_SET_LOCAL, + OP_TEE_LOCAL, + OP_GET_GLOBAL, + OP_SET_GLOBAL, + OP_I32_LOAD = 0x28, + OP_I64_LOAD, + OP_F32_LOAD, + OP_F64_LOAD, + OP_I32_LOAD8_S, + OP_I32_LOAD8_U, + OP_I32_LOAD16_S, + OP_I32_LOAD16_U, + OP_I64_LOAD8_S, + OP_I64_LOAD8_U, + OP_I64_LOAD16_S, + OP_I64_LOAD16_U, + OP_I64_LOAD32_S, + OP_I64_LOAD32_U, + OP_I32_STORE, + OP_I64_STORE, + OP_F32_STORE, + OP_F64_STORE, + OP_I32_STORE8, + OP_I32_STORE16, + OP_I64_STORE8, + OP_I64_STORE16, + OP_I64_STORE32, + OP_CURRENT_MEMORY, + OP_GROW_MEMORY, + OP_I32_CONST, + OP_I64_CONST, + OP_F32_CONST, + OP_F64_CONST, + OP_I32_EQZ, + OP_I32_EQ, + OP_I32_NE, + OP_I32_LT_S, + OP_I32_LT_U, + OP_I32_GT_S, + OP_I32_GT_U, + OP_I32_LE_S, + OP_I32_LE_U, + OP_I32_GE_S, + OP_I32_GE_U, + OP_I64_EQZ, + OP_I64_EQ, + OP_I64_NE, + OP_I64_LT_S, + OP_I64_LT_U, + OP_I64_GT_S, + OP_I64_GT_U, + OP_I64_LE_S, + OP_I64_LE_U, + OP_I64_GE_S, + OP_I64_GE_U, + OP_F32_EQ, + OP_F32_NE, + OP_F32_LT, + OP_F32_GT, + OP_F32_LE, + OP_F32_GE, + OP_F64_EQ, + OP_F64_NE, + OP_F64_LT, + OP_F64_GT, + OP_F64_LE, + OP_F64_GE, + OP_I32_CLZ, + OP_I32_CTZ, + OP_I32_POPCNT, + OP_I32_ADD, + OP_I32_SUB, + OP_I32_MUL, + OP_I32_DIV_S, + OP_I32_DIV_U, + OP_I32_REM_S, + OP_I32_REM_U, + OP_I32_AND, + OP_I32_OR, + OP_I32_XOR, + OP_I32_SHL, + OP_I32_SHR_S, + OP_I32_SHR_U, + OP_I32_ROTL, + OP_I32_ROTR, + OP_I64_CLZ, + OP_I64_CTZ, + OP_I64_POPCNT, + OP_I64_ADD, + OP_I64_SUB, + OP_I64_MUL, + OP_I64_DIV_S, + OP_I64_DIV_U, + OP_I64_REM_S, + OP_I64_REM_U, + OP_I64_AND, + OP_I64_OR, + OP_I64_XOR, + OP_I64_SHL, + OP_I64_SHR_S, + OP_I64_SHR_U, + OP_I64_ROTL, + OP_I64_ROTR, + OP_F32_ABS, + OP_F32_NEG, + OP_F32_CEIL, + OP_F32_FLOOR, + OP_F32_TRUNC, + OP_F32_NEAREST, + OP_F32_SQRT, + OP_F32_ADD, + OP_F32_SUB, + OP_F32_MUL, + OP_F32_DIV, + OP_F32_MIN, + OP_F32_MAX, + OP_F32_COPYSIGN, + OP_F64_ABS, + OP_F64_NEG, + OP_F64_CEIL, + OP_F64_FLOOR, + OP_F64_TRUNC, + OP_F64_NEAREST, + OP_F64_SQRT, + OP_F64_ADD, + OP_F64_SUB, + OP_F64_MUL, + OP_F64_DIV, + OP_F64_MIN, + OP_F64_MAX, + OP_F64_COPYSIGN, + OP_I32_WRAP_I64, + OP_I32_TRUNC_S_F32, + OP_I32_TRUNC_U_F32, + OP_I32_TRUNC_S_F64, + OP_I32_TRUNC_U_F64, + OP_I64_EXTEND_S_I32, + OP_I64_EXTEND_U_I32, + OP_I64_TRUNC_S_F32, + OP_I64_TRUNC_U_F32, + OP_I64_TRUNC_S_F64, + OP_I64_TRUNC_U_F64, + OP_F32_CONVERT_S_I32, + OP_F32_CONVERT_U_I32, + OP_F32_CONVERT_S_I64, + OP_F32_CONVERT_U_I64, + OP_F32_DEMOTE_F64, + OP_F64_CONVERT_S_I32, + OP_F64_CONVERT_U_I32, + OP_F64_CONVERT_S_I64, + OP_F64_CONVERT_U_I64, + OP_F64_PROMOTE_F32, + OP_I32_REINTERPRET_F32, + OP_I64_REINTERPRET_F64, + OP_F32_REINTERPRET_I32, + OP_F64_REINTERPRET_I64, + OP_MISC = 0xfc +}; + +const char *nwp_op_tostr(enum opcode op); + +#endif |
