[pypy-svn] r20535 - in pypy/branch/somepbc-refactoring/pypy/translator/llvm: . module

arigo at codespeak.net arigo at codespeak.net
Thu Dec 1 22:02:01 CET 2005


Author: arigo
Date: Thu Dec  1 22:02:00 2005
New Revision: 20535

Modified:
   pypy/branch/somepbc-refactoring/pypy/translator/llvm/externs2ll.py
   pypy/branch/somepbc-refactoring/pypy/translator/llvm/genllvm.py
   pypy/branch/somepbc-refactoring/pypy/translator/llvm/module/support.py
   pypy/branch/somepbc-refactoring/pypy/translator/llvm/opwriter.py
Log:
(pedronis, arigo)

Fixing LLVM was rather easy.


Modified: pypy/branch/somepbc-refactoring/pypy/translator/llvm/externs2ll.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/llvm/externs2ll.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/llvm/externs2ll.py	Thu Dec  1 22:02:00 2005
@@ -3,7 +3,8 @@
 import types
 import urllib
 
-from pypy.rpython.rmodel import inputconst, getfunctionptr
+from pypy.objspace.flow.model import FunctionGraph
+from pypy.rpython.rmodel import inputconst
 from pypy.rpython.lltypesystem import lltype
 from pypy.translator.llvm.codewriter import DEFAULT_CCONV
 
@@ -113,8 +114,8 @@
     for c_name, obj in decls:
         if isinstance(obj, lltype.LowLevelType):
             db.prepare_type(obj)
-        elif isinstance(obj, types.FunctionType):
-            funcptr = getfunctionptr(db.translator, obj)
+        elif isinstance(obj, FunctionGraph):
+            funcptr = rtyper.getcallable(obj)
             c = inputconst(lltype.typeOf(funcptr), funcptr)
             db.prepare_arg_value(c)
         elif isinstance(lltype.typeOf(obj), lltype.Ptr):
@@ -156,8 +157,8 @@
         if isinstance(obj, lltype.LowLevelType):
             s = "#define %s struct %s\n%s;\n" % (c_name, c_name, c_name)
             ccode.append(s)
-        elif isinstance(obj, types.FunctionType):
-            funcptr = getfunctionptr(db.translator, obj)
+        elif isinstance(obj, FunctionGraph):
+            funcptr = db.translator.rtyper.getcallable(obj)
             c = inputconst(lltype.typeOf(funcptr), funcptr)
             predeclarefn(c_name, db.repr_arg(c))
         elif isinstance(lltype.typeOf(obj), lltype.Ptr):

Modified: pypy/branch/somepbc-refactoring/pypy/translator/llvm/genllvm.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/llvm/genllvm.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/llvm/genllvm.py	Thu Dec  1 22:02:00 2005
@@ -3,7 +3,8 @@
 from pypy.translator.llvm import build_llvm_module
 from pypy.translator.llvm.database import Database 
 from pypy.translator.llvm.pyxwrapper import write_pyx_wrapper 
-from pypy.rpython.rmodel import inputconst, getfunctionptr
+from pypy.rpython.rmodel import inputconst
+from pypy.rpython.typesystem import getfunctionptr
 from pypy.rpython.lltypesystem import lltype
 from pypy.tool.udir import udir
 from pypy.translator.llvm.codewriter import CodeWriter
@@ -161,7 +162,8 @@
             func = self.translator.entrypoint
         self.entrypoint = func
 
-        ptr = getfunctionptr(self.translator, func)
+        bk = self.translator.annotator.bookkeeper
+        ptr = getfunctionptr(bk.getdesc(func).cachedgraph(None))
         c = inputconst(lltype.typeOf(ptr), ptr)
         self.db.prepare_arg_value(c)
         self.entry_func_name = func.func_name

Modified: pypy/branch/somepbc-refactoring/pypy/translator/llvm/module/support.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/llvm/module/support.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/llvm/module/support.py	Thu Dec  1 22:02:00 2005
@@ -36,7 +36,7 @@
 internal fastcc %RPyString* %RPyString_FromString(sbyte* %s) {
     %lenu      = call ccc uint %strlen(sbyte* %s)
     %len       = cast uint %lenu to int
-    %rpy       = call fastcc %RPyString* %pypy_RPyString_New__Signed(int %len)
+    %rpy       = call fastcc %RPyString* %pypy_RPyString_New(int %len)
     %rpystrptr = getelementptr %RPyString* %rpy, int 0, uint 1, uint 1
     %rpystr    = cast [0 x sbyte]* %rpystrptr to sbyte*
 

Modified: pypy/branch/somepbc-refactoring/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/branch/somepbc-refactoring/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/branch/somepbc-refactoring/pypy/translator/llvm/opwriter.py	Thu Dec  1 22:02:00 2005
@@ -324,7 +324,7 @@
                              argtypes, none_label, exc_label)
 
         e = self.db.translator.rtyper.getexceptiondata()
-        ll_exception_match       = '%pypy_' + e.ll_exception_match.__name__
+        ll_exception_match       = '%pypy_' + e.fn_exception_match._obj._name
 
         # XXX Can we use database?
         lltype_of_exception_type = ('%structtype_' +



More information about the Pypy-commit mailing list