feat(ir2mcode): 添加IR到机器码转换功能并修复函数命名

添加了完整的scc_ir2mcode实现,将MIR指令转换为机器码,
同时修复了头文件中的函数命名错误(scc_mir2sccf改为scc_ir2sccf)。

BREAKING CHANGE: 函数名从scc_mir2sccf更改为scc_ir2sccf

fix(vec): 修复向量循环和内存释放问题

修改了scc_vec_foreach宏使用+= 1避免潜在的编译器警告,
并添加了空指针检查以防止重复释放内存导致的崩溃。

refactor(hashtable): 优化哈希表接口设计

将scc_hashtable_get参数改为const类型,提供更好的只读访问安全性。

test: 添加break/continue和goto语句测试用例

新增18_break_continue.c和19_goto.c测试用例,
并对齐expect.toml文件格式以便于维护。
This commit is contained in:
zzy
2026-05-03 21:34:40 +08:00
parent b06c4fe3cc
commit 676f3ec82c
9 changed files with 90 additions and 21 deletions

View File

@@ -144,7 +144,7 @@ void *scc_hashtable_set(scc_hashtable_t *ht, const void *key, void *value) {
return old_value;
}
void *scc_hashtable_get(scc_hashtable_t *ht, const void *key) {
void *scc_hashtable_get(const scc_hashtable_t *ht, const void *key) {
if (ht->entries.cap == 0)
return nullptr;