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
86b34864
Commit
86b34864
authored
Dec 31, 2011
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:taddeus/peephole
parents
d5d6df6b
8d613005
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
10 deletions
+4
-10
src/liveness.py
src/liveness.py
+1
-7
src/optimize/__init__.py
src/optimize/__init__.py
+3
-3
No files found.
src/liveness.py
View file @
86b34864
...
...
@@ -38,8 +38,7 @@ def is_reg_dead_after(reg, block, index, known_jump_targets=[]):
# If dead within the same block, check if the register is in the block's
# live_out set
#return reg not in RESERVED_OUT and reg not in block.live_out
return
reg
not
in
block
.
live_out
return
reg
not
in
RESERVED_OUT
and
reg
not
in
block
.
live_out
def
create_use_def
(
block
):
...
...
@@ -94,12 +93,10 @@ def create_in_out(blocks):
# Start by analyzing the exit points
work_list
=
set
()
exit_points
=
[]
for
b
in
blocks
:
if
b
.
edges_from
and
not
b
.
edges_to
:
work_list
.
add
(
b
)
exit_points
.
append
(
b
)
while
len
(
work_list
):
b
=
work_list
.
pop
()
...
...
@@ -118,6 +115,3 @@ def create_in_out(blocks):
if
new_in
!=
b
.
live_in
:
b
.
live_in
=
new_in
work_list
|=
set
(
b
.
edges_from
)
for
b
in
exit_points
:
b
.
live_out
|=
set
(
RESERVED_OUT
)
src/optimize/__init__.py
View file @
86b34864
...
...
@@ -44,6 +44,6 @@ def optimize(program, verbose=0):
# Print results
if
verbose
:
print
'Original statements:
%d'
%
o
print
'Statements removed:
%d (%d%%)'
\
%
(
o
-
b
,
int
((
o
-
b
)
/
float
(
b
)
*
100
))
print
'Original statements: %d'
%
o
print
'Statements removed:
%d (%d%%)'
%
(
o
-
b
,
int
((
o
-
b
)
/
float
(
b
)
*
100
))
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