aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/binop_type.h7
-rw-r--r--include/bytecode/bytecode.h11
-rw-r--r--include/ssa/ssa.h9
-rw-r--r--include/tokenizer.h1
4 files changed, 26 insertions, 2 deletions
diff --git a/include/binop_type.h b/include/binop_type.h
index 94d2b7a..9264cf7 100644
--- a/include/binop_type.h
+++ b/include/binop_type.h
@@ -8,7 +8,12 @@ typedef enum {
BINOP_DIV,
BINOP_DOT,
BINOP_EQUALS,
- BINOP_AND
+ BINOP_NOT_EQUAL,
+ BINOP_AND,
+ BINOP_LESS,
+ BINOP_LESS_EQUAL,
+ BINOP_GREATER,
+ BINOP_GREATER_EQUAL
} BinopType;
#endif
diff --git a/include/bytecode/bytecode.h b/include/bytecode/bytecode.h
index 30f3bb5..f649368 100644
--- a/include/bytecode/bytecode.h
+++ b/include/bytecode/bytecode.h
@@ -59,7 +59,16 @@ typedef enum {
AMAL_OP_CALL, /* call ii, fi - Call a function in imported file (ii, import index) using function index (fi). The number of arguments is the number of values pushed to stack. ii is u8, fi is u16 */
AMAL_OP_CALLR, /* callr reg - Call a function using a register. Used for function pointers. The number of arguments is the number of values pushed to stack */
AMAL_OP_CALLE, /* calle ii, efi - Call an extern function in imported file (ii, import index) using extern function index (efi). The number of arguments is the number of values pushed to stack. ii is u8, efi is u16 */
- AMAL_OP_CMP, /* cmp dst, reg1, reg2 - Set dst to 1 if reg1 equals reg2, otherwise set it to 0 */
+ AMAL_OP_EQ, /* eq dst, reg1, reg2 - Set dst to 1 if reg1 equals reg2, otherwise set it to 0 */
+ AMAL_OP_NEQ, /* neq dst, reg1, reg2 - Set dst to 1 if reg1 is not equal to reg2, otherwise set it to 0 */
+ AMAL_OP_ILT, /* ilt dst, reg1, reg2 - Set dst to 1 if reg1 is less than reg2 (signed comparison), otherwise set it to 0 */
+ AMAL_OP_ILE, /* ile dst, reg1, reg2 - Set dst to 1 if reg1 is less or equal to reg2 (signed comparison), otherwise set it to 0 */
+ AMAL_OP_IGT, /* igt dst, reg1, reg2 - Set dst to 1 if reg1 is greater than reg2 (signed comparison), otherwise set it to 0 */
+ AMAL_OP_IGE, /* ige dst, reg1, reg2 - Set dst to 1 if reg1 is greater or equal to reg2 (signed comparison), otherwise set it to 0 */
+ AMAL_OP_LT, /* lt dst, reg1, reg2 - Set dst to 1 if reg1 is less than reg2 (unsigned comparison), otherwise set it to 0 */
+ AMAL_OP_LE, /* le dst, reg1, reg2 - Set dst to 1 if reg1 is less or equal to reg2 (unsigned comparison), otherwise set it to 0 */
+ AMAL_OP_GT, /* gt dst, reg1, reg2 - Set dst to 1 if reg1 is greater than reg2 (unsigned comparison), otherwise set it to 0 */
+ AMAL_OP_GE, /* ge dst, reg1, reg2 - Set dst to 1 if reg1 is greater or equal to reg2 (unsigned comparison), otherwise set it to 0 */
AMAL_OP_BIT_AND, /* and dst, reg1, reg2 - Perform bit and on reg1 and reg2, store the result in dst */
AMAL_OP_JZ, /* jz reg, label - Jump to label in the current function if reg is zero. label is u16 */
AMAL_OP_JMP, /* jmp label - Unconditional jump to label in the current function. label is u16 */
diff --git a/include/ssa/ssa.h b/include/ssa/ssa.h
index c6d58f6..e8e68c3 100644
--- a/include/ssa/ssa.h
+++ b/include/ssa/ssa.h
@@ -22,7 +22,16 @@ typedef enum {
SSA_IDIV,
SSA_DIV,
SSA_EQUALS,
+ SSA_NOT_EQUAL,
SSA_AND,
+ SSA_ILT,
+ SSA_ILE,
+ SSA_IGT,
+ SSA_IGE,
+ SSA_LT,
+ SSA_LE,
+ SSA_GT,
+ SSA_GE,
SSA_FUNC_START,
SSA_FUNC_END,
SSA_PUSH,
diff --git a/include/tokenizer.h b/include/tokenizer.h
index 4735d6f..f716ab2 100644
--- a/include/tokenizer.h
+++ b/include/tokenizer.h
@@ -24,6 +24,7 @@ typedef enum {
TOK_FN,
TOK_STRUCT,
TOK_EQUALS,
+ TOK_NOT,
TOK_OPEN_PAREN,
TOK_CLOSING_PAREN,
TOK_COMMA,