[backend]修复了多参数传递的问题

This commit is contained in:
Lixuanwang
2025-07-30 17:58:39 +08:00
parent 877a0f5dc2
commit 1fb5cd398d
4 changed files with 99 additions and 19 deletions

View File

@@ -82,7 +82,10 @@ void RISCv64RegAlloc::run() {
// 阶段 5: 图着色算法分配物理寄存器
colorGraph();
// 阶段 6: 重写函数(插入溢出/填充代码,替换虚拟寄存器为物理寄存器)
rewriteFunction();
rewriteFunction();
// 将最终的寄存器分配结果保存到MachineFunction的帧信息中供后续Pass使用
MFunc->getFrameInfo().vreg_to_preg_map = this->color_map;
}
/**
@@ -794,7 +797,7 @@ void RISCv64RegAlloc::colorGraph() {
for (unsigned vreg : sorted_vregs) {
std::set<PhysicalReg> used_colors;
for (unsigned neighbor_id : interference_graph.at(vreg)) {
// ... (收集邻居颜色的逻辑保持不变) ...
// 收集邻居颜色的逻辑保持不变
if (color_map.count(neighbor_id)) {
used_colors.insert(color_map.at(neighbor_id));
}