Commit 56a04b33 authored by Jayke Meijer's avatar Jayke Meijer

Added unittest for completing coverage of copyprop.

parent 2473f617
...@@ -50,6 +50,20 @@ class TestOptimizeAdvanced(unittest.TestCase): ...@@ -50,6 +50,20 @@ class TestOptimizeAdvanced(unittest.TestCase):
S('command', 'addu', '$3', '$2', '$4'), S('command', 'addu', '$3', '$2', '$4'),
self.bar]) self.bar])
def test_copy_propagation_other_arg(self):
block = B([self.foo,
S('command', 'move', '$1', '$2'),
self.foo,
S('command', 'addu', '$3', '$4', '$1'),
self.bar])
self.assertTrue(copy_propagation(block))
self.assertEqual(block.statements, [self.foo,
S('command', 'move', '$1', '$2'),
self.foo,
S('command', 'addu', '$3', '$4', '$2'),
self.bar])
def test_copy_propagation_overwrite(self): def test_copy_propagation_overwrite(self):
block = B([self.foo, \ block = B([self.foo, \
S('command', 'move', '$1', '$2'), S('command', 'move', '$1', '$2'),
...@@ -169,7 +183,8 @@ class TestOptimizeAdvanced(unittest.TestCase): ...@@ -169,7 +183,8 @@ class TestOptimizeAdvanced(unittest.TestCase):
def test_algebraic_transforms_mult3(self): def test_algebraic_transforms_mult3(self):
arguments = [self.foo, arguments = [self.foo,
S('command', 'mult', '$1', '$2', 3), S('command', 'mult', '$2', 3),
S('command', 'mflo', '$1'),
self.bar] self.bar]
block = B(arguments) block = B(arguments)
......
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