32 lines
659 B
C++
32 lines
659 B
C++
#ifndef RISCV64_ASMPRINTER_H
|
|
#define RISCV64_ASMPRINTER_H
|
|
|
|
#include "RISCv64LLIR.h"
|
|
#include <iostream>
|
|
|
|
namespace sysy {
|
|
|
|
class RISCv64AsmPrinter {
|
|
public:
|
|
RISCv64AsmPrinter(MachineFunction* mfunc);
|
|
// 主入口
|
|
void run(std::ostream& os);
|
|
|
|
private:
|
|
// 打印各个部分
|
|
void printPrologue();
|
|
void printEpilogue();
|
|
void printBasicBlock(MachineBasicBlock* mbb);
|
|
void printInstruction(MachineInstr* instr);
|
|
|
|
// 辅助函数
|
|
std::string regToString(PhysicalReg reg);
|
|
void printOperand(MachineOperand* op);
|
|
|
|
MachineFunction* MFunc;
|
|
std::ostream* OS;
|
|
};
|
|
|
|
} // namespace sysy
|
|
|
|
#endif // RISCV64_ASMPRINTER_H
|