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
9b5cb148
Commit
9b5cb148
authored
Nov 29, 2022
by
张栋澈
🤡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Lab4.2] Update json cases & doc about transfer function
parent
98881a1f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
9 deletions
+5
-9
Documentations/4.2-gvn/README.md
Documentations/4.2-gvn/README.md
+5
-3
tests/4-ir-opt/testcases/GVN/functional/loop3.json
tests/4-ir-opt/testcases/GVN/functional/loop3.json
+0
-3
tests/4-ir-opt/testcases/GVN/functional/pure_func.json
tests/4-ir-opt/testcases/GVN/functional/pure_func.json
+0
-3
No files found.
Documentations/4.2-gvn/README.md
View file @
9b5cb148
...
@@ -223,9 +223,11 @@ Intersect(Ci, Cj)
...
@@ -223,9 +223,11 @@ Intersect(Ci, Cj)
return Ck
return Ck
```
```
`TransferFunction`
接受一个赋值语句 x=e(x是变量,e为表达式),与一个 partition $
`PIN_s`
$ 。其中
getVN 从一个 partition 中根据 e 来找到对应的编号。
`TransferFunction`
接受一个赋值语句 x=e(x是变量,e为表达式),与一个 partition $
`PIN_s`
$ 。其中
valueExpr 接受一个 expression 返回其对应的 value expression,由于 value expression 是由变量和操作符以及value expression 递归定义的,因此需要建立 e 中的操作数变量与其对应的 value expression 关联,在伪代码的基础上,需要为 valueExpr 函数添加 partition $
`PIN_s`
$ 作为参数。而 getVN 从一个 partition 中根据 e 来找到对应的编号。
注: 在 lightir 的设计中,普通语句的 x 与 e 存在同一个类中,而 phi 语句中需要经转换为 copy 语句,x 与 e 与普通语句会有一些不同,需要仔细思考区分一下。
**注1**
: 在 lightir 的设计中,普通语句的 x 与 e 存在同一个 Instruction 类中,参考
[
lightir核心类
](
),Instruction
本身可以视作为 x,而通过 Instruction 成员运算符,和成员操作数可以抽象的组成 expression e。
**注2**
: phi 语句中需要经转换为 copy 语句,x 与 e 将不存在同一个 Instruction 中,请仔细思考区分一下。
```
clike
```
clike
TransferFunction(x = e, PINs)
TransferFunction(x = e, PINs)
...
@@ -265,7 +267,7 @@ valuePhiFunc(ve,P)
...
@@ -265,7 +267,7 @@ valuePhiFunc(ve,P)
GVN 通过数据流分析来检测冗余的变量和计算,通过替换和死代码删除结合,实现优化效果。前述的例子中主要以二元运算语句来解释原理,且助教为大家提供了代码替换和删除的逻辑,除此之外,需要完成的方向有:
GVN 通过数据流分析来检测冗余的变量和计算,通过替换和死代码删除结合,实现优化效果。前述的例子中主要以二元运算语句来解释原理,且助教为大家提供了代码替换和删除的逻辑,除此之外,需要完成的方向有:
1.
对冗余指令的检测与消除包括(二元运算指令,cmp,gep,类型转换指令)
1.
对冗余指令的检测与消除包括(二元运算指令,cmp,gep,类型转换指令)
2.
对纯函数的冗余调用消除(助教提供了纯函数分析,见
[
FuncInfo.h
](
../../include/optimization/FuncInfo.h
)
)
2.
对纯函数的冗余调用消除(助教提供了纯函数分析,见
[
FuncInfo.h
](
../../include/optimization/FuncInfo.h
)
)
...
...
tests/4-ir-opt/testcases/GVN/functional/loop3.json
View file @
9b5cb148
...
@@ -4,13 +4,11 @@
...
@@ -4,13 +4,11 @@
"pout"
:
{
"pout"
:
{
"label_entry"
:
[
"label_entry"
:
[
[
[
0
,
"%op3"
,
"%op3"
,
"%op2"
,
"%op2"
,
"%op1"
,
"%op1"
,
],
],
[
[
1
,
"%op7"
,
"%op7"
,
],
],
],
],
...
@@ -67,7 +65,6 @@
...
@@ -67,7 +65,6 @@
"%op18"
,
"%op18"
,
],
],
[
[
1
,
"%op19"
,
"%op19"
,
],
],
],
],
...
...
tests/4-ir-opt/testcases/GVN/functional/pure_func.json
View file @
9b5cb148
...
@@ -91,7 +91,6 @@
...
@@ -91,7 +91,6 @@
],
],
[
[
"%op4"
,
"%op4"
,
0
,
],
],
],
],
"label3"
:
[
"label3"
:
[
...
@@ -262,7 +261,6 @@
...
@@ -262,7 +261,6 @@
"%op0"
,
"%op0"
,
],
],
[
[
0
,
"%op6"
,
"%op6"
,
],
],
[
[
...
@@ -362,7 +360,6 @@
...
@@ -362,7 +360,6 @@
"%op9"
,
"%op9"
,
],
],
[
[
0
,
"%op31"
,
"%op31"
,
],
],
],
],
...
...
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