[backend] almost all test passed
This commit is contained in:
@@ -161,8 +161,9 @@ std::string RISCv32CodeGen::basicBlock_gen(BasicBlock* bb, const RegAllocResult&
|
|||||||
bb_name = "entry";
|
bb_name = "entry";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ss << bb_name << ":\n"; // 基本块标签
|
else {
|
||||||
|
ss << bb_name << ":\n"; // 基本块标签
|
||||||
|
}
|
||||||
// !!! 重要的修改:此处不再清除 value_vreg_map 和 vreg_counter。
|
// !!! 重要的修改:此处不再清除 value_vreg_map 和 vreg_counter。
|
||||||
// !!! 这些映射在 function_gen -> register_allocation 阶段为整个函数建立。
|
// !!! 这些映射在 function_gen -> register_allocation 阶段为整个函数建立。
|
||||||
// value_vreg_map.clear(); // 移除此行
|
// 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;
|
if (node->operands.empty() || !node->operands[0]) break;
|
||||||
std::string cond_reg = get_preg_or_temp(node->operands[0]->result_vreg);
|
std::string cond_reg = get_preg_or_temp(node->operands[0]->result_vreg);
|
||||||
std::string then_block = br->getThenBlock()->getName();
|
std::string then_block = br->getThenBlock()->getName();
|
||||||
std::string else_block = br->getName();
|
std::string else_block = br->getElseBlock()->getName();
|
||||||
|
|
||||||
// 修复空标签问题
|
// 修复空标签问题
|
||||||
if (then_block.empty()) {
|
if (then_block.empty()) {
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
rm -rf tmp/*
|
rm -rf tmp/*
|
||||||
rm -rf *.s
|
rm -rf *.s *.ll *clang *sysyc
|
||||||
rm -rf *_riscv32
|
rm -rf *_riscv32
|
||||||
@@ -33,7 +33,7 @@ for sy_file in "$input_dir"*.sy; do
|
|||||||
output_file="${base_name}_sysyc.ll"
|
output_file="${base_name}_sysyc.ll"
|
||||||
|
|
||||||
# 使用 sysyc 编译 .sy 文件为 .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
|
if [ $? -eq 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user