[backend]重构了后端
This commit is contained in:
38
src/include/RISCv64AsmPrinter.h
Normal file
38
src/include/RISCv64AsmPrinter.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef RISCV64_ASMPRINTER_H
|
||||
#define RISCV64_ASMPRINTER_H
|
||||
|
||||
#include "RISCv64LLIR.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace sysy {
|
||||
|
||||
class RISCv64AsmPrinter {
|
||||
public:
|
||||
// 主入口,将整个MachineFunction打印到指定的输出流
|
||||
void runOnMachineFunction(MachineFunction* mfunc, std::ostream& os);
|
||||
|
||||
private:
|
||||
// 打印单个基本块
|
||||
void printBasicBlock(MachineBasicBlock* mbb);
|
||||
|
||||
// 打印单条指令
|
||||
void printInstruction(MachineInstr* instr, MachineBasicBlock* parent_bb);
|
||||
|
||||
// 打印函数序言
|
||||
void printPrologue(MachineFunction* mfunc);
|
||||
|
||||
// 打印函数尾声
|
||||
void printEpilogue(MachineFunction* mfunc);
|
||||
|
||||
// 将物理寄存器枚举转换为字符串 (从原RISCv64Backend迁移)
|
||||
std::string regToString(PhysicalReg reg);
|
||||
|
||||
// 打印单个操作数
|
||||
void printOperand(MachineOperand* op);
|
||||
|
||||
std::ostream* OS; // 指向当前输出流
|
||||
};
|
||||
|
||||
} // namespace sysy
|
||||
|
||||
#endif // RISCV64_ASMPRINTER_H
|
||||
Reference in New Issue
Block a user