[pypy-commit] pypy arm-backend-2: cleanup
bivab
noreply at buildbot.pypy.org
Sun Aug 19 13:27:27 CEST 2012
Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r56749:fcecfd5b3b74
Date: 2012-08-18 10:06 +0200
http://bitbucket.org/pypy/pypy/changeset/fcecfd5b3b74/
Log: cleanup
diff --git a/pypy/jit/backend/arm/opassembler.py b/pypy/jit/backend/arm/opassembler.py
--- a/pypy/jit/backend/arm/opassembler.py
+++ b/pypy/jit/backend/arm/opassembler.py
@@ -16,7 +16,6 @@
gen_emit_unary_float_op,
saved_registers,
count_reg_args)
-from pypy.jit.backend.arm.helper.regalloc import check_imm_arg
from pypy.jit.backend.arm.codebuilder import ARMv7Builder, OverwritingBuilder
from pypy.jit.backend.arm.jump import remap_frame_layout
from pypy.jit.backend.arm.regalloc import TempInt, TempPtr
@@ -28,7 +27,7 @@
from pypy.jit.metainterp.history import JitCellToken, TargetToken
from pypy.jit.metainterp.resoperation import rop
from pypy.rlib.objectmodel import we_are_translated
-from pypy.rpython.lltypesystem import lltype, rffi, rstr
+from pypy.rpython.lltypesystem import rstr
NO_FORCE_INDEX = -1
@@ -50,7 +49,7 @@
def emit_op_int_add(self, op, arglocs, regalloc, fcond):
return self.int_add_impl(op, arglocs, regalloc, fcond)
-
+
def int_add_impl(self, op, arglocs, regalloc, fcond, flags=False):
l0, l1, res = arglocs
if flags:
@@ -100,7 +99,7 @@
self.mc.MOV_ri(res.value, 0, cond=c.LT)
self.mc.MOV_rr(res.value, arg.value, cond=c.GE)
return fcond
-
+
#ref: http://blogs.arm.com/software-enablement/detecting-overflow-from-mul/
def emit_guard_int_mul_ovf(self, op, guard, arglocs, regalloc, fcond):
reg1 = arglocs[0]
@@ -173,7 +172,6 @@
emit_op_int_add_ovf = emit_op_int_add
emit_op_int_sub_ovf = emit_op_int_sub
-
emit_op_int_is_true = gen_emit_op_unary_cmp('int_is_true', c.NE)
emit_op_int_is_zero = gen_emit_op_unary_cmp('int_is_zero', c.EQ)
@@ -191,7 +189,6 @@
self.mc.RSB_ri(resloc.value, l0.value, imm=0)
return fcond
-
def _emit_guard(self, op, arglocs, fcond, save_exc,
is_guard_not_invalidated=False):
assert isinstance(save_exc, bool)
@@ -294,7 +291,6 @@
return self._emit_guard(op, locs, fcond, save_exc=False,
is_guard_not_invalidated=True)
-
def emit_op_jump(self, op, arglocs, regalloc, fcond):
# The backend's logic assumes that the target code is in a piece of
# assembler that was also called with the same number of arguments,
@@ -362,7 +358,8 @@
self.gen_func_epilog()
return fcond
- def emit_op_call(self, op, arglocs, regalloc, fcond, force_index=NO_FORCE_INDEX):
+ def emit_op_call(self, op, arglocs, regalloc, fcond,
+ force_index=NO_FORCE_INDEX):
if force_index == NO_FORCE_INDEX:
force_index = self.write_new_force_index()
resloc = arglocs[0]
@@ -371,16 +368,18 @@
descr = op.getdescr()
size = descr.get_result_size()
signed = descr.is_result_signed()
- cond = self._emit_call(force_index, adr, arglist,
+ cond = self._emit_call(force_index, adr, arglist,
fcond, resloc, (size, signed))
return cond
- def _emit_call(self, force_index, adr, arglocs, fcond=c.AL,
- resloc=None, result_info=(-1,-1)):
+ def _emit_call(self, force_index, adr, arglocs, fcond=c.AL,
+ resloc=None, result_info=(-1, -1)):
if self.cpu.use_hf_abi:
- stack_args, adr = self._setup_call_hf(force_index, adr, arglocs, fcond, resloc, result_info)
+ stack_args, adr = self._setup_call_hf(force_index, adr,
+ arglocs, fcond, resloc, result_info)
else:
- stack_args, adr = self._setup_call_sf(force_index, adr, arglocs, fcond, resloc, result_info)
+ stack_args, adr = self._setup_call_sf(force_index, adr,
+ arglocs, fcond, resloc, result_info)
#the actual call
#self.mc.BKPT()
@@ -416,7 +415,7 @@
else:
n += DOUBLE_WORD
self._adjust_sp(-n, fcond=fcond)
- assert n % 8 == 0 # sanity check
+ assert n % 8 == 0 # sanity check
def _collect_stack_args_sf(self, arglocs):
n_args = len(arglocs)
@@ -448,9 +447,8 @@
else:
self.regalloc_push(arg)
- def _setup_call_sf(self, force_index, adr, arglocs, fcond=c.AL,
- resloc=None, result_info=(-1,-1)):
- n_args = len(arglocs)
+ def _setup_call_sf(self, force_index, adr, arglocs, fcond=c.AL,
+ resloc=None, result_info=(-1, -1)):
reg_args = count_reg_args(arglocs)
stack_args = self._collect_stack_args_sf(arglocs)
self._push_stack_args(stack_args)
@@ -494,10 +492,8 @@
self.mov_from_vfp_loc(loc, reg, r.all_regs[reg.value + 1])
return stack_args, adr
-
- def _setup_call_hf(self, force_index, adr, arglocs, fcond=c.AL,
- resloc=None, result_info=(-1,-1)):
- n_reg_args = n_vfp_args = 0
+ def _setup_call_hf(self, force_index, adr, arglocs, fcond=c.AL,
+ resloc=None, result_info=(-1, -1)):
non_float_locs = []
non_float_regs = []
float_locs = []
@@ -510,15 +506,15 @@
reg = r.argument_regs[len(non_float_regs)]
non_float_locs.append(arg)
non_float_regs.append(reg)
- else: # non-float argument that needs to go on the stack
+ else: # non-float argument that needs to go on the stack
count += 1
stack_args.append(arg)
else:
- if len(float_regs) < len(r.vfp_argument_regs):
+ if len(float_regs) < len(r.vfp_argument_regs):
reg = r.vfp_argument_regs[len(float_regs)]
float_locs.append(arg)
float_regs.append(reg)
- else: # float argument that needs to go on the stack
+ else: # float argument that needs to go on the stack
if count % 2 != 0:
stack_args.append(None)
count = 0
@@ -615,7 +611,7 @@
# GCFLAG_CARDS_SET is in this byte at 0x80
self.mc.TST_ri(r.ip.value, imm=0x80)
- js_location = self.mc.currpos() #
+ js_location = self.mc.currpos()
self.mc.BKPT()
else:
js_location = 0
@@ -651,7 +647,7 @@
# patch the JS above
offset = self.mc.currpos()
pmc = OverwritingBuilder(self.mc, js_location, WORD)
- pmc.B_offs(offset, c.NE) # We want to jump if the z flag is not set
+ pmc.B_offs(offset, c.NE) # We want to jump if the z flag isn't set
#
# case GCFLAG_CARDS_SET: emit a few instructions to do
# directly the card flag setting
@@ -660,17 +656,17 @@
# must save the register loc_index before it is mutated
self.mc.PUSH([loc_index.value])
tmp1 = loc_index
- tmp2 = arglocs[2]
+ tmp2 = arglocs[2]
# lr = byteofs
s = 3 + descr.jit_wb_card_page_shift
self.mc.MVN_rr(r.lr.value, loc_index.value,
imm=s, shifttype=shift.LSR)
-
+
# tmp1 = byte_index
self.mc.MOV_ri(r.ip.value, imm=7)
self.mc.AND_rr(tmp1.value, r.ip.value, loc_index.value,
imm=descr.jit_wb_card_page_shift, shifttype=shift.LSR)
-
+
# set the bit
self.mc.MOV_ri(tmp2.value, imm=1)
self.mc.LDRB_rr(r.ip.value, loc_base.value, r.lr.value)
@@ -684,7 +680,7 @@
# patch the JNS above
offset = self.mc.currpos()
pmc = OverwritingBuilder(self.mc, jns_location, WORD)
- pmc.B_offs(offset, c.EQ) # We want to jump if the z flag is set
+ pmc.B_offs(offset, c.EQ) # We want to jump if the z flag is set
offset = self.mc.currpos()
pmc = OverwritingBuilder(self.mc, jz_location, WORD)
@@ -693,7 +689,6 @@
emit_op_cond_call_gc_wb_array = emit_op_cond_call_gc_wb
-
def emit_op_setfield_gc(self, op, arglocs, regalloc, fcond):
value_loc, base_loc, ofs, size = arglocs
if size.value == 8:
@@ -846,7 +841,6 @@
return fcond
emit_op_setinteriorfield_raw = emit_op_setinteriorfield_gc
-
def emit_op_arraylen_gc(self, op, arglocs, regalloc, fcond):
res, base_loc, ofs = arglocs
self.mc.LDR_ri(res.value, base_loc.value, ofs.value)
@@ -1017,7 +1011,8 @@
# need the box here
if isinstance(args[4], Box):
length_box = args[4]
- length_loc = regalloc._ensure_value_is_boxed(args[4], forbidden_vars)
+ length_loc = regalloc._ensure_value_is_boxed(args[4],
+ forbidden_vars)
else:
length_box = TempInt()
length_loc = regalloc.force_allocate_reg(length_box,
@@ -1079,7 +1074,6 @@
else:
raise AssertionError("bad unicode item size")
-
emit_op_unicodelen = emit_op_strlen
def emit_op_unicodegetitem(self, op, arglocs, regalloc, fcond):
@@ -1109,7 +1103,6 @@
return fcond
-
def emit_op_force_token(self, op, arglocs, regalloc, fcond):
res_loc = arglocs[0]
self.mc.MOV_rr(res_loc.value, r.fp.value)
@@ -1199,11 +1192,11 @@
# corresponding result register because it was already allocated for
# the result
core = r.caller_resp
- if op.result:
- if resloc.is_vfp_reg():
+ if op.result:
+ if resloc.is_vfp_reg():
floats = r.caller_vfp_resp[1:]
else:
- core = r.caller_resp[1:] + [r.ip] # keep alignment
+ core = r.caller_resp[1:] + [r.ip] # keep alignment
with saved_registers(self.mc, core, floats):
# result of previous call is in r0
self.mov_loc_loc(arglocs[0], r.r1)
@@ -1253,7 +1246,7 @@
size = descr.get_result_size()
signed = descr.is_result_signed()
#
- self._emit_call(fail_index, adr, callargs, fcond,
+ self._emit_call(fail_index, adr, callargs, fcond,
resloc, (size, signed))
self.mc.LDR_ri(r.ip.value, r.fp.value)
@@ -1282,7 +1275,7 @@
size = descr.get_result_size()
signed = descr.is_result_signed()
#
- self._emit_call(fail_index, adr, callargs, fcond,
+ self._emit_call(fail_index, adr, callargs, fcond,
resloc, (size, signed))
# then reopen the stack
if gcrootmap:
@@ -1304,7 +1297,8 @@
regs_to_save.append(reg)
assert gcrootmap.is_shadow_stack
with saved_registers(self.mc, regs_to_save):
- self._emit_call(NO_FORCE_INDEX, imm(self.releasegil_addr), [], fcond)
+ self._emit_call(NO_FORCE_INDEX,
+ imm(self.releasegil_addr), [], fcond)
def call_reacquire_gil(self, gcrootmap, save_loc, fcond):
# save the previous result into the stack temporarily.
@@ -1341,7 +1335,6 @@
self.mc.gen_load_int(r.ip.value, fail_index)
self.mc.STR_ri(r.ip.value, r.fp.value)
-
def emit_op_call_malloc_gc(self, op, arglocs, regalloc, fcond):
self.emit_op_call(op, arglocs, regalloc, fcond)
self.propagate_memoryerror_if_r0_is_null()
@@ -1371,7 +1364,6 @@
self.mc.BKPT()
self.mc.NOP()
-
emit_op_float_add = gen_emit_float_op('float_add', 'VADD')
emit_op_float_sub = gen_emit_float_op('float_sub', 'VSUB')
emit_op_float_mul = gen_emit_float_op('float_mul', 'VMUL')
@@ -1426,8 +1418,10 @@
self.mc.VMOV_rc(res.value, r.ip.value, loc.value)
return fcond
- emit_op_convert_float_bytes_to_longlong = gen_emit_unary_float_op('float_bytes_to_longlong', 'VMOV_cc')
- emit_op_convert_longlong_bytes_to_float = gen_emit_unary_float_op('longlong_bytes_to_float', 'VMOV_cc')
+ emit_op_convert_float_bytes_to_longlong = gen_emit_unary_float_op(
+ 'float_bytes_to_longlong', 'VMOV_cc')
+ emit_op_convert_longlong_bytes_to_float = gen_emit_unary_float_op(
+ 'longlong_bytes_to_float', 'VMOV_cc')
def emit_op_read_timestamp(self, op, arglocs, regalloc, fcond):
assert 0, 'not supported'
More information about the pypy-commit
mailing list