Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select...
Transcript of Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select...
![Page 1: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/1.jpg)
1
1
Exercise 1
2
Def-clear path (another example)
Q1: Find def-clear paths for defs and uses of x and z.Q2: Which definitions are live at node 4?
>
<
![Page 2: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/2.jpg)
2
3
Def-clear Path
Variable x:
d1(x) and u2(x): 1->2d1(x) and u5(x): 1->2->5 or 1->2->5->6->2->5d1(x) and u6(x): 1->2->3->6
1->2->3->4->61->2->5>6
Variable z:
d1(z) and u4(z): 1->2->3->4d1(z) and u6(z): 1->2->3->6d4(z) and u6(z): 4->6d5(z) and u6(z): 5->6d4(z) and u4(z): 4->6->2->3->4d5(z) and u4(z): 5->6->2->3->4d4(z) and u7(z): 4->6->7 or 4->6->2->3->6->7d5(z) and u7(z): 5->6->7d1(z) and u7(z): 1->2->3->6->7
If loops are considered, there can be more def-clear paths.
4
![Page 3: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/3.jpg)
3
5
6
![Page 4: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/4.jpg)
4
7
8
![Page 5: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/5.jpg)
5
9
10
![Page 6: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/6.jpg)
6
11
12
![Page 7: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/7.jpg)
7
13
14
![Page 8: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/8.jpg)
8
15
16
![Page 9: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/9.jpg)
9
17
18
![Page 10: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/10.jpg)
10
19
Exercise 2
20
Def-use pairs (example)
Variable z: (5, 4)Variable count: (1, (6,2)), and (1, (6,7)) are infeasible.
![Page 11: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/11.jpg)
11
21
22
![Page 12: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/12.jpg)
12
23
24
![Page 13: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/13.jpg)
13
25
26
![Page 14: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/14.jpg)
14
27
28
![Page 15: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/15.jpg)
15
29
Exercise 3
30
Def-use pairs: Minimal set (2)
What will be also covered if we have a test case which covers (d1(z), u4(z))?
How about (d4(z), u4(z))?
![Page 16: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/16.jpg)
16
31
(d1(z), u4(z))
1->2->3->4->6->7
32
(d1(z), u4(z))
1->2->3->6->2->3->4->6->7
![Page 17: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/17.jpg)
17
33
Select an execution path that covers the specific def-use pairIdentify all the def-use pairs in the selected path
For each recognized def-use pair (di(x), uj(x))
Try to find a path from node I to node j that is not def-clear path for variable xIf so, remove the def-use pair (di(x), uj(x))If not, keep it
34
Consider execution path 1->2->3->4->6->7, its covered def-use pairs are
Variable x: (1, (2, 3)) (1, 6)
Variable y: (1, 4) (1, 6) (1, (3, 4))
Variable z: (1, 4) (4, 6) (4, 7)
Variable count: (1, 6) (6, (6, 7))
Def-use pairs for variable y, (1, 4) and (1, (3, 4)) can be removed because variable y is re-defined at node 6 in an alternative execution path 1->2->3->6->2->3->4->6->7
![Page 18: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/18.jpg)
18
35
Exercise 4
36
C-use coverage
![Page 19: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/19.jpg)
19
37
C-use coverage: path traversed
Path (Start, .. q, k, .., z, .. End) covers the c-use at node z of x defined at node q given that (k …, z) is def clear with respect to x
c-use of x
Exercise: Find the c-use coverage when program P14.16 (refer to slide 101) is executed against the following test:
t1: <x=5, y=-1, count=1>
38
![Page 20: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/20.jpg)
20
39
covered def-c-use pairs with respect to t1
Variable x: (1, 5) (1, 6)
Variable y: (1, 6)Variable z: (5, 6) (5, 7)Variable count: (1, 6)
40
Exercise 5
![Page 21: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/21.jpg)
21
41
p-use coverage
42
p-use coverage: paths traversed
Exercise: Find the p-use coverage when program P14.16 (refer to slide 101) is executed against test t2: <x= -2, y= -1, count= 3>
![Page 22: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/22.jpg)
22
43
44
![Page 23: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/23.jpg)
23
45
46
covered def-p-use pairs with respect to t2
Variable x: (1, (2, 3))
Variable y: (1, (3, 6)) (6, (3, 4)) (6, (3, 6))
Variable count: (6, (6, 2)) (6, (6, 7))
![Page 24: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/24.jpg)
24
47
Exercise 6
48
All-uses coverage
Exercise: Is T={t1, t2} adequate w.r.t. to all-uses coverage for P14.16?
![Page 25: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/25.jpg)
25
49
covered def-use pairs with respect to t1Variable x: (1, 5) (1, 6) (1, (2, 5))Variable y: (1, 6)Variable z: (5, 6) (5, 7)Variable count: (1, 6) (6, (6, 7))
50
covered def-use pairs with respect to t2Variable x: (1, 6)
(1, (2, 3))
Variable y: (1, 6) (6, 4) (6, 6)(1, (3, 6)) (6, (3, 4)) (6, (3, 6))
Variable z: (1, 4) (1, 6) (4, 6) (4, 7)
Variable count: (1, 6) (6, 6) (6, (6, 2)) (6, (6, 7))
![Page 26: Exercise 1 - University of Texas at Dallasewong/SE6367/03-Lecture/12-Dataflow-answer.pdf17 33 Select an execution path that covers the specific def-use pair Identify all the def-use](https://reader034.fdocuments.us/reader034/viewer/2022042416/5f31b2d6a66d8013e066776e/html5/thumbnails/26.jpg)
26
51
No, four def-use pairs are not covered with respect to t1 and t2, i.e.,
Variable y: (1, 4) and (1, (3, 4))Variable z: (1, 7) and (4, 4)
In addition, there are three infeasible def-use pairs. That is,
Variable z: (5, 4)Variable count: (1, (6, 2)) (1, (6, 7))
All use coverage is 20
0 83327 3
.=−