MLIR  17.0.0git
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
mlir::Type Class Reference

Instances of the Type class are uniqued, have an immutable identifier and an optional mutable component. More...

#include "mlir/IR/Types.h"

+ Inheritance diagram for mlir::Type:
+ Collaboration diagram for mlir::Type:

Public Types

template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits>
using TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits... >
 Utility class for implementing types. More...
 
using ImplType = TypeStorage
 
using AbstractTy = AbstractType
 

Public Member Functions

constexpr Type ()=default
 
 Type (const ImplType *impl)
 
 Type (const Type &other)=default
 
Typeoperator= (const Type &other)=default
 
bool operator== (Type other) const
 
bool operator!= (Type other) const
 
 operator bool () const
 
bool operator! () const
 
template<typename... Tys>
bool isa () const
 
template<typename... Tys>
bool isa_and_nonnull () const
 
template<typename U >
dyn_cast () const
 
template<typename U >
dyn_cast_or_null () const
 
template<typename U >
cast () const
 
TypeID getTypeID ()
 Return a unique identifier for the concrete type. More...
 
MLIRContextgetContext () const
 Return the MLIRContext in which this type was uniqued. More...
 
DialectgetDialect () const
 Get the dialect this type is registered to. More...
 
bool isIndex () const
 
bool isFloat8E5M2 () const
 
bool isFloat8E4M3FN () const
 
bool isBF16 () const
 
bool isF16 () const
 
bool isF32 () const
 
bool isF64 () const
 
bool isF80 () const
 
bool isF128 () const
 
bool isInteger (unsigned width) const
 Return true if this is an integer type with the specified width. More...
 
bool isSignlessInteger () const
 Return true if this is a signless integer type (with the specified width). More...
 
bool isSignlessInteger (unsigned width) const
 
bool isSignedInteger () const
 Return true if this is a signed integer type (with the specified width). More...
 
bool isSignedInteger (unsigned width) const
 
bool isUnsignedInteger () const
 Return true if this is an unsigned integer type (with the specified width). More...
 
bool isUnsignedInteger (unsigned width) const
 
unsigned getIntOrFloatBitWidth () const
 Return the bit width of an integer or a float type, assert failure on other types. More...
 
bool isSignlessIntOrIndex () const
 Return true if this is a signless integer or index type. More...
 
bool isSignlessIntOrIndexOrFloat () const
 Return true if this is a signless integer, index, or float type. More...
 
bool isSignlessIntOrFloat () const
 Return true of this is a signless integer or a float type. More...
 
bool isIntOrIndex () const
 Return true if this is an integer (of any signedness) or an index type. More...
 
bool isIntOrFloat () const
 Return true if this is an integer (of any signedness) or a float type. More...
 
bool isIntOrIndexOrFloat () const
 Return true if this is an integer (of any signedness), index, or float type. More...
 
void print (raw_ostream &os) const
 Print the current type. More...
 
void print (raw_ostream &os, AsmState &state) const
 
void dump () const
 
const void * getAsOpaquePointer () const
 Methods for supporting PointerLikeTypeTraits. More...
 
template<template< typename T > class Trait>
bool hasTrait ()
 Returns true if the type was registered with a particular trait. More...
 
const AbstractTygetAbstractType () const
 Return the abstract type descriptor for this type. More...
 
ImplTypegetImpl () const
 Return the Type implementation. More...
 
void walkImmediateSubElements (function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const
 Walk all of the immediately nested sub-attributes and sub-types. More...
 
auto replaceImmediateSubElements (ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const
 Replace the immediately nested sub-attributes and sub-types with those provided. More...
 
template<WalkOrder Order = WalkOrder::PostOrder, typename... WalkFns>
auto walk (WalkFns &&...walkFns)
 Walk this type and all attibutes/types nested within using the provided walk functions. More...
 
template<typename... ReplacementFns>
auto replace (ReplacementFns &&...replacementFns)
 Recursively replace all of the nested sub-attributes and sub-types using the provided map functions. More...
 

Static Public Member Functions

static Type getFromOpaquePointer (const void *pointer)
 

Protected Attributes

ImplTypeimpl {nullptr}
 

Friends

::llvm::hash_code hash_value (Type arg)
 

Detailed Description

Instances of the Type class are uniqued, have an immutable identifier and an optional mutable component.

They wrap a pointer to the storage object owned by MLIRContext. Therefore, instances of Type are passed around by value.

Some types are "primitives" meaning they do not have any parameters, for example the Index type. Parametric types have additional information that differentiates the types of the same class, for example the Integer type has bitwidth, making i8 and i16 belong to the same kind by be different instances of the IntegerType. Type parameters are part of the unique immutable key. The mutable component of the type can be modified after the type is created, but cannot affect the identity of the type.

Types are constructed and uniqued via the 'detail::TypeUniquer' class.

Derived type classes are expected to implement several required implementation hooks:

Type storage objects inherit from TypeStorage and contain the following:

Definition at line 74 of file Types.h.

Member Typedef Documentation

◆ AbstractTy

Definition at line 84 of file Types.h.

◆ ImplType

Definition at line 82 of file Types.h.

◆ TypeBase

template<typename ConcreteType , typename BaseType , typename StorageType , template< typename T > class... Traits>
using mlir::Type::TypeBase = detail::StorageUserBase<ConcreteType, BaseType, StorageType, detail::TypeUniquer, Traits...>

Utility class for implementing types.

Definition at line 79 of file Types.h.

Constructor & Destructor Documentation

◆ Type() [1/3]

constexpr mlir::Type::Type ( )
constexprdefault

Referenced by getFromOpaquePointer().

◆ Type() [2/3]

mlir::Type::Type ( const ImplType impl)
inline

Definition at line 87 of file Types.h.

◆ Type() [3/3]

mlir::Type::Type ( const Type other)
default

Member Function Documentation

◆ cast()

template<typename U >
U mlir::Type::cast

Definition at line 318 of file Types.h.

Referenced by addBodyWithPayloadOp(), mlir::bufferization::allocateTensorForShapedValue(), applyPad(), mlir::sparse_tensor::Merger::buildExp(), mlir::LLVMTypeConverter::canConvertToBarePtr(), castAllocFuncResult(), mlir::quant::QuantizedType::castFromExpressedType(), mlir::quant::QuantizedType::castFromStorageType(), mlir::bufferization::castOrReallocMemRefValue(), mlir::quant::QuantizedType::castToExpressedType(), mlir::quant::QuantizedType::castToStorageType(), mlir::linalg::collapseGenericOpIterationDims(), convertArrayType(), convertOmpAtomicRead(), mlir::tensor::createCanonicalRankReducingExtractSliceOp(), mlir::tensor::createCanonicalRankReducingInsertSliceOp(), mlir::memref::createCanonicalRankReducingSubViewOp(), createConstantAllBitsSet(), mlir::tensor::createDimValues(), mlir::tensor::createDynamicDimValues(), createElementFPowIFunc(), createFoldedDimOp(), mlir::linalg::createFoldedDimOp(), createFPConstant(), createGlobalVarForEntryPointArgument(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createScalarOrSplatConstant(), createSubViewIntersection(), defaultUnknownTypeConverter(), doubleBuffer(), ensureToMemrefOpIsValid(), extendVectorRank(), extractLastDimSlice(), extractOne(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), generateCopy(), generatePointWiseCopy(), genExpand(), mlir::DenseElementsAttr::get(), getBufferizationOptions(), mlir::spirv::SampledImageType::getCapabilities(), mlir::spirv::ArrayType::getCapabilities(), mlir::spirv::PointerType::getCapabilities(), mlir::spirv::RuntimeArrayType::getCapabilities(), mlir::spirv::CooperativeMatrixNVType::getCapabilities(), mlir::spirv::JointMatrixINTELType::getCapabilities(), mlir::spirv::MatrixType::getCapabilities(), mlir::AffineDmaStartOp::getDstMemorySpace(), mlir::AffineDmaStartOp::getDstMemRefRank(), mlir::AffineDmaStartOp::getDstMemRefType(), mlir::linalg::getDynOperands(), mlir::MemRefDescriptor::getElementPtrType(), mlir::ShapeAdaptor::getElementType(), mlir::spirv::SampledImageType::getExtensions(), mlir::spirv::ArrayType::getExtensions(), mlir::spirv::PointerType::getExtensions(), mlir::spirv::RuntimeArrayType::getExtensions(), mlir::spirv::CooperativeMatrixNVType::getExtensions(), mlir::spirv::JointMatrixINTELType::getExtensions(), mlir::spirv::MatrixType::getExtensions(), getFullMemRefAsRegion(), mlir::arith::getIdentityValueAttr(), getInsertExtractValueElementType(), getIntegerDotProductCapabilities(), mlir::AllocationOpLLVMLowering::getMemRefResultType(), mlir::bufferization::getMemRefType(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), mlir::bufferization::getMemRefTypeWithStaticIdentityLayout(), mlir::memref::getMixedSizes(), mlir::tensor::getMixedSizes(), getMultiLevelStrides(), mlir::sparse_tensor::getOneAttr(), mlir::spirv::getOpenCLElementPtr(), mlir::bufferization::getPartialBufferizationOptions(), getPointerDataLayoutEntry(), getPushConstantVariable(), mlir::quant::QuantizedType::getQuantizedElementType(), getReshapeOutputShapeFromInputShape(), getShapeDimSize(), getShapeDimSizes(), mlir::spirv::ArrayType::getSizeInBytes(), mlir::AffineDmaStartOp::getSrcMemorySpace(), mlir::AffineDmaStartOp::getSrcMemRefType(), mlir::AffineDmaStartOp::getTagMemRefRank(), mlir::AffineDmaWaitOp::getTagMemRefRank(), mlir::AffineDmaStartOp::getTagMemRefType(), mlir::AffineDmaWaitOp::getTagMemRefType(), mlir::nvgpu::getWarpMatrixInfo(), getZero(), mlir::Builder::getZeroAttr(), mlir::LLVM::detail::handleMultidimensionalVectors(), inferDynamicDimsForConv(), inferIntrinsicResultType(), insertCopies(), insertCopyLoops(), insertLastDimSlice(), insertOne(), mlir::quant::QuantizedType::isCompatibleExpressedType(), isComplexOfIntType(), mlir::LLVM::isScalableVectorType(), mlir::linalg::makeMemRefCopyOp(), mlir::linalg::makeTransposeOp(), mlir::OperandElementTypeIterator::mapElement(), mlir::ResultElementTypeIterator::mapElement(), CmpFIntToFPConst::matchAndRewrite(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::OpToFuncCallLowering< SourceOp >::matchAndRewrite(), ConvertLoad::matchAndRewrite(), MaxPool2dIsNoOp::matchAndRewrite(), ReshapeConstOptimization::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), ReduceMultiDimReductionRank::matchAndRewrite(), mlir::MemRefDescriptor::MemRefDescriptor(), minMaxValueForFloat(), minMaxValueForSignedInt(), minMaxValueForUnsignedInt(), minusOneIntegerAttribute(), mlir::normalizeMemRef(), mlir::bufferization::populateDynamicDimSizes(), produceSliceErrorMsg(), produceSubViewErrorMsg(), promoteSubViews(), mlir::replaceAllMemRefUsesWith(), replaceUsesAndPropagateType(), reshapeLoad(), reshapeLowerToHigher(), reshapeStore(), mlir::linalg::rewriteAsPaddedOp(), mlir::spirv::Serializer::processOp< spirv::GenericCastToPtrExplicitOp >(), mlir::sparse_tensor::sizesFromSrc(), mlir::vector::splitFullAndPartialTransfer(), mlir::linalg::splitReductionByScaling(), tileAndFuseFirstExtractUse(), tileAndFuseFirstExtractUseThroughContainingOpBlockArgument(), transposeOneLinalgOperandAndReplace(), unpackOperandVector(), vectorizeAsLinalgGeneric(), mlir::linalg::vectorizeCopy(), mlir::spirv::MatrixType::verify(), verifyAtomicUpdateOp(), verifyBlockReadWritePtrAndValTypes(), verifyCastOp(), verifyExtOp(), verifyLoadStorePtrAndValTypes(), verifyPointerAndCoopMatrixType(), verifyPointerAndJointMatrixType(), verifyReductionVarList(), verifyTruncateOp(), and wrapExternalFunction().

◆ dump()

void Type::dump ( ) const

Definition at line 3557 of file AsmPrinter.cpp.

References print().

◆ dyn_cast()

template<typename U >
U mlir::Type::dyn_cast

Definition at line 308 of file Types.h.

Referenced by appendMangledType(), appendX1Dim(), mlir::bufferization::func_ext::FuncOpInterface::bufferize(), mlir::bufferization::BufferizeTypeConverter::BufferizeTypeConverter(), mlir::tosa::buildConvOpQuantizationAttr(), mlir::tosa::buildConvOpResultTypeInfo(), mlir::tosa::buildMatMulOpQuantizationAttr(), buildMatMulOpWithQuantInfo(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildQTypeFromMinMax(), mlir::tosa::buildUnaryOpQuantizationAttr(), mlir::spirv::SPIRVType::classof(), mlir::spirv::ScalarType::classof(), mlir::spirv::CompositeType::classof(), mlir::linalg::computeSliceParameters(), mlir::sparse_tensor::constantOne(), mlir::sparse_tensor::constantZero(), mlir::quant::ExpressedToQuantizedConverter::convert(), mlir::LLVMTypeConverter::convertCallingConventionType(), mlir::LLVMTypeConverter::convertFunctionTypeCWrapper(), convertIntrinsicResult(), convertMemrefType(), mlir::convertScalarToDtype(), convertTensorType(), createFPConstant(), createNonLdMatrixLoads(), createScalarOrSplatConstant(), deduceCanonicalResource(), defaultIsSmallAlloc(), dropTrailingX1Dim(), elementwiseMatchAndRewriteHelper(), ensureToMemrefOpIsValid(), extractVectorElementType(), foldExtractFromBroadcast(), mlir::bufferization::foldToMemrefToTensorPair(), mlir::sparse_tensor::genIsNonzero(), getBitWidth(), mlir::bufferization::getBuffer(), mlir::bufferization::func_ext::getBufferizedFunctionArgType(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), mlir::detail::getDenseElementBitWidth(), getElementPtrType(), getElementType(), mlir::getElementTypeOrSelf(), getI1SameShape(), getInsertExtractValueElementType(), getIntegerDotProductCapabilities(), getIntegerWidth(), mlir::tosa::ValueKnowledge::getKnowledgeFromType(), getLoadStoreElementType(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), mlir::bufferization::getMemRefTypeWithStaticIdentityLayout(), getMmaSyncVectorOperandType(), mlir::linalg::getNeutralElement(), getNumBits(), mlir::sparse_tensor::getOneAttr(), mlir::tensor::getOrCreateDestination(), mlir::quant::QuantizedType::getQuantizedElementType(), mlir::pdl::getRangeElementTypeOrSelf(), getRuntimeArrayElementType(), getScalarOrVectorI32Constant(), getShape(), mlir::sparse_tensor::getSparseTensorEncoding(), mlir::ConstantIntRanges::getStorageBitwidth(), getTensorOrVectorElementType(), mlir::memref::getTensorTypeFromMemRefType(), getTypeNumBytes(), getUnaryOpResultType(), mlir::getValueOrCreateCastToIndexLike(), mlir::Builder::getZeroAttr(), mlir::hasNonIdentityLayout(), PadOpVectorizationWithTransferWritePattern::hasSameTensorSize(), insertCasts(), isAllocationSupported(), isBoolScalarOrVector(), mlir::vector::isBroadcastableTo(), mlir::LLVM::isCompatibleOuterType(), mlir::LLVM::isCompatibleVectorType(), mlir::shape::isExtentTensorType(), mlir::VulkanLayoutUtils::isLegalType(), isLegalType(), mlir::isOpaqueTypeWithName(), isSameTypesWithoutEncoding(), isSignedIntegerOrVector(), isSupportedSourceType(), isUnsignedIntegerOrVector(), mlir::DataDescriptor::isValid(), mlir::spirv::MatrixType::isValidColumnType(), isValidIntOrFloat(), mlir::sparse_tensor::isZeroRankedTensorOrScalar(), matchAndReplaceDepthwiseConv(), mlir::GPUFuncOpLowering::matchAndRewrite(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mlir::linalg::materializeTiledShape(), mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(), mfmaConcatIfNeeded(), mfmaOpToIntrinsic(), minusOneIntegerAttribute(), mlir::nvgpu::optimizeSharedMemoryReadsAndWrites(), optionallyBroadcast(), mlir::sparse_tensor::overheadTypeEncoding(), parseAndVerifyMatrixType(), parseAndVerifyType(), parseArithmeticExtendedBinaryOp(), parseAtomicCompareExchangeImpl(), parseAtomicUpdateOp(), parseAwaitResultType(), mlir::AsmParser::parseColonType(), mlir::AsmParser::parseCustomTypeWithFallback(), mlir::detail::Parser::parseDecOrHexAttr(), mlir::detail::Parser::parseDenseResourceElementsAttr(), mlir::detail::Parser::parseElementsLiteralType(), parseGlobalMemrefOpTypeAndInitialValue(), parseOneResultSameOperandTypeOp(), mlir::AsmParser::parseType(), mlir::tensor::preservesStaticInformation(), mlir::sparse_tensor::primaryTypeEncoding(), mlir::ExtensibleDialect::printIfDynamicType(), mlir::LLVM::ModuleImport::processFunction(), promoteSubViews(), mlir::DialectBytecodeReader::readType(), reduceIfNeeded(), replaceUnitExtents(), reshapeLowerToHigher(), mlir::linalg::DownscaleSizeOneWindowed2DConvolution< Conv2DOp, Conv1DOp >::returningMatchAndRewrite(), mlir::linalg::DownscaleDepthwiseConv2DNhwcHwcOp::returningMatchAndRewrite(), mlir::impl::scalarizeVectorOp(), mlir::ShapeAdaptor::ShapeAdaptor(), mlir::SPIRVTypeConverter::SPIRVTypeConverter(), mlir::structFuncArgTypeConverter(), mlir::DenseElementsAttr::tryGetComplexFloatValues(), mlir::DenseElementsAttr::tryGetFloatValues(), vectorShape(), mlir::quant::QuantizedType::verify(), verifyCastOp(), mlir::verifyCompatibleShape(), verifyConstantType(), verifyIntegerDotProduct(), verifyOutputShape(), and verifyTransferOp().

◆ dyn_cast_or_null()

template<typename U >
U mlir::Type::dyn_cast_or_null

Definition at line 313 of file Types.h.

Referenced by convertMemrefType(), and getBoolAttribute().

◆ getAbstractType()

const AbstractTy& mlir::Type::getAbstractType ( ) const
inline

Return the abstract type descriptor for this type.

Definition at line 186 of file Types.h.

Referenced by hasTrait(), replaceImmediateSubElements(), and walkImmediateSubElements().

◆ getAsOpaquePointer()

const void* mlir::Type::getAsOpaquePointer ( ) const
inline

Methods for supporting PointerLikeTypeTraits.

Definition at line 172 of file Types.h.

References impl.

Referenced by llvm::PointerLikeTypeTraits< mlir::Type >::getAsVoidPointer().

◆ getContext()

MLIRContext * Type::getContext ( ) const

Return the MLIRContext in which this type was uniqued.

Definition at line 35 of file Types.cpp.

Referenced by combineOneSpec(), mlir::quant::fakeQuantAttrsToType(), mlir::gpu::MMAMatrixType::get(), mlir::spirv::MatrixType::get(), mlir::spirv::RuntimeArrayType::get(), mlir::spirv::CooperativeMatrixNVType::get(), mlir::spirv::JointMatrixINTELType::get(), mlir::spirv::ArrayType::get(), mlir::quant::CalibratedQuantizedType::get(), mlir::spirv::SampledImageType::get(), mlir::DataLayoutEntryAttr::get(), mlir::spirv::PointerType::get(), mlir::quant::UniformQuantizedPerAxisType::get(), mlir::quant::UniformQuantizedType::get(), mlir::quant::AnyQuantizedType::get(), mlir::sparse_tensor::get1DMemRefType(), mlir::gpu::MMAMatrixType::getChecked(), mlir::spirv::MatrixType::getChecked(), mlir::quant::CalibratedQuantizedType::getChecked(), mlir::spirv::SampledImageType::getChecked(), mlir::quant::UniformQuantizedPerAxisType::getChecked(), mlir::quant::UniformQuantizedType::getChecked(), mlir::quant::AnyQuantizedType::getChecked(), mlir::Value::getContext(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), getGetValueTypeOpValueType(), getI1SameShape(), mlir::bufferization::getMemRefTypeWithFullyDynamicLayout(), getRegisterIndexToTileOffsetMap(), mlir::memref::getTensorTypeFromMemRefType(), getUnaryOpResultType(), getValAndBoolStructType(), inferIntrinsicResultType(), mlir::LLVM::isCompatibleType(), mlir::spirv::MemorySpaceToStorageClassConverter::MemorySpaceToStorageClassConverter(), mlir::UnrankedMemRefDescriptor::sizeBasePtr(), and mlir::arith::WideIntEmulationConverter::WideIntEmulationConverter().

◆ getDialect()

Dialect Type::getDialect ( ) const
inline

◆ getFromOpaquePointer()

static Type mlir::Type::getFromOpaquePointer ( const void *  pointer)
inlinestatic

◆ getImpl()

ImplType* mlir::Type::getImpl ( ) const
inline

◆ getIntOrFloatBitWidth()

unsigned Type::getIntOrFloatBitWidth ( ) const

◆ getTypeID()

TypeID mlir::Type::getTypeID ( )
inline

Return a unique identifier for the concrete type.

This is used to support dynamic type casting.

Definition at line 112 of file Types.h.

Referenced by mlir::DataLayout::getTypeABIAlignment(), mlir::DataLayout::getTypePreferredAlignment(), mlir::DataLayout::getTypeSize(), mlir::DataLayout::getTypeSizeInBits(), mlir::DynamicType::isa(), and mlir::OpTrait::impl::verifyElementwise().

◆ hasTrait()

template<template< typename T > class Trait>
bool mlir::Type::hasTrait ( )
inline

Returns true if the type was registered with a particular trait.

Definition at line 181 of file Types.h.

References getAbstractType(), and mlir::AbstractType::hasTrait().

Referenced by mlir::DynamicType::classof().

◆ isa()

template<typename... Tys>
bool mlir::Type::isa

Definition at line 298 of file Types.h.

Referenced by mlir::ArithBuilder::add(), mlir::bufferization::allocateTensorForShapedValue(), mlir::linalg::areElementwiseOpsFusable(), broadcast(), mlir::bufferization::func_ext::CallOpInterface::bufferize(), buildVectorWrite(), mlir::LLVMTypeConverter::canConvertToBarePtr(), mlir::quant::QuantizedType::castFromExpressedType(), mlir::quant::QuantizedType::castFromStorageType(), mlir::quant::QuantizedType::castToExpressedType(), mlir::quant::QuantizedType::castToStorageType(), mlir::spirv::SPIRVType::classof(), mlir::spirv::CompositeType::classof(), mlir::FloatType::classof(), mlir::TensorType::classof(), mlir::BaseMemRefType::classof(), mlir::linalg::computeAllSliceParameters(), mlir::convertScalarToDtype(), mlir::ConvertToLLVMPattern::copyUnrankedDescriptors(), createConstantAllBitsSet(), createContractArithOp(), createElementIPowIFunc(), createGroupReduceOp(), createInitialValueForReduceOp(), createLinalgBodyCalculationForElementwiseOp(), createLinalgBodyCalculationForReduceOp(), createNonLdMatrixLoads(), mlir::vector::createOrFoldDimOp(), createOrFoldDimOp(), mlir::linalg::createOrFoldDimOp(), mlir::bufferization::detail::defaultGetBufferType(), dispatchPrint(), fillStructuredOpRegion(), foldExtractStridedOpFromInsertChain(), mlir::memref::foldMemRefCast(), mlir::quant::ExpressedToQuantizedConverter::forInputType(), mlir::linalg::fuseElementwiseOps(), genIndexLoad(), mlir::sparse_tensor::genIsNonzero(), getBitWidth(), mlir::OpTrait::util::getBroadcastedType(), mlir::bufferization::getBufferType(), mlir::detail::getDefaultABIAlignment(), mlir::detail::getDefaultPreferredAlignment(), mlir::detail::getDefaultTypeSizeInBits(), getGenericEffectsImpl(), getGetValueTypeOpValueType(), getI1SameShape(), mlir::sparse_tensor::getOneAttr(), mlir::spirv::getOpenCLElementPtr(), getOperandTreePredicates(), mlir::LLVM::getPrimitiveTypeSizeInBits(), getProducerOfTensor(), mlir::quant::QuantizedType::getQuantizedElementType(), getTreePredicates(), getTypeNumBytes(), getUnderlyingType(), getVectorType(), getZero(), mlir::Builder::getZeroAttr(), mlir::spirv::CompositeType::hasCompileTimeKnownNumElements(), hasTensorOrVectorType(), insertCasts(), insertLastDimSlice(), isAccessIndexInvariant(), isaTensor(), mlir::quant::QuantizedType::isCompatibleExpressedType(), mlir::LLVM::isCompatibleFloatingPointType(), mlir::LLVM::isCompatibleOuterType(), mlir::LLVM::isCompatibleVectorType(), isComplexOfIntType(), isDefinedByCallTo(), isErrorPropagationPossible(), isGpuAsyncTokenType(), isQuantizablePrimitiveType(), mlir::async::isRefCounted(), mlir::LLVM::isScalableVectorType(), isSupportedCombiningKind(), mlir::LLVM::LLVMStructType::isValidElementType(), mlir::TensorType::isValidElementType(), mlir::BaseMemRefType::isValidElementType(), isValidIntOrFloat(), mlir::bufferization::AnalysisState::isValueRead(), mlir::transform::TransformState::mapBlockArgument(), mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite(), ConvertSameRankInsertStridedSliceIntoShuffle::matchAndRewrite(), ConvertAccessChain::matchAndRewrite(), mlir::vector::ContractionOpToMatmulOpLowering::matchAndRewrite(), mfmaOpToIntrinsic(), mlir::ArithBuilder::mul(), mlir::AffineDmaWaitOp::parse(), parseAndVerifySampledImageType(), mlir::detail::Parser::parseComplexType(), mlir::detail::Parser::parseDecOrHexAttr(), mlir::detail::Parser::parseFloatAttr(), mlir::OpAsmPrinter::printFunctionalType(), mlir::bufferization::replaceOpWithBufferizedValues(), mlir::impl::scalarizeVectorOp(), mlir::spirv::Serializer::processOp< spirv::FunctionCallOp >(), setInPlaceOpOperand(), mlir::ArithBuilder::sgt(), mlir::ArithBuilder::slt(), mlir::structFuncArgTypeConverter(), mlir::ArithBuilder::sub(), vectorizeOperand(), mlir::quant::CalibratedQuantizedType::verify(), mlir::spirv::SampledImageType::verify(), mlir::quant::UniformQuantizedPerAxisType::verify(), mlir::quant::UniformQuantizedType::verify(), mlir::quant::AnyQuantizedType::verify(), mlir::detail::verifyDestinationStyleOpInterface(), verifyOutputShape(), verifyPointerAndCoopMatrixType(), verifyPointerAndJointMatrixType(), mlir::transform::detail::verifyPossibleTopLevelTransformOpTrait(), verifyReduceOpAndType(), verifyShapeOrExtentTensorOp(), verifySizeOrIndexOp(), and visitUpward().

◆ isa_and_nonnull()

template<typename... Tys>
bool mlir::Type::isa_and_nonnull

Definition at line 303 of file Types.h.

Referenced by destructureIndices().

◆ isBF16()

bool Type::isBF16 ( ) const

◆ isF128()

bool Type::isF128 ( ) const

Definition at line 44 of file Types.cpp.

Referenced by fltSemanticsForType().

◆ isF16()

bool Type::isF16 ( ) const

◆ isF32()

bool Type::isF32 ( ) const

◆ isF64()

bool Type::isF64 ( ) const

◆ isF80()

bool Type::isF80 ( ) const

Definition at line 43 of file Types.cpp.

Referenced by fltSemanticsForType().

◆ isFloat8E4M3FN()

bool Type::isFloat8E4M3FN ( ) const

Definition at line 38 of file Types.cpp.

◆ isFloat8E5M2()

bool Type::isFloat8E5M2 ( ) const

Definition at line 37 of file Types.cpp.

◆ isIndex()

bool Type::isIndex ( ) const

◆ isInteger()

bool Type::isInteger ( unsigned  width) const

◆ isIntOrFloat()

bool Type::isIntOrFloat ( ) const

◆ isIntOrIndex()

bool Type::isIntOrIndex ( ) const

Return true if this is an integer (of any signedness) or an index type.

Definition at line 103 of file Types.cpp.

Referenced by mlir::sparse_tensor::genIsNonzero(), isSupportedCombiningKind(), mlir::detail::Parser::parseDenseArrayAttr(), and mlir::dataflow::IntegerRangeAnalysis::visitOperation().

◆ isIntOrIndexOrFloat()

bool Type::isIntOrIndexOrFloat ( ) const

◆ isSignedInteger() [1/2]

bool Type::isSignedInteger ( ) const

Return true if this is a signed integer type (with the specified width).

Definition at line 67 of file Types.cpp.

Referenced by buildAttributeAPInt(), mlir::Builder::getIntegerAttr(), and isSignedIntegerOrVector().

◆ isSignedInteger() [2/2]

bool Type::isSignedInteger ( unsigned  width) const

Definition at line 73 of file Types.cpp.

◆ isSignlessInteger() [1/2]

bool Type::isSignlessInteger ( ) const

Return true if this is a signless integer type (with the specified width).

Definition at line 55 of file Types.cpp.

Referenced by mlir::arith::ConstantIntOp::build().

◆ isSignlessInteger() [2/2]

bool Type::isSignlessInteger ( unsigned  width) const

Definition at line 61 of file Types.cpp.

◆ isSignlessIntOrFloat()

bool Type::isSignlessIntOrFloat ( ) const

Return true of this is a signless integer or a float type.

Definition at line 99 of file Types.cpp.

Referenced by mlir::linalg::RegionMatcher::matchAsScalarBinaryOp().

◆ isSignlessIntOrIndex()

bool Type::isSignlessIntOrIndex ( ) const

Return true if this is a signless integer or index type.

Definition at line 91 of file Types.cpp.

◆ isSignlessIntOrIndexOrFloat()

bool Type::isSignlessIntOrIndexOrFloat ( ) const

Return true if this is a signless integer, index, or float type.

Definition at line 95 of file Types.cpp.

Referenced by appendMangledType().

◆ isUnsignedInteger() [1/2]

bool Type::isUnsignedInteger ( ) const

Return true if this is an unsigned integer type (with the specified width).

Definition at line 79 of file Types.cpp.

Referenced by createLinalgBodyCalculationForElementwiseOp(), isUnsignedIntegerOrVector(), and mlir::detail::Parser::parseDecOrHexAttr().

◆ isUnsignedInteger() [2/2]

bool Type::isUnsignedInteger ( unsigned  width) const

Definition at line 85 of file Types.cpp.

◆ operator bool()

mlir::Type::operator bool ( ) const
inlineexplicit

Definition at line 95 of file Types.h.

References impl.

◆ operator!()

bool mlir::Type::operator! ( ) const
inline

Definition at line 97 of file Types.h.

◆ operator!=()

bool mlir::Type::operator!= ( Type  other) const
inline

Definition at line 94 of file Types.h.

◆ operator=()

Type& mlir::Type::operator= ( const Type other)
default

◆ operator==()

bool mlir::Type::operator== ( Type  other) const
inline

Definition at line 93 of file Types.h.

References impl.

◆ print() [1/2]

void Type::print ( raw_ostream &  os) const

Print the current type.

Definition at line 3544 of file AsmPrinter.cpp.

References print().

Referenced by mlir::operator<<().

◆ print() [2/2]

void Type::print ( raw_ostream &  os,
AsmState state 
) const

◆ replace()

template<typename... ReplacementFns>
auto mlir::Type::replace ( ReplacementFns &&...  replacementFns)
inline

Recursively replace all of the nested sub-attributes and sub-types using the provided map functions.

Returns nullptr in the case of failure. See AttrTypeReplacer for information on the support replacement function types.

Definition at line 225 of file Types.h.

References mlir::AttrTypeReplacer::addReplacement(), and mlir::AttrTypeReplacer::replace().

Referenced by mlir::gpu::populateMemorySpaceAttributeTypeConversions().

◆ replaceImmediateSubElements()

auto mlir::Type::replaceImmediateSubElements ( ArrayRef< Attribute replAttrs,
ArrayRef< Type replTypes 
) const
inline

Replace the immediately nested sub-attributes and sub-types with those provided.

The order of the provided elements is derived from the order of the elements returned by the callbacks of walkImmediateSubElements. The element at index 0 would replace the very first attribute given by walkImmediateSubElements. On success, the new instance with the values replaced is returned. If replacement fails, nullptr is returned.

Definition at line 204 of file Types.h.

References getAbstractType(), and mlir::AbstractType::replaceImmediateSubElements().

◆ walk()

template<WalkOrder Order = WalkOrder::PostOrder, typename... WalkFns>
auto mlir::Type::walk ( WalkFns &&...  walkFns)
inline

Walk this type and all attibutes/types nested within using the provided walk functions.

See AttrTypeWalker for information on the supported walk function types.

Definition at line 214 of file Types.h.

References mlir::AttrTypeWalker::addWalk(), and mlir::AttrTypeWalker::walk().

◆ walkImmediateSubElements()

void mlir::Type::walkImmediateSubElements ( function_ref< void(Attribute)>  walkAttrsFn,
function_ref< void(Type)>  walkTypesFn 
) const
inline

Walk all of the immediately nested sub-attributes and sub-types.

This method does not recurse into sub elements.

Definition at line 193 of file Types.h.

References getAbstractType(), and mlir::AbstractType::walkImmediateSubElements().

Friends And Related Function Documentation

◆ hash_value

::llvm::hash_code hash_value ( Type  arg)
friend

Definition at line 293 of file Types.h.

Member Data Documentation

◆ impl

ImplType* mlir::Type::impl {nullptr}
protected

Definition at line 233 of file Types.h.

Referenced by getAsOpaquePointer(), getImpl(), operator bool(), and operator==().


The documentation for this class was generated from the following files: