#ifndef __SCC_IR2MCODE_H__ #define __SCC_IR2MCODE_H__ #include #include typedef struct scc_reloc { usize offset; // 占位位置 u8 size; // 占位字节数(可选,用于校验) int arch_type; // 架构相关的重定位类型(由后端解释) enum { SCC_RELOC_TARGET_NONE, SCC_RELOC_TARGET_SYMBOL, SCC_RELOC_TARGET_BBLOCK, } target_kind; union { const char *symbol; int bblock_id; }; i64 addend; } scc_reloc_t; typedef SCC_VEC(scc_reloc_t) scc_reloc_vec_t; // FIXME target choice void scc_ir2mcode_emit_instr(scc_mcode_t *mcode, scc_reloc_vec_t *relocs, const scc_mir_instr_t *mir_instr); void scc_ir2mcode_patch(scc_mcode_t *mcode, scc_reloc_t *reloc, i64 value); void scc_ir2mcode(scc_mcode_t *mcode, scc_reloc_vec_t *relocs, const scc_mir_module_t *mir_module); #endif /* __SCC_IR2MCODE_H__ */