diff options
author | Wojciech Kosior <kwojtus@protonmail.com> | 2020-10-06 18:49:05 +0200 |
---|---|---|
committer | Wojciech Kosior <kwojtus@protonmail.com> | 2020-10-06 18:49:05 +0200 |
commit | 63a2cced4238af7d171e0b8807d887c435b4656b (patch) | |
tree | e08a23b3700ccd540c053d7c4cbe24bf7cf53d6c /tools/stack_machine_instruction.h | |
parent | f0cd9e4e8bc1e1b109fff627c75527ee7195c82e (diff) | |
download | AGH-engineering-thesis-63a2cced4238af7d171e0b8807d887c435b4656b.tar.gz AGH-engineering-thesis-63a2cced4238af7d171e0b8807d887c435b4656b.zip |
add translation of relational operations and loops
Diffstat (limited to 'tools/stack_machine_instruction.h')
-rw-r--r-- | tools/stack_machine_instruction.h | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/tools/stack_machine_instruction.h b/tools/stack_machine_instruction.h index 003fa19..1f47c40 100644 --- a/tools/stack_machine_instruction.h +++ b/tools/stack_machine_instruction.h @@ -2,45 +2,6 @@ #include "wasm_compile.h" -/* - * TODO: this enum is to be removed; it it only still here as a cheat sheet - * for use when defining missing inline functions for those instructions - */ -enum instruction_code { - STORE, - STORE_P, - STOREB, - STOREB_P, - STOREW, - STOREW_P, - LOAD, - LOAD_P, - LOADBZX, - LOADBZX_P, - LOADBSX, - LOADBSX_P, - LOADWZX, - LOADWZX_P, - LOADWSX, - LOADWSX_P, - HALT, - NOP, - SWAP, - SET_SP, - JUMP, - TEE, - GET_FRAME, - CONST, - CALL, - ADD, - SUB, - DIV, - MUL, - DROP, - RET, - COND_JUMP -}; - #define DATA_NONE 0 #define DATA_KNOWN 1 #define DATA_KNOWN_21_BITS 2 @@ -156,6 +117,15 @@ Y(sub, 0x3001) /* 0011_0000_0000_0001 */ Y(div, 0x3002) /* 0011_0000_0000_0010 */ Y(mul, 0x3003) /* 0011_0000_0000_0011 */ Y(drop, 0x3004) /* 0011_0000_0000_0100 */ +Y(eq, 0x3007) /* 0011_0000_0000_0111 */ +Y(lt, 0x3008) /* 0011_0000_0000_1000 */ +Y(ult, 0x3009) /* 0011_0000_0000_1001 */ +Y(le, 0x300A) /* 0011_0000_0000_1010 */ +Y(ule, 0x300B) /* 0011_0000_0000_1011 */ +Y(gt, 0x300C) /* 0011_0000_0000_1100 */ +Y(ugt, 0x300D) /* 0011_0000_0000_1101 */ +Y(ge, 0x300E) /* 0011_0000_0000_1110 */ +Y(uge, 0x300F) /* 0011_0000_0000_1111 */ Y(ret, 0x3080) /* 0011_0000_1000_0000 */ X(cond_jump, 0x7080) /* 0111_0000_1xxx_xxxx */ X(cond_jump_n, 0x7100) /* 0111_0001_0xxx_xxxx */ |