[pypy-svn] r67112 - in pypy/branch/pyjitpl5/pypy/jit/backend/x86: . test
arigo at codespeak.net
arigo at codespeak.net
Sun Aug 23 14:26:28 CEST 2009
Author: arigo
Date: Sun Aug 23 14:26:26 2009
New Revision: 67112
Modified:
pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py
pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py
Log:
(benjamin, arigo)
Implement simple register moving.
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/jump.py Sun Aug 23 14:26:26 2009
@@ -1,4 +1,8 @@
def remap_stack_layout(assembler, src_locations, dst_locations):
- pass
+ for i in range(len(dst_locations)):
+ src = src_locations[i]
+ dst = dst_locations[i]
+ if src is not dst:
+ assembler.regalloc_load(src, dst)
Modified: pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py (original)
+++ pypy/branch/pyjitpl5/pypy/jit/backend/x86/test/test_jump.py Sun Aug 23 14:26:26 2009
@@ -5,6 +5,13 @@
def __init__(self):
self.ops = []
+ def regalloc_load(self, from_loc, to_loc):
+ self.ops.append(('load', from_loc, to_loc))
+
+ def regalloc_store(self, from_loc, to_loc):
+ self.ops.append(('store', from_loc, to_loc))
+
+
def test_trivial():
assembler = MockAssembler()
remap_stack_layout(assembler, [], [])
@@ -18,3 +25,10 @@
remap_stack_layout(assembler, [eax, ebx, ecx, s20, s8, edx, s12, esi, edi],
[eax, ebx, ecx, s20, s8, edx, s12, esi, edi])
assert assembler.ops == []
+
+def test_simple_registers():
+ assembler = MockAssembler()
+ remap_stack_layout(assembler, [eax, ebx, ecx], [edx, esi, edi])
+ assert assembler.ops == [('load', eax, edx),
+ ('load', ebx, esi),
+ ('load', ecx, edi)]
More information about the Pypy-commit
mailing list