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
030e9754
Commit
030e9754
authored
Dec 28, 2011
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extended docstrings.
parent
870d25ee
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
src/optimize/advanced.py
src/optimize/advanced.py
+15
-6
No files found.
src/optimize/advanced.py
View file @
030e9754
...
...
@@ -8,6 +8,11 @@ def create_variable():
def
eliminate_common_subexpressions
(
block
):
"""
Common subexpression elimination:
x = a + b -> u = a + b
y = a + b x = u
y = u
The algorithm used is as follows:
- Traverse through the statements in reverse order.
- If the statement can be possibly be eliminated, walk further collecting
all other occurrences of the expression until one of the arguments is
...
...
@@ -65,7 +70,11 @@ def to_hex(value):
def
fold_constants
(
block
):
"""
Constant folding:
- An immidiate load defines a register value:
x = 3 + 5 -> x = 8
y = x * 2 y = 16
To keep track of constant values, the following assumptions are made:
- An immediate load defines a register value:
li $reg, XX -> register[$reg] = XX
- Integer variable definition is of the following form:
li $reg, XX -> constants[VAR] = XX
...
...
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