forked from OSchip/llvm-project
NFC: Move the Type::is* predicates to StandardTypes.cpp
These methods are currently defined 'inline' in StandardTypes.h, but this may create linker errors if StandardTypes.h isn't included at the use site. PiperOrigin-RevId: 263850328
This commit is contained in:
parent
3191f9c5e0
commit
36c373129d
|
@ -71,13 +71,6 @@ enum Kind {
|
|||
|
||||
} // namespace StandardTypes
|
||||
|
||||
inline bool Type::isBF16() { return getKind() == StandardTypes::BF16; }
|
||||
inline bool Type::isF16() { return getKind() == StandardTypes::F16; }
|
||||
inline bool Type::isF32() { return getKind() == StandardTypes::F32; }
|
||||
inline bool Type::isF64() { return getKind() == StandardTypes::F64; }
|
||||
|
||||
inline bool Type::isIndex() { return getKind() == StandardTypes::Index; }
|
||||
|
||||
/// Index is a special integer-like type with unknown platform-dependent bit
|
||||
/// width.
|
||||
class IndexType : public Type::TypeBase<IndexType, Type> {
|
||||
|
@ -123,25 +116,6 @@ public:
|
|||
static constexpr unsigned kMaxWidth = 4096;
|
||||
};
|
||||
|
||||
/// Return true if this is an integer type with the specified width.
|
||||
inline bool Type::isInteger(unsigned width) {
|
||||
if (auto intTy = dyn_cast<IntegerType>())
|
||||
return intTy.getWidth() == width;
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool Type::isIntOrIndex() {
|
||||
return isa<IndexType>() || isa<IntegerType>();
|
||||
}
|
||||
|
||||
inline bool Type::isIntOrIndexOrFloat() {
|
||||
return isa<IndexType>() || isa<IntegerType>() || isa<FloatType>();
|
||||
}
|
||||
|
||||
inline bool Type::isIntOrFloat() {
|
||||
return isa<IntegerType>() || isa<FloatType>();
|
||||
}
|
||||
|
||||
class FloatType : public Type::TypeBase<FloatType, Type> {
|
||||
public:
|
||||
using Base::Base;
|
||||
|
|
|
@ -27,6 +27,32 @@
|
|||
using namespace mlir;
|
||||
using namespace mlir::detail;
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Type
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
bool Type::isBF16() { return getKind() == StandardTypes::BF16; }
|
||||
bool Type::isF16() { return getKind() == StandardTypes::F16; }
|
||||
bool Type::isF32() { return getKind() == StandardTypes::F32; }
|
||||
bool Type::isF64() { return getKind() == StandardTypes::F64; }
|
||||
|
||||
bool Type::isIndex() { return isa<IndexType>(); }
|
||||
|
||||
/// Return true if this is an integer type with the specified width.
|
||||
bool Type::isInteger(unsigned width) {
|
||||
if (auto intTy = dyn_cast<IntegerType>())
|
||||
return intTy.getWidth() == width;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Type::isIntOrIndex() { return isa<IndexType>() || isa<IntegerType>(); }
|
||||
|
||||
bool Type::isIntOrIndexOrFloat() {
|
||||
return isa<IndexType>() || isa<IntegerType>() || isa<FloatType>();
|
||||
}
|
||||
|
||||
bool Type::isIntOrFloat() { return isa<IntegerType>() || isa<FloatType>(); }
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Integer Type
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
Loading…
Reference in New Issue