[backend] almost all test passed

This commit is contained in:
Lixuanwang
2025-06-24 16:03:39 +08:00
parent cd91cc98ed
commit 5222027b68
3 changed files with 6 additions and 5 deletions

View File

@@ -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()) {