- 在cbuild.toml中启用lir依赖项,取消注释相关配置 - 重构libs/README.md文档,添加详细的库说明和层级结构 - 重命名头文件以统一命名规范:ast_def.h → scc_ast_def.h, ast_dump.h → scc_ast_dump.h, hir相关文件添加scc前缀 - 更新include路径以匹配新的文件命名 - 在cfg模块中添加symbol ID类型和linkage枚举,完善符号表功能 - 实现cfg模块中的符号添加、查找和获取功能 - 修改HIR中meta字段替换原有的attribute字段,更新相关访问宏 - 修复HIR构建器中的函数元数据访问错误 - 为LIR模块创建完整的头文件结构,包括指令定义、转换器等组件
33 lines
1.3 KiB
C
33 lines
1.3 KiB
C
#ifndef __SCC_AST2IR_H__
|
|
#define __SCC_AST2IR_H__
|
|
|
|
#include <scc_ast.h>
|
|
#include <scc_hir_builder.h>
|
|
#include <scc_type_abi.h>
|
|
|
|
typedef struct {
|
|
scc_hir_builder_t builder;
|
|
scc_hashtable_t ast2ir_cache; ///< ast node to ir ref cache
|
|
scc_hashtable_t symtab; ///< symbol to ir_ref
|
|
// scc_strpool_t strpool; ///< string pool
|
|
const scc_abi_type_calc_t *abi;
|
|
cbool hint_using_value; // 转换时尽可能使用value而不是alloc
|
|
} scc_ast2ir_ctx_t;
|
|
|
|
void scc_ast2ir_ctx_init(scc_ast2ir_ctx_t *ctx, const scc_abi_type_calc_t *abi,
|
|
scc_hir_cprog_t *cprog);
|
|
void scc_ast2ir_ctx_drop(scc_ast2ir_ctx_t *ctx);
|
|
|
|
void scc_ast2ir_translation_unit(scc_ast2ir_ctx_t *ctx,
|
|
const scc_ast_translation_unit_t *tu);
|
|
void scc_ast2ir_decl(scc_ast2ir_ctx_t *ctx, const scc_ast_decl_t *decl,
|
|
cbool is_global);
|
|
scc_hir_value_ref_t scc_ast2ir_expr(scc_ast2ir_ctx_t *ctx,
|
|
const scc_ast_expr_t *expr,
|
|
cbool is_lvalue);
|
|
void scc_ast2ir_stmt(scc_ast2ir_ctx_t *ctx, const scc_ast_stmt_t *stmt);
|
|
scc_hir_type_ref_t scc_ast2ir_type(scc_ast2ir_ctx_t *ctx,
|
|
const scc_ast_type_t *ast_type);
|
|
|
|
#endif /* __SCC_AST2IR_H__ */
|