// Convenience predicates. This is only for floating point types,
// derived types should use isa/dyn_cast.
- bool isIndex();
- bool isBF16();
- bool isF16();
- bool isF32();
- bool isF64();
+ bool isIndex() const;
+ bool isBF16() const;
+ bool isF16() const;
+ bool isF32() const;
+ bool isF64() const;
/// Return true if this is an integer type with the specified width.
- bool isInteger(unsigned width);
+ bool isInteger(unsigned width) const;
/// Return true if this is a signless integer type (with the specified width).
- bool isSignlessInteger();
- bool isSignlessInteger(unsigned width);
+ bool isSignlessInteger() const;
+ bool isSignlessInteger(unsigned width) const;
/// Return true if this is a signed integer type (with the specified width).
- bool isSignedInteger();
- bool isSignedInteger(unsigned width);
+ bool isSignedInteger() const;
+ bool isSignedInteger(unsigned width) const;
/// Return true if this is an unsigned integer type (with the specified
/// width).
- bool isUnsignedInteger();
- bool isUnsignedInteger(unsigned width);
+ bool isUnsignedInteger() const;
+ bool isUnsignedInteger(unsigned width) const;
/// Return the bit width of an integer or a float type, assert failure on
/// other types.
- unsigned getIntOrFloatBitWidth();
+ unsigned getIntOrFloatBitWidth() const;
/// Return true if this is a signless integer or index type.
- bool isSignlessIntOrIndex();
+ bool isSignlessIntOrIndex() const;
/// Return true if this is a signless integer, index, or float type.
- bool isSignlessIntOrIndexOrFloat();
+ bool isSignlessIntOrIndexOrFloat() const;
/// Return true of this is a signless integer or a float type.
- bool isSignlessIntOrFloat();
+ bool isSignlessIntOrFloat() const;
/// Return true if this is an integer (of any signedness) or an index type.
- bool isIntOrIndex();
+ bool isIntOrIndex() const;
/// Return true if this is an integer (of any signedness) or a float type.
- bool isIntOrFloat();
+ bool isIntOrFloat() const;
/// Return true if this is an integer (of any signedness), index, or float
/// type.
- bool isIntOrIndexOrFloat();
+ bool isIntOrIndexOrFloat() const;
/// Print the current type.
void print(raw_ostream &os);
// Type
//===----------------------------------------------------------------------===//
-bool Type::isBF16() { return isa<BFloat16Type>(); }
-bool Type::isF16() { return isa<Float16Type>(); }
-bool Type::isF32() { return isa<Float32Type>(); }
-bool Type::isF64() { return isa<Float64Type>(); }
+bool Type::isBF16() const { return isa<BFloat16Type>(); }
+bool Type::isF16() const { return isa<Float16Type>(); }
+bool Type::isF32() const { return isa<Float32Type>(); }
+bool Type::isF64() const { return isa<Float64Type>(); }
-bool Type::isIndex() { return isa<IndexType>(); }
+bool Type::isIndex() const { return isa<IndexType>(); }
/// Return true if this is an integer type with the specified width.
-bool Type::isInteger(unsigned width) {
+bool Type::isInteger(unsigned width) const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.getWidth() == width;
return false;
}
-bool Type::isSignlessInteger() {
+bool Type::isSignlessInteger() const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isSignless();
return false;
}
-bool Type::isSignlessInteger(unsigned width) {
+bool Type::isSignlessInteger(unsigned width) const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isSignless() && intTy.getWidth() == width;
return false;
}
-bool Type::isSignedInteger() {
+bool Type::isSignedInteger() const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isSigned();
return false;
}
-bool Type::isSignedInteger(unsigned width) {
+bool Type::isSignedInteger(unsigned width) const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isSigned() && intTy.getWidth() == width;
return false;
}
-bool Type::isUnsignedInteger() {
+bool Type::isUnsignedInteger() const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isUnsigned();
return false;
}
-bool Type::isUnsignedInteger(unsigned width) {
+bool Type::isUnsignedInteger(unsigned width) const {
if (auto intTy = dyn_cast<IntegerType>())
return intTy.isUnsigned() && intTy.getWidth() == width;
return false;
}
-bool Type::isSignlessIntOrIndex() {
+bool Type::isSignlessIntOrIndex() const {
return isSignlessInteger() || isa<IndexType>();
}
-bool Type::isSignlessIntOrIndexOrFloat() {
+bool Type::isSignlessIntOrIndexOrFloat() const {
return isSignlessInteger() || isa<IndexType, FloatType>();
}
-bool Type::isSignlessIntOrFloat() {
+bool Type::isSignlessIntOrFloat() const {
return isSignlessInteger() || isa<FloatType>();
}
-bool Type::isIntOrIndex() { return isa<IntegerType>() || isIndex(); }
+bool Type::isIntOrIndex() const { return isa<IntegerType>() || isIndex(); }
-bool Type::isIntOrFloat() { return isa<IntegerType, FloatType>(); }
+bool Type::isIntOrFloat() const { return isa<IntegerType, FloatType>(); }
-bool Type::isIntOrIndexOrFloat() { return isIntOrFloat() || isIndex(); }
+bool Type::isIntOrIndexOrFloat() const { return isIntOrFloat() || isIndex(); }
-unsigned Type::getIntOrFloatBitWidth() {
+unsigned Type::getIntOrFloatBitWidth() const {
assert(isIntOrFloat() && "only integers and floats have a bitwidth");
if (auto intType = dyn_cast<IntegerType>())
return intType.getWidth();