Implement if-else
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
# - Procedure calls in expressions.
|
||||
# - Comments between (* and *) are supported. These are still single line
|
||||
# comments and they should be on a separate line.
|
||||
# - _syscall builtin. _syscall takes 7 arguments,
|
||||
# the 7th argument gets stored in a7 before invoking ecall.
|
||||
# Other arguments are saved in a0 through a5.
|
||||
# - New intrinsics: _load_byte, _load_word, _store_byte, _store_word.
|
||||
const
|
||||
symbol_builtin_name_int := "Int";
|
||||
symbol_builtin_name_word := "Word";
|
||||
@@ -1403,7 +1407,13 @@ begin
|
||||
_skip_empty_lines();
|
||||
_compile_var_part();
|
||||
|
||||
_write_z(".section .text\n\0");
|
||||
_write_z(".section .text\n\n\0");
|
||||
_write_z(".type _syscall, @function\n_syscall:\n\tmv a7, a6\n\tecall\n\tret\n\n\0");
|
||||
_write_z(".type _load_byte, @function\n_load_byte:\n\tlb a0, (a0)\nret\n\n\0");
|
||||
_write_z(".type _load_word, @function\n_load_word:\n\tlw a0, (a0)\nret\n\n\0");
|
||||
_write_z(".type _store_byte, @function\n_store_byte:\n\tsb a0, (a1)\nret\n\n\0");
|
||||
_write_z(".type _store_word, @function\n_store_word:\n\tsw a0, (a1)\nret\n\n\0");
|
||||
|
||||
.compile_module_loop:
|
||||
_skip_empty_lines();
|
||||
|
||||
|
Reference in New Issue
Block a user