Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
peephole
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Taddeüs Kroes
peephole
Commits
6ceb955b
Commit
6ceb955b
authored
13 years ago
by
Taddeus Kroes
Browse files
Options
Downloads
Patches
Plain Diff
Fixed unit tests.
parent
25ca44c0
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_optimize_advanced.py
+22
-5
22 additions, 5 deletions
tests/test_optimize_advanced.py
with
22 additions
and
5 deletions
tests/test_optimize_advanced.py
+
22
−
5
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment