feat(cbuild): 添加 lir 库依赖并注释掉未使用的模块
- 添加 { name = "lir", path = "./libs/lir" } 依赖项
- 注释掉 ir2mcode 和 sccf2target 模块以暂时禁用
refactor(ast2ir): 修复类型转换问题并简化哈希表初始化
- 修复 compute_type_layout 函数中的类型转换警告
- 在表达式处理末尾添加 UNREACHABLE() 断言
- 移除 begin_func 中的 param_names 参数
- 使用 scc_hashtable_usize_init 替代自定义比较函数
refactor(ir): 简化函数构建器接口并修复返回值处理
- 移除 scc_ir_builder_begin_func 中的 param_names 参数
- 修改 scc_ir_builder_ret_void 以正确处理 void 返回值
- 初始化返回值节点而不是直接设置为 0
refactor(ir): 简化模块初始化中的哈希表配置
- 移除自定义 hash_key 和 cmp_key 函数
- 使用 scc_hashtable_usize_init 统一初始化哈希表
feat(lir): 添加低层中间表示库基础结构
- 创建 lir 库的包配置文件
- 定义 LIR 的基本数据结构、指令类型和操作枚举
- 实现 LIR 构建器和模块管理功能
- 添加 LIR 转换器头文件和转储功能
This commit is contained in:
26
libs/lir/include/scc_lir_builder.h
Normal file
26
libs/lir/include/scc_lir_builder.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef __SCC_LIR_BUILDER_H__
|
||||
#define __SCC_LIR_BUILDER_H__
|
||||
|
||||
#include "scc_lir.h"
|
||||
#include "scc_lir_module.h"
|
||||
#include <scc_hashtable.h>
|
||||
|
||||
typedef struct scc_lir_builder {
|
||||
scc_lir_func_t *func;
|
||||
scc_lir_bblock_t *cur_bb;
|
||||
scc_hashtable_t value_to_vreg; // 高层 IR 值 -> 虚拟寄存器
|
||||
scc_lir_module_t *module;
|
||||
} scc_lir_builder_t;
|
||||
|
||||
void scc_lir_builder_init(scc_lir_builder_t *builder, scc_lir_module_t *module);
|
||||
void scc_lir_builder_drop(scc_lir_builder_t *builder);
|
||||
void scc_lir_builder_begin_func(scc_lir_builder_t *builder, const char *name);
|
||||
void scc_lir_builder_end_func(scc_lir_builder_t *builder);
|
||||
void scc_lir_builder_begin_bblock(scc_lir_builder_t *builder,
|
||||
const char *label);
|
||||
void scc_lir_builder_end_bblock(scc_lir_builder_t *builder);
|
||||
void scc_lir_builder_add_instr(scc_lir_builder_t *builder,
|
||||
const scc_lir_instr_t *instr);
|
||||
unsigned int scc_lir_builder_new_vreg(scc_lir_builder_t *builder);
|
||||
|
||||
#endif /* __SCC_LIR_BUILDER_H__ */
|
||||
Reference in New Issue
Block a user