[pypy-commit] pypy s390x-backend: extending the structure, added first test to check the assembly of int_add
plan_rich
noreply at buildbot.pypy.org
Tue Oct 13 17:52:38 CEST 2015
Author: Richard Plangger <planrichi at gmail.com>
Branch: s390x-backend
Changeset: r80164:f086429ff834
Date: 2015-10-13 17:52 +0200
http://bitbucket.org/pypy/pypy/changeset/f086429ff834/
Log: extending the structure, added first test to check the assembly of
int_add
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
@@ -115,7 +115,7 @@
elif backend_name == MODEL_ARM:
return "rpython.jit.backend.arm.runner", "CPU_ARM"
elif backend_name == MODEL_S390_64:
- return "rpython.jit.backend.zarch.runner", "CPU_ZARCH"
+ return "rpython.jit.backend.zarch.runner", "CPU_S390_64"
else:
raise ProcessorAutodetectError, (
"we have no JIT backend for this cpu: '%s'" % backend_name)
diff --git a/rpython/jit/backend/zarch/assembler.py b/rpython/jit/backend/zarch/assembler.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/assembler.py
@@ -0,0 +1,6 @@
+from rpython.jit.backend.llsupport.assembler import GuardToken, BaseAssembler
+
+class AssemblerZARCH(BaseAssembler):
+ def emit_op_int_add(self, op):
+ pass
+
diff --git a/rpython/jit/backend/zarch/conditions.py b/rpython/jit/backend/zarch/conditions.py
new file mode 100644
diff --git a/rpython/jit/backend/zarch/instruction_builder.py b/rpython/jit/backend/zarch/instruction_builder.py
new file mode 100644
diff --git a/rpython/jit/backend/zarch/locations.py b/rpython/jit/backend/zarch/locations.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/locations.py
@@ -0,0 +1,3 @@
+
+
+imm = None
diff --git a/rpython/jit/backend/zarch/registers.py b/rpython/jit/backend/zarch/registers.py
new file mode 100644
diff --git a/rpython/jit/backend/zarch/runner.py b/rpython/jit/backend/zarch/runner.py
--- a/rpython/jit/backend/zarch/runner.py
+++ b/rpython/jit/backend/zarch/runner.py
@@ -3,5 +3,5 @@
class AbstractZARCHCPU(AbstractLLCPU):
pass
-class CPU_S390X(AbstractZARCHCPU):
+class CPU_S390_64(AbstractZARCHCPU):
pass
diff --git a/rpython/jit/backend/zarch/test/conftest.py b/rpython/jit/backend/zarch/test/conftest.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/test/conftest.py
@@ -0,0 +1,13 @@
+"""
+This disables the backend tests on non zarch platforms.
+Note that you need "--slow" to run translation tests.
+"""
+import py, os
+from rpython.jit.backend import detect_cpu
+
+cpu = detect_cpu.autodetect()
+
+def pytest_collect_directory(path, parent):
+ if not cpu.startswith('s390x'):
+ py.test.skip("zarch tests skipped: cpu is %r" % (cpu,))
+pytest_collect_file = pytest_collect_directory
diff --git a/rpython/jit/backend/zarch/test/support.py b/rpython/jit/backend/zarch/test/support.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/test/support.py
@@ -0,0 +1,4 @@
+
+
+def run_asm():
+ pass
diff --git a/rpython/jit/backend/zarch/test/test_assembler.py b/rpython/jit/backend/zarch/test/test_assembler.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/test/test_assembler.py
@@ -0,0 +1,37 @@
+from rpython.jit.backend.zarch import conditions as c
+from rpython.jit.backend.zarch import registers as r
+from rpython.jit.backend.zarch.assembler import AssemblerZARCH
+from rpython.jit.backend.zarch.locations import imm
+from rpython.jit.backend.zarch.test.support import run_asm
+from rpython.jit.backend.detect_cpu import getcpuclass
+from rpython.jit.metainterp.resoperation import rop
+from rpython.jit.codewriter import longlong
+
+from rpython.rtyper.annlowlevel import llhelper
+from rpython.rtyper.lltypesystem import lltype, rffi
+from rpython.jit.metainterp.history import JitCellToken
+from rpython.jit.backend.model import CompiledLoopToken
+from rpython.rtyper.lltypesystem import lltype, llmemory, rffi
+from rpython.rtyper.annlowlevel import llhelper
+from rpython.rlib.objectmodel import specialize
+from rpython.rlib.debug import ll_assert
+
+CPU = getcpuclass()
+
+
+class TestRunningAssembler(object):
+ def setup_method(self, method):
+ cpu = CPU(None, None)
+ self.a = AssemblerZARCH(cpu)
+ self.a.setup_once()
+ token = JitCellToken()
+ clt = CompiledLoopToken(cpu, 0)
+ clt.allgcrefs = []
+ token.compiled_loop_token = clt
+ self.a.setup(token)
+
+ def test_make_operation_list(self):
+ i = rop.INT_ADD
+ from rpython.jit.backend.zarch import assembler
+ assert assembler.asm_operations[i] \
+ is AssemblerZARCH.emit_op_int_add.im_func
More information about the pypy-commit
mailing list