Просмотр исходного кода

Merge branch 'master' of github.com:taddeus/peephole

Taddeus Kroes 14 лет назад
Родитель
Сommit
47e216c221
1 измененных файлов с 6 добавлено и 4 удалено
  1. 6 4
      src/statement.py

+ 6 - 4
src/statement.py

@@ -151,8 +151,10 @@ class Statement:
 
 
     def get_def(self):
     def get_def(self):
         """Get the variable that this statement defines, if any."""
         """Get the variable that this statement defines, if any."""
-        instr = ['move', 'addu', 'subu', 'li', 'mtc1', 'dmfc1', 'mov.d']
-
+        instr = ['move', 'addu', 'subu', 'li', 'dmfc1', 'mov.d']
+        
+        if self.is_command('mtc1'):
+            return [self[1]]
         if self.is_load_non_immediate() or self.is_arith() \
         if self.is_load_non_immediate() or self.is_arith() \
                 or self.is_logical() or self.is_double_arithmetic() \
                 or self.is_logical() or self.is_double_arithmetic() \
                 or self.is_move_from_spec() or self.is_double_unary() \
                 or self.is_move_from_spec() or self.is_double_unary() \
@@ -165,13 +167,13 @@ class Statement:
 
 
     def get_use(self):
     def get_use(self):
         """Get the variables that this statement uses, if any."""
         """Get the variables that this statement uses, if any."""
-        instr = ['addu', 'subu', 'mult', 'div', 'move', 'mtc1', 'mov.d', \
+        instr = ['addu', 'subu', 'mult', 'div', 'move', 'mov.d', \
             'dmfc1']
             'dmfc1']
         use = []
         use = []
 
 
         # Case arg0
         # Case arg0
         if self.is_branch() or self.is_store() or self.is_compare() \
         if self.is_branch() or self.is_store() or self.is_compare() \
-                or self.is_command(*['mult', 'div', 'dsz']):
+                or self.is_command(*['mult', 'div', 'dsz', 'mtc1']):
             if self.name == 'dsz':
             if self.name == 'dsz':
                 m = re.match('^[^(]+\(([^)]+)\)$', self[0])
                 m = re.match('^[^(]+\(([^)]+)\)$', self[0])