Commit 5b6e6336 authored by Taddeus Kroes's avatar Taddeus Kroes

Fixed recursiveness bug in liveness analysis.

parent 9d97e660
......@@ -29,13 +29,14 @@ def create_use_def(block):
def succ(block, known=[]):
"""Recursively find all successors of a node."""
direct = filter(lambda b: b not in known, block.edges_to)
p = copy(direct)
direct = filter(lambda b: b != block and b not in known, block.edges_to)
s = copy(direct)
for successor in direct:
p += succ(successor, direct)
s += succ(successor, known + direct)
return s
return p
return s
def create_in_out(blocks):
......
......@@ -43,6 +43,7 @@ def optimize(statements, verbose=0):
"""Optimization wrapper function, calls global and basic-block level
optimization functions."""
# Optimize on a global level
# TODO: only count instructions (no directives)
o = len(statements)
remove_redundant_jumps(statements)
g = len(statements)
......
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