stage1 修复设计问题 实现ir2vm
This commit is contained in:
@@ -343,6 +343,14 @@ int spl_prog_store_to_file(const char *fname, spl_prog_t *prog) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int spl_prog_add_instr(spl_prog_t *prog, uint8_t opcode, uint8_t type, spl_val_t imm) {
|
||||
if (!prog)
|
||||
return 0;
|
||||
spl_ins_t ins = (spl_ins_t){.opcode = opcode, .type = type, .imm = imm};
|
||||
vec_push(prog->insns, ins);
|
||||
return vec_size(prog->insns);
|
||||
}
|
||||
|
||||
int spl_prog_add_func(spl_prog_t *prog, spl_func_t *func) {
|
||||
if (!prog || !func)
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user