Author: David Schneider <[email protected]>
Branch: arm-backed-float
Changeset: r44511:ea74932e6aa5
Date: 2011-05-26 14:20 +0200
http://bitbucket.org/pypy/pypy/changeset/ea74932e6aa5/

Log:    when spilling a variable or loading a spilled one use an immediate
        value to store the offset on the stack if it is in the range -4095
        to 4095

diff --git a/pypy/jit/backend/arm/assembler.py 
b/pypy/jit/backend/arm/assembler.py
--- a/pypy/jit/backend/arm/assembler.py
+++ b/pypy/jit/backend/arm/assembler.py
@@ -803,19 +803,21 @@
         if loc.is_stack() or prev_loc.is_stack():
             temp = r.lr
             if loc.is_stack() and prev_loc.is_reg():
-                offset = ConstInt(loc.position*-WORD)
-                if not _check_imm_arg(offset):
-                    self.mc.gen_load_int(temp.value, offset.value)
+                # spill a core register
+                offset = ConstInt(loc.position*WORD)
+                if not _check_imm_arg(offset, size=0xFFF):
+                    self.mc.gen_load_int(temp.value, -1*offset.value)
                     self.mc.STR_rr(prev_loc.value, r.fp.value, temp.value, 
cond=cond)
                 else:
-                    self.mc.STR_ri(prev_loc.value, r.fp.value, offset.value, 
cond=cond)
+                    self.mc.STR_ri(prev_loc.value, r.fp.value, 
imm=-1*offset.value, cond=cond)
             elif loc.is_reg() and prev_loc.is_stack():
-                offset = ConstInt(prev_loc.position*-WORD)
-                if not _check_imm_arg(offset):
-                    self.mc.gen_load_int(temp.value, offset.value)
+                # unspill a core register
+                offset = ConstInt(prev_loc.position*WORD)
+                if not _check_imm_arg(offset, size=0xFFF):
+                    self.mc.gen_load_int(temp.value, -1*offset.value)
                     self.mc.LDR_rr(loc.value, r.fp.value, temp.value, 
cond=cond)
                 else:
-                    self.mc.LDR_ri(loc.value, r.fp.value, offset.value, 
cond=cond)
+                    self.mc.LDR_ri(loc.value, r.fp.value, imm=-1*offset.value, 
cond=cond)
             elif loc.is_stack() and prev_loc.is_vfp_reg():
                 # spill vfp register
                 offset = ConstInt(loc.position*-WORD)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to