diff options
| author | River Riddle <riverriddle@google.com> | 2018-10-30 14:59:22 -0700 |
|---|---|---|
| committer | jpienaar <jpienaar@google.com> | 2019-03-29 13:45:54 -0700 |
| commit | 4c465a181db49c436f62da303e8fdd3ed317fee7 (patch) | |
| tree | fb190912d0714222d6e336e19d5b8ea16342fb6e /mlir/lib/IR/Builders.cpp | |
| parent | 75376b8e33c67a42e3dca2c597197e0622b6eaa2 (diff) | |
| download | bcm5719-llvm-4c465a181db49c436f62da303e8fdd3ed317fee7.tar.gz bcm5719-llvm-4c465a181db49c436f62da303e8fdd3ed317fee7.zip | |
Implement value type abstraction for types.
This is done by changing Type to be a POD interface around an underlying pointer storage and adding in-class support for isa/dyn_cast/cast.
PiperOrigin-RevId: 219372163
Diffstat (limited to 'mlir/lib/IR/Builders.cpp')
| -rw-r--r-- | mlir/lib/IR/Builders.cpp | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/mlir/lib/IR/Builders.cpp b/mlir/lib/IR/Builders.cpp index 22d749a6c8c..906b580d9af 100644 --- a/mlir/lib/IR/Builders.cpp +++ b/mlir/lib/IR/Builders.cpp @@ -52,59 +52,58 @@ FileLineColLoc *Builder::getFileLineColLoc(UniquedFilename filename, // Types. //===----------------------------------------------------------------------===// -FloatType *Builder::getBF16Type() { return Type::getBF16(context); } +FloatType Builder::getBF16Type() { return Type::getBF16(context); } -FloatType *Builder::getF16Type() { return Type::getF16(context); } +FloatType Builder::getF16Type() { return Type::getF16(context); } -FloatType *Builder::getF32Type() { return Type::getF32(context); } +FloatType Builder::getF32Type() { return Type::getF32(context); } -FloatType *Builder::getF64Type() { return Type::getF64(context); } +FloatType Builder::getF64Type() { return Type::getF64(context); } -OtherType *Builder::getIndexType() { return Type::getIndex(context); } +OtherType Builder::getIndexType() { return Type::getIndex(context); } -OtherType *Builder::getTFControlType() { return Type::getTFControl(context); } +OtherType Builder::getTFControlType() { return Type::getTFControl(context); } -OtherType *Builder::getTFResourceType() { return Type::getTFResource(context); } +OtherType Builder::getTFResourceType() { return Type::getTFResource(context); } -OtherType *Builder::getTFVariantType() { return Type::getTFVariant(context); } +OtherType Builder::getTFVariantType() { return Type::getTFVariant(context); } -OtherType *Builder::getTFComplex64Type() { +OtherType Builder::getTFComplex64Type() { return Type::getTFComplex64(context); } -OtherType *Builder::getTFComplex128Type() { +OtherType Builder::getTFComplex128Type() { return Type::getTFComplex128(context); } -OtherType *Builder::getTFF32REFType() { return Type::getTFF32REF(context); } +OtherType Builder::getTFF32REFType() { return Type::getTFF32REF(context); } -OtherType *Builder::getTFStringType() { return Type::getTFString(context); } +OtherType Builder::getTFStringType() { return Type::getTFString(context); } -IntegerType *Builder::getIntegerType(unsigned width) { +IntegerType Builder::getIntegerType(unsigned width) { return Type::getInteger(width, context); } -FunctionType *Builder::getFunctionType(ArrayRef<Type *> inputs, - ArrayRef<Type *> results) { +FunctionType Builder::getFunctionType(ArrayRef<Type> inputs, + ArrayRef<Type> results) { return FunctionType::get(inputs, results, context); } -MemRefType *Builder::getMemRefType(ArrayRef<int> shape, Type *elementType, - ArrayRef<AffineMap> affineMapComposition, - unsigned memorySpace) { +MemRefType Builder::getMemRefType(ArrayRef<int> shape, Type elementType, + ArrayRef<AffineMap> affineMapComposition, + unsigned memorySpace) { return MemRefType::get(shape, elementType, affineMapComposition, memorySpace); } -VectorType *Builder::getVectorType(ArrayRef<int> shape, Type *elementType) { +VectorType Builder::getVectorType(ArrayRef<int> shape, Type elementType) { return VectorType::get(shape, elementType); } -RankedTensorType *Builder::getTensorType(ArrayRef<int> shape, - Type *elementType) { +RankedTensorType Builder::getTensorType(ArrayRef<int> shape, Type elementType) { return RankedTensorType::get(shape, elementType); } -UnrankedTensorType *Builder::getTensorType(Type *elementType) { +UnrankedTensorType Builder::getTensorType(Type elementType) { return UnrankedTensorType::get(elementType); } @@ -144,7 +143,7 @@ IntegerSetAttr Builder::getIntegerSetAttr(IntegerSet set) { return IntegerSetAttr::get(set); } -TypeAttr Builder::getTypeAttr(Type *type) { +TypeAttr Builder::getTypeAttr(Type type) { return TypeAttr::get(type, context); } @@ -152,23 +151,23 @@ FunctionAttr Builder::getFunctionAttr(const Function *value) { return FunctionAttr::get(value, context); } -ElementsAttr Builder::getSplatElementsAttr(VectorOrTensorType *type, +ElementsAttr Builder::getSplatElementsAttr(VectorOrTensorType type, Attribute elt) { return SplatElementsAttr::get(type, elt); } -ElementsAttr Builder::getDenseElementsAttr(VectorOrTensorType *type, +ElementsAttr Builder::getDenseElementsAttr(VectorOrTensorType type, ArrayRef<char> data) { return DenseElementsAttr::get(type, data); } -ElementsAttr Builder::getSparseElementsAttr(VectorOrTensorType *type, +ElementsAttr Builder::getSparseElementsAttr(VectorOrTensorType type, DenseIntElementsAttr indices, DenseElementsAttr values) { return SparseElementsAttr::get(type, indices, values); } -ElementsAttr Builder::getOpaqueElementsAttr(VectorOrTensorType *type, +ElementsAttr Builder::getOpaqueElementsAttr(VectorOrTensorType type, StringRef bytes) { return OpaqueElementsAttr::get(type, bytes); } @@ -296,7 +295,7 @@ OperationStmt *MLFuncBuilder::createOperation(const OperationState &state) { OperationStmt *MLFuncBuilder::createOperation(Location *location, OperationName name, ArrayRef<MLValue *> operands, - ArrayRef<Type *> types, + ArrayRef<Type> types, ArrayRef<NamedAttribute> attrs) { auto *op = OperationStmt::create(location, name, operands, types, attrs, getContext()); |

