diff --git a/src/RISCv32Backend.cpp b/src/RISCv32Backend.cpp index c7760e1..20677e1 100644 --- a/src/RISCv32Backend.cpp +++ b/src/RISCv32Backend.cpp @@ -161,8 +161,9 @@ std::string RISCv32CodeGen::basicBlock_gen(BasicBlock* bb, const RegAllocResult& bb_name = "entry"; } } - ss << bb_name << ":\n"; // 基本块标签 - + else { + ss << bb_name << ":\n"; // 基本块标签 + } // !!! 重要的修改:此处不再清除 value_vreg_map 和 vreg_counter。 // !!! 这些映射在 function_gen -> register_allocation 阶段为整个函数建立。 // value_vreg_map.clear(); // 移除此行 @@ -733,7 +734,7 @@ void RISCv32CodeGen::select_instructions(DAGNode* node, const RegAllocResult& al if (node->operands.empty() || !node->operands[0]) break; std::string cond_reg = get_preg_or_temp(node->operands[0]->result_vreg); std::string then_block = br->getThenBlock()->getName(); - std::string else_block = br->getName(); + std::string else_block = br->getElseBlock()->getName(); // 修复空标签问题 if (then_block.empty()) { diff --git a/test_script/clean.sh b/test_script/clean.sh index 40cd3de..d203552 100644 --- a/test_script/clean.sh +++ b/test_script/clean.sh @@ -1,3 +1,3 @@ rm -rf tmp/* -rm -rf *.s +rm -rf *.s *.ll *clang *sysyc rm -rf *_riscv32 \ No newline at end of file diff --git a/test_script/sysyll.sh b/test_script/sysyll.sh index 4b27256..f3b6334 100644 --- a/test_script/sysyll.sh +++ b/test_script/sysyll.sh @@ -33,7 +33,7 @@ for sy_file in "$input_dir"*.sy; do output_file="${base_name}_sysyc.ll" # 使用 sysyc 编译 .sy 文件为 .ll 文件 - ../build/bin/sysyc -s llvmir "$sy_file" > "$output_file" + ../build/bin/sysyc -s ir "$sy_file" > "$output_file" # 检查是否成功 if [ $? -eq 0 ]; then