22 walkImmediateSubElementsFn(type, walkAttrsFn, walkTypesFn);
28 return replaceImmediateSubElementsFn(type, replAttrs, replTypes);
40 return llvm::isa<Float8E5M2FNUZType>(*
this);
43 return llvm::isa<Float8E4M3FNUZType>(*
this);
46 return llvm::isa<Float8E4M3B11FNUZType>(*
this);
48 bool Type::isBF16()
const {
return llvm::isa<BFloat16Type>(*
this); }
49 bool Type::isF16()
const {
return llvm::isa<Float16Type>(*
this); }
50 bool Type::isF32()
const {
return llvm::isa<Float32Type>(*
this); }
51 bool Type::isF64()
const {
return llvm::isa<Float64Type>(*
this); }
52 bool Type::isF80()
const {
return llvm::isa<Float80Type>(*
this); }
53 bool Type::isF128()
const {
return llvm::isa<Float128Type>(*
this); }
59 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
60 return intTy.getWidth() == width;
65 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
66 return intTy.isSignless();
71 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
72 return intTy.isSignless() && intTy.getWidth() == width;
77 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
78 return intTy.isSigned();
83 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
84 return intTy.isSigned() && intTy.getWidth() == width;
89 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
90 return intTy.isUnsigned();
95 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
96 return intTy.isUnsigned() && intTy.getWidth() == width;
101 return isSignlessInteger() || llvm::isa<IndexType>(*
this);
105 return isSignlessInteger() || llvm::isa<IndexType, FloatType>(*
this);
109 return isSignlessInteger() || llvm::isa<FloatType>(*
this);
113 return llvm::isa<IntegerType>(*
this) || isIndex();
117 return llvm::isa<IntegerType, FloatType>(*
this);
123 assert(isIntOrFloat() &&
"only integers and floats have a bitwidth");
124 if (
auto intType = llvm::dyn_cast<IntegerType>(*
this))
125 return intType.getWidth();
126 return llvm::cast<FloatType>(*this).getWidth();
Type replaceImmediateSubElements(Type type, ArrayRef< Attribute > replAttrs, ArrayRef< Type > replTypes) const
Replace the immediate sub-elements of the given type.
void walkImmediateSubElements(Type type, function_ref< void(Attribute)> walkAttrsFn, function_ref< void(Type)> walkTypesFn) const
Walk the immediate sub-elements of the given type.
Attributes are known-constant values of operations.
MLIRContext is the top-level object for a collection of MLIR operations.
Instances of the Type class are uniqued, have an immutable identifier and an optional mutable compone...
bool isInteger(unsigned width) const
Return true if this is an integer type with the specified width.
bool isSignlessIntOrIndex() const
Return true if this is a signless integer or index type.
MLIRContext * getContext() const
Return the MLIRContext in which this type was uniqued.
bool isSignedInteger() const
Return true if this is a signed integer type (with the specified width).
bool isFloat8E4M3FN() const
bool isSignlessInteger() const
Return true if this is a signless integer type (with the specified width).
bool isIntOrIndexOrFloat() const
Return true if this is an integer (of any signedness), index, or float type.
bool isFloat8E4M3FNUZ() const
bool isUnsignedInteger() const
Return true if this is an unsigned integer type (with the specified width).
bool isIntOrIndex() const
Return true if this is an integer (of any signedness) or an index type.
bool isFloat8E4M3B11FNUZ() const
bool isIntOrFloat() const
Return true if this is an integer (of any signedness) or a float type.
bool isFloat8E5M2() const
bool isSignlessIntOrFloat() const
Return true of this is a signless integer or a float type.
unsigned getIntOrFloatBitWidth() const
Return the bit width of an integer or a float type, assert failure on other types.
bool isFloat8E5M2FNUZ() const
bool isSignlessIntOrIndexOrFloat() const
Return true if this is a signless integer, index, or float type.
Detect if any of the given parameter types has a sub-element handler.
This header declares functions that assist transformations in the MemRef dialect.