Commit 22ec8037 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed liveness in- and out set generation.

parent 1120fc8f
......@@ -66,29 +66,30 @@ def create_in_out(blocks):
for b in blocks:
create_use_def(b)
b.live_in = b.use_set
b.live_in = set()
b.live_out = set()
change = True
while change:
change = False
# Start by analyzing the exit points
work_list = set()
for b in blocks:
if b.edges_from and not b.edges_to:
work_list.add(b)
while len(work_list):
b = work_list.pop()
# in[B] = use[B] | (out[B] - def[B])
new_in = b.use_set | (b.live_out - b.def_set)
# out[B] = union of in[S] for S in succ(B)
new_out = set()
b.live_out = set()
for s in succ(b):
new_out |= s.live_in
b.live_out |= s.live_in
# Check if either `in' or `out' changed
# Check if the out set has changed. If so, add all predecessors to the
# work list
if new_in != b.live_in:
b.live_in = new_in
change = True
if new_out != b.live_out:
b.live_out = new_out
change = True
work_list |= set(b.edges_from)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment