[pypy-svn] r76292 - pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86

jcreigh at codespeak.net jcreigh at codespeak.net
Tue Jul 20 20:27:10 CEST 2010


Author: jcreigh
Date: Tue Jul 20 20:27:08 2010
New Revision: 76292

Modified:
   pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/jump.py
   pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/regloc.py
Log:
fix some asserts and add an "is_memory_reference" helper method for clarity

Modified: pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/jump.py
==============================================================================
--- pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/jump.py	(original)
+++ pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/jump.py	Tue Jul 20 20:27:08 2010
@@ -63,7 +63,7 @@
             assert pending_dests == 0
 
 def _move(assembler, src, dst, tmpreg):
-    if isinstance(dst, StackLoc) and isinstance(src, StackLoc):
+    if dst.is_memory_reference() and src.is_memory_reference():
         assembler.regalloc_mov(src, tmpreg)
         src = tmpreg
     assembler.regalloc_mov(src, dst)

Modified: pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/regloc.py
==============================================================================
--- pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/regloc.py	(original)
+++ pypy/branch/x86-64-jit-backend/pypy/jit/backend/x86/regloc.py	Tue Jul 20 20:27:08 2010
@@ -19,6 +19,9 @@
     def _getregkey(self):
         return self.value
 
+    def is_memory_reference(self):
+        return self.location_code() in ('b', 's', 'j', 'a', 'm')
+
     def value_r(self): return self.value
     def value_b(self): return self.value
     def value_s(self): return self.value
@@ -191,8 +194,8 @@
             # must be careful not to combine it with location types that
             # might need to use the scratch register themselves.
             if loc2 is X86_64_SCRATCH_REG:
-                assert code1 not in ('j', 'i')
-            if loc1 is X86_64_SCRATCH_REG:
+                assert code1 != 'j'
+            if loc1 is X86_64_SCRATCH_REG and not name.startswith("MOV"):
                 assert code2 not in ('j', 'i')
 
             for possible_code1 in unrolling_location_codes:



More information about the Pypy-commit mailing list