[pypy-svn] r20978 - pypy/dist/pypy/translator/llvm
rxe at codespeak.net
rxe at codespeak.net
Fri Dec 9 22:41:57 CET 2005
Author: rxe
Date: Fri Dec 9 22:41:54 2005
New Revision: 20978
Modified:
pypy/dist/pypy/translator/llvm/arraynode.py
pypy/dist/pypy/translator/llvm/database.py
pypy/dist/pypy/translator/llvm/exception.py
pypy/dist/pypy/translator/llvm/gc.py
pypy/dist/pypy/translator/llvm/varsize.py
Log:
Phew - pypy-llvm compiling again. Try some pending experimental optmisations
on snake.
Modified: pypy/dist/pypy/translator/llvm/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/arraynode.py (original)
+++ pypy/dist/pypy/translator/llvm/arraynode.py Fri Dec 9 22:41:54 2005
@@ -70,6 +70,17 @@
def writedatatypedecl(self, codewriter):
codewriter.typedef(self.ref, self.db.get_machine_word())
+
+
+class StrArrayTypeNode(ArrayTypeNode):
+ def writeimpl(self, codewriter):
+ log.writeimpl(self.ref)
+ varsize.write_constructor(self.db, codewriter, self.ref,
+ self.constructor_decl,
+ self.array,
+ atomic=self.array._is_atomic(),
+ is_str=True)
+
class ArrayNode(ConstantLLVMNode):
""" An arraynode. Elements can be
Modified: pypy/dist/pypy/translator/llvm/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/database.py (original)
+++ pypy/dist/pypy/translator/llvm/database.py Fri Dec 9 22:41:54 2005
@@ -7,7 +7,7 @@
from pypy.translator.llvm.structnode import StructNode, StructVarsizeNode, \
StructTypeNode, StructVarsizeTypeNode
from pypy.translator.llvm.arraynode import ArrayNode, StrArrayNode, \
- VoidArrayNode, ArrayTypeNode, VoidArrayTypeNode
+ VoidArrayNode, ArrayTypeNode, StrArrayTypeNode, VoidArrayTypeNode
from pypy.translator.llvm.opaquenode import OpaqueNode, ExtOpaqueNode, \
OpaqueTypeNode, ExtOpaqueTypeNode
from pypy.rpython.lltypesystem import lltype
@@ -155,6 +155,8 @@
elif isinstance(type_, lltype.Array):
if type_.OF is lltype.Void:
self.addpending(type_, VoidArrayTypeNode(self, type_))
+ elif type_.OF is lltype.Char:
+ self.addpending(type_, StrArrayTypeNode(self, type_))
else:
self.addpending(type_, ArrayTypeNode(self, type_))
Modified: pypy/dist/pypy/translator/llvm/exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/exception.py (original)
+++ pypy/dist/pypy/translator/llvm/exception.py Fri Dec 9 22:41:54 2005
@@ -201,7 +201,8 @@
def invoke(self, codewriter, targetvar, tail_, cconv, returntype, functionref, args, label, except_label):
if returntype == 'void':
- if functionref != '%keepalive': #XXX I think keepalive should not be the last operation here!
+ #XXX I think keepalive should not be the last operation here!
+ if functionref != '%keepalive':
codewriter.indent('%scall %s void %s(%s)' % (tail_, cconv, functionref, args))
else:
codewriter.indent('%s = %scall %s %s %s(%s)' % (targetvar, tail_, cconv, returntype, functionref, args))
Modified: pypy/dist/pypy/translator/llvm/gc.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/gc.py (original)
+++ pypy/dist/pypy/translator/llvm/gc.py Fri Dec 9 22:41:54 2005
@@ -67,10 +67,11 @@
%%malloc_Ptr%(cnt)s = call fastcc sbyte* %%pypy_malloc%(atomic)s(%(uword)s %%malloc_SizeU%(cnt)s)
%(targetvar)s = cast sbyte* %%malloc_Ptr%(cnt)s to %(type_)s*
''' % locals()
- if is_atomic:
- t += '''
-call ccc void %%llvm.memset(sbyte* %%malloc_Ptr%(cnt)s, ubyte 0, uint %%malloc_SizeU%(cnt)s, uint 0)
-''' % locals()
+
+ #if is_atomic:
+ # t += '''
+ #call ccc void %%llvm.memset(sbyte* %%malloc_Ptr%(cnt)s, ubyte 0, uint %%malloc_SizeU%(cnt)s, uint 0)
+ #''' % locals()
return t
def pyrex_code(self):
Modified: pypy/dist/pypy/translator/llvm/varsize.py
==============================================================================
--- pypy/dist/pypy/translator/llvm/varsize.py (original)
+++ pypy/dist/pypy/translator/llvm/varsize.py Fri Dec 9 22:41:54 2005
@@ -1,7 +1,7 @@
from pypy.rpython.rstr import STR
def write_constructor(db, codewriter, ref, constructor_decl, ARRAY,
- indices_to_array=(), atomic=False):
+ indices_to_array=(), atomic=False, is_str=False):
#varsized arrays and structs look like this:
#Array: {int length , elemtype*}
@@ -27,12 +27,27 @@
codewriter.cast("%result", "sbyte*", "%ptr", ref + "*")
indices_to_arraylength = tuple(indices_to_array) + (("uint", 0),)
+
# the following accesses the length field of the array
codewriter.getelementptr("%arraylength", ref + "*",
"%result",
*indices_to_arraylength)
codewriter.store(lentype, "%len", "%arraylength")
+ if is_str:
+ indices_to_hash = (("uint", 0),)
+ codewriter.getelementptr("%xxx1", ref + "*",
+ "%result",
+ *indices_to_hash)
+ codewriter.store("int", "0", "%arraylength")
+
+ codewriter.getelementptr("%xxx2", ref + "*",
+ "%result",
+ *elemindices)
+ codewriter.store(elemtype, "0", "%xxx2")
+
+
+
codewriter.ret(ref + "*", "%result")
codewriter.closefunc()
More information about the Pypy-commit
mailing list