[pypy-svn] r16031 - pypy/dist/pypy/translator/llvm2
rxe at codespeak.net
rxe at codespeak.net
Sat Aug 13 11:39:35 CEST 2005
Author: rxe
Date: Sat Aug 13 11:39:33 2005
New Revision: 16031
Modified:
pypy/dist/pypy/translator/llvm2/arraynode.py
pypy/dist/pypy/translator/llvm2/database.py
pypy/dist/pypy/translator/llvm2/funcnode.py
pypy/dist/pypy/translator/llvm2/structnode.py
Log:
cleanup some XXXs
Modified: pypy/dist/pypy/translator/llvm2/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/arraynode.py (original)
+++ pypy/dist/pypy/translator/llvm2/arraynode.py Sat Aug 13 11:39:33 2005
@@ -49,9 +49,8 @@
elif isinstance(self.arraytype, lltype.Ptr):
return False
else:
- # XXX Recurse...
- return False
-
+ return self.db.is_atomic(self.arraytype)
+
# ______________________________________________________________________
# entry points from genllvm
#
@@ -132,20 +131,15 @@
typeval)
p, c = lltype.parentlink(self.value)
- if p is not None:
- assert False, "XXX TODO - but NOT needed by rtyper"
+ assert p is None, "child arrays are NOT needed by rtyper"
return ref
def get_pbcref(self, toptr):
ref = self.ref
p, c = lltype.parentlink(self.value)
- if p is not None:
- assert False, "XXX TODO - but NOT needed by rtyper"
+ assert p is None, "child arrays are NOT needed by rtyper"
fromptr = "%s*" % self.get_typerepr()
- # XXX old version
- #refptr = "getelementptr (%s %s, int 0)" % (fromptr, ref)
- #ref = "cast(%s %s to %s)" % (fromptr, refptr, toptr)
ref = "cast(%s %s to %s)" % (fromptr, ref, toptr)
return ref
Modified: pypy/dist/pypy/translator/llvm2/database.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/database.py (original)
+++ pypy/dist/pypy/translator/llvm2/database.py Sat Aug 13 11:39:33 2005
@@ -111,25 +111,18 @@
if (isinstance(k, lltype.LowLevelType) or
isinstance(k, Constant)):
continue
- # XXX tmp try blocks
- try:
- ref = v.get_ref()
- except AttributeError, e:
- ref = "AttributeError: %s" % e
- except AssertionError, e:
- ref = "AssertionError: %s" % e
- try:
- pbc_ref = v.get_ref()
- except AttributeError, e:
- pbc_ref = "AttributeError: %s" % e
- except AssertionError, e:
- pbc_ref = "AssertionError: %s" % e
assert isinstance(lltype.typeOf(k), lltype.ContainerType)
- r += "\ndump_pbcs %s (%s)\n" \
- "getref -> %s \n" \
- "pbcref -> %s \n" % (v, k, ref, pbc_ref)
- return r
+ # Only dump top levels
+ p, _ = lltype.parentlink(k)
+ if p is None:
+ ref = v.get_ref()
+ pbc_ref = v.get_ref()
+
+ r += "\ndump_pbcs %s (%s)\n" \
+ "getref -> %s \n" \
+ "pbcref -> %s \n" % (v, k, ref, pbc_ref)
+ return r
#_______create node_____________________________________
@@ -194,7 +187,7 @@
if isinstance(ct, lltype.Array) or isinstance(ct, lltype.Struct):
p, c = lltype.parentlink(value)
if p is None:
- log.prepare_repr_arg("XXX skipping preparing non root", value)
+ log.prepare_repr_arg("skipping preparing non root", value)
return
if value is not None:
@@ -306,14 +299,6 @@
return self.repr_arg_type(arg.TO) + '*'
else:
raise TypeError("cannot represent %r" %(arg,))
-
- def is_function_ptr(self, arg):
- if isinstance(arg, (Constant, Variable)):
- arg = arg.concretetype
- if isinstance(arg, lltype.Ptr):
- if isinstance(arg.TO, lltype.FuncType):
- return True
- return False
def repr_argwithtype(self, arg):
return self.repr_arg(arg), self.repr_arg_type(arg)
@@ -387,3 +372,17 @@
def get_machine_uword(self):
return self.primitives[lltype.Unsigned]
+
+ # __________________________________________________________
+ # Other helpers
+
+ def is_function_ptr(self, arg):
+ if isinstance(arg, (Constant, Variable)):
+ arg = arg.concretetype
+ if isinstance(arg, lltype.Ptr):
+ if isinstance(arg.TO, lltype.FuncType):
+ return True
+ return False
+
+ def is_atomic(self, value):
+ return self.obj2node[value].is_atomic()
Modified: pypy/dist/pypy/translator/llvm2/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/funcnode.py (original)
+++ pypy/dist/pypy/translator/llvm2/funcnode.py Sat Aug 13 11:39:33 2005
@@ -105,7 +105,6 @@
def getdecl(self):
startblock = self.graph.startblock
returnblock = self.graph.returnblock
- # XXX hack as per remove_voids()
startblock_inputargs = [a for a in startblock.inputargs
if a.concretetype is not lltype.Void]
Modified: pypy/dist/pypy/translator/llvm2/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/structnode.py (original)
+++ pypy/dist/pypy/translator/llvm2/structnode.py Sat Aug 13 11:39:33 2005
@@ -34,8 +34,7 @@
return False
if not isinstance(f, lltype.Primitive):
- # XXX Recurse
- return False
+ return self.db.is_atomic(f)
return True
# ______________________________________________________________________
@@ -71,7 +70,7 @@
# build up a list of indices to get to the last
# var-sized struct (or rather the according array)
- indices_to_array = []
+ indices_to_array = []
current = self.struct
while isinstance(current, lltype.Struct):
last_pos = len(current._names_without_voids()) - 1
@@ -80,12 +79,15 @@
current = current._flds[name]
assert isinstance(current, lltype.Array)
arraytype = self.db.repr_arg_type(current.OF)
- # XXX write type info as a comment
- varsize.write_constructor(self.db, codewriter,
- self.ref, self.constructor_decl, arraytype,
- indices_to_array,
- atomicmalloc=self.is_atomic())
-
+ # XXX write type info as a comment
+ varsize.write_constructor(self.db,
+ codewriter,
+ self.ref,
+ self.constructor_decl,
+ arraytype,
+ indices_to_array,
+ atomicmalloc=self.is_atomic())
+
class StructNode(ConstantLLVMNode):
""" A struct constant. Can simply contain
a primitive,
@@ -219,9 +221,7 @@
""" Returns a reference as used per pbc. """
ref = self.ref
p, c = lltype.parentlink(self.value)
- if p is not None:
- assert False, "XXX TODO - but NOT needed by rtyper"
-
+ assert p is None, "child arrays are NOT needed by rtyper"
fromptr = "%s*" % self.get_typerepr()
refptr = "getelementptr (%s %s, int 0)" % (fromptr, ref)
ref = "cast(%s %s to %s)" % (fromptr, refptr, toptr)
More information about the Pypy-commit
mailing list