[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

@@ -2,9 +2,6 @@
#define RISCV64_REGALLOC_H
#include "RISCv64LLIR.h"
#include <map>
#include <set>
#include <vector>
namespace sysy {
@@ -19,6 +16,9 @@ private:
using LiveSet = std::set<unsigned>; // 活跃虚拟寄存器集合
using InterferenceGraph = std::map<unsigned, std::set<unsigned>>;
// 栈帧管理
void eliminateFrameIndices();
// 活跃性分析
void analyzeLiveness();
@@ -28,7 +28,7 @@ private:
// 图着色分配寄存器
void colorGraph();
// 重写函数,将虚拟寄存器替换为物理寄存器,并插入溢出代码
// 重写函数,替换vreg并插入溢出代码
void rewriteFunction();
// 辅助函数获取指令的Use/Def集合
@@ -37,8 +37,8 @@ private:
MachineFunction* MFunc;
// 活跃性分析结果
std::map<MachineInstr*, LiveSet> live_in_map;
std::map<MachineInstr*, LiveSet> live_out_map;
std::map<const MachineInstr*, LiveSet> live_in_map;
std::map<const MachineInstr*, LiveSet> live_out_map;
// 干扰图
InterferenceGraph interference_graph;
@@ -49,7 +49,6 @@ private:
// 可用的物理寄存器池
std::vector<PhysicalReg> allocable_int_regs;
std::vector<PhysicalReg> allocable_float_regs; // (为未来浮点支持预留)
};
} // namespace sysy