22 walkImmediateSubElementsFn(type, walkAttrsFn, walkTypesFn);
28 return replaceImmediateSubElementsFn(type, replAttrs, replTypes);
37 bool Type::isBF16()
const {
return llvm::isa<BFloat16Type>(*
this); }
38 bool Type::isF16()
const {
return llvm::isa<Float16Type>(*
this); }
39 bool Type::isTF32()
const {
return llvm::isa<FloatTF32Type>(*
this); }
40 bool Type::isF32()
const {
return llvm::isa<Float32Type>(*
this); }
41 bool Type::isF64()
const {
return llvm::isa<Float64Type>(*
this); }
42 bool Type::isF80()
const {
return llvm::isa<Float80Type>(*
this); }
43 bool Type::isF128()
const {
return llvm::isa<Float128Type>(*
this); }
51 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
52 return intTy.getWidth() == width;
57 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
58 return intTy.isSignless();
63 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
64 return intTy.isSignless() && intTy.getWidth() == width;
69 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
70 return intTy.isSigned();
75 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
76 return intTy.isSigned() && intTy.getWidth() == width;
81 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
82 return intTy.isUnsigned();
87 if (
auto intTy = llvm::dyn_cast<IntegerType>(*
this))
88 return intTy.isUnsigned() && intTy.getWidth() == width;
93 return isSignlessInteger() || llvm::isa<IndexType>(*
this);
97 return isSignlessInteger() || llvm::isa<IndexType, FloatType>(*
this);
101 return isSignlessInteger() || llvm::isa<FloatType>(*
this);
105 return llvm::isa<IntegerType>(*
this) || isIndex();
109 return llvm::isa<IntegerType, FloatType>(*
this);
115 assert(isIntOrFloat() &&
"only integers and floats have a bitwidth");
116 if (
auto intType = llvm::dyn_cast<IntegerType>(*
this))
117 return intType.getWidth();
118 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 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 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 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 isInteger() const
Return true if this is an integer type (with the specified width).
bool isIntOrFloat() const
Return true if this is an integer (of any signedness) or a float type.
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 isSignlessIntOrIndexOrFloat() const
Return true if this is a signless integer, index, or float type.
Include the generated interface declarations.