[pypy-commit] pypy default: detect ABI at runtime and simplify the code that selects the ABI

bivab noreply at buildbot.pypy.org
Tue Apr 16 22:35:07 CEST 2013


Author: David Schneider <david.schneider at picle.org>
Branch: 
Changeset: r63434:4407fb5f5f5e
Date: 2013-04-16 22:33 +0200
http://bitbucket.org/pypy/pypy/changeset/4407fb5f5f5e/

Log:	detect ABI at runtime and simplify the code that selects the ABI

diff --git a/rpython/jit/backend/arm/assembler.py b/rpython/jit/backend/arm/assembler.py
--- a/rpython/jit/backend/arm/assembler.py
+++ b/rpython/jit/backend/arm/assembler.py
@@ -13,7 +13,7 @@
     operations as regalloc_operations,
     operations_with_guard as regalloc_operations_with_guard)
 from rpython.jit.backend.llsupport import jitframe
-from rpython.jit.backend.llsupport.assembler import DEBUG_COUNTER, debug_bridge
+from rpython.jit.backend.llsupport.assembler import DEBUG_COUNTER, debug_bridge, BaseAssembler
 from rpython.jit.backend.llsupport.asmmemmgr import MachineDataBlockWrapper
 from rpython.jit.backend.model import CompiledLoopToken
 from rpython.jit.codewriter.effectinfo import EffectInfo
@@ -25,7 +25,7 @@
 from rpython.rlib.rarithmetic import r_uint
 from rpython.rtyper.annlowlevel import llhelper, cast_instance_to_gcref
 from rpython.rtyper.lltypesystem import lltype, rffi
-
+from rpython.jit.backend.arm.detect import detect_hardfloat
 
 class AssemblerARM(ResOpAssembler):
 
@@ -49,6 +49,10 @@
         self.loop_run_counters = []
         self.gcrootmap_retaddr_forced = 0
 
+    def setup_once(self):
+        BaseAssembler.setup_once(self)
+        self.hf_abi = detect_hardfloat()
+
     def setup(self, looptoken):
         assert self.memcpy_addr != 0, 'setup_once() not called?'
         if we_are_translated():
diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py
--- a/rpython/jit/backend/arm/opassembler.py
+++ b/rpython/jit/backend/arm/opassembler.py
@@ -3,7 +3,6 @@
 from rpython.jit.backend.arm import registers as r
 from rpython.jit.backend.arm import shift
 from rpython.jit.backend.arm.arch import WORD, DOUBLE_WORD, JITFRAME_FIXED_SIZE
-
 from rpython.jit.backend.arm.helper.assembler import (gen_emit_op_by_helper_call,
                                                 gen_emit_op_unary_cmp,
                                                 gen_emit_guard_unary_cmp,
@@ -354,7 +353,7 @@
                                             result_info=(-1, -1),
                                             can_collect=1,
                                             reload_frame=False):
-        if self.cpu.hf_abi:
+        if self.hf_abi:
             stack_args, adr = self._setup_call_hf(adr, arglocs, fcond,
                                             resloc, result_info)
         else:
@@ -379,7 +378,7 @@
 
         # ensure the result is wellformed and stored in the correct location
         if resloc is not None:
-            if resloc.is_vfp_reg() and not self.cpu.hf_abi:
+            if resloc.is_vfp_reg() and not self.hf_abi:
                 # move result to the allocated register
                 self.mov_to_vfp_loc(r.r0, r.r1, resloc)
             elif resloc.is_reg() and result_info != (-1, -1):
diff --git a/rpython/jit/backend/arm/runner.py b/rpython/jit/backend/arm/runner.py
--- a/rpython/jit/backend/arm/runner.py
+++ b/rpython/jit/backend/arm/runner.py
@@ -6,6 +6,7 @@
 from rpython.jit.backend.llsupport.llmodel import AbstractLLCPU
 from rpython.rlib.jit_hooks import LOOP_RUN_CONTAINER
 from rpython.rtyper.lltypesystem import lltype, llmemory
+from rpython.jit.backend.arm.detect import detect_hardfloat
 
 jitframe.STATICSIZE = JITFRAME_FIXED_SIZE
 
@@ -16,7 +17,7 @@
     supports_floats = True
     supports_longlong = False # XXX requires an implementation of
                               # read_timestamp that works in user mode
-    supports_singlefloats = True
+    supports_singlefloats = not detect_hardfloat()
 
     from rpython.jit.backend.arm.arch import JITFRAME_FIXED_SIZE
     all_reg_indexes = range(len(all_regs))
@@ -112,22 +113,10 @@
 
 
 class CPU_ARM(AbstractARMCPU):
-    """ARM v7 uses softfp ABI, requires vfp"""
+    """ARM v7"""
     backend_name = "armv7"
 
-
-class CPU_ARMHF(AbstractARMCPU):
-    """ARM v7 uses hardfp ABI, requires vfp"""
-    hf_abi = True
-    backend_name = "armv7hf"
-    supports_floats = True
-    supports_singlefloats = False
-
-
-class CPU_ARMv6HF(AbstractARMCPU):
+class CPU_ARMv6(AbstractARMCPU):
     """ ARM v6, uses hardfp ABI, requires vfp"""
-    hf_abi = True
     arch_version = 6
-    backend_name = "armv6hf"
-    supports_floats = True
-    supports_singlefloats = False
+    backend_name = "armv6"
diff --git a/rpython/jit/backend/detect_cpu.py b/rpython/jit/backend/detect_cpu.py
--- a/rpython/jit/backend/detect_cpu.py
+++ b/rpython/jit/backend/detect_cpu.py
@@ -61,8 +61,6 @@
                 model = 'x86-without-sse2'
     if model.startswith('arm'):
         from rpython.jit.backend.arm.detect import detect_hardfloat, detect_float
-        if detect_hardfloat():
-            model += 'hf'
         assert detect_float(), 'the JIT-compiler requires a vfp unit'
     return model
 
@@ -77,12 +75,10 @@
         return "rpython.jit.backend.x86.runner", "CPU_X86_64"
     elif backend_name == 'cli':
         return "rpython.jit.backend.cli.runner", "CliCPU"
-    elif backend_name == 'armv6hf':
-        return "rpython.jit.backend.arm.runner", "CPU_ARMv6HF"
-    elif backend_name == 'armv7':
+    elif backend_name.startswith('armv6'):
+        return "rpython.jit.backend.arm.runner", "CPU_ARMv6"
+    elif backend_name.startswith('armv7'):
         return "rpython.jit.backend.arm.runner", "CPU_ARM"
-    elif backend_name == 'armv7hf':
-        return "rpython.jit.backend.arm.runner", "CPU_ARMHF"
     else:
         raise ProcessorAutodetectError, (
             "we have no JIT backend for this cpu: '%s'" % backend_name)


More information about the pypy-commit mailing list