Author: hager <[email protected]>
Branch: ppc-jit-backend
Changeset: r51223:7ccc3bb51335
Date: 2012-01-11 14:24 +0100
http://bitbucket.org/pypy/pypy/changeset/7ccc3bb51335/
Log: use temporary scratch register in emit_getarrayitem_gc and
emit_setarrayitem_gc
diff --git a/pypy/jit/backend/ppc/ppcgen/opassembler.py
b/pypy/jit/backend/ppc/ppcgen/opassembler.py
--- a/pypy/jit/backend/ppc/ppcgen/opassembler.py
+++ b/pypy/jit/backend/ppc/ppcgen/opassembler.py
@@ -549,8 +549,15 @@
def emit_setarrayitem_gc(self, op, arglocs, regalloc):
value_loc, base_loc, ofs_loc, scale, ofs = arglocs
assert ofs_loc.is_reg()
+
+ # use r20 as scratch reg
+ SAVE_SCRATCH = r.r20
+ # save value temporarily
+ self.mc.mtctr(SAVE_SCRATCH.value)
+
if scale.value > 0:
- scale_loc = r.SCRATCH
+ #scale_loc = r.SCRATCH
+ scale_loc = SAVE_SCRATCH
if IS_PPC_32:
self.mc.slwi(scale_loc.value, ofs_loc.value, scale.value)
else:
@@ -574,13 +581,23 @@
else:
assert 0, "scale %s not supported" % (scale.value)
+ # restore value of SAVE_SCRATCH
+ self.mc.mfctr(SAVE_SCRATCH.value)
+
emit_setarrayitem_raw = emit_setarrayitem_gc
def emit_getarrayitem_gc(self, op, arglocs, regalloc):
res, base_loc, ofs_loc, scale, ofs = arglocs
assert ofs_loc.is_reg()
+
+ # use r20 as scratch reg
+ SAVE_SCRATCH = r.r20
+ # save value temporarily
+ self.mc.mtctr(SAVE_SCRATCH.value)
+
if scale.value > 0:
- scale_loc = r.SCRATCH
+ #scale_loc = r.SCRATCH
+ scale_loc = SAVE_SCRATCH
if IS_PPC_32:
self.mc.slwi(scale_loc.value, ofs_loc.value, scale.value)
else:
@@ -604,6 +621,9 @@
else:
assert 0
+ # restore value of SAVE_SCRATCH
+ self.mc.mfctr(SAVE_SCRATCH.value)
+
#XXX Hack, Hack, Hack
if not we_are_translated():
descr = op.getdescr()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit