Beruflich Dokumente
Kultur Dokumente
Lecture 5: Superblocks
"
#$% &
"
'()
*( &
+ 2 $3
10
, ! 0
-
- 4
3 5 BB1
. " & 90 80 20
/ ! 0 . 6 BB2 BB3
. . 6
80 20
1 BB4
10
COS 598C - Advanced Compilers Prof. David August COS 598C - Advanced Compilers Prof. David August
Linearizing a Trace Intelligent Trace Layout for I-Cache Performance
10 (entry count)
BB1 Intraprocedural code placement
BB1 Procedure positioning trace1
20 (side exit) Procedure splitting
80 BB2
COS 598C - Advanced Compilers Prof. David August COS 598C - Advanced Compilers Prof. David August
10 i = 0;
mark all BBs unvisited
2
BB1 while (there are unvisited nodes) do
3 < = 90 80 seed = unvisited BB with largest execution freq
20
> - trace[i] += seed
BB2 BB3 mark seed visited
/$ ) $ current = seed
80 20
8 ! $ /* Grow trace forward */
8 ! $ BB4 while (1) do
10 next = best_successor_of(current)
$ if (next == 0) then break
*((7 " & BB5 90 trace[i] += next
$ 10 mark next visited
current = next
2 " & BB6 endwhile
3 /* Grow trace backward analogously */
3 i++
10
endwhile
COS 598C - Advanced Compilers Prof. David August COS 598C - Advanced Compilers Prof. David August
Best Successor/Predecessor Class Problem 1
> 9 :
best_successor_of(BB)
e = control flow edge with highest 100
probability leaving BB Find the traces. Assume
2 . /31 a threshold probability BB1
if (e is a backedge) then
20
$ return 0 of 60%. 80
endif BB2 BB3
if (probability(e) <= THRESHOLD) then
?($@(7 return 0 80
20
> endif BB4
d = destination of e 51 49
*
if (d is visited) then
9 return 0 BB5 BB3
10
endif 41
return d 49
8 endprocedure 450 BB6 BB6
" *(( 41
& 10
BB6
COS 598C - Advanced Compilers ! Prof. David August COS 598C - Advanced Compilers " Prof. David August
2
100
2 10
BB1 Find the traces. Assume )
60 40 a threshold probability of 60%. BB1
,
90 80 20
BB2 BB3 A
. BB2 BB3
50 10 5 135 100
80 20
BB4 BB5 BB6 .
25 BB4
15 35 10
.
BB7 BB5 90
25
75 2 10
BB6
BB8
100
10
COS 598C - Advanced Compilers # Prof. David August COS 598C - Advanced Compilers Prof. David August
Region Type 2 – Superblock Tail Duplication
. $3 2
10 4 5 10
0
BB1 , BB1
90 80 20 90 80 20
4
3 5 BB2 BB3 BB2 BB3
" & 80 20 80 20
2 BB4 BB4
. 10 10
. 8 < B $*
BB5 90 BB5 90
*:2
10 10
B:
BB6 C BB6
10 10
COS 598C - Advanced Compilers Prof. David August COS 598C - Advanced Compilers Prof. David August
10 10
10 .
7.2 7.2
2.8 25.2 2.8 25.2
10
COS 598C - Advanced Compilers Prof. David August COS 598C - Advanced Compilers Prof. David August
Class Problem 3
100
BB1
20 80 Create the superblocks, trace
threshold is 60%
BB2 BB3
20 80
BB4
51 49
BB5 BB6
10
41
49
450 BB7 BB8
41
10
BB9