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
053da966
Commit
053da966
authored
Dec 29, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some debug print statements to reaching definitions.
parent
2f461f59
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
src/dataflow.py
src/dataflow.py
+10
-0
No files found.
src/dataflow.py
View file @
053da966
...
@@ -63,6 +63,10 @@ def get_defs(blocks):
...
@@ -63,6 +63,10 @@ def get_defs(blocks):
def
reaching_definitions
(
blocks
):
def
reaching_definitions
(
blocks
):
"""Generate the `in' and `out' sets of the given blocks using the iterative
"""Generate the `in' and `out' sets of the given blocks using the iterative
algorithm from the lecture slides."""
algorithm from the lecture slides."""
# Generate flow graph
generate_flow_graph
(
blocks
)
# Create gen/kill sets
defs
=
get_defs
(
blocks
)
defs
=
get_defs
(
blocks
)
print
'defs:'
,
defs
print
'defs:'
,
defs
...
@@ -76,14 +80,20 @@ def reaching_definitions(blocks):
...
@@ -76,14 +80,20 @@ def reaching_definitions(blocks):
change
=
False
change
=
False
for
b
in
blocks
:
for
b
in
blocks
:
print
'block:'
,
b
b
.
in_set
=
set
()
b
.
in_set
=
set
()
for
pred
in
b
.
edges_from
:
for
pred
in
b
.
edges_from
:
print
'pred: '
,
pred
b
.
in_set
|=
pred
.
out_set
b
.
in_set
|=
pred
.
out_set
print
'b.in_set: '
,
b
.
in_set
print
'b.out_set: '
,
b
.
out_set
new_out
=
b
.
gen_set
|
(
b
.
in_set
-
b
.
kill_set
)
new_out
=
b
.
gen_set
|
(
b
.
in_set
-
b
.
kill_set
)
print
'new_out: '
,
new_out
if
new_out
!=
b
.
out_set
:
if
new_out
!=
b
.
out_set
:
print
'changed'
b
.
out_set
=
new_out
b
.
out_set
=
new_out
change
=
True
change
=
True
...
...
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