Skip to content
Snippets Groups Projects
Commit 5b6e6336 authored by Taddeus Kroes's avatar Taddeus Kroes
Browse files

Fixed recursiveness bug in liveness analysis.

parent 9d97e660
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment