Ver código fonte

Did some debigging in DCE.

Taddeus Kroes 14 anos atrás
pai
commit
876d7a9802
3 arquivos alterados com 8 adições e 6 exclusões
  1. 4 2
      src/dataflow.py
  2. 1 1
      src/liveness.py
  3. 3 3
      src/optimize/advanced.py

+ 4 - 2
src/dataflow.py

@@ -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
-            if last_statement.is_branch() and i < len(blocks) - 1:
+            # A branch and jump-and-line instruction also creates an edge to
+            # 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])

+ 1 - 1
src/liveness.py

@@ -1,7 +1,7 @@
 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):

+ 3 - 3
src/optimize/advanced.py

@@ -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.name = ' Dead:\t%s\t%s\t(dead register %s)' \
-                            % (s.name, ','.join(map(str, s)), reg)
+                    s.set_inline_comment(' dead register %s' % reg)
+                    s.name = ' Dead:\t%s\t%s' \
+                            % (s.name, ','.join(map(str, s)))
                 else:
                 else:
                     s.remove = True
                     s.remove = True