





















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Mahlke; Class: Advanced Compilers; Subject: Electrical Engineering And Computer Science; University: University of Michigan - Ann Arbor; Term: Winter 2005;
Typology: Study notes
1 / 29
This page cannot be seen from the preview
Don't miss anything!






















1,2 reach^ 1,2 available^ 3:r4 = 4^ 4:r6 = 8 5:r6 = r2 + r36:r7 = r4 – r5^ 1,2,3,4 reach1 available 1,2 reach 1,2 available
1,3,4 reach 1,3,4 available
at a point p if along all
paths
from d to p, d is not killed Y Remember, a definition of a variable is killed
between 2
points when there is another definition of that variablealong the path^ »^ r1 = r2 + r3 kills previous definitions of r1 Y Algorithm^ »^ Forward dataflow analysis as propagation occurs from defsdownwards^ »^ Use the Intersect function as the meet operator to guarantee theall-path requirement^ »^ GEN/KILL/IN/OUT similar to reaching defs^ y^ Initialization of IN/OUT is the tricky part
U = universal set of all operations in the Procedure IN(0) = 0 OUT(0) = GEN(0) for each basic block in procedure, W, (W != 0), do^ IN(W) = 0^ OUT(W) = U – KILL(W) change = 1 while^ (change) do^ change = 0^ for^ each basic block in procedure, X, do^ old_OUT = OUT(X)^ IN(X) = Intersect(OUT(Y)) for all predecessors Y of X^ OUT(X) = GEN(X) + (IN(X) – KILL(X))^ if^ (old_OUT != OUT(X)) then^ change = 1^ endif^ endfor endfor
7: r7 = 0 8: r1 = r1 + 5 9: r7 = r1 - 6 10: r8 = r7 + r8 11: r1 = r3 – r8 12: r3 = r1 * 2
7: r7 = r3 * r4 8: r1 = r1 + 5 9: r7 = r1 - 6 10: r8 = r2 + 1 11: r1 = r3 * r4 12: r3 = r6 * r
mark n as visited y for each successor of n not yet visited, s, do^ X^ Visit (s) y postorder(n) = count y count += 1 » count = 1; Visit(entry) Y Backward analysis – PostDFS order » Visit a node only when all of its successors have been visited
= 2 predicates nevertrue at the same time » Superset^ = 1 predicate truemore often » Subset = 1 predicate true lessoften » Predicate query system
t = pclearx =p,q = cmpp.uc.un (a<b)t = cmpp.oc(a<b)x =^
if p x =^
if q r,s = cmpp.un.uc(c!=d)
if q t = cmpp.on(c!=d)
if q x =^
if s = y^
if r = x^
if t = x
p^ q^ r^ s^ t y e1 (^1 0 0 0 1) y e2 (^0 1 1 0 1) y e3 (^0 1 0 1 0) » Execution sets y P = {e1}, Q = {e2,e3}, R = {e2}, S= {e3}, T = {e1,e2}, 1 ={e1,e2,e3}
t = pclear x = p,q = cmpp.uc.un (a<b) t = cmpp.oc(a<b) x =^
if p x =^
if q r,s = cmpp.un.uc(c!=d)
if q t = cmpp.on(c!=d)
if q x =^
if s = y^
if r = x^
if t = x
p^ q r^ s t
u m n
symbol^ string
source 0 1 2 3 4 5 6 Predicate computations reordered to follow the paper p = !(a < b) * true q = (a < b) * true t1 = false t2 = t1 + !(a<b) * true t3 = t2 + (c != d) * q s = !(c != d) * q r = (c != d) * q
symbol^ string
source 0 false
false,t 1 true^
true 2 !(a<b)*
p,t 3 (a<b)*
q^
4 !(c=d)*
r 5 (c=d)*
s^
t3^ 6 = 2|
ÆN denoted tocome from same partition
p = (a<b) * true q = !(a<b) * true r = (c>d) * p s = !(c>d) * p u = (e!=5) * true v = !(e!=5) * true^1 p^ q^
u^ v r^ s