Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
2
2022fall-Compiler_CMinus
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
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
李晓奇
2022fall-Compiler_CMinus
Commits
92ddf834
Commit
92ddf834
authored
Dec 08, 2022
by
李晓奇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
can pass loop3
parent
0f5a162d
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
148 additions
and
72 deletions
+148
-72
Documentations/4.2-gvn/README.md
Documentations/4.2-gvn/README.md
+9
-0
Reports/4.2-gvn/figures/index_set.png
Reports/4.2-gvn/figures/index_set.png
+0
-0
Reports/4.2-gvn/figures/loop3.png
Reports/4.2-gvn/figures/loop3.png
+0
-0
Reports/4.2-gvn/figures/value_phi_func.png
Reports/4.2-gvn/figures/value_phi_func.png
+0
-0
Reports/4.2-gvn/report.md
Reports/4.2-gvn/report.md
+135
-68
gvn.json
gvn.json
+3
-0
src/optimization/GVN.cpp
src/optimization/GVN.cpp
+1
-4
No files found.
Documentations/4.2-gvn/README.md
View file @
92ddf834
# Lab4 实验文档
# Lab4 实验文档
-
[
Lab4 实验文档
](
#lab4-实验文档
)
-
[
Lab4 实验文档
](
#lab4-实验文档
)
-
[
0. 前言
](
#0-前言
)
-
[
0. 前言
](
#0-前言
)
-
[
1. GVN 基础知识
](
#1-gvn-基础知识
)
-
[
1. GVN 基础知识
](
#1-gvn-基础知识
)
-
[
1.1 GVN 简介
](
#11-gvn-简介
)
-
[
1.1 GVN 简介
](
#11-gvn-简介
)
-
[
1.2 GVN 相关概念
](
#12-gvn-相关概念
)
-
[
1.2 GVN 相关概念
](
#12-gvn-相关概念
)
-
[
1. IR 假设
](
#1-ir-假设
)
-
[
1. IR 假设
](
#1-ir-假设
)
...
@@ -14,8 +17,11 @@
...
@@ -14,8 +17,11 @@
-
[
7. Join 操作
](
#7-join-操作
)
-
[
7. Join 操作
](
#7-join-操作
)
-
[
8. 变量等价与表达式等价
](
#8-变量等价与表达式等价
)
-
[
8. 变量等价与表达式等价
](
#8-变量等价与表达式等价
)
-
[
9. Transfer Function
](
#9-transfer-function
)
-
[
9. Transfer Function
](
#9-transfer-function
)
-
[
2. GVN 算法(论文中提供的伪代码)
](
#2-gvn-算法论文中提供的伪代码
)
-
[
2. GVN 算法(论文中提供的伪代码)
](
#2-gvn-算法论文中提供的伪代码
)
-
[
3. 实验内容
](
#3-实验内容
)
-
[
3. 实验内容
](
#3-实验内容
)
-
[
3.1 GVN pass 实现内容要求
](
#31-gvn-pass-实现内容要求
)
-
[
3.1 GVN pass 实现内容要求
](
#31-gvn-pass-实现内容要求
)
-
[
3.2 GVN 辅助类
](
#32-gvn-辅助类
)
-
[
3.2 GVN 辅助类
](
#32-gvn-辅助类
)
-
[
3.3 注册及运行 GVN Pass
](
#33-注册及运行-gvn-pass
)
-
[
3.3 注册及运行 GVN Pass
](
#33-注册及运行-gvn-pass
)
...
@@ -23,8 +29,11 @@
...
@@ -23,8 +29,11 @@
-
[
运行 Pass
](
#运行-pass
)
-
[
运行 Pass
](
#运行-pass
)
-
[
3.3 自动测试
](
#33-自动测试
)
-
[
3.3 自动测试
](
#33-自动测试
)
-
[
3.4 Tips
](
#34-tips
)
-
[
3.4 Tips
](
#34-tips
)
-
[
4. 提交要求
](
#4-提交要求
)
-
[
4. 提交要求
](
#4-提交要求
)
-
[
目录结构
](
#目录结构
)
-
[
目录结构
](
#目录结构
)
-
[
提交要求和评分标准
](
#提交要求和评分标准
)
-
[
提交要求和评分标准
](
#提交要求和评分标准
)
## 0. 前言
## 0. 前言
...
...
Reports/4.2-gvn/figures/index_set.png
0 → 100644
View file @
92ddf834
24.2 KB
Reports/4.2-gvn/figures/loop3.png
0 → 100644
View file @
92ddf834
150 KB
Reports/4.2-gvn/figures/value_phi_func.png
0 → 100644
View file @
92ddf834
93.1 KB
Reports/4.2-gvn/report.md
View file @
92ddf834
This diff is collapsed.
Click to expand it.
gvn.json
0 → 100644
View file @
92ddf834
[{
"function"
:
"main"
,
"pout"
:
{
"label_entry"
:
[[
"%op0"
,
],
[
"%op1"
,
],
[
"%op2"
,
"%op3"
,
],
],}},]
\ No newline at end of file
src/optimization/GVN.cpp
View file @
92ddf834
...
@@ -263,9 +263,7 @@ GVN::intersect(shared_ptr<CongruenceClass> ci, shared_ptr<CongruenceClass> cj) {
...
@@ -263,9 +263,7 @@ GVN::intersect(shared_ptr<CongruenceClass> ci, shared_ptr<CongruenceClass> cj) {
if
(
c
->
members_
.
size
())
// not empty
if
(
c
->
members_
.
size
())
// not empty
{
{
if
(
c
->
index_
==
0
)
{
if
(
c
->
index_
==
0
)
{
// it must be a phi instruction
// we should use the `index` int the previous block
// and be separated to 2 copy statement
// we should use the copy-stmt int the previous block
auto
instr
=
static_cast
<
Instruction
*>
(
*
c
->
members_
.
begin
());
auto
instr
=
static_cast
<
Instruction
*>
(
*
c
->
members_
.
begin
());
auto
instr_phi
=
dynamic_cast
<
PhiInst
*>
(
instr
);
auto
instr_phi
=
dynamic_cast
<
PhiInst
*>
(
instr
);
int
exact_idx
;
int
exact_idx
;
...
@@ -570,7 +568,6 @@ GVN::transferFunction(Instruction *instr, Value *e, partitions pin) {
...
@@ -570,7 +568,6 @@ GVN::transferFunction(Instruction *instr, Value *e, partitions pin) {
}
}
// TODO: get different ValueExpr by Instruction::OpID, modify pout
// TODO: get different ValueExpr by Instruction::OpID, modify pout
// ??
// get ve and vpf
// get ve and vpf
shared_ptr
<
Expression
>
ve
;
shared_ptr
<
Expression
>
ve
;
if
(
e
)
{
if
(
e
)
{
...
...
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