feat(ast2ir): 实现C11类型提升系统并重构HIR基本块管理
- 新增 scc_ast2ir_promote.c 实现整数提升(6.3.1.1)和寻常算术转换(6.3.1.8) - 重构 HIR Builder: bblock → create_bblock + append_bblock,引入BBList链表管理 - AST2IR 全面集成类型提升:二元运算、赋值、函数调用参数、自增/自减操作符 - 变参函数支持:跳过 ... 假参数,实现默认参数提升(float→double等) - 简化 HIR Dump 实现 - MIR: Win64 ABI改进、x86指令选择优化 - 新增 printf 测试用例
This commit is contained in:
@@ -62,8 +62,8 @@ static void emit_mir_module(sccf_builder_t *builder, scc_mcode_t *mcode,
|
||||
scc_hashtable_usize_init(&bblock_offset);
|
||||
scc_reloc_vec_t relocs;
|
||||
scc_vec_init(relocs);
|
||||
scc_vec_foreach(func->bblocks, i) {
|
||||
scc_cfg_bblock_id_t id = scc_vec_at(func->bblocks, i);
|
||||
scc_vec_foreach(func->bblocks, j) {
|
||||
scc_cfg_bblock_id_t id = scc_vec_at(func->bblocks, j);
|
||||
const scc_cfg_bblock_t *bb =
|
||||
scc_cfg_module_unsafe_get_bblock(&mir_module->cfg_module, id);
|
||||
|
||||
@@ -72,20 +72,21 @@ static void emit_mir_module(sccf_builder_t *builder, scc_mcode_t *mcode,
|
||||
(void *)scc_mcode_size(mcode));
|
||||
|
||||
scc_mir_instr_vec_t *instrs = SCC_MIR_BBLOCK_VALUES_PTR(bb);
|
||||
scc_vec_foreach(*instrs, i) {
|
||||
scc_vec_foreach(*instrs, k) {
|
||||
const scc_mir_instr_t *ins =
|
||||
scc_vec_sized_at_ptr(*instrs, mir_module->instr_size, i);
|
||||
scc_vec_sized_at_ptr(*instrs, mir_module->instr_size, k);
|
||||
// FIXME reloc symbol needed
|
||||
scc_ir2mcode_emit_instr(mcode, &relocs, ins);
|
||||
}
|
||||
}
|
||||
|
||||
scc_vec_foreach(relocs, i) {
|
||||
scc_reloc_t *reloc = &scc_vec_at(relocs, i);
|
||||
scc_vec_foreach(relocs, j) {
|
||||
scc_reloc_t *reloc = &scc_vec_at(relocs, j);
|
||||
if (reloc->target_kind == SCC_RELOC_TARGET_BBLOCK) {
|
||||
reloc->target_kind = SCC_RELOC_TARGET_NONE;
|
||||
usize addr = (usize)scc_hashtable_get(
|
||||
&bblock_offset, (void *)(usize)reloc->bblock_id);
|
||||
Assert(addr != 0);
|
||||
scc_ir2mcode_patch(mcode, reloc, addr);
|
||||
} else if (reloc->target_kind == SCC_RELOC_TARGET_SYMBOL) {
|
||||
usize sym_idx =
|
||||
|
||||
Reference in New Issue
Block a user