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
ed8637b8
Commit
ed8637b8
authored
Dec 28, 2011
by
Jayke Meijer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on copy propagation.
parent
7b0de9af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
src/optimize/__init__.py
src/optimize/__init__.py
+2
-2
src/optimize/advanced.py
src/optimize/advanced.py
+13
-2
No files found.
src/optimize/__init__.py
View file @
ed8637b8
from
src.
dataflow
import
find_basic_blocks
from
dataflow
import
find_basic_blocks
from
standard
import
redundant_move_1
,
redundant_move_2
,
\
from
standard
import
redundant_move_1
,
redundant_move_2
,
\
redundant_move_3
,
redundant_move_4
,
redundant_load
,
\
redundant_move_3
,
redundant_move_4
,
redundant_load
,
\
...
@@ -57,7 +57,7 @@ def optimize_block(block):
...
@@ -57,7 +57,7 @@ def optimize_block(block):
# or fold_constants(block)
# or fold_constants(block)
while
eliminate_common_subexpressions
(
block
)
\
while
eliminate_common_subexpressions
(
block
)
\
|
fold_constants
(
block
):
|
fold_constants
(
block
)
|
copy_propagation
(
block
)
:
pass
pass
def
optimize
(
statements
,
verbose
=
0
):
def
optimize
(
statements
,
verbose
=
0
):
...
...
src/optimize/advanced.py
View file @
ed8637b8
from
s
rc.s
tatement
import
Statement
as
S
from
statement
import
Statement
as
S
def
eliminate_common_subexpressions
(
block
):
def
eliminate_common_subexpressions
(
block
):
...
@@ -55,9 +55,20 @@ def fold_constants(block):
...
@@ -55,9 +55,20 @@ def fold_constants(block):
"""
"""
return
False
return
False
def
copy_propagtion
(
block
):
def
copy_propag
a
tion
(
block
):
"""
"""
Rename values that were copied to there original, so the copy statement
Rename values that were copied to there original, so the copy statement
might be useless, allowing it to be removed by dead code elimination.
might be useless, allowing it to be removed by dead code elimination.
"""
"""
moves
=
[]
count
=
0
while
not
block
.
end
():
s
=
block
.
read
()
if
s
.
is_command
(
'move'
):
moves
.
append
((
s
[
0
],
s
[
1
]))
count
+=
1
print
"count"
,
count
return
false
return
false
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