diff options
| author | Mistivia <i@mistivia.com> | 2025-03-25 17:31:08 +0800 |
|---|---|---|
| committer | Mistivia <i@mistivia.com> | 2025-03-25 17:31:08 +0800 |
| commit | 39e2a605f6d8ebcc3cb454daae3d0a4298df2eb6 (patch) | |
| tree | 9d0933cdcb0d4bb2d80316f106611a4aa9024dd4 /src/as_op.c | |
| parent | d1195499338ba4b6536f8a6a56564622eb07469f (diff) | |
add codegen
Diffstat (limited to 'src/as_op.c')
| -rw-r--r-- | src/as_op.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/as_op.c b/src/as_op.c index 67c91ff..71ba0f3 100644 --- a/src/as_op.c +++ b/src/as_op.c @@ -19,6 +19,7 @@ struct op_table_entry op_table [] = { {OP_SRV, "srv"}, // OP_IMM, {OP_IMM, "imm"}, + {OP_IMM, "rel"}, // OP_LD8, OP_LD16, OP_LD32, OP_LD, {OP_LD8, "ld8"}, {OP_LD16, "ld16"}, @@ -93,7 +94,7 @@ struct op_table_entry op_table [] = { }; int op_size(enum op op) { - if (op == OP_IMM) { + if (op == OP_IMM || op == OP_REL) { return 8 + 1; } if (op == OP_CALL @@ -112,21 +113,11 @@ int op_size(enum op op) { return 1; } -int is_ld_op(enum op op) { - if (op == OP_LD - || op == OP_LD8 - || op == OP_LD16 - || op == OP_LD32) { +int is_pseudo_op(enum op op) { + if (op == OP_LDARG || op == OP_STARG) { return 1; } - return 0; -} - -int is_st_op(enum op op) { - if (op == OP_ST - || op == OP_ST8 - || op == OP_ST16 - || op == OP_ST32) { + if (op == OP_LDVAR || op == OP_STVAR) { return 1; } return 0; @@ -141,6 +132,6 @@ enum op str2op(const char* str) { return OP_END; } -int isOp(const char *str) { +int is_op(const char *str) { return OP_END != str2op(str); } |
