[pypy-svn] pypy fold_intadd: (hakanardo) Changed code to emit all intermediate operations, leave elimination to backend. Magically cured the errors I was getting.

ademan commits-noreply at bitbucket.org
Wed Mar 16 10:02:20 CET 2011


Author: Daniel Roberts <Ademan555 at gmail.com>
Branch: fold_intadd
Changeset: r42696:62d080096e19
Date: 2011-03-16 02:01 -0700
http://bitbucket.org/pypy/pypy/changeset/62d080096e19/

Log:	(hakanardo) Changed code to emit all intermediate operations, leave
	elimination to backend. Magically cured the errors I was getting.

diff --git a/pypy/jit/metainterp/optimizeopt/__init__.py b/pypy/jit/metainterp/optimizeopt/__init__.py
--- a/pypy/jit/metainterp/optimizeopt/__init__.py
+++ b/pypy/jit/metainterp/optimizeopt/__init__.py
@@ -12,8 +12,8 @@
 from pypy.rlib.unroll import unrolling_iterable
 
 ALL_OPTS = [
+            ('intbounds', OptIntBounds),
             ('fold_intadd', OptAddition),
-            ('intbounds', OptIntBounds),
             ('rewrite', OptRewrite),
             ('virtualize', OptVirtualize),
             ('string', OptString),

diff --git a/pypy/jit/metainterp/test/test_optimizeopt.py b/pypy/jit/metainterp/test/test_optimizeopt.py
--- a/pypy/jit/metainterp/test/test_optimizeopt.py
+++ b/pypy/jit/metainterp/test/test_optimizeopt.py
@@ -5519,6 +5519,8 @@
 
         expected = """
         [i0]
+        i1 = int_add(i0, 3)
+        i2 = int_add(i0, 19)
         i3 = int_add(i0, 28)
         jump(i3)
         """

diff --git a/pypy/jit/metainterp/optimizeopt/fold_intadd.py b/pypy/jit/metainterp/optimizeopt/fold_intadd.py
--- a/pypy/jit/metainterp/optimizeopt/fold_intadd.py
+++ b/pypy/jit/metainterp/optimizeopt/fold_intadd.py
@@ -35,6 +35,11 @@
 
         self.args[result] = root, constant
 
+        constant = ConstInt(constant)
+        new_op = self._int_add(root, constant, result)
+        print new_op
+        self.emit_operation(new_op)
+
     def optimize_INT_ADD(self, op):
         lv = self.getvalue(op.getarg(0))
         rv = self.getvalue(op.getarg(1))


More information about the Pypy-commit mailing list