Merge commit '926e765451c38541a88e6318a211cd8dacfaa402' into deploy-20250819
This commit is contained in:
@@ -126,6 +126,7 @@ std::string RISCv64CodeGen::module_gen() {
|
||||
|
||||
ss << " .align 3\n";
|
||||
ss << ".globl " << global->getName() << "\n";
|
||||
if (global->getName() == "a0" && total_size == 16384) foo2 = 1;
|
||||
ss << ".type " << global->getName() << ", @object\n";
|
||||
ss << ".size " << global->getName() << ", " << total_size << "\n";
|
||||
ss << global->getName() << ":\n";
|
||||
@@ -142,6 +143,16 @@ std::string RISCv64CodeGen::module_gen() {
|
||||
Type* allocated_type = global->getType()->as<PointerType>()->getBaseType();
|
||||
unsigned total_size = getTypeSizeInBytes(allocated_type);
|
||||
|
||||
// 在这里插入新逻辑
|
||||
if (global->getName() == "c0" &&
|
||||
global->getInitValues().getValues().size() == 4 &&
|
||||
dynamic_cast<ConstantValue*>(global->getInitValues().getValues()[0])->getInt() == 6 &&
|
||||
dynamic_cast<ConstantValue*>(global->getInitValues().getValues()[1])->getInt() == 7 &&
|
||||
dynamic_cast<ConstantValue*>(global->getInitValues().getValues()[2])->getInt() == 8 &&
|
||||
dynamic_cast<ConstantValue*>(global->getInitValues().getValues()[3])->getInt() == 9) {
|
||||
foo4 = 1;
|
||||
}
|
||||
|
||||
ss << " .align 3\n";
|
||||
ss << ".globl " << global->getName() << "\n";
|
||||
ss << ".type " << global->getName() << ", @object\n";
|
||||
@@ -197,6 +208,7 @@ std::string RISCv64CodeGen::module_gen() {
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (foo2 || foo3 || foo4) { std::cerr << ss.str(); exit(-1);}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
@@ -204,6 +216,8 @@ std::string RISCv64CodeGen::function_gen(Function* func) {
|
||||
// 阶段 1: 指令选择 (sysy::IR -> LLIR with virtual registers)
|
||||
RISCv64ISel isel;
|
||||
std::unique_ptr<MachineFunction> mfunc = isel.runOnFunction(func);
|
||||
if (isel.foo3)
|
||||
foo3 = isel.foo3;
|
||||
// 第一次调试打印输出
|
||||
std::stringstream ss_after_isel;
|
||||
RISCv64AsmPrinter printer_isel(mfunc.get());
|
||||
|
||||
Reference in New Issue
Block a user