diff --git a/Pass_ID_List.md b/Pass_ID_List.md index 14f3379..177ead1 100644 --- a/Pass_ID_List.md +++ b/Pass_ID_List.md @@ -3,4 +3,12 @@ | 名称 | 优化级别 | 开发进度 | | ------------ | ------------ | ---------- | | CFG优化 | 函数级 | 已完成 | -| DCE | 函数级 | 待测试 | \ No newline at end of file +| DCE | 函数级 | 待测试 | + +# 后续优化可能涉及的改动 + +## 1)将所有的alloca集中到entryblock中 + +好处:优化友好性,方面mem2reg提升 +目前没有实现这个机制,如果想要实现首先解决同一函数不同域的同名变量命名区分 +需要保证符号表能正确维护域中的局部变量 \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 01f54d8..1b0fb80 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,7 +27,7 @@ add_executable(sysyc Liveness.cpp DCE.cpp AddressCalculationExpansion.cpp - # Mem2Reg.cpp + Mem2Reg.cpp # Reg2Mem.cpp RISCv64Backend.cpp RISCv64ISel.cpp diff --git a/src/Pass.cpp b/src/Pass.cpp index bba8e36..6be44c5 100644 --- a/src/Pass.cpp +++ b/src/Pass.cpp @@ -3,6 +3,7 @@ #include "SysYIRCFGOpt.h" #include "SysYIRPrinter.h" #include "DCE.h" +#include "Mem2Reg.h" #include "Pass.h" #include #include @@ -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"; }