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:
@@ -101,40 +101,6 @@ scc_mir_x86_instr_3(scc_mir_x86_instr_t *out, scc_x86_iform_t opcode,
|
||||
out->x86_instr.src_loc = pos;
|
||||
}
|
||||
|
||||
static inline scc_x86_iform_t
|
||||
scc_mir_x86_mov_reg_mem(scc_x86_operand_value_t op0,
|
||||
scc_x86_operand_value_t op1) {
|
||||
Assert(op0.size == op1.size);
|
||||
Assert(op0.kind == SCC_X86_OPR_REG && op1.kind == SCC_X86_OPR_MEM);
|
||||
return op0.size == 1 ? SCC_X86_IFORM_MOV_GPR8_MEMB
|
||||
: SCC_X86_IFORM_MOV_GPRV_MEMV;
|
||||
}
|
||||
static inline scc_x86_iform_t
|
||||
scc_mir_x86_mov_mem_reg(scc_x86_operand_value_t op0,
|
||||
scc_x86_operand_value_t op1) {
|
||||
Assert(op0.size == op1.size);
|
||||
Assert(op0.kind == SCC_X86_OPR_MEM && op1.kind == SCC_X86_OPR_REG);
|
||||
return op0.size == 1 ? SCC_X86_IFORM_MOV_MEMB_GPR8
|
||||
: SCC_X86_IFORM_MOV_MEMV_GPRV;
|
||||
}
|
||||
static inline scc_x86_iform_t
|
||||
scc_mir_x86_mov_reg_reg(scc_x86_operand_value_t op0,
|
||||
scc_x86_operand_value_t op1) {
|
||||
Assert(op0.size == op1.size);
|
||||
Assert(op0.kind == SCC_X86_OPR_REG && op1.kind == SCC_X86_OPR_REG);
|
||||
return op0.size == 1 ? SCC_X86_IFORM_MOV_GPR8_GPR8_8A
|
||||
: SCC_X86_IFORM_MOV_GPRV_GPRV_8B;
|
||||
}
|
||||
|
||||
static inline scc_x86_iform_t
|
||||
scc_mir_x86_mov_reg_imm(scc_x86_operand_value_t op0,
|
||||
scc_x86_operand_value_t op1) {
|
||||
Assert(op0.size == op1.size);
|
||||
Assert(op0.kind == SCC_X86_OPR_REG && op1.kind == SCC_X86_OPR_IMM);
|
||||
return op0.size == 1 ? SCC_X86_IFORM_MOV_GPR8_IMMB_B0
|
||||
: SCC_X86_IFORM_MOV_GPRV_IMMV;
|
||||
}
|
||||
|
||||
void scc_x86_emit_move_to_vec(scc_mir_x86_instr_vec_t *vec,
|
||||
scc_x86_operand_value_t dst,
|
||||
scc_x86_operand_value_t src);
|
||||
|
||||
@@ -29,6 +29,7 @@ typedef struct scc_mir_stack_slot {
|
||||
int size; // 通常是 8 字节 (指针大小)
|
||||
int alignment; // 对齐要求
|
||||
int offset; // 相对于 RSP 的偏移 (最终确定)
|
||||
int arg_idx; // == 0 means local slot, > 0 means argument slot
|
||||
} scc_mir_stack_slot_t;
|
||||
typedef SCC_VEC(scc_mir_stack_slot_t) scc_mir_stack_slot_vec_t;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
void scc_win_pc_x64_abi_lowering(scc_abi_lowering_t *abi_lowering);
|
||||
void scc_win_pc_x64_reg_alloc_fill(scc_reg_alloc_op_t *ops);
|
||||
void scc_win_pc_x64_frame_alloc_init(scc_frame_layout_t *ctx);
|
||||
void scc_win_pc_x64_frame_layout_init(scc_frame_layout_t *ctx);
|
||||
void scc_win_pc_x64_prolog_epilog_init(scc_prolog_epilog_t *ctx);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user