- 统一包名格式化,添加空格对齐 - 将依赖项从ir和lir重命名为hir,移除lir注释 - 为ast2ir模块添加正确的包名称"scc_ast2ir" - 更新依赖引用路径指向新的HIR库结构 - 移除注释掉的ir2mcode和sccf2target依赖项 refactor(ast2ir): 迁移到HIR中间表示替换IR表示 - 更新头文件包含,使用hir_builder.h替代ir_builder.h - 修改上下文结构体,将scc_ir_builder_t替换为scc_hir_builder_t - 更新函数签名,将参数类型从scc_ir_*转换为scc_hir_* - 调整返回值类型,将scc_ir_value_ref_t和scc_ir_type_ref_t 分别替换为scc_hir_value_ref_t和scc_hir_type_ref_t - 重新排列头文件包含顺序以满足依赖关系
51 lines
2.0 KiB
C
51 lines
2.0 KiB
C
#ifndef __SCC_HIR_MODULE_H__
|
|
#define __SCC_HIR_MODULE_H__
|
|
|
|
#include "hir_def.h"
|
|
#include <scc_cfg.h>
|
|
#include <scc_hashtable.h>
|
|
|
|
typedef struct {
|
|
scc_cfg_module_t cfg_module;
|
|
|
|
scc_cfg_id_t value_uid;
|
|
scc_cfg_id_t type_uid;
|
|
SCC_VEC(scc_hir_value_t) values;
|
|
SCC_VEC(scc_hir_type_t) types;
|
|
// UID -> ref index
|
|
scc_hashtable_t uid2value;
|
|
scc_hashtable_t uid2type;
|
|
|
|
SCC_VEC(scc_hir_bblock_meta_t *) bblock_meta;
|
|
SCC_VEC(scc_hir_func_meta_t *) funcs_meta;
|
|
} scc_hir_module_t;
|
|
|
|
void scc_hir_module_init(scc_hir_module_t *ctx);
|
|
void scc_hir_module_drop(scc_hir_module_t *ctx);
|
|
scc_hir_type_ref_t scc_hir_module_add_type(scc_hir_module_t *ctx,
|
|
const scc_hir_type_t *type);
|
|
scc_hir_value_ref_t scc_hir_module_add_value(scc_hir_module_t *ctx,
|
|
const scc_hir_value_t *node);
|
|
scc_hir_bblock_ref_t scc_hir_module_add_bblock(scc_hir_module_t *ctx,
|
|
const scc_hir_bblock_t *bblock);
|
|
scc_hir_func_ref_t scc_hir_module_add_func(scc_hir_module_t *ctx,
|
|
const scc_hir_func_t *func);
|
|
scc_hir_type_t *scc_hir_module_get_type(scc_hir_module_t *ctx,
|
|
scc_hir_type_ref_t ref);
|
|
scc_hir_value_t *scc_hir_module_get_value(scc_hir_module_t *ctx,
|
|
scc_hir_value_ref_t ref);
|
|
scc_hir_bblock_t *scc_hir_module_get_bblock(scc_hir_module_t *ctx,
|
|
scc_hir_bblock_ref_t ref);
|
|
scc_hir_func_t *scc_hir_module_get_func(scc_hir_module_t *ctx,
|
|
scc_hir_func_ref_t ref);
|
|
|
|
static inline scc_hir_type_t *
|
|
scc_hir_module_get_type_by_value(scc_hir_module_t *ctx,
|
|
scc_hir_value_ref_t ref) {
|
|
scc_hir_value_t *value = scc_hir_module_get_value(ctx, ref);
|
|
Assert(value != nullptr);
|
|
return scc_hir_module_get_type(ctx, value->type);
|
|
}
|
|
|
|
#endif /* __SCC_HIR_MODULE_H__ */
|