Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
peephole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
peephole
Commits
6ceb955b
Commit
6ceb955b
authored
Dec 31, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unit tests.
parent
25ca44c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
tests/test_optimize_advanced.py
tests/test_optimize_advanced.py
+22
-5
No files found.
tests/test_optimize_advanced.py
View file @
6ceb955b
...
...
@@ -2,10 +2,13 @@ import unittest
from
copy
import
copy
from
src.optimize_advanced
import
eliminate_common_subexpressions
,
\
fold_constants
,
propagate_copies
propagate_copies
from
src.statement
import
Statement
as
S
from
src.dataflow
import
BasicBlock
as
B
,
generate_flow_graph
from
src.dataflow
import
BasicBlock
as
B
,
find_basic_blocks
,
\
generate_flow_graph
import
src.liveness
as
liveness
import
src.reaching_definitions
as
reaching_definitions
import
src.copy_propagation
as
copy_propagation
class
TestOptimizeAdvanced
(
unittest
.
TestCase
):
...
...
@@ -37,9 +40,6 @@ class TestOptimizeAdvanced(unittest.TestCase):
eliminate_common_subexpressions
(
b
)
self
.
assertEqual
(
b
.
statements
,
e
)
def
test_fold_constants
(
self
):
pass
#def test_propagate_copies_true(self):
# block = B([self.foo,
# S('command', 'move', '$1', '$2'),
...
...
@@ -61,6 +61,11 @@ class TestOptimizeAdvanced(unittest.TestCase):
S
(
'command'
,
'addu'
,
'$3'
,
'$4'
,
'$1'
),
self
.
bar
])
find_basic_blocks
([
block
])
generate_flow_graph
([
block
])
reaching_definitions
.
create_in_out
([
block
])
copy_propagation
.
create_in_out
([
block
])
self
.
assertTrue
(
propagate_copies
(
block
))
self
.
assertEqual
(
block
.
statements
,
[
self
.
foo
,
S
(
'command'
,
'move'
,
'$1'
,
'$2'
),
...
...
@@ -90,6 +95,12 @@ class TestOptimizeAdvanced(unittest.TestCase):
S
(
'command'
,
'addu'
,
'$3'
,
'$1'
,
'$4'
),
self
.
bar
]
block
=
B
(
arguments
)
find_basic_blocks
([
block
])
generate_flow_graph
([
block
])
reaching_definitions
.
create_in_out
([
block
])
copy_propagation
.
create_in_out
([
block
])
self
.
assertFalse
(
propagate_copies
(
block
))
self
.
assertEqual
(
block
.
statements
,
arguments
)
...
...
@@ -101,6 +112,12 @@ class TestOptimizeAdvanced(unittest.TestCase):
S
(
'command'
,
'addu'
,
'$3'
,
'$1'
,
'$4'
),
self
.
bar
]
block
=
B
(
arguments
)
find_basic_blocks
([
block
])
generate_flow_graph
([
block
])
reaching_definitions
.
create_in_out
([
block
])
copy_propagation
.
create_in_out
([
block
])
self
.
assertFalse
(
propagate_copies
(
block
))
self
.
assertEqual
(
block
.
statements
,
arguments
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment