[pypy-svn] r10771 - pypy/dist/pypy/translator/llvm

arigo at codespeak.net arigo at codespeak.net
Sun Apr 17 13:53:59 CEST 2005


Author: arigo
Date: Sun Apr 17 13:53:59 2005
New Revision: 10771

Modified:
   pypy/dist/pypy/translator/llvm/seqrepr.py
   pypy/dist/pypy/translator/llvm/typerepr.py
Log:
Updated genllvm to the changes in annotation.model.SomeList.


Modified: pypy/dist/pypy/translator/llvm/seqrepr.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/seqrepr.py	(original)
+++ pypy/dist/pypy/translator/llvm/seqrepr.py	Sun Apr 17 13:53:59 2005
@@ -77,19 +77,19 @@
     l_listtypes = {}
     def get(obj, gen):
         if obj.__class__ is annmodel.SomeList:
-            if (obj.s_item.__class__, gen) in ListTypeRepr.l_listtypes:
-                return ListTypeRepr.l_listtypes[(obj.s_item.__class__, gen)]
+            if (listitem(obj).__class__, gen) in ListTypeRepr.l_listtypes:
+                return ListTypeRepr.l_listtypes[(listitem(obj).__class__, gen)]
             l_repr = ListTypeRepr(obj, gen)
-            ListTypeRepr.l_listtypes[(obj.s_item.__class__, gen)] = l_repr
+            ListTypeRepr.l_listtypes[(listitem(obj).__class__, gen)] = l_repr
             return l_repr
         return None
     get = staticmethod(get)
 
     def __init__(self, obj, gen):
         if debug:
-            print "ListTypeRepr: %s, %s" % (obj, obj.s_item)
+            print "ListTypeRepr: %s, %s" % (obj, listitem(obj))
         self.gen = gen
-        self.l_itemtype = gen.get_repr(obj.s_item)
+        self.l_itemtype = gen.get_repr(listitem(obj))
         self.dependencies = sets.Set([self.l_itemtype])
         itemtype = self.l_itemtype.typename()
         self.name = "%%std.list.%s" % itemtype.strip("%").replace("*", "")
@@ -231,3 +231,8 @@
             raise CompileError, "Invalid arguments to getitem"
         lblock.getelementptr(l_tmp, l_args[0], [0, l_unsigned])
         lblock.load(l_target, l_tmp)
+
+
+def listitem(s_list):
+    assert isinstance(s_list, annmodel.SomeList)
+    return s_list.listdef.listitem.s_value

Modified: pypy/dist/pypy/translator/llvm/typerepr.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/typerepr.py	(original)
+++ pypy/dist/pypy/translator/llvm/typerepr.py	Sun Apr 17 13:53:59 2005
@@ -6,6 +6,7 @@
 from pypy.objspace.flow.model import Variable, Constant
 from pypy.objspace.flow.model import last_exception, last_exc_value
 from pypy.annotation import model as annmodel
+from pypy.annotation.listdef import ListDef
 
 from pypy.translator.llvm.representation import debug, LLVMRepr, CompileError
 from pypy.translator.llvm.representation import LLVM_SIMPLE_TYPES
@@ -71,7 +72,7 @@
 
     def setup(self):
         self.l_charlist = self.gen.get_repr(
-            annmodel.SomeList(None, annmodel.SomeChar()))
+            annmodel.SomeList(ListDef(None, annmodel.SomeChar())))
         self.dependencies.add(self.l_charlist)
         self.name = self.l_charlist.typename_wo_pointer()
 



More information about the Pypy-commit mailing list