30 lines
743 B
C++
30 lines
743 B
C++
#ifndef RISCV64_PEEPHOLE_H
|
|
#define RISCV64_PEEPHOLE_H
|
|
|
|
#include "RISCv64LLIR.h"
|
|
#include "Pass.h"
|
|
|
|
namespace sysy {
|
|
|
|
/**
|
|
* @class PeepholeOptimizer
|
|
* @brief 窥孔优化器
|
|
* * 在已分配物理寄存器的指令流上,通过一个小的滑动窗口来查找
|
|
* 并替换掉一些冗余或低效的指令模式。
|
|
*/
|
|
class PeepholeOptimizer : public Pass {
|
|
public:
|
|
static char ID;
|
|
|
|
PeepholeOptimizer() : Pass("peephole-optimizer", Granularity::Function, PassKind::Optimization) {}
|
|
|
|
void *getPassID() const override { return &ID; }
|
|
|
|
bool runOnFunction(Function *F, AnalysisManager& AM) override;
|
|
|
|
void runOnMachineFunction(MachineFunction* mfunc);
|
|
};
|
|
|
|
} // namespace sysy
|
|
|
|
#endif // RISCV64_PEEPHOLE_H
|