[pypy-svn] r7406 - pypy/trunk/src/pypy/translator
hpk at codespeak.net
hpk at codespeak.net
Thu Nov 18 19:47:54 CET 2004
Author: hpk
Date: Thu Nov 18 19:47:54 2004
New Revision: 7406
Modified:
pypy/trunk/src/pypy/translator/annrpython.py
pypy/trunk/src/pypy/translator/transform.py
Log:
a small first hack at removing dead "simple_call" operations
watch some of the specialized wrap_..._SomeXXX getting very
small, yay
Modified: pypy/trunk/src/pypy/translator/annrpython.py
==============================================================================
--- pypy/trunk/src/pypy/translator/annrpython.py (original)
+++ pypy/trunk/src/pypy/translator/annrpython.py Thu Nov 18 19:47:54 2004
@@ -239,6 +239,9 @@
# Generic simplifications
from pypy.translator import transform
transform.transform_graph(self)
+ from pypy.translator import simplify
+ for graph in self.translator.flowgraphs.values():
+ simplify.eliminate_empty_blocks(graph)
#___ flowing annotations in blocks _____________________
Modified: pypy/trunk/src/pypy/translator/transform.py
==============================================================================
--- pypy/trunk/src/pypy/translator/transform.py (original)
+++ pypy/trunk/src/pypy/translator/transform.py Thu Nov 18 19:47:54 2004
@@ -106,6 +106,7 @@
CanRemove = {'newtuple': True,
'newlist': True,
'newdict': True,
+ 'is_': True,
'is_true': True}
read_vars = {} # set of variables really used
variable_flow = {} # map {Var: list-of-Vars-it-depends-on}
@@ -155,8 +156,14 @@
# look for removable operations whose result is never used
for i in range(len(block.operations)-1, -1, -1):
op = block.operations[i]
- if op.opname in CanRemove and op.result not in read_vars:
- del block.operations[i]
+ if op.result not in read_vars:
+ if op.opname in CanRemove:
+ del block.operations[i]
+ elif op.opname == 'simple_call':
+ if op.args and isinstance(op.args[0], Constant):
+ func = op.args[0].value
+ if func is isinstance:
+ del block.operations[i]
# look for output variables never used
# warning: this must be completely done *before* we attempt to
More information about the Pypy-commit
mailing list