[pypy-commit] pypy ppc-jit-backend: (bivab, hager): StackLocations have now a value field which stores the offset to the SPP. It is used in regalloc_mov.

hager noreply at buildbot.pypy.org
Tue Jan 10 17:24:08 CET 2012


Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r51209:b5f5e48c3799
Date: 2012-01-10 17:22 +0100
http://bitbucket.org/pypy/pypy/changeset/b5f5e48c3799/

Log:	(bivab, hager): StackLocations have now a value field which stores
	the offset to the SPP. It is used in regalloc_mov.

diff --git a/pypy/jit/backend/ppc/ppcgen/locations.py b/pypy/jit/backend/ppc/ppcgen/locations.py
--- a/pypy/jit/backend/ppc/ppcgen/locations.py
+++ b/pypy/jit/backend/ppc/ppcgen/locations.py
@@ -88,11 +88,11 @@
 
     def __init__(self, position, num_words=1, type=INT):
         self.position = position
-        self.width = num_words * WORD
         self.type = type
+        self.value = get_spp_offset(position)
 
     def __repr__(self):
-        return 'FP(%s)+%d' % (self.type, self.position,)
+        return 'SPP(%s)+%d' % (self.type, self.value)
 
     def location_code(self):
         return 'b'
@@ -108,3 +108,9 @@
 
 def imm(val):
     return ImmLocation(val)
+
+def get_spp_offset(pos):
+    if pos < 0:
+        return -pos * WORD
+    else:
+        return -(pos + 1) * WORD
diff --git a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/ppc_assembler.py
@@ -711,14 +711,14 @@
             # move immediate value to memory
             elif loc.is_stack():
                 self.mc.alloc_scratch_reg()
-                offset = loc.as_key() * WORD
+                offset = loc.value
                 self.mc.load_imm(r.SCRATCH.value, value)
                 self.mc.store(r.SCRATCH.value, r.SPP.value, offset)
                 self.mc.free_scratch_reg()
                 return
             assert 0, "not supported location"
         elif prev_loc.is_stack():
-            offset = prev_loc.as_key() * WORD
+            offset = prev_loc.value
             # move from memory to register
             if loc.is_reg():
                 reg = loc.as_key()
@@ -726,7 +726,7 @@
                 return
             # move in memory
             elif loc.is_stack():
-                target_offset = loc.as_key() * WORD
+                target_offset = loc.value
                 self.mc.alloc_scratch_reg()
                 self.mc.load(r.SCRATCH.value, r.SPP.value, offset)
                 self.mc.store(r.SCRATCH.value, r.SPP.value, target_offset)
@@ -742,7 +742,7 @@
                 return
             # move to memory
             elif loc.is_stack():
-                offset = loc.as_key() * WORD
+                offset = loc.value
                 self.mc.store(reg, r.SPP.value, offset)
                 return
             assert 0, "not supported location"


More information about the pypy-commit mailing list