diff options
author | dec05eba <dec05eba@protonmail.com> | 2019-08-17 02:57:08 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-25 14:36:46 +0200 |
commit | 81c5f8e750fcda6a2451fb54604130431434f88f (patch) | |
tree | 944fa06c781d57b1db90e9153080f411a1c34a55 /executor/executor.h | |
parent | 20662a1d203ffb9e05d6694347fd258115b41d0a (diff) |
Implement more instructions, implement function parameters and arguments
Diffstat (limited to 'executor/executor.h')
-rw-r--r-- | executor/executor.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/executor/executor.h b/executor/executor.h index fdf6e67..5be9abc 100644 --- a/executor/executor.h +++ b/executor/executor.h @@ -20,6 +20,10 @@ CHECK_RESULT int amal_executor_init(amal_executor **self); void amal_executor_deinit(amal_executor *self); CHECK_RESULT int amal_executor_run(amal_executor *self); +/* These functions are called for every file in the program. Every file has its own list of strings, intermediates, functions and external functions */ +CHECK_RESULT int amal_executor_instructions_start(amal_executor *self, u16 num_functions); +CHECK_RESULT int amal_executor_instructions_end(amal_executor *self); + CHECK_RESULT int amal_exec_nop(amal_executor *self); CHECK_RESULT int amal_exec_setz(amal_executor *self, u8 dst_reg); CHECK_RESULT int amal_exec_mov(amal_executor *self, u8 dst_reg, u8 src_reg); @@ -34,12 +38,12 @@ CHECK_RESULT int amal_exec_div(amal_executor *self, u8 dst_reg, u8 src_reg1, u8 CHECK_RESULT int amal_exec_push(amal_executor *self, u8 reg); CHECK_RESULT int amal_exec_pushi(amal_executor *self, i64 imm); CHECK_RESULT int amal_exec_pushd(amal_executor *self, BufferView data); -/*CHECK_RESULT int amal_exec_call(u8 dst_reg, BufferView data); -CHECK_RESULT int amal_exec_callr(u8 dst_reg, BufferView data);*/ +CHECK_RESULT int amal_exec_call(amal_executor *self, u16 func_index, u8 num_args); +/*CHECK_RESULT int amal_exec_callr(u8 dst_reg, BufferView data);*/ CHECK_RESULT int amal_exec_cmp(amal_executor *self, u8 dst_reg, u8 src_reg1, u8 src_reg2); CHECK_RESULT int amal_exec_jz(amal_executor *self, u8 dst_reg, i16 offset); CHECK_RESULT int amal_exec_jmp(amal_executor *self, i16 offset); -CHECK_RESULT int amal_exec_ret(amal_executor *self); +CHECK_RESULT int amal_exec_ret(amal_executor *self, u8 reg); CHECK_RESULT int amal_exec_func_start(amal_executor *self, u16 num_regs); CHECK_RESULT int amal_exec_func_end(amal_executor *self); |