[pypy-svn] r74115 - in pypy/branch/blackhole-improvement/pypy/jit/codewriter: . test

fijal at codespeak.net fijal at codespeak.net
Tue Apr 27 18:25:33 CEST 2010


Author: fijal
Date: Tue Apr 27 18:25:31 2010
New Revision: 74115

Modified:
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/flatten.py
   pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_flatten.py
Log:
Add a repr to register


Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/flatten.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/flatten.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/flatten.py	Tue Apr 27 18:25:31 2010
@@ -28,6 +28,8 @@
     def __init__(self, kind, index):
         self.kind = kind          # 'int', 'ref' or 'float'
         self.index = index
+    def __repr__(self):
+        return "%%%s%d" % (self.kind[0], self.index)
 
 class ListOfKind(object):
     # a list of Regs/Consts, all of the same 'kind'.

Modified: pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_flatten.py
==============================================================================
--- pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_flatten.py	(original)
+++ pypy/branch/blackhole-improvement/pypy/jit/codewriter/test/test_flatten.py	Tue Apr 27 18:25:31 2010
@@ -1,7 +1,7 @@
 import py, sys
 from pypy.jit.codewriter import support
 from pypy.jit.codewriter.flatten import flatten_graph, reorder_renaming_list
-from pypy.jit.codewriter.flatten import GraphFlattener, ListOfKind
+from pypy.jit.codewriter.flatten import GraphFlattener, ListOfKind, Register
 from pypy.jit.codewriter.format import format_assembler
 from pypy.jit.codewriter.jitter import transform_graph
 from pypy.jit.metainterp.history import AbstractDescr
@@ -49,6 +49,8 @@
     result = reorder_renaming_list([4, 3, 1, 2, 6], [1, 2, 3, 4, 5])
     assert result == None
 
+def test_repr():
+    assert repr(Register('int', 13)) == '%i13'
 
 class TestFlatten:
 



More information about the Pypy-commit mailing list