[midend-mem2reg]暂存文件,思路留存

This commit is contained in:
rain2133
2025-07-28 14:57:15 +08:00
parent efe74cba6c
commit 535a935bf1
3 changed files with 15 additions and 2 deletions

View File

@@ -4,3 +4,11 @@
| ------------ | ------------ | ---------- |
| CFG优化 | 函数级 | 已完成 |
| DCE | 函数级 | 待测试 |
# 后续优化可能涉及的改动
## 1将所有的alloca集中到entryblock中
好处优化友好性方面mem2reg提升
目前没有实现这个机制,如果想要实现首先解决同一函数不同域的同名变量命名区分
需要保证符号表能正确维护域中的局部变量

View File

@@ -27,7 +27,7 @@ add_executable(sysyc
Liveness.cpp
DCE.cpp
AddressCalculationExpansion.cpp
# Mem2Reg.cpp
Mem2Reg.cpp
# Reg2Mem.cpp
RISCv64Backend.cpp
RISCv64ISel.cpp

View File

@@ -3,6 +3,7 @@
#include "SysYIRCFGOpt.h"
#include "SysYIRPrinter.h"
#include "DCE.h"
#include "Mem2Reg.h"
#include "Pass.h"
#include <iostream>
#include <queue>
@@ -62,6 +63,10 @@ void PassManager::runOptimizationPipeline(Module* moduleIR, IRBuilder* builderIR
this->addPass(&DCE::ID);
this->run();
this->clearPasses();
this->addPass(&Mem2Reg::ID);
this->run();
if (DEBUG) std::cout << "--- Custom optimization sequence finished ---\n";
}