- 在scc_abi_base_type_kind枚举中添加SCC_ABI_TYPE_VA_LIST类型 - 为Windows x64平台实现VA_LIST类型的ABI规则,遵循MSVC调用约定 - 在AST到ABI类型转换中处理SCC_AST_BUILTIN_TYPE_VA_LIST和BOOL类型 refactor(ast2ir): 实现循环控制流和跳转语句转换 - 添加break和continue缓存表用于语句跳转目标管理 - 实现while、do-while和for循环的正确控制流结构 - 添加对break、continue、goto和label语句的IR转换支持 - 修复复合表达式和声明类型的处理逻辑 refactor(parser): 重构语义分析接口和循环语句解析 - 将语义分析上下文从回调结构改为指针传递 - 为switch、while、do-while和for语句添加BEGIN/END语义标记 - 实现匿名结构体/联合体/枚举的符号命名处理 - 优化结构体/联合体/枚举声明的类型解析逻辑 feat(parser): 实现跳转语句语义分析和符号绑定 - 添加break_stack和continue_stack用于跟踪循环层级 - 实现break和continue语句的目标语句绑定检查 - 支持goto和label语句的标签符号查找和绑定 - 添加对跳转语句位置的有效性验证 Co-authored-by: Copilot <copilot@github.com>
35 lines
1.4 KiB
C
35 lines
1.4 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 break_cache; ///< break cache
|
|
scc_hashtable_t continue_cache; ///< continue 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_run(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_qual_type_t *ast_type);
|
|
|
|
#endif /* __SCC_AST2IR_H__ */
|