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

rxe at codespeak.net rxe at codespeak.net
Thu Dec 6 17:46:32 CET 2007


Author: rxe
Date: Thu Dec  6 17:46:32 2007
New Revision: 49453

Modified:
   pypy/dist/pypy/translator/llvm/codewriter.py
   pypy/dist/pypy/translator/llvm/externs2ll.py
   pypy/dist/pypy/translator/llvm/opwriter.py
Log:
fix up debug_print() again

Modified: pypy/dist/pypy/translator/llvm/codewriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/codewriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/codewriter.py	Thu Dec  6 17:46:32 2007
@@ -168,6 +168,7 @@
     def debug_print(self, s):
         var = self.db.repr_tmpvar()
         node = self.db.create_debug_string(s)
+        arg = "bitcast(%s* %s to i8*)" % (node.get_typerepr(), node.ref)
         self.call(var, "i32", "@write",
                   ['i32', 'i8*', 'i32'],
-                  ['2', node.ref, '%d' % node.get_length()])
+                  ['2', arg, '%d' % node.get_length()])

Modified: pypy/dist/pypy/translator/llvm/externs2ll.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/externs2ll.py	(original)
+++ pypy/dist/pypy/translator/llvm/externs2ll.py	Thu Dec  6 17:46:32 2007
@@ -35,8 +35,6 @@
         includestr += "-I %s " % ii
     return includestr
 
-# call boehm finalizers need to be fastcc
-
 def generate_ll(ccode, eci):
     filename = str(udir.join("ccode.c"))
     f = open(filename, "w")
@@ -52,13 +50,14 @@
         raise Exception("Failed to run '%s'" % cmd)
 
     llcode = open(plain + '.ll').read()
-
+ 
     # strip lines
     lines = []
     for line in llcode.split('\n'):
         lines.append(line)
 
-    lines.append("declare ccc void @abort()")
+    lines.append("declare void @abort()")
+    lines.append("declare i32 @write(i32, i8 *, i32)")
     return'\n'.join(lines)
 
 def generate_c(db, entrynode, eci, standalone):

Modified: pypy/dist/pypy/translator/llvm/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/opwriter.py	(original)
+++ pypy/dist/pypy/translator/llvm/opwriter.py	Thu Dec  6 17:46:32 2007
@@ -111,9 +111,9 @@
         return indices
 
     def write_operation(self, op):
+        self.codewriter.comment(str(op))
         if self.db.genllvm.config.translation.llvm.debug:
-            self.codewriter.comment(str(op))
-            #self.codewriter.debug_print(str(op) + "\n")
+            self.codewriter.debug_print(str(op) + "\n")
 
         if op.opname in ("direct_call", 'indirect_call'):
             opr = OpReprCall(op, self.db)



More information about the Pypy-commit mailing list