Add convenience builder for MemRefType.

PiperOrigin-RevId: 208245701
This commit is contained in:
Jacques Pienaar 2018-08-10 11:56:47 -07:00 committed by jpienaar
parent 22ae97cffc
commit 067d70f20d
2 changed files with 9 additions and 0 deletions

View File

@ -70,6 +70,9 @@ public:
IntegerType *getIntegerType(unsigned width);
FunctionType *getFunctionType(ArrayRef<Type *> inputs,
ArrayRef<Type *> results);
MemRefType *getMemRefType(ArrayRef<int> shape, Type *elementType,
ArrayRef<AffineMap *> affineMapComposition = {},
unsigned memorySpace = 0);
VectorType *getVectorType(ArrayRef<unsigned> shape, Type *elementType);
RankedTensorType *getTensorType(ArrayRef<int> shape, Type *elementType);
UnrankedTensorType *getTensorType(Type *elementType);

View File

@ -59,6 +59,12 @@ FunctionType *Builder::getFunctionType(ArrayRef<Type *> inputs,
return FunctionType::get(inputs, results, context);
}
MemRefType *Builder::getMemRefType(ArrayRef<int> shape, Type *elementType,
ArrayRef<AffineMap *> affineMapComposition,
unsigned memorySpace) {
return MemRefType::get(shape, elementType, affineMapComposition, memorySpace);
}
VectorType *Builder::getVectorType(ArrayRef<unsigned> shape,
Type *elementType) {
return VectorType::get(shape, elementType);