[pypy-svn] r64058 - in pypy/branch/pyjitpl5-simplify/pypy: config jit/backend jit/metainterp translator

arigo at codespeak.net arigo at codespeak.net
Tue Apr 14 14:10:37 CEST 2009


Author: arigo
Date: Tue Apr 14 14:10:36 2009
New Revision: 64058

Modified:
   pypy/branch/pyjitpl5-simplify/pypy/config/translationoption.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/backend/detect_cpu.py
   pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
   pypy/branch/pyjitpl5-simplify/pypy/translator/driver.py
Log:
Add the option --jit-backend=xx to translate.py,
to choose a specific backend.  (Don't forget to
also say --jit.)


Modified: pypy/branch/pyjitpl5-simplify/pypy/config/translationoption.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/config/translationoption.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/config/translationoption.py	Tue Apr 14 14:10:36 2009
@@ -113,6 +113,9 @@
                default=False, cmdline="--jit",
                requires=[("translation.gc", "boehm"),
                          ("translation.list_comprehension_operations", True)]),
+    ChoiceOption("jit_backend", "choose the backend for the JIT",
+                 ["auto", "minimal", "x86"],
+                 default="auto", cmdline="--jit-backend"),
 
     # misc
     BoolOption("verbose", "Print extra information", default=False),

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/backend/detect_cpu.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/backend/detect_cpu.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/backend/detect_cpu.py	Tue Apr 14 14:10:36 2009
@@ -40,10 +40,13 @@
     except KeyError:
         raise ProcessorAutodetectError, "unsupported processor '%s'" % mach
 
-def getcpuclass():
-    cpu = autodetect()
-    if cpu == 'i386':
+def getcpuclass(backend_name="auto"):
+    if backend_name == "auto":
+        backend_name = autodetect()
+    if backend_name in ('i386', 'x86'):
         from pypy.jit.backend.x86.runner import CPU
+    elif backend_name == 'minimal':
+        from pypy.jit.backend.minimal.runner import CPU
     else:
         raise ProcessorAutodetectError, "unsupported cpu '%s'" % cpu
     return CPU

Modified: pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/jit/metainterp/warmspot.py	Tue Apr 14 14:10:36 2009
@@ -23,10 +23,10 @@
 
 from pypy.jit.metainterp.simple_optimize import Optimizer
 
-def apply_jit(translator, **kwds):
+def apply_jit(translator, backend_name="auto", **kwds):
     if 'CPUClass' not in kwds:
         from pypy.jit.backend.detect_cpu import getcpuclass
-        kwds['CPUClass'] = getcpuclass()
+        kwds['CPUClass'] = getcpuclass(backend_name)
     warmrunnerdesc = WarmRunnerDesc(translator,
                                     translate_support_code=True,
                                     listops=True,

Modified: pypy/branch/pyjitpl5-simplify/pypy/translator/driver.py
==============================================================================
--- pypy/branch/pyjitpl5-simplify/pypy/translator/driver.py	(original)
+++ pypy/branch/pyjitpl5-simplify/pypy/translator/driver.py	Tue Apr 14 14:10:36 2009
@@ -374,7 +374,8 @@
         self.jitpolicy = get_policy(self)
         #
         from pypy.jit.metainterp.warmspot import apply_jit
-        apply_jit(self.translator, policy=self.jitpolicy)
+        apply_jit(self.translator, policy=self.jitpolicy,
+                  backend_name=config.translation.jit_backend)
         #
         self.log.info("the JIT compiler was generated")
     #



More information about the Pypy-commit mailing list