feat(ir): 重构指针操作API并优化数组访问逻辑
- 将scc_ir_builder_get_ptr重命名为scc_ir_builder_get_elem_ptr以更好地反映其功能 - 移除旧的GET_PTR相关枚举和结构体定义 - 更新IR构建器中指针类型的处理逻辑,支持数组元素指针计算 - 在代码生成阶段正确处理元素指针操作的索引计算 fix(ast2ir): 修正数组下标表达式的指针获取操作 - 将数组访问中的get_ptr调用替换为get_elem_ptr - 确保数组元素访问使用正确的IR指令 perf(runtime): 优化fprintf函数的大字符串处理性能 - 实现动态缓冲区分配策略,小字符串使用栈缓冲区,大字符串使用堆分配 - 避免固定大小缓冲区可能导致的截断问题 - 添加适当的内存清理机制
This commit is contained in:
@@ -82,9 +82,9 @@ void scc_ir_value_init(scc_ir_value_t *in, const char *name,
|
||||
in->data.store.target = 0;
|
||||
in->data.store.value = 0;
|
||||
break;
|
||||
case SCC_IR_VALUE_TAG_GET_PTR:
|
||||
in->data.get_ptr.src_addr = 0;
|
||||
in->data.get_ptr.index = 0;
|
||||
case SCC_IR_VALUE_TAG_GET_ELEM_PTR:
|
||||
in->data.get_elem_ptr.src_addr = 0;
|
||||
in->data.get_elem_ptr.index = 0;
|
||||
break;
|
||||
case SCC_IR_VALUE_TAG_OP:
|
||||
in->data.op.op = SCC_IR_OP_EMPTY;
|
||||
|
||||
Reference in New Issue
Block a user