feat(ast): 重构AST转储功能并创建AST到IR转换器
- 重构ast_dump.c中的宏定义,简化PRINT_VALUE、PRINT_NODE、 PRINT_QUOTED_VALUE等宏的实现 - 移除冗余的PRINT_COLORED宏定义 - 统一使用SCC_TREE_DUMP_PRINT_PURE和SCC_TREE_DUMP_PRINT_AROUND 宏进行转储输出 - 在dump_stmt_impl函数中优化节点转储逻辑,统一使用end_node_dump 替代手动换行 - 添加对未知节点类型的警告日志输出 - 创建新的ast2ir模块,包含AST到IR的基本转换功能 - 实现ast_type_to_ir_type、ast_expr_to_ir、ast_stmt_to_ir、 ast_decl_to_ir等核心转换函数 - 更新IR库依赖配置,添加scc_utils和tree_dump依赖 - 新增IR基础接口定义文件ir_base.h和IR构建器接口ir_builder.h
This commit is contained in:
@@ -1,27 +1,9 @@
|
||||
#ifndef __SCC_IR_H__
|
||||
#define __SCC_IR_H__
|
||||
|
||||
#include "ir_builder.h"
|
||||
#include "ir_ctx.h"
|
||||
#include "ir_def.h"
|
||||
|
||||
void scc_ir_type_init(scc_ir_type_t *in, scc_ir_type_tag_t tag);
|
||||
void scc_ir_bblock_init(scc_ir_bblock_t *in, const char *label);
|
||||
void scc_ir_func_init(scc_ir_func_t *in, const char *name);
|
||||
|
||||
// node name can be null ptr
|
||||
void scc_ir_node_init(scc_ir_node_t *in, const char *name,
|
||||
scc_ir_node_tag_t tag);
|
||||
|
||||
void scc_ir_cprog_init(ir_cprog_t *in);
|
||||
|
||||
scc_ir_type_t *scc_ir_type_alloc(scc_ir_type_tag_t tag);
|
||||
scc_ir_bblock_t *scc_ir_bblock_alloc(const char *label);
|
||||
scc_ir_func_t *scc_ir_func_alloc(const char *name);
|
||||
scc_ir_node_t *scc_ir_node_alloc(const char *name, scc_ir_node_tag_t tag);
|
||||
|
||||
// scc_ir_type_t *scc_ir_type_alloc_with_ctx(scc_ir_type_tag_t tag);
|
||||
// scc_ir_bblock_t *scc_ir_bblock_alloc_with_ctx(const char *label);
|
||||
// scc_ir_func_t *scc_ir_func_alloc_with_ctx(const char *name);
|
||||
// scc_ir_node_t *scc_ir_node_alloc_with_ctx(const char *name,
|
||||
// scc_ir_node_tag_t tag);
|
||||
#include <scc_utils.h>
|
||||
|
||||
#endif /* __SCC_IR_H__ */
|
||||
|
||||
Reference in New Issue
Block a user