Commit 876d7a98 authored by Taddeus Kroes's avatar Taddeus Kroes

Did some debigging in DCE.

parent cf984639
...@@ -76,8 +76,10 @@ def generate_flow_graph(blocks): ...@@ -76,8 +76,10 @@ def generate_flow_graph(blocks):
if other[0].is_label(target): if other[0].is_label(target):
b.add_edge_to(other) b.add_edge_to(other)
# A branch instruction also creates an edge to the next block # A branch and jump-and-line instruction also creates an edge to
if last_statement.is_branch() and i < len(blocks) - 1: # the next block
if (last_statement.is_branch() or last_statement.name == 'jal') \
and i < len(blocks) - 1:
b.add_edge_to(blocks[i + 1]) b.add_edge_to(blocks[i + 1])
elif i < len(blocks) - 1: elif i < len(blocks) - 1:
b.add_edge_to(blocks[i + 1]) b.add_edge_to(blocks[i + 1])
from copy import copy from copy import copy
RESERVED_REGISTERS = ['$fp', '$sp'] RESERVED_REGISTERS = ['$fp', '$sp', '$31']
def is_reg_dead_after(reg, block, index): def is_reg_dead_after(reg, block, index):
......
...@@ -404,9 +404,9 @@ def eliminate_dead_code(block): ...@@ -404,9 +404,9 @@ def eliminate_dead_code(block):
if block.debug: if block.debug:
s.stype = 'comment' s.stype = 'comment'
s.options['block'] = False s.options['block'] = False
s.options[''] = False s.set_inline_comment(' dead register %s' % reg)
s.name = ' Dead:\t%s\t%s\t(dead register %s)' \ s.name = ' Dead:\t%s\t%s' \
% (s.name, ','.join(map(str, s)), reg) % (s.name, ','.join(map(str, s)))
else: else:
s.remove = True s.remove = True
......
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