Author: Manuel Jacob
Branch: llvm-translation-backend
Changeset: r71668:0365fc6d78ce
Date: 2014-05-22 08:11 +0200
http://bitbucket.org/pypy/pypy/changeset/0365fc6d78ce/

Log:    Use rffi.size_and_sign() here. Unsplit rffi.size_and_sign() to
        reduce diff with default.

diff --git a/rpython/rtyper/lltypesystem/rffi.py 
b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -909,20 +909,19 @@
                                  # the ptr must point to an array.
 
 def size_and_sign(tp):
-    return sizeof(tp), is_unsigned(tp)
-
-def is_unsigned(tp):
+    size = sizeof(tp)
     try:
-        return not tp._type.SIGNED
+        unsigned = not tp._type.SIGNED
     except AttributeError:
         if not isinstance(tp, lltype.Primitive):
-            return False
+            unsigned = False
         elif tp in (lltype.Signed, FLOAT, DOUBLE, llmemory.Address):
-            return False
+            unsigned = False
         elif tp in (lltype.Char, lltype.UniChar, lltype.Bool):
-            return True
+            unsigned = True
         else:
-            raise AssertionError("is_unsigned(%r)" % (tp,))
+            raise AssertionError("size_and_sign(%r)" % (tp,))
+    return size, unsigned
 
 def sizeof(tp):
     """Similar to llmemory.sizeof() but tries hard to return a integer
diff --git a/rpython/translator/llvm/genllvm.py 
b/rpython/translator/llvm/genllvm.py
--- a/rpython/translator/llvm/genllvm.py
+++ b/rpython/translator/llvm/genllvm.py
@@ -350,8 +350,8 @@
 
 for type in rffi.NUMBER_TYPES + [lltype.Char, lltype.UniChar]:
     if type not in PRIMITIVES:
-        PRIMITIVES[type] = IntegralType(rffi.sizeof(type) * 8,
-                                         rffi.is_unsigned(type))
+        size_in_bytes, is_unsigned = rffi.size_and_sign(type)
+        PRIMITIVES[type] = IntegralType(size_in_bytes * 8, is_unsigned)
 LLVMSigned = PRIMITIVES[lltype.Signed]
 SIGNED_TYPE = LLVMSigned.repr_type()
 LLVMHalfWord = PRIMITIVES[llgroup.HALFWORD]
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to