[pypy-svn] r15575 - pypy/dist/pypy/translator/llvm2

rxe at codespeak.net rxe at codespeak.net
Wed Aug 3 21:37:35 CEST 2005


Author: rxe
Date: Wed Aug  3 21:37:33 2005
New Revision: 15575

Modified:
   pypy/dist/pypy/translator/llvm2/arraynode.py
   pypy/dist/pypy/translator/llvm2/database.py
   pypy/dist/pypy/translator/llvm2/structnode.py
Log:
Minor mods to pbs to make more llvm code more readable.



Modified: pypy/dist/pypy/translator/llvm2/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/arraynode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/arraynode.py	Wed Aug  3 21:37:33 2005
@@ -118,18 +118,20 @@
 
         p, c = lltype.parentlink(self.value)
         if p is not None:
-            assert False, "XXX TODO - but needed by rtyper"
+            assert False, "XXX TODO - but NOT needed by rtyper"
         return ref
 
     def get_pbcref(self, toptr):
         ref = self.ref
         p, c = lltype.parentlink(self.value)
         if p is not None:
-            assert False, "XXX TODO - but needed by rtyper"
+            assert False, "XXX TODO - but NOT needed by rtyper"
 
         fromptr = "%s*" % self.get_typerepr()
-        refptr = "getelementptr (%s %s, int 0)" % (fromptr, ref)
-        ref = "cast(%s %s to %s)" % (fromptr, refptr, toptr)
+        # XXX old version
+        #refptr = "getelementptr (%s %s, int 0)" % (fromptr, ref)
+        #ref = "cast(%s %s to %s)" % (fromptr, refptr, toptr)
+        ref = "cast(%s %s to %s)" % (fromptr, ref, toptr)
         return ref
 
     def get_childref(self, index):
@@ -171,7 +173,7 @@
         item_length = len(items)
         if item_length == 0 or items[-1] != chr(0):
             items = items + [chr(0)]
-        l = item_length + 1
+            item_length += 1
         s = []
         for c in items:
             if ord(c) in StrArrayNode.printables:
@@ -180,7 +182,7 @@
                 s.append("\\%02x" % ord(c))
                 
         r = 'c"%s"' % "".join(s)
-        return l, r
+        return item_length, r
 
 class VoidArrayNode(ConstantLLVMNode):
 

Modified: pypy/dist/pypy/translator/llvm2/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/database.py	(original)
+++ pypy/dist/pypy/translator/llvm2/database.py	Wed Aug  3 21:37:33 2005
@@ -139,7 +139,7 @@
                 node = StructNode(self, value)
                     
         elif isinstance(type_, lltype.Array):
-            if type_ is STR.chars:
+            if type_.OF is lltype.Char:
                 node = StrArrayNode(self, value)
             elif type_.OF is lltype.Void:
                 node = VoidArrayNode(self, value)

Modified: pypy/dist/pypy/translator/llvm2/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/structnode.py	(original)
+++ pypy/dist/pypy/translator/llvm2/structnode.py	Wed Aug  3 21:37:33 2005
@@ -218,7 +218,7 @@
         ref = self.ref
         p, c = lltype.parentlink(self.value)
         if p is not None:
-            assert False, "XXX TODO"
+            assert False, "XXX TODO - but NOT needed by rtyper"
 
         fromptr = "%s*" % self.get_typerepr()
         refptr = "getelementptr (%s %s, int 0)" % (fromptr, ref)



More information about the Pypy-commit mailing list