diff --git a/data_types.py b/data_types.py index 6ac97023aa71e4889918b8cbb421a06ab92134b9..7b084f6846d02e9767b27647f99be22828d89a19 100644 --- a/data_types.py +++ b/data_types.py @@ -59,7 +59,7 @@ class TypedSymbol(sp.Symbol): def _hashable_content(self): superClassContents = list(super(TypedSymbol, self)._hashable_content()) - return tuple(superClassContents + [hash(str(self._dtype))]) + return tuple(superClassContents + [hash(self._dtype)]) def __getnewargs__(self): return self.name, self.dtype @@ -232,6 +232,7 @@ if ir: np.dtype(np.float64): ir.DoubleType(), } + def peelOffType(dtype, typeToPeelOff): while type(dtype) is typeToPeelOff: dtype = dtype.baseType @@ -465,7 +466,7 @@ class VectorType(Type): raise NotImplementedError() def __hash__(self): - return hash(str(self)) + return hash((self.baseType, self.width)) class PointerType(Type): @@ -502,7 +503,7 @@ class PointerType(Type): return str(self) def __hash__(self): - return hash(str(self)) + return hash((self._baseType, self.const, self.restrict)) class StructType(object):