diff --git a/transformations.py b/transformations.py index f83fa9c6495295145e38de19a949996e7c708ae2..b39bd92b2dd289014c85a64146c78e5bfa94c7f9 100644 --- a/transformations.py +++ b/transformations.py @@ -222,6 +222,7 @@ def resolveFieldAccesses(astNode, readOnlyFieldNames=set(), fieldToBasePointerIn dtype = DataType(field.dtype) dtype.alias = False + dtype.ptr = True if field.name in readOnlyFieldNames: dtype.const = True diff --git a/types.py b/types.py index e4f579e6804f5f2ea3c151d5e33ee4614b483113..2da1e3fc45c891d175d860b54d115434cddd4e7a 100644 --- a/types.py +++ b/types.py @@ -22,7 +22,7 @@ class TypedSymbol(sp.Symbol): def _hashable_content(self): superClassContents = list(super(TypedSymbol, self)._hashable_content()) - t = tuple(superClassContents + [hash(self._dtype)]) + t = tuple(superClassContents + [hash(repr(self._dtype))]) return t def __getnewargs__(self): @@ -37,10 +37,12 @@ class DataType(object): def __init__(self, dtype): self.alias = True self.const = False + self.ptr = False if isinstance(dtype, str): self.dtype = _dtype_dict[dtype] else: self.dtype = dtype def __repr__(self): - return "{!s} {!s} {!s}".format("const" if self.const else "", "__restrict__" if not self.alias else "", _c_dtype_dict[self.dtype]) + return "{!s} {!s}{!s} {!s}".format("const" if self.const else "", _c_dtype_dict[self.dtype], + "*" if self.ptr else "", "__restrict__" if not self.alias else "")