-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmodule121.tex
More file actions
316 lines (295 loc) · 10.3 KB
/
module121.tex
File metadata and controls
316 lines (295 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
\section{Composing Transfer Functions}
\FloatBarrier
\begin{flushright}
\textit{Scribed by Arpit Saxena}
\end{flushright}
\begin{figure}[H]
\centering
\subfloat[\label{fig:m121:fig1:a}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {f\textsubscript{1}};
\node[box](b2) {f\textsubscript{2}};
\coordinate[on chain] (end);
\node[draw,fit=(b1) (b2)](summary) {};
\node[below right] at (summary.south) {f\textsubscript{summary}};
\path[]
(begin) edge (b1)
(b1) edge (b2)
(b2) edge (end);
\end{tikzpicture}
}}
\subfloat[\label{fig:m121:fig1:b}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box, inner ysep=2mm](b1) {};
\node[box, below left=of b1](b2) {f\textsubscript{1}};
\node[box, below right=of b1](b3) {f\textsubscript{2}};
\node[box, below=of b1, below left=of b3, inner ysep=2mm](b4) {};
\coordinate[on chain] (end) {};
\path[]
(begin) edge (b1)
(b1) edge (b2)
(b1) edge (b3)
(b2) edge (b4)
(b3) edge (b4)
(b4) edge (end);
\node[draw, fit=(b1)(b2)(b3)(b4)](summary) {};
\node[below right] at (summary.south) {f\textsubscript{summary}};
\end{tikzpicture}
}}
\subfloat[\label{fig:m121:fig1:c}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {f};
\coordinate[on chain] (end) {};
\path[]
(begin) edge (b1)
(b1) edge (end);
\draw (b1.230) -| coordinate (l1) ++ (0.6,-0.3) -| coordinate (l2) ([xshift=5mm]b1.east) |-
coordinate (l3) ([yshift=5mm]b1.50) -- coordinate (l4) (b1.50);
\node[draw, fit=(b1) (l1) (l2) (l3) (l4)](summary) {};
\node[below right] at (summary.south) {f\textsubscript{summary}};
\end{tikzpicture}
}}
\caption{}
\end{figure}
\begin{itemize}
\item The summary functions for larger regions are based on the transfer
functions of the smaller sub-regions.
\item The summary functions may involve sophisticated symbolic analysis.
\item The fallback summary transfer functions can be described using
composition, meet, and closure operators on transfer functions (for
reducible graphs).
The loops can be captures by the structure that there is a loop body and a
back edge, the value for it is being captured by the closure. Closure
means to repeat f one or more times, potentially unbounded.
\item More sophisticated summary transfer functions can often be described
using composition, meet, and closure operations on transfer functions.
\end{itemize}
\subsection{Transfer Function Operations}
\begin{figure}[H]
\centering
\subfloat[\centering Composition \label{fig:m121:fig2:a}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {f\textsubscript{1}};
\node[box](b2) {f\textsubscript{2}};
\coordinate[on chain] (end);
\node[draw,fit=(b1) (b2)](summary) {};
\node[right] at (summary.east) {$f_1 \circ f_2$};
\path[]
(begin) edge (b1)
(b1) edge (b2)
(b2) edge (end);
\end{tikzpicture}
}}
\subfloat[\centering Meet\label{fig:m121:fig2:b}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\coordinate[on chain] (dummy);
\node[box, below left=of dummy](b2) {f\textsubscript{1}};
\node[box, below right=of dummy](b3) {f\textsubscript{2}};
\coordinate[on chain, below=of dummy, below left=of b3] (end) {};
\path[]
(begin) edge[-] (dummy)
(dummy) edge (b2)
(dummy) edge (b3)
(b2) edge (end)
(b3) edge (end);
\node[draw, fit=(dummy)(b2)(b3)](summary) {};
\node[right] at (summary.east) {$f_1 \wedge f_2$};
\end{tikzpicture}
}}
\subfloat[\centering Closure\label{fig:m121:fig2:c}] {{
\tt
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {f};
\coordinate[on chain] (end) {};
\path[]
(begin) edge (b1)
(b1) edge (end);
\draw (b1.230) -| coordinate (l1) ++ (0.6,-0.3) -| coordinate (l2) ([xshift=5mm]b1.east) |-
coordinate (l3) ([yshift=5mm]b1.50) -- coordinate (l4) (b1.50);
\node[draw, fit=(b1) (l1) (l2) (l3) (l4)](summary) {};
\node[right] at (summary.east) {f*};
\end{tikzpicture}
}}
\caption{}
\end{figure}
\subsubsection{Example: Constant Propagation}
\begin{minipage}{0.4\textwidth}
\tt
\captionsetup{type=figure}
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {x = 2};
\node[box](b2) {y = 3};
\coordinate[on chain] (end);
\path[]
(begin) edge (b1)
(b1) edge (b2)
(b2) edge (end);
\end{tikzpicture}
\captionof{figure}{Constant Propagation: Composition}
\label{fig:m121:const_prop_composition}
\end{minipage}
\hfill
\begin{minipage}{0.5\textwidth}
\begin{lstlisting}
f1(in) {
in $\cup$ {(x:2)}
}
f2(in) {
in $\cup$ {(y:3)}
}
f1 $\circ$ f2(in) {
in $\cup$ {(x:2), (y:3)}
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.4\textwidth}
\tt
\captionsetup[]{type=figure}
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center, inner xsep=4 mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\node[on chain, inner xsep=5mm] (begin) {~};
\node[box, below left=of begin](b2) {x = 2 \\ y = 3};
\node[box, below right=of begin](b3) {y = 2 \\ x = 3};
\node[on chain, below=of begin, below left=of b3, inner xsep=5mm] (end) {~};
\path[]
(begin) edge (b2)
(begin) edge (b3)
(b2) edge (end)
(b3) edge (end);
\end{tikzpicture}
\captionof{figure}{Constant Propagation: Meet}
\label{fig:m121:const_prop_meet}
\end{minipage}
\hfill
\begin{minipage}{0.5\textwidth}
\begin{lstlisting}
f1(in) {
in $\cup$ {(x,2), (y,3)}
}
f2(in) {
in $\cup$ {(y,2), (x,3)}
}
f1 $\wedge$ f2 (in) {
f1(in) $\wedge$ f2(in)
}
\end{lstlisting}
\end{minipage}
\subsubsection{Example: Available Expressions}
\begin{minipage}{0.4\textwidth}
\tt
\captionsetup{type=figure}
\begin{tikzpicture}[->,
node distance = 12mm,
start chain = going below,
box/.style = {draw,rounded corners,fill=white,
on chain,align=center,inner xsep=8mm},
unbox/.style = {on chain,align=center},
edge/.style = {midway}]
\coordinate[on chain] (begin);
\node[box](b1) {f};
\coordinate[on chain] (end) {};
\path[]
(begin) edge (b1)
(b1) edge (end);
\draw (b1.230) -| coordinate (l1) ++ (0.6,-0.3) -| coordinate (l2) ([xshift=5mm]b1.east) |-
coordinate (l3) ([yshift=5mm]b1.50) -- coordinate (l4) (b1.50);
\end{tikzpicture}
\captionof{figure}{Available Expressions}
\begin{lstlisting}
while x != n:
x = x + 1
\end{lstlisting}
\end{minipage}
\hfill
\begin{minipage}{0.5\textwidth}
\begin{lstlisting}
f(in) {
if in[x] != n
in{x $\leftarrow$ in[x] + 1}
// Updation on in
else
in
}
\end{lstlisting}
Fallback Closure:
\begin{lstlisting}
f* (in) {
in {x $\leftarrow \bot$}
}
\end{lstlisting}
Symbolic Closure:
\begin{lstlisting}
f* (in) {
in {x $\leftarrow$ max(in(x), n)}
}
\end{lstlisting}
\end{minipage}
\subsection{Composing GEN/KILL Transfers}
Consider the example of reaching definitions.
\begin{lstlisting}
f1(in) = gen1 $\cup$ (in - kill1)
f2(in) = gen2 $\cup$ (in - kill2)
f1 $\circ$ f2(in) = gen2 $\cup$ ((gen1 $\cup$ (in - kill1)) - kill2)
f1 $\wedge$ f2(in) = gen1 $\cup$ (in - kill1) $\cup$ gen2 $\cup$ (in - kill2)
f1* (in) = gen1 $\cup$ (in - kill2)
\end{lstlisting}
For closure, notice that \texttt{f1(f1(x)) = f1(x)}