[pypy-commit] pypy ppc-jit-backend: explicitely allocate scratch reg
hager
noreply at buildbot.pypy.org
Mon Mar 5 17:26:40 CET 2012
Author: hager <sven.hager at uni-duesseldorf.de>
Branch: ppc-jit-backend
Changeset: r53233:bf278cfd2d03
Date: 2012-03-05 08:06 -0800
http://bitbucket.org/pypy/pypy/changeset/bf278cfd2d03/
Log: explicitely allocate scratch reg
diff --git a/pypy/jit/backend/ppc/ppc_assembler.py b/pypy/jit/backend/ppc/ppc_assembler.py
--- a/pypy/jit/backend/ppc/ppc_assembler.py
+++ b/pypy/jit/backend/ppc/ppc_assembler.py
@@ -292,14 +292,16 @@
mc.write32(0)
frame_size = (# add space for floats later
+ (BACKCHAIN_SIZE + MAX_REG_PARAMS) * WORD)
- if IS_PPC_32:
- mc.stwu(r.SP.value, r.SP.value, -frame_size)
- mc.mflr(r.SCRATCH.value)
- mc.stw(r.SCRATCH.value, r.SP.value, frame_size + WORD)
- else:
- mc.stdu(r.SP.value, r.SP.value, -frame_size)
- mc.mflr(r.SCRATCH.value)
- mc.std(r.SCRATCH.value, r.SP.value, frame_size + 2 * WORD)
+
+ with scratch_reg(mc):
+ if IS_PPC_32:
+ mc.stwu(r.SP.value, r.SP.value, -frame_size)
+ mc.mflr(r.SCRATCH.value)
+ mc.stw(r.SCRATCH.value, r.SP.value, frame_size + WORD)
+ else:
+ mc.stdu(r.SP.value, r.SP.value, -frame_size)
+ mc.mflr(r.SCRATCH.value)
+ mc.std(r.SCRATCH.value, r.SP.value, frame_size + 2 * WORD)
# managed volatiles are saved below
if self.cpu.supports_floats:
assert 0, "make sure to save floats here"
@@ -324,8 +326,10 @@
ofs = WORD
else:
ofs = WORD * 2
- mc.load(r.SCRATCH.value, r.SP.value, frame_size + ofs)
- mc.mtlr(r.SCRATCH.value)
+
+ with scratch_reg(mc):
+ mc.load(r.SCRATCH.value, r.SP.value, frame_size + ofs)
+ mc.mtlr(r.SCRATCH.value)
mc.addi(r.SP.value, r.SP.value, frame_size)
mc.blr()
@@ -335,8 +339,9 @@
pmc.bc(12, 2, offset)
pmc.overwrite()
# restore the frame before leaving
- mc.load(r.SCRATCH.value, r.SP.value, frame_size + ofs)
- mc.mtlr(r.SCRATCH.value)
+ with scratch_reg(mc):
+ mc.load(r.SCRATCH.value, r.SP.value, frame_size + ofs)
+ mc.mtlr(r.SCRATCH.value)
mc.addi(r.SP.value, r.SP.value, frame_size)
mc.b_abs(self.propagate_exception_path)
More information about the pypy-commit
mailing list