stable 重构文件结构

抽象出Machine Code
This commit is contained in:
ZZY
2025-04-01 23:27:25 +08:00
parent 74f43a1ab7
commit b57f21556a
76 changed files with 657 additions and 260 deletions

View File

@@ -0,0 +1,15 @@
#include "riscv32_asm.h"
void init_rv32_prog(rv32_prog_t* prog, strpool_t* strpool) {
if (strpool == NULL) {
prog->strpool = salloc_alloc(sizeof(strpool_t));
init_strpool(prog->strpool);
} else {
prog->strpool = strpool;
}
prog->data_base_address = 0;
vector_init(prog->data);
prog->text_base_address = 0;
init_symtab_asm(&prog->symtab);
init_rv32_mcode(&prog->mcode, sizeof(symasm_entry_t));
}