Author: Richard Plangger <[email protected]>
Branch: s390x-backend
Changeset: r80210:7881dc958ddb
Date: 2015-10-14 17:18 +0200
http://bitbucket.org/pypy/pypy/changeset/7881dc958ddb/

Log:    copied locations and added gp registers (as well as floating
        register)

diff --git a/rpython/jit/backend/arm/locations.py 
b/rpython/jit/backend/arm/locations.py
--- a/rpython/jit/backend/arm/locations.py
+++ b/rpython/jit/backend/arm/locations.py
@@ -1,7 +1,6 @@
 from rpython.jit.metainterp.history import INT, FLOAT
 from rpython.jit.backend.arm.arch import WORD, DOUBLE_WORD, JITFRAME_FIXED_SIZE
 
-
 class AssemblerLocation(object):
     _immutable_ = True
     type = INT
diff --git a/rpython/jit/backend/zarch/arch.py 
b/rpython/jit/backend/zarch/arch.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/backend/zarch/arch.py
@@ -0,0 +1,5 @@
+
+# TODO
+WORD = 8
+
+JITFRAME_FIXED_SIZE = 48
diff --git a/rpython/jit/backend/zarch/locations.py 
b/rpython/jit/backend/zarch/locations.py
--- a/rpython/jit/backend/zarch/locations.py
+++ b/rpython/jit/backend/zarch/locations.py
@@ -1,3 +1,175 @@
+from rpython.jit.metainterp.history import INT, FLOAT
+from rpython.jit.backend.zarch.arch import WORD, JITFRAME_FIXED_SIZE
 
+class AssemblerLocation(object):
+    _immutable_ = True
+    type = INT
 
-imm = None
+    def is_imm(self):
+        return False
+
+    def is_stack(self):
+        return False
+
+    def is_raw_sp(self):
+        return False
+
+    def is_core_reg(self):
+        return False
+
+    def is_vfp_reg(self):
+        return False
+
+    def is_imm_float(self):
+        return False
+
+    def is_float(self):
+        return False
+
+    def as_key(self):
+        raise NotImplementedError
+
+    def get_position(self):
+        raise NotImplementedError # only for stack
+
+class RegisterLocation(AssemblerLocation):
+    _immutable_ = True
+    width = WORD
+
+    def __init__(self, value):
+        self.value = value
+
+    def __repr__(self):
+        return 'r%d' % self.value
+
+    def is_core_reg(self):
+        return True
+
+    def as_key(self):       # 0 <= as_key <= 15
+        return self.value
+
+
+class FloatRegisterLocation(RegisterLocation):
+    _immutable_ = True
+    type = FLOAT
+    width = WORD
+
+    def __repr__(self):
+        return 'f%d' % self.value
+
+    def is_core_reg(self):
+        return False
+
+    def is_vfp_reg(self):
+        return True
+
+    def as_key(self):            # 20 <= as_key <= 35
+        return self.value + 20
+
+    def is_float(self):
+        return True
+
+class ImmLocation(AssemblerLocation):
+    _immutable_ = True
+    width = WORD
+
+    def __init__(self, value):
+        self.value = value
+
+    def getint(self):
+        return self.value
+
+    def __repr__(self):
+        return "imm(%d)" % (self.value)
+
+    def is_imm(self):
+        return True
+
+
+class ConstFloatLoc(AssemblerLocation):
+    """This class represents an imm float value which is stored in memory at
+    the address stored in the field value"""
+    _immutable_ = True
+    width = WORD
+    type = FLOAT
+
+    def __init__(self, value):
+        self.value = value
+
+    def getint(self):
+        return self.value
+
+    def __repr__(self):
+        return "imm_float(stored at %d)" % (self.value)
+
+    def is_imm_float(self):
+        return True
+
+    def as_key(self):          # a real address + 1
+        return self.value | 1
+
+    def is_float(self):
+        return True
+
+class StackLocation(AssemblerLocation):
+    _immutable_ = True
+
+    def __init__(self, position, fp_offset, type=INT):
+        if type == FLOAT:
+            self.width = DOUBLE_WORD
+        else:
+            self.width = WORD
+        self.position = position
+        self.value = fp_offset
+        self.type = type
+
+    def __repr__(self):
+        return 'FP(%s)+%d' % (self.type, self.position,)
+
+    def location_code(self):
+        return 'b'
+
+    def get_position(self):
+        return self.position
+
+    def assembler(self):
+        return repr(self)
+
+    def is_stack(self):
+        return True
+
+    def as_key(self):                # an aligned word + 10000
+        return self.position + 10000
+
+    def is_float(self):
+        return self.type == FLOAT
+
+class RawSPStackLocation(AssemblerLocation):
+    _immutable_ = True
+
+    def __init__(self, sp_offset, type=INT):
+        if type == FLOAT:
+            self.width = DOUBLE_WORD
+        else:
+            self.width = WORD
+        self.value = sp_offset
+        self.type = type
+
+    def __repr__(self):
+        return 'SP(%s)+%d' % (self.type, self.value,)
+
+    def is_raw_sp(self):
+        return True
+
+    def is_float(self):
+        return self.type == FLOAT
+
+    def as_key(self):            # a word >= 1000, and < 1000 + size of SP 
frame
+        return self.value + 1000
+
+
+def imm(i):
+    return ImmLocation(i)
+
+def get_fp_offset(base_ofs, position):
+    return base_ofs + WORD * (position + JITFRAME_FIXED_SIZE)
diff --git a/rpython/jit/backend/zarch/registers.py 
b/rpython/jit/backend/zarch/registers.py
--- a/rpython/jit/backend/zarch/registers.py
+++ b/rpython/jit/backend/zarch/registers.py
@@ -0,0 +1,13 @@
+
+
+from rpython.jit.backend.zarch.locations import FloatRegisterLocation
+from rpython.jit.backend.zarch.locations import RegisterLocation
+
+registers = [RegisterLocation(i) for i in range(16)]
+fpregisters = [FloatRegisterLocation(i) for i in range(16)]
+
+[r0,r1,r2,r3,r4,r5,r6,r7,r8,
+ r9,r10,r11,r12,r13,r14,r15] = registers
+
+[f0,f1,f2,f3,f4,f5,f6,f7,f8,
+ f9,f10,f11,f12,f13,f14,f15] = fpregisters
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to