Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2025ustc-jianmu-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
43
Merge Requests
43
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
compiler_staff
2025ustc-jianmu-compiler
Commits
843e628e
Commit
843e628e
authored
Dec 05, 2025
by
Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a bug
parent
daa009a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
README.md
README.md
+1
-1
src/passes/Mem2Reg.cpp
src/passes/Mem2Reg.cpp
+1
-1
No files found.
README.md
View file @
843e628e
...
...
@@ -2,5 +2,5 @@
本仓库为 USTC 编译原理和技术 2025 的课程实验仓库。在本学期的编译实验中,你们将构建一个从词法分析器开始到后端代码生成的JIANMU编译器。
本分支
提供了直到 lab2 的助教代码实现,可以用于完成 lab3 phase2
。
本分支
用于完成 lab4
。
src/passes/Mem2Reg.cpp
View file @
843e628e
...
...
@@ -142,7 +142,7 @@ void Mem2Reg::rename(BasicBlock *bb) {
// 步骤一:对每个 alloca 非数组变量(局部变量), 在其存储值栈存入其当前的最新值(也就是目前的栈顶值)
// 步骤二:遍历基本块所有指令,执行操作并记录需要删除的 load/store/alloca 指令(注意: 并非所有 load/store/alloca 都是 Mem2Reg 需要处理的)
// - 步骤三: 将 store 指令存储的值,作为其对应局部变量的最新值(更新栈顶)
// - 步骤四: 将 phi 指令
的所有使用替换为其对应的局部变量的最新值
// - 步骤四: 将 phi 指令
作为其对应局部变量的最新值(更新栈顶)
// - 步骤五: 将 load 指令的所有使用替换为其读取的局部变量的最新值
// 步骤六:为所有后继块的 phi 添加参数
// 步骤七:对 bb 在支配树上的所有后继节点,递归执行 rename 操作
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment