feat(ir): 添加IR库的基础结构和定义
- 创建IR库的cbuild.toml配置文件,添加对scc_core的依赖 - 新增ir_def.h头文件,定义IR类型、节点、基本块和函数的数据结构 - 添加ir_builtin.h和ir_builtin.c,提供内置的i32类型和零值常量 - 实现ir_dump.h和ir_dump.c,提供IR转储功能的接口 - 创建scc_ir.h和scc_ir.c,实现IR对象的初始化和分配功能 - 添加测试文件test_ir.c用于验证IR库功能 - 定义了完整的IR节点类型枚举和操作类型枚举
This commit is contained in:
27
libs/ir/include/scc_ir.h
Normal file
27
libs/ir/include/scc_ir.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef __SCC_IR_H__
|
||||
#define __SCC_IR_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);
|
||||
|
||||
#endif /* __SCC_IR_H__ */
|
||||
Reference in New Issue
Block a user