[backend-llir]修复了许多重构的bug

This commit is contained in:
Lixuanwang
2025-07-19 17:50:14 +08:00
parent d4a6996d74
commit 9528335a04
11 changed files with 513 additions and 497 deletions

View File

@@ -8,29 +8,23 @@ namespace sysy {
class RISCv64AsmPrinter {
public:
// 主入口将整个MachineFunction打印到指定的输出流
void runOnMachineFunction(MachineFunction* mfunc, std::ostream& os);
RISCv64AsmPrinter(MachineFunction* mfunc);
// 主入口
void run(std::ostream& os);
private:
// 打印单个基本块
// 打印各个部分
void printPrologue();
void printEpilogue();
void printBasicBlock(MachineBasicBlock* mbb);
// 打印单条指令
void printInstruction(MachineInstr* instr, MachineBasicBlock* parent_bb);
// 打印函数序言
void printPrologue(MachineFunction* mfunc);
void printInstruction(MachineInstr* instr);
// 打印函数尾声
void printEpilogue(MachineFunction* mfunc);
// 将物理寄存器枚举转换为字符串 (从原RISCv64Backend迁移)
// 辅助函数
std::string regToString(PhysicalReg reg);
// 打印单个操作数
void printOperand(MachineOperand* op);
std::ostream* OS; // 指向当前输出流
MachineFunction* MFunc;
std::ostream* OS;
};
} // namespace sysy