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

View File

@ -1,3 +1,3 @@
rm -rf tmp/*
rm -rf *.s
rm -rf *.s *.ll *clang *sysyc
rm -rf *_riscv32

View File

@ -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