Author: Armin Rigo <[email protected]>
Branch: jit-resizable-list
Changeset: r44659:1570bcf08e71
Date: 2011-06-03 11:43 +0200
http://bitbucket.org/pypy/pypy/changeset/1570bcf08e71/
Log: Unify these two dictionaries.
diff --git a/pypy/jit/backend/x86/assembler.py
b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -864,15 +864,10 @@
def regalloc_perform_discard(self, op, arglocs):
genop_discard_list[op.getopnum()](self, op, arglocs)
- def regalloc_perform_llong(self, op, arglocs, resloc):
+ def regalloc_perform_oopspeccall(self, op, arglocs, resloc):
effectinfo = op.getdescr().get_extra_info()
oopspecindex = effectinfo.oopspecindex
- genop_llong_list[oopspecindex](self, op, arglocs, resloc)
-
- def regalloc_perform_math(self, op, arglocs, resloc):
- effectinfo = op.getdescr().get_extra_info()
- oopspecindex = effectinfo.oopspecindex
- genop_math_list[oopspecindex](self, op, arglocs, resloc)
+ genop_oopspeccall_list[oopspecindex](self, op, arglocs, resloc)
def regalloc_perform_with_guard(self, op, guard_op, faillocs,
arglocs, resloc, current_depths):
@@ -2212,9 +2207,8 @@
genop_discard_list = [Assembler386.not_implemented_op_discard] * rop._LAST
genop_list = [Assembler386.not_implemented_op] * rop._LAST
-genop_llong_list = {}
-genop_math_list = {}
genop_guard_list = [Assembler386.not_implemented_op_guard] * rop._LAST
+genop_oopspeccall_list = {}
for name, value in Assembler386.__dict__.iteritems():
if name.startswith('genop_discard_'):
@@ -2225,14 +2219,11 @@
opname = name[len('genop_guard_'):]
num = getattr(rop, opname.upper())
genop_guard_list[num] = value
- elif name.startswith('genop_llong_'):
- opname = name[len('genop_llong_'):]
- num = getattr(EffectInfo, 'OS_LLONG_' + opname.upper())
- genop_llong_list[num] = value
- elif name.startswith('genop_math_'):
- opname = name[len('genop_math_'):]
- num = getattr(EffectInfo, 'OS_MATH_' + opname.upper())
- genop_math_list[num] = value
+ elif (name.startswith('genop_llong_') or
+ name.startswith('genop_math_')):
+ opname = name[len('genop_'):]
+ num = getattr(EffectInfo, 'OS_' + opname.upper())
+ genop_oopspeccall_list[num] = value
elif name.startswith('genop_'):
opname = name[len('genop_'):]
num = getattr(rop, opname.upper())
diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -326,15 +326,10 @@
self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs))
self.assembler.regalloc_perform(op, arglocs, result_loc)
- def PerformLLong(self, op, arglocs, result_loc):
+ def PerformOOPSpecCall(self, op, arglocs, result_loc):
if not we_are_translated():
self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs))
- self.assembler.regalloc_perform_llong(op, arglocs, result_loc)
-
- def PerformMath(self, op, arglocs, result_loc):
- if not we_are_translated():
- self.assembler.dump('%s <- %s(%s)' % (result_loc, op, arglocs))
- self.assembler.regalloc_perform_math(op, arglocs, result_loc)
+ self.assembler.regalloc_perform_oopspeccall(op, arglocs, result_loc)
def locs_for_fail(self, guard_op):
return [self.loc(v) for v in guard_op.getfailargs()]
@@ -699,7 +694,7 @@
args = [op.getarg(1), op.getarg(2)]
loc1 = self.load_xmm_aligned_16_bytes(args[1])
loc0 = self.xrm.force_result_in_reg(op.result, args[0], args)
- self.PerformLLong(op, [loc0, loc1], loc0)
+ self.PerformOOPSpecCall(op, [loc0, loc1], loc0)
self.xrm.possibly_free_vars(args)
def _consider_llong_eq_ne_xx(self, op):
@@ -713,7 +708,7 @@
loc3 = self.xrm.force_allocate_reg(tmpxvar, args)
self.xrm.possibly_free_var(tmpxvar)
loc0 = self.rm.force_allocate_reg(op.result, need_lower_byte=True)
- self.PerformLLong(op, [loc1, loc2, loc3], loc0)
+ self.PerformOOPSpecCall(op, [loc1, loc2, loc3], loc0)
self.xrm.possibly_free_vars(args)
def _maybe_consider_llong_lt(self, op):
@@ -728,7 +723,7 @@
assert isinstance(box, BoxFloat)
loc1 = self.xrm.make_sure_var_in_reg(box)
loc0 = self.rm.force_allocate_reg(op.result)
- self.PerformLLong(op, [loc1], loc0)
+ self.PerformOOPSpecCall(op, [loc1], loc0)
self.xrm.possibly_free_var(box)
return True
@@ -736,7 +731,7 @@
# accept an argument in a xmm register or in the stack
loc1 = self.xrm.loc(op.getarg(1))
loc0 = self.rm.force_allocate_reg(op.result)
- self.PerformLLong(op, [loc1], loc0)
+ self.PerformOOPSpecCall(op, [loc1], loc0)
self.xrm.possibly_free_var(op.getarg(1))
def _loc_of_const_longlong(self, value64):
@@ -755,19 +750,19 @@
tmpxvar = TempBox()
loc2 = self.xrm.force_allocate_reg(tmpxvar, [op.result])
self.xrm.possibly_free_var(tmpxvar)
- self.PerformLLong(op, [loc1, loc2], loc0)
+ self.PerformOOPSpecCall(op, [loc1, loc2], loc0)
self.rm.possibly_free_var(box)
def _consider_llong_from_uint(self, op):
assert IS_X86_32
loc0 = self.xrm.force_allocate_reg(op.result)
loc1 = self.rm.make_sure_var_in_reg(op.getarg(1))
- self.PerformLLong(op, [loc1], loc0)
+ self.PerformOOPSpecCall(op, [loc1], loc0)
self.rm.possibly_free_vars_for_op(op)
def _consider_math_sqrt(self, op):
loc0 = self.xrm.force_result_in_reg(op.result, op.getarg(1))
- self.PerformMath(op, [loc0], loc0)
+ self.PerformOOPSpecCall(op, [loc0], loc0)
self.xrm.possibly_free_var(op.getarg(1))
def _call(self, op, arglocs, force_store=[], guard_not_forced_op=None):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit