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
c7080a74
Commit
c7080a74
authored
Dec 31, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved optimization files to src/ directory.
parent
4542b9c5
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
14 additions
and
14 deletions
+14
-14
src/optimize/__init__.py
src/optimize/__init__.py
+0
-0
src/optimize_advanced.py
src/optimize_advanced.py
+0
-0
src/optimize_redundancies.py
src/optimize_redundancies.py
+0
-0
src/program.py
src/program.py
+2
-2
tests/test_optimize.py
tests/test_optimize.py
+11
-11
tests/test_optimize_advanced.py
tests/test_optimize_advanced.py
+1
-1
No files found.
src/optimize/__init__.py
deleted
100644 → 0
View file @
4542b9c5
src/optimize
/
advanced.py
→
src/optimize
_
advanced.py
View file @
c7080a74
File moved
src/optimize
/
redundancies.py
→
src/optimize
_
redundancies.py
View file @
c7080a74
File moved
src/program.py
View file @
c7080a74
from
statement
import
Statement
as
S
,
Block
from
dataflow
import
find_basic_blocks
,
generate_flow_graph
from
optimize
.
redundancies
import
remove_redundant_jumps
,
remove_redundancies
,
\
from
optimize
_
redundancies
import
remove_redundant_jumps
,
remove_redundancies
,
\
remove_redundant_branch_jumps
from
optimize
.
advanced
import
eliminate_common_subexpressions
,
\
from
optimize
_
advanced
import
eliminate_common_subexpressions
,
\
fold_constants
,
propagate_copies
,
eliminate_dead_code
import
liveness
...
...
tests/test_optimize.py
View file @
c7080a74
import
unittest
from
src.optimize
.
redundancies
import
remove_redundancies
,
\
from
src.optimize
_
redundancies
import
remove_redundancies
,
\
remove_redundant_jumps
,
remove_redundant_branch_jumps
from
src.program
import
Program
from
src.statement
import
Statement
as
S
,
Block
as
B
...
...
@@ -12,7 +12,7 @@ def optimize_block(block):
# program.blocks = [block]
# del program.statements
# program.optimize_blocks()
remove_redundancies
(
block
)
...
...
@@ -173,7 +173,7 @@ class TestOptimize(unittest.TestCase):
self
.
assertEquals
(
block
.
statements
,
arguments
)
self
.
assertEquals
(
block2
.
statements
,
arguments2
)
self
.
assertEquals
(
block3
.
statements
,
arguments3
)
def
test_optimize_block_move_move_true
(
self
):
block
=
B
([
self
.
foo
,
S
(
'command'
,
'move'
,
'$regA'
,
'$regB'
),
...
...
@@ -194,30 +194,30 @@ class TestOptimize(unittest.TestCase):
remove_redundancies
(
block
)
self
.
assertEquals
(
block
.
statements
,
arguments
)
def
test_remove_redundant_jumps_true
(
self
):
block
=
B
([
self
.
foo
,
S
(
'command'
,
'j'
,
'$L1'
),
S
(
'label'
,
'$L1'
),
self
.
bar
])
remove_redundant_jumps
(
block
)
self
.
assertEqual
(
block
.
statements
,
[
self
.
foo
,
self
.
assertEqual
(
block
.
statements
,
[
self
.
foo
,
S
(
'label'
,
'$L1'
),
self
.
bar
])
def
test_remove_redundant_jumps_false
(
self
):
arguments
=
[
self
.
foo
,
S
(
'command'
,
'j'
,
'$L1'
),
S
(
'label'
,
'$L2'
),
self
.
bar
]
block
=
B
(
arguments
)
remove_redundant_jumps
(
block
)
self
.
assertEqual
(
block
.
statements
,
arguments
)
def
test_remove_redundant_branch_jumps_beq_j_true
(
self
):
block
=
B
([
self
.
foo
,
S
(
'command'
,
'beq'
,
'$regA'
,
'$regB'
,
'$Lx'
),
...
...
tests/test_optimize_advanced.py
View file @
c7080a74
import
unittest
from
copy
import
copy
from
src.optimize
.
advanced
import
eliminate_common_subexpressions
,
\
from
src.optimize
_
advanced
import
eliminate_common_subexpressions
,
\
fold_constants
,
propagate_copies
from
src.statement
import
Statement
as
S
from
src.dataflow
import
BasicBlock
as
B
,
generate_flow_graph
...
...
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