summaryrefslogtreecommitdiffstats
path: root/mlir/lib
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/lib')
-rw-r--r--mlir/lib/IR/StandardTypes.cpp26
-rw-r--r--mlir/lib/IR/Types.cpp14
-rw-r--r--mlir/lib/LLVMIR/IR/LLVMDialect.cpp2
3 files changed, 15 insertions, 27 deletions
diff --git a/mlir/lib/IR/StandardTypes.cpp b/mlir/lib/IR/StandardTypes.cpp
index b9da3b92285..21323a07847 100644
--- a/mlir/lib/IR/StandardTypes.cpp
+++ b/mlir/lib/IR/StandardTypes.cpp
@@ -50,9 +50,7 @@ IntegerType IntegerType::getChecked(unsigned width, MLIRContext *context,
return Base::getChecked(location, context, StandardTypes::Integer, width);
}
-unsigned IntegerType::getWidth() const {
- return static_cast<ImplType *>(type)->width;
-}
+unsigned IntegerType::getWidth() const { return getImpl()->width; }
/// Float Type.
@@ -221,9 +219,7 @@ bool VectorType::verifyConstructionInvariants(llvm::Optional<Location> loc,
return false;
}
-ArrayRef<int64_t> VectorType::getShape() const {
- return static_cast<ImplType *>(type)->getShape();
-}
+ArrayRef<int64_t> VectorType::getShape() const { return getImpl()->getShape(); }
/// TensorType
@@ -269,11 +265,7 @@ bool RankedTensorType::verifyConstructionInvariants(
}
ArrayRef<int64_t> RankedTensorType::getShape() const {
- return static_cast<ImplType *>(type)->getShape();
-}
-
-ArrayRef<int64_t> MemRefType::getShape() const {
- return static_cast<ImplType *>(type)->getShape();
+ return getImpl()->getShape();
}
/// UnrankedTensorType
@@ -351,6 +343,10 @@ MemRefType MemRefType::getImpl(ArrayRef<int64_t> shape, Type elementType,
cleanedAffineMapComposition, memorySpace);
}
+ArrayRef<int64_t> MemRefType::getShape() const {
+ return static_cast<ImplType *>(type)->getShape();
+}
+
Type MemRefType::getElementType() const {
return static_cast<ImplType *>(type)->elementType;
}
@@ -376,11 +372,7 @@ TupleType TupleType::get(ArrayRef<Type> elementTypes, MLIRContext *context) {
}
/// Return the elements types for this tuple.
-ArrayRef<Type> TupleType::getTypes() const {
- return static_cast<ImplType *>(type)->getTypes();
-}
+ArrayRef<Type> TupleType::getTypes() const { return getImpl()->getTypes(); }
/// Return the number of element types.
-unsigned TupleType::size() const {
- return static_cast<ImplType *>(type)->size();
-}
+unsigned TupleType::size() const { return getImpl()->size(); }
diff --git a/mlir/lib/IR/Types.cpp b/mlir/lib/IR/Types.cpp
index 65101871092..d41af5803d5 100644
--- a/mlir/lib/IR/Types.cpp
+++ b/mlir/lib/IR/Types.cpp
@@ -41,15 +41,13 @@ FunctionType FunctionType::get(ArrayRef<Type> inputs, ArrayRef<Type> results,
}
ArrayRef<Type> FunctionType::getInputs() const {
- return static_cast<ImplType *>(type)->getInputs();
+ return getImpl()->getInputs();
}
-unsigned FunctionType::getNumResults() const {
- return static_cast<ImplType *>(type)->numResults;
-}
+unsigned FunctionType::getNumResults() const { return getImpl()->numResults; }
ArrayRef<Type> FunctionType::getResults() const {
- return static_cast<ImplType *>(type)->getResults();
+ return getImpl()->getResults();
}
/// UnknownType
@@ -66,13 +64,11 @@ UnknownType UnknownType::getChecked(Identifier dialect, StringRef typeData,
/// Returns the dialect namespace of the unknown type.
Identifier UnknownType::getDialectNamespace() const {
- return static_cast<ImplType *>(type)->dialectNamespace;
+ return getImpl()->dialectNamespace;
}
/// Returns the raw type data of the unknown type.
-StringRef UnknownType::getTypeData() const {
- return static_cast<ImplType *>(type)->typeData;
-}
+StringRef UnknownType::getTypeData() const { return getImpl()->typeData; }
/// Verify the construction of an unknown type.
bool UnknownType::verifyConstructionInvariants(llvm::Optional<Location> loc,
diff --git a/mlir/lib/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/LLVMIR/IR/LLVMDialect.cpp
index 7f7a00a7def..b2e0f975104 100644
--- a/mlir/lib/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/LLVMIR/IR/LLVMDialect.cpp
@@ -57,7 +57,7 @@ LLVMType LLVMType::get(MLIRContext *context, llvm::Type *llvmType) {
}
llvm::Type *LLVMType::getUnderlyingType() const {
- return static_cast<ImplType *>(type)->underlyingType;
+ return getImpl()->underlyingType;
}
/*---- LLVM IR Dialect and its registration ----------------------------- */
OpenPOWER on IntegriCloud