[pypy-commit] pypy ppc-jit-backend: started refactoring of stackframes
hager
noreply at buildbot.pypy.org
Fri Dec 2 14:02:32 CET 2011
Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r50062:d1741320b829
Date: 2011-12-02 14:02 +0100
http://bitbucket.org/pypy/pypy/changeset/d1741320b829/
Log: started refactoring of stackframes
diff --git a/pypy/jit/backend/ppc/ppcgen/arch.py b/pypy/jit/backend/ppc/ppcgen/arch.py
--- a/pypy/jit/backend/ppc/ppcgen/arch.py
+++ b/pypy/jit/backend/ppc/ppcgen/arch.py
@@ -1,19 +1,23 @@
# Constants that depend on whether we are on 32-bit or 64-bit
-from pypy.jit.backend.ppc.ppcgen.register import NONVOLATILES
+from pypy.jit.backend.ppc.ppcgen.register import (NONVOLATILES,
+ NONVOLATILES_FLOAT)
import sys
if sys.maxint == (2**31 - 1):
WORD = 4
IS_PPC_32 = True
- BACKCHAIN_SIZE = 2 * WORD
else:
WORD = 8
IS_PPC_32 = False
- BACKCHAIN_SIZE = 4 * WORD
-IS_PPC_64 = not IS_PPC_32
-MY_COPY_OF_REGS = 0
+DWORD = 2 * WORD
+BACKCHAIN_SIZE = 6 * WORD
+IS_PPC_64 = not IS_PPC_32
+MY_COPY_OF_REGS = 0
-GPR_SAVE_AREA = len(NONVOLATILES) * WORD
-MAX_REG_PARAMS = 8
+FORCE_INDEX = WORD
+GPR_SAVE_AREA = len(NONVOLATILES) * WORD
+FPR_SAVE_AREA = len(NONVOLATILES_FLOAT) * DWORD
+FLOAT_INT_CONVERSION = 4 * WORD
+MAX_REG_PARAMS = 8
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
@@ -1,5 +1,13 @@
from pypy.jit.metainterp.history import INT, FLOAT, REF
-from pypy.jit.backend.arm.arch import WORD
+import sys
+
+# XXX import from arch.py, currently we have a circular import
+if sys.maxint == (2**31 - 1):
+ WORD = 4
+else:
+ WORD = 8
+DWORD = 2 * WORD
+
class AssemblerLocation(object):
_immutable_ = True
type = INT
@@ -38,6 +46,23 @@
def as_key(self):
return self.value
+class FPRegisterLocation(RegisterLocation):
+ _immutable_ = True
+ type = FLOAT
+ width = DWORD
+
+ def __repr__(self):
+ return 'fp%d' % self.value
+
+ def is_reg(self):
+ return False
+
+ def is_fp_reg(self):
+ return True
+
+ def as_key(self):
+ return self.value
+
class ImmLocation(AssemblerLocation):
_immutable_ = True
width = 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
@@ -11,7 +11,9 @@
from pypy.jit.backend.ppc.ppcgen.jump import remap_frame_layout
from pypy.jit.backend.ppc.ppcgen.arch import (IS_PPC_32, IS_PPC_64, WORD,
NONVOLATILES,
- GPR_SAVE_AREA, BACKCHAIN_SIZE)
+ GPR_SAVE_AREA, BACKCHAIN_SIZE,
+ FPR_SAVE_AREA,
+ FLOAT_INT_CONVERSION, FORCE_INDEX)
from pypy.jit.backend.ppc.ppcgen.helper.assembler import (gen_emit_cmp_op,
encode32, decode32,
decode64,
@@ -127,6 +129,7 @@
self.fail_boxes_count = 0
self.current_clt = None
self._regalloc = None
+ self.max_stack_params = 0
def _save_nonvolatiles(self):
for i, reg in enumerate(NONVOLATILES):
@@ -546,6 +549,7 @@
self.datablockwrapper = MachineDataBlockWrapper(self.cpu.asmmemmgr,
allblocks)
self.stack_in_use = False
+ self.max_stack_params = 0
def setup_once(self):
gc_ll_descr = self.cpu.gc_ll_descr
@@ -712,6 +716,7 @@
self._regalloc = None
assert self.datablockwrapper is None
self.stack_in_use = False
+ self.max_stack_params = 0
def _walk_operations(self, operations, regalloc):
self._regalloc = regalloc
@@ -770,10 +775,21 @@
return mc.materialize(self.cpu.asmmemmgr, [],
self.cpu.gc_ll_descr.gcrootmap)
+ #def compute_frame_depth(self, regalloc):
+ # frame_depth = (GPR_SAVE_AREA # GPR space
+ # + WORD # FORCE INDEX
+ # + regalloc.frame_manager.frame_depth * WORD)
+ # return frame_depth
def compute_frame_depth(self, regalloc):
- frame_depth = (GPR_SAVE_AREA # GPR space
- + WORD # FORCE INDEX
- + regalloc.frame_manager.frame_depth * WORD)
+ frame_depth = ( GPR_SAVE_AREA
+ + FPR_SAVE_AREA
+ + FLOAT_INT_CONVERSION
+ + FORCE_INDEX
+ + regalloc.frame_manager.frame_depth * WORD
+ + len(r.MANAGED_REGS) * WORD
+ + self.max_stack_params * WORD
+ + BACKCHAIN_SIZE)
+
return frame_depth
def materialize_loop(self, looptoken, show):
diff --git a/pypy/jit/backend/ppc/ppcgen/register.py b/pypy/jit/backend/ppc/ppcgen/register.py
--- a/pypy/jit/backend/ppc/ppcgen/register.py
+++ b/pypy/jit/backend/ppc/ppcgen/register.py
@@ -1,14 +1,24 @@
-from pypy.jit.backend.ppc.ppcgen.locations import RegisterLocation
+from pypy.jit.backend.ppc.ppcgen.locations import (RegisterLocation,
+ FPRegisterLocation)
-ALL_REGS = [RegisterLocation(i) for i in range(32)]
+ALL_REGS = [RegisterLocation(i) for i in range(32)]
+ALL_FLOAT_REGS = [FPRegisterLocation(i) for i in range(32)]
r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15, r16,\
r17, r18, r19, r20, r21, r22, r23, r24, r25, r26, r27, r28, r29, r30, r31\
= ALL_REGS
-NONVOLATILES = [r14, r15, r16, r17, r18, r19, r20, r21, r22, r23,
+f0, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16,\
+ f17, f18, f19, f20, f21, f22, f23, f24, f25, f26, f27, f28, f29, f30, f31\
+ = ALL_FLOAT_REGS
+
+NONVOLATILES = [r14, r15, r16, r17, r18, r19, r20, r21, r22, r23,
r24, r25, r26, r27, r28, r29, r30, r31]
-VOLATILES = [r0, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13]
+VOLATILES = [r0, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13]
+
+NONVOLATILES_FLOAT = [f14, f15, f16, f17, f18, f19, f20, f21, f22, f23,
+ f24, f25, f26, f27, f28, f29, f30, f31]
+
SPP = r31
SP = r1
diff --git a/pypy/jit/backend/ppc/ppcgen/test/test_stackframe.py b/pypy/jit/backend/ppc/ppcgen/test/test_stackframe.py
--- a/pypy/jit/backend/ppc/ppcgen/test/test_stackframe.py
+++ b/pypy/jit/backend/ppc/ppcgen/test/test_stackframe.py
@@ -14,7 +14,7 @@
| | |
--------------------------- --
| | |
- | FLOAT/INT CONVERSION | |>> ? * WORD
+ | FLOAT/INT CONVERSION | |>> 4 (?) * WORD
| | |
--------------------------- --
| FORCE INDEX | WORD | 1 WORD
More information about the pypy-commit
mailing list