[pypy-commit] pypy arm-backend-2: move is_comparison_or_ovf_op to llsuport

bivab noreply at buildbot.pypy.org
Thu Dec 29 09:57:37 CET 2011


Author: David Schneider <david.schneider at picle.org>
Branch: arm-backend-2
Changeset: r50947:d8831765a657
Date: 2011-12-29 09:47 +0100
http://bitbucket.org/pypy/pypy/changeset/d8831765a657/

Log:	move is_comparison_or_ovf_op to llsuport

diff --git a/pypy/jit/backend/llsupport/regalloc.py b/pypy/jit/backend/llsupport/regalloc.py
--- a/pypy/jit/backend/llsupport/regalloc.py
+++ b/pypy/jit/backend/llsupport/regalloc.py
@@ -527,6 +527,17 @@
     return longevity, useful
 
 
+def is_comparison_or_ovf_op(opnum):
+    from pypy.jit.metainterp.resoperation import opclasses
+    cls = opclasses[opnum]
+    # hack hack: in theory they are instance method, but they don't use
+    # any instance field, we can use a fake object
+    class Fake(cls):
+        pass
+    op = Fake(None)
+    return op.is_comparison() or op.is_ovf()
+
+
 def not_implemented(msg):
     os.write(2, '[llsupport/regalloc] %s\n' % msg)
     raise NotImplementedError(msg)
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
@@ -20,7 +20,7 @@
 from pypy.jit.backend.llsupport.descr import BaseCallDescr, BaseSizeDescr
 from pypy.jit.backend.llsupport.descr import InteriorFieldDescr
 from pypy.jit.backend.llsupport.regalloc import FrameManager, RegisterManager,\
-     TempBox, compute_vars_longevity
+     TempBox, compute_vars_longevity, is_comparison_or_ovf_op
 from pypy.jit.backend.x86.arch import WORD, FRAME_FIXED_SIZE
 from pypy.jit.backend.x86.arch import IS_X86_32, IS_X86_64, MY_COPY_OF_REGS
 from pypy.rlib.rarithmetic import r_longlong
@@ -1461,16 +1461,6 @@
 def add_none_argument(fn):
     return lambda self, op: fn(self, op, None)
 
-def is_comparison_or_ovf_op(opnum):
-    from pypy.jit.metainterp.resoperation import opclasses
-    cls = opclasses[opnum]
-    # hack hack: in theory they are instance method, but they don't use
-    # any instance field, we can use a fake object
-    class Fake(cls):
-        pass
-    op = Fake(None)
-    return op.is_comparison() or op.is_ovf()
-
 for name, value in RegAlloc.__dict__.iteritems():
     if name.startswith('consider_'):
         name = name[len('consider_'):]


More information about the pypy-commit mailing list