refactor(ast2ir): 更新IR构建器接口并重构类型映射
- 将IR构建器初始化函数修改为接受cprog参数 - 添加scc_ast2ir_ctx_drop函数用于资源清理 - 更新类型标识符命名规范,从大写改为小写形式 - 替换scc_ir_ctx_get_*函数调用为scc_ir_module_get_*函数 - 移除对ir_builtin.h的依赖,改用ir_builder.h中的构建器函数 - 为整数常量创建添加专门的构建器辅助函数 fix(ir): 重构IR上下文和模块管理结构 - 将原有的scc_ir_cprog_ctx_t拆分为scc_ir_module_t和scc_ir_ctx_t - 添加scc_ir_module_t结构用于统一管理IR对象存储 - 更新IR类型枚举名称格式,从SCC_IR_TYPE_XXX改为SCC_IR_TYPE_xxx - 添加整数、无符号整数和浮点数常量联合体定义 - 移除ir_base.h和ir_builtin.h头文件,整合到scc_ir.h中 feat(ir_builder): 添加类型构建器函数和常量创建功能 - 为各种基础类型添加scc_ir_builder_type_*内联函数 - 实现scc_ir_builder_const_int函数用于创建整数常量 - 修改构建器初始化函数签名以接受cprog参数 - 更新构建器内部结构,使用指向cprog的指针而非嵌入式结构
This commit is contained in:
@@ -29,7 +29,7 @@ typedef scc_hashtable_t *(*scc_reg_alloc_func_t)(
|
||||
);
|
||||
|
||||
typedef struct scc_reg_alloc {
|
||||
scc_ir_cprog_ctx_t *ir_ctx; ///< IR上下文
|
||||
scc_ir_module_t *ir_module; ///< IR存储节点
|
||||
scc_hashtable_t node_ref2reg_loc; ///< 输出结果哈希表
|
||||
scc_reg_loc_vec_t reg_loc_vec;
|
||||
int gpr_caller_saved; ///< 函数可以随意修改,调用者如果在意需自行保护.
|
||||
@@ -41,7 +41,7 @@ typedef struct scc_reg_alloc {
|
||||
#define scc_reg_alloc(ctx, func) ((ctx)->reg_alloc_func(ctx, func))
|
||||
|
||||
void scc_reg_alloc_init(scc_reg_alloc_t *ctx, scc_reg_alloc_func_t func,
|
||||
scc_ir_cprog_ctx_t *ir_ctx);
|
||||
scc_ir_module_t *ir_module);
|
||||
scc_hashtable_t *scc_reg_alloc_with_stack(scc_reg_alloc_t *ctx,
|
||||
scc_ir_func_t *func);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user