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

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Apr 6 16:14:05 CEST 2005


Author: cfbolz
Date: Wed Apr  6 16:14:05 2005
New Revision: 10367

Modified:
   pypy/dist/pypy/translator/llvm/classrepr.py
   pypy/dist/pypy/translator/llvm/llvmbc.py
Log:
Implemented the instantiation of builtin exceptions.

Modified: pypy/dist/pypy/translator/llvm/classrepr.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/classrepr.py	(original)
+++ pypy/dist/pypy/translator/llvm/classrepr.py	Wed Apr  6 16:14:05 2005
@@ -269,3 +269,14 @@
         lblock.instruction("store %%std.class* %s, %%std.class** %s" %
                            (self.l_base.objectname, l_tmp.llvmname()))
 
+    def op_simple_call(self, l_target, args, lblock, l_func):
+        lblock.malloc(l_target)
+        l_args0 = self.gen.get_repr(args[0])
+        l_cast = self.gen.get_local_tmp(PointerTypeRepr("%std.list.sbyte",
+                                                        self.gen), l_func)
+        l_tmp = self.gen.get_local_tmp(PointerTypeRepr("%std.list.sbyte*",
+                                                       self.gen), l_func)
+        l_func.dependencies.update([l_args0, l_cast, l_tmp])
+        lblock.cast(l_cast, l_args0)
+        lblock.getelementptr(l_tmp, l_target, [0, 1])
+        lblock.store(l_cast, l_tmp)

Modified: pypy/dist/pypy/translator/llvm/llvmbc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/llvmbc.py	(original)
+++ pypy/dist/pypy/translator/llvm/llvmbc.py	Wed Apr  6 16:14:05 2005
@@ -92,10 +92,15 @@
         s = "store %s, %s" % (l_value.typed_name(), l_pter.typed_name())
         self.instructions.append(s)
 
-    def malloc(self, l_target, l_type, num=1):
+    def malloc(self, l_target, l_type=None, num=1):
         self.phi_done = True
-        s = "%s = malloc %s" % (l_target.llvmname(),
-                                l_type.typename_wo_pointer())
+        if l_type is None:
+            #XXX assuming that l_target.llvmtype() ends with an "*" here
+            s = "%s = malloc %s" % (l_target.llvmname(),
+                                    l_target.llvmtype()[:1])
+        else:
+            s = "%s = malloc %s" % (l_target.llvmname(),
+                                    l_type.typename_wo_pointer())
         if num > 1:
             s += ", uint %i" % num
         self.instructions.append(s)



More information about the Pypy-commit mailing list