[pypy-svn] r34364 - in pypy/dist/pypy/jit/codegen/ppc: . test
mwh at codespeak.net
mwh at codespeak.net
Wed Nov 8 13:47:53 CET 2006
Author: mwh
Date: Wed Nov 8 13:47:51 2006
New Revision: 34364
Modified:
pypy/dist/pypy/jit/codegen/ppc/instruction.py
pypy/dist/pypy/jit/codegen/ppc/regalloc.py
pypy/dist/pypy/jit/codegen/ppc/rgenop.py
pypy/dist/pypy/jit/codegen/ppc/test/test_rgenop.py
Log:
change the registers we allocate from for the restricted test-the-allocator tests.
changing the gprs uncovered a bug, changing the crfs required a little code for
spilling non-gprs.
Modified: pypy/dist/pypy/jit/codegen/ppc/instruction.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/instruction.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/instruction.py Wed Nov 8 13:47:51 2006
@@ -12,6 +12,8 @@
is_register = False
def __init__(self, offset):
self.offset = offset
+ def __repr__(self):
+ return "stack@%s"%(self.offset,)
_stack_slot_cache = {}
def stack_slot(offset):
Modified: pypy/dist/pypy/jit/codegen/ppc/regalloc.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/regalloc.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/regalloc.py Wed Nov 8 13:47:51 2006
@@ -44,6 +44,12 @@
if freeregs:
reg = freeregs.pop()
+ if newarg in self.var2loc:
+ spill = self.var2loc[newarg]
+ assert not spill.is_register
+ self.insns.append(Unspill(newarg, reg, spill))
+ del self.loc2var[spill] # not stored there anymore, reuse??
+ #print "allocate_reg: Unspilled %r from %r." % (newarg, spill)
self.loc2var[reg] = newarg
self.var2loc[newarg] = reg
#print "allocate_reg: Putting %r into fresh register %r" % (newarg, reg)
@@ -65,7 +71,12 @@
spill = stack_slot(self.spill())
self.var2loc[argtospill] = spill
self.loc2var[spill] = argtospill
- self.insns.append(Spill(argtospill, reg, spill))
+ if regclass != GP_REGISTER:
+ self.insns.append(reg.move_to_gpr(self, 0))
+ _reg = gprs[0]
+ else:
+ _reg = reg
+ self.insns.append(Spill(argtospill, _reg, spill))
#print "allocate_reg: Spilled %r to %r." % (argtospill, spill)
# If the value is currently on the stack, load it up into the
Modified: pypy/dist/pypy/jit/codegen/ppc/rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/rgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/rgenop.py Wed Nov 8 13:47:51 2006
@@ -53,6 +53,7 @@
def load_now(self, asm, loc):
if loc.is_register:
+ assert isinstance(loc, insn.GPR)
asm.load_word(loc.number, self.value)
else:
asm.load_word(rSCRATCH, self.value)
@@ -316,7 +317,7 @@
if not loc.is_register:
min_stack_offset = min(min_stack_offset, loc.offset)
else:
- usedregs[loc] = None # XXX use this
+ usedregs[loc] = None
unusedregs = [loc for loc in self.rgenop.freeregs[insn.GP_REGISTER] if loc not in usedregs]
arg_locations = []
Modified: pypy/dist/pypy/jit/codegen/ppc/test/test_rgenop.py
==============================================================================
--- pypy/dist/pypy/jit/codegen/ppc/test/test_rgenop.py (original)
+++ pypy/dist/pypy/jit/codegen/ppc/test/test_rgenop.py Wed Nov 8 13:47:51 2006
@@ -7,9 +7,9 @@
class FewRegisters(RPPCGenOp):
freeregs = {
- insn.GP_REGISTER:insn.gprs[29:],
+ insn.GP_REGISTER:insn.gprs[3:6],
insn.FP_REGISTER:insn.fprs,
- insn.CR_FIELD:insn.crfs,
+ insn.CR_FIELD:insn.crfs[:1],
insn.CT_REGISTER:[insn.ctr]}
class TestRPPCGenop(AbstractRGenOpTests):
@@ -25,7 +25,7 @@
args_gv = [gv_x, gv_y]
builder.enter_next_block([signed_kind, signed_kind], args_gv)
[gv_x, gv_y] = args_gv
-
+
gv_gt = builder.genop2("int_gt", gv_x, gv_y)
gv_lt = builder.genop2("int_lt", gv_x, gv_y)
gv_ge = builder.genop2("int_ge", gv_x, gv_y)
More information about the Pypy-commit
mailing list