









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










mov d0, mov d1, add d0,d
mov eax, mov eax, add eax,eax
(^) Problem: (^) IR contains an unbounded number of temporaries. Actual machine has bounded number of registers. (^) Approach: (^) Temporaries with disjoint live ranges (where their values are needed) can map to same register. (^) If not enough registers then spill some temporaries. (^) [i.e., keep them in memory]
(^) Liveness Analysis = determining when variables/registers hold values that may still be needed.
(^) Nodes may be individual program statements or basic blocks. (^) Edges represent potential flow of control.
a = 0 b = a + 1 c = c + b a = b * 2 a < N return c
a = 0 b = a + 1 c = c + b a = b * 2 a < N return c
a = 0 b = a + 1 c = c + b a = b * 2 a < N return c a b c Docsity.com
(^) assignments define a variable, v: def[v] set of graph nodes that define vdef[n] set of variables defined by node n (^) occurrences of v in expressions use it: use[v] = set of nodes that use vuse[n] = set of variables used in node n
(^) in[n]: variables live-in at n (^) out[n]: variables live-out at n
(^) out[n] = ∪ in[s] (^) s∈succ[n] (^) for a single node successor, succ[n] = {} => out[n] = {}
(^) in[n] ⊇ use[n] (^) in[n] ⊇ out[n] - def[n]
(^) Liveness flows backward along control-flow arcs, from out to in.
Liveness Algorithm Complexity 1/
(^) There is often more than one solution for a given dataflow problem (see example in text). (^) Any solution to dataflow equations is a conservative approximation: v has some later use downstream from n, (^) => v ∈ out(n) (^) but not the converse