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:
zzy
2026-05-24 15:46:22 +08:00
parent ea553718f0
commit cec96333e7
27 changed files with 1223 additions and 740 deletions

View File

@@ -176,6 +176,13 @@ typedef struct {
} func;
} scc_hir_builtin_t;
typedef enum {
SCC_HIR_CONV_NONE,
SCC_HIR_CONV_SEXT,
SCC_HIR_CONV_ZEXT,
SCC_HIR_CONV_TRUNC,
} scc_hir_conv_type_t;
struct scc_hir_value {
scc_hir_type_ref_t type;
const char *name;
@@ -199,9 +206,9 @@ struct scc_hir_value {
scc_hir_value_ref_t value;
} global_alloc;
struct {
scc_hir_value_ref_t operand;
scc_hir_value_ref_t operand; // 原始类型
scc_hir_type_ref_t target_type; // 目标类型
enum { CONV_SEXT, CONV_ZEXT, CONV_TRUNC } conv_type;
scc_hir_conv_type_t conv_type;
} conv;
struct {
scc_hir_value_ref_t target;
@@ -250,6 +257,7 @@ typedef struct scc_hir_func_meta {
scc_hir_type_ref_t type;
scc_hir_value_ref_vec_t params;
int defined;
cbool is_variadic;
} scc_hir_func_meta_t;
#define SCC_HIR_BBLOCK_VALUES(bblock) \