Author: David Schneider <david.schnei...@picle.org> Branch: arm-backend-2 Changeset: r48438:e9b9f641f506 Date: 2011-10-25 16:30 +0200 http://bitbucket.org/pypy/pypy/changeset/e9b9f641f506/
Log: add names to the functions generated to emit code in the assembler diff --git a/pypy/jit/backend/arm/helper/assembler.py b/pypy/jit/backend/arm/helper/assembler.py --- a/pypy/jit/backend/arm/helper/assembler.py +++ b/pypy/jit/backend/arm/helper/assembler.py @@ -6,7 +6,7 @@ from pypy.rlib.rarithmetic import r_uint, r_longlong, intmask from pypy.jit.metainterp.resoperation import rop -def gen_emit_op_unary_cmp(true_cond, false_cond): +def gen_emit_op_unary_cmp(name, true_cond, false_cond): def f(self, op, arglocs, regalloc, fcond): assert fcond is not None reg, res = arglocs @@ -14,9 +14,10 @@ self.mc.MOV_ri(res.value, 1, true_cond) self.mc.MOV_ri(res.value, 0, false_cond) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_op_ri(opname): +def gen_emit_op_ri(name, opname): ri_op = getattr(AbstractARMv7Builder, '%s_ri' % opname) rr_op = getattr(AbstractARMv7Builder, '%s_rr' % opname) def f(self, op, arglocs, regalloc, fcond): @@ -27,9 +28,10 @@ else: rr_op(self.mc, res.value, l0.value, l1.value) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_op_by_helper_call(opname): +def gen_emit_op_by_helper_call(name, opname): helper = getattr(AbstractARMv7Builder, opname) def f(self, op, arglocs, regalloc, fcond): assert fcond is not None @@ -40,9 +42,10 @@ with saved_registers(self.mc, regs, r.caller_vfp_resp): helper(self.mc, fcond) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_cmp_op(condition): +def gen_emit_cmp_op(name, condition): def f(self, op, arglocs, regalloc, fcond): l0, l1, res = arglocs @@ -54,9 +57,10 @@ self.mc.MOV_ri(res.value, 1, cond=condition) self.mc.MOV_ri(res.value, 0, cond=inv) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_cmp_op_guard(condition): +def gen_emit_cmp_op_guard(name, condition): def f(self, op, guard, arglocs, regalloc, fcond): l0 = arglocs[0] l1 = arglocs[1] @@ -72,24 +76,27 @@ cond = inv self._emit_guard(guard, arglocs[2:], cond) return fcond + f.__name__ = 'emit_guard_%s' % name + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_float_op(opname): +def gen_emit_float_op(name, opname): op_rr = getattr(AbstractARMv7Builder, opname) def f(self, op, arglocs, regalloc, fcond): arg1, arg2, result = arglocs op_rr(self.mc, result.value, arg1.value, arg2.value) return fcond return f -def gen_emit_unary_float_op(opname): +def gen_emit_unary_float_op(name, opname): op_rr = getattr(AbstractARMv7Builder, opname) def f(self, op, arglocs, regalloc, fcond): arg1, result = arglocs op_rr(self.mc, result.value, arg1.value) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_float_cmp_op(cond): +def gen_emit_float_cmp_op(name, cond): def f(self, op, arglocs, regalloc, fcond): arg1, arg2, res = arglocs inv = c.get_opposite_of(cond) @@ -98,9 +105,10 @@ self.mc.MOV_ri(res.value, 1, cond=cond) self.mc.MOV_ri(res.value, 0, cond=inv) return fcond + f.__name__ = 'emit_op_%s' % name return f -def gen_emit_float_cmp_op_guard(guard_cond): +def gen_emit_float_cmp_op_guard(name, guard_cond): def f(self, op, guard, arglocs, regalloc, fcond): arg1 = arglocs[0] arg2 = arglocs[1] @@ -113,6 +121,7 @@ cond = inv self._emit_guard(guard, arglocs[2:], cond) return fcond + f.__name__ = 'emit_guard_%s' % name return f class saved_registers(object): 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 @@ -9,6 +9,7 @@ from pypy.jit.backend.arm.helper.assembler import (gen_emit_op_by_helper_call, gen_emit_op_unary_cmp, + gen_emit_guard_unary_cmp, gen_emit_op_ri, gen_emit_cmp_op, gen_emit_cmp_op_guard, @@ -117,45 +118,45 @@ self._emit_guard_overflow(guard, arglocs[3:], fcond) return fcond - emit_op_int_floordiv = gen_emit_op_by_helper_call('DIV') - emit_op_int_mod = gen_emit_op_by_helper_call('MOD') - emit_op_uint_floordiv = gen_emit_op_by_helper_call('UDIV') + emit_op_int_floordiv = gen_emit_op_by_helper_call('int_floordiv', 'DIV') + emit_op_int_mod = gen_emit_op_by_helper_call('int_mod', 'MOD') + emit_op_uint_floordiv = gen_emit_op_by_helper_call('uint_floordiv', 'UDIV') - emit_op_int_and = gen_emit_op_ri('AND') - emit_op_int_or = gen_emit_op_ri('ORR') - emit_op_int_xor = gen_emit_op_ri('EOR') - emit_op_int_lshift = gen_emit_op_ri('LSL') - emit_op_int_rshift = gen_emit_op_ri('ASR') - emit_op_uint_rshift = gen_emit_op_ri('LSR') + emit_op_int_and = gen_emit_op_ri('int_and', 'AND') + emit_op_int_or = gen_emit_op_ri('int_or', 'ORR') + emit_op_int_xor = gen_emit_op_ri('int_xor', 'EOR') + emit_op_int_lshift = gen_emit_op_ri('int_lshift', 'LSL') + emit_op_int_rshift = gen_emit_op_ri('int_rshift', 'ASR') + emit_op_uint_rshift = gen_emit_op_ri('uint_rshift', 'LSR') - emit_op_int_lt = gen_emit_cmp_op(c.LT) - emit_op_int_le = gen_emit_cmp_op(c.LE) - emit_op_int_eq = gen_emit_cmp_op(c.EQ) - emit_op_int_ne = gen_emit_cmp_op(c.NE) - emit_op_int_gt = gen_emit_cmp_op(c.GT) - emit_op_int_ge = gen_emit_cmp_op(c.GE) + emit_op_int_lt = gen_emit_cmp_op('int_lt', c.LT) + emit_op_int_le = gen_emit_cmp_op('int_le', c.LE) + emit_op_int_eq = gen_emit_cmp_op('int_eq', c.EQ) + emit_op_int_ne = gen_emit_cmp_op('int_ne', c.NE) + emit_op_int_gt = gen_emit_cmp_op('int_gt', c.GT) + emit_op_int_ge = gen_emit_cmp_op('int_ge', c.GE) - emit_op_uint_le = gen_emit_cmp_op(c.LS) - emit_op_uint_gt = gen_emit_cmp_op(c.HI) + emit_op_uint_le = gen_emit_cmp_op('uint_le', c.LS) + emit_op_uint_gt = gen_emit_cmp_op('uint_gt', c.HI) - emit_op_uint_lt = gen_emit_cmp_op(c.HI) - emit_op_uint_ge = gen_emit_cmp_op(c.LS) + emit_op_uint_lt = gen_emit_cmp_op('uint_lt', c.HI) + emit_op_uint_ge = gen_emit_cmp_op('uint_ge', c.LS) emit_op_ptr_eq = emit_op_int_eq emit_op_ptr_ne = emit_op_int_ne - emit_guard_int_lt = gen_emit_cmp_op_guard(c.LT) - emit_guard_int_le = gen_emit_cmp_op_guard(c.LE) - emit_guard_int_eq = gen_emit_cmp_op_guard(c.EQ) - emit_guard_int_ne = gen_emit_cmp_op_guard(c.NE) - emit_guard_int_gt = gen_emit_cmp_op_guard(c.GT) - emit_guard_int_ge = gen_emit_cmp_op_guard(c.GE) + emit_guard_int_lt = gen_emit_cmp_op_guard('int_lt', c.LT) + emit_guard_int_le = gen_emit_cmp_op_guard('int_le', c.LE) + emit_guard_int_eq = gen_emit_cmp_op_guard('int_eq', c.EQ) + emit_guard_int_ne = gen_emit_cmp_op_guard('int_ne', c.NE) + emit_guard_int_gt = gen_emit_cmp_op_guard('int_gt', c.GT) + emit_guard_int_ge = gen_emit_cmp_op_guard('int_ge', c.GE) - emit_guard_uint_le = gen_emit_cmp_op_guard(c.LS) - emit_guard_uint_gt = gen_emit_cmp_op_guard(c.HI) + emit_guard_uint_le = gen_emit_cmp_op_guard('uint_le', c.LS) + emit_guard_uint_gt = gen_emit_cmp_op_guard('uint_gt', c.HI) - emit_guard_uint_lt = gen_emit_cmp_op_guard(c.HI) - emit_guard_uint_ge = gen_emit_cmp_op_guard(c.LS) + emit_guard_uint_lt = gen_emit_cmp_op_guard('uint_lt', c.HI) + emit_guard_uint_ge = gen_emit_cmp_op_guard('uint_ge', c.LS) emit_guard_ptr_eq = emit_guard_int_eq emit_guard_ptr_ne = emit_guard_int_ne @@ -169,8 +170,8 @@ _mixin_ = True - emit_op_int_is_true = gen_emit_op_unary_cmp(c.NE, c.EQ) - emit_op_int_is_zero = gen_emit_op_unary_cmp(c.EQ, c.NE) + emit_op_int_is_true = gen_emit_op_unary_cmp('int_is_true', c.NE, c.EQ) + emit_op_int_is_zero = gen_emit_op_unary_cmp('int_is_zero', c.EQ, c.NE) def emit_op_int_invert(self, op, arglocs, regalloc, fcond): reg, res = arglocs @@ -1142,28 +1143,28 @@ class FloatOpAssemlber(object): _mixin_ = True - emit_op_float_add = gen_emit_float_op('VADD') - emit_op_float_sub = gen_emit_float_op('VSUB') - emit_op_float_mul = gen_emit_float_op('VMUL') - emit_op_float_truediv = gen_emit_float_op('VDIV') + 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') + emit_op_float_truediv = gen_emit_float_op('float_truediv', 'VDIV') - emit_op_float_neg = gen_emit_unary_float_op('VNEG') - emit_op_float_abs = gen_emit_unary_float_op('VABS') - emit_op_math_sqrt = gen_emit_unary_float_op('VSQRT') + emit_op_float_neg = gen_emit_unary_float_op('float_neg', 'VNEG') + emit_op_float_abs = gen_emit_unary_float_op('float_abs', 'VABS') + emit_op_math_sqrt = gen_emit_unary_float_op('math_sqrt', 'VSQRT') - emit_op_float_lt = gen_emit_float_cmp_op(c.VFP_LT) - emit_op_float_le = gen_emit_float_cmp_op(c.VFP_LE) - emit_op_float_eq = gen_emit_float_cmp_op(c.EQ) - emit_op_float_ne = gen_emit_float_cmp_op(c.NE) - emit_op_float_gt = gen_emit_float_cmp_op(c.GT) - emit_op_float_ge = gen_emit_float_cmp_op(c.GE) + emit_op_float_lt = gen_emit_float_cmp_op('float_lt', c.VFP_LT) + emit_op_float_le = gen_emit_float_cmp_op('float_le', c.VFP_LE) + emit_op_float_eq = gen_emit_float_cmp_op('float_eq', c.EQ) + emit_op_float_ne = gen_emit_float_cmp_op('float_ne', c.NE) + emit_op_float_gt = gen_emit_float_cmp_op('float_gt', c.GT) + emit_op_float_ge = gen_emit_float_cmp_op('float_ge', c.GE) - emit_guard_float_lt = gen_emit_float_cmp_op_guard(c.VFP_LT) - emit_guard_float_le = gen_emit_float_cmp_op_guard(c.VFP_LE) - emit_guard_float_eq = gen_emit_float_cmp_op_guard(c.EQ) - emit_guard_float_ne = gen_emit_float_cmp_op_guard(c.NE) - emit_guard_float_gt = gen_emit_float_cmp_op_guard(c.GT) - emit_guard_float_ge = gen_emit_float_cmp_op_guard(c.GE) + emit_guard_float_lt = gen_emit_float_cmp_op_guard('float_lt', c.VFP_LT) + emit_guard_float_le = gen_emit_float_cmp_op_guard('float_le', c.VFP_LE) + emit_guard_float_eq = gen_emit_float_cmp_op_guard('float_eq', c.EQ) + emit_guard_float_ne = gen_emit_float_cmp_op_guard('float_ne', c.NE) + emit_guard_float_gt = gen_emit_float_cmp_op_guard('float_gt', c.GT) + emit_guard_float_ge = gen_emit_float_cmp_op_guard('float_ge', c.GE) def emit_op_cast_float_to_int(self, op, arglocs, regalloc, fcond): arg, temp, res = arglocs _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit