complement in 11.13
This commit is contained in:
34
notes/8.md
34
notes/8.md
@@ -64,4 +64,36 @@ Analysis of Reaching Definition
|
|||||||
|
|
||||||
Effect of an Instruction
|
Effect of an Instruction
|
||||||
|
|
||||||
`IN[b]` and `OUT[b]`
|
`IN[b]` and `OUT[b]`
|
||||||
|
|
||||||
|
Meet Operator
|
||||||
|
|
||||||
|
`IN[b] = union(OUT[p1]...OUT[pn])`
|
||||||
|
|
||||||
|
```c
|
||||||
|
// init
|
||||||
|
OUT[entry] = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
## Liveness Analysis
|
||||||
|
|
||||||
|
Liveness is the concept the variable is used in the future. It helps **eliminating dead code**.
|
||||||
|
|
||||||
|
Transfer function
|
||||||
|
|
||||||
|
* `USE[b]` set of variables used in `b`
|
||||||
|
* `DEF[b]` set of variables defined in `b`
|
||||||
|
|
||||||
|
so transfer function `f_b` for a basic block b:
|
||||||
|
```IN[b] = USE[b] + (OUT[b] - DEF[b])```
|
||||||
|
|
||||||
|
for reaching defintion
|
||||||
|
|
||||||
|
```OUT[b] = union(INs)```
|
||||||
|
|
||||||
|
For supporting cyclic graphs, repeated computation is needed.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
28
notes/9.md
Normal file
28
notes/9.md
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Control Flow Analysis
|
||||||
|
|
||||||
|
Dominator
|
||||||
|
|
||||||
|
for a given CFG **a node `x` dominates a node `y`** if every path from the Entry block to `y` contains `x`.
|
||||||
|
|
||||||
|
* Each BB dominates itself
|
||||||
|
* If `x dom y` and `y dom z` then `x dom z`
|
||||||
|
* If `x dom z` and `y dom z` then either `x dom y` or `y dom x`
|
||||||
|
|
||||||
|
Dominator Tree
|
||||||
|
* initial node is a root
|
||||||
|
* `x dom y` means that "`y` is a child of `x`"
|
||||||
|
|
||||||
|
|
||||||
|
Natural Loops
|
||||||
|
|
||||||
|
How to Find Natural Loop?: Introduction Backedge
|
||||||
|
|
||||||
|
Important concepts in a loop
|
||||||
|
* Header and Loop BB
|
||||||
|
* Back Edges
|
||||||
|
* Exit Edges
|
||||||
|
* Preheader (Preloop)
|
||||||
|
|
||||||
|
Loop-Invariant Computation
|
||||||
|
|
||||||
|
|
||||||
BIN
pdf/L9.pdf
Normal file
BIN
pdf/L9.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user