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
diff --git a/include/mlir/IR/StandardTypes.h b/include/mlir/IR/StandardTypes.h
index 4666e58..0e78898 100644
--- a/include/mlir/IR/StandardTypes.h
+++ b/include/mlir/IR/StandardTypes.h
@@ -71,13 +71,6 @@
} // 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 @@
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;
diff --git a/lib/IR/StandardTypes.cpp b/lib/IR/StandardTypes.cpp
index 6077e4d..7c996f5 100644
--- a/lib/IR/StandardTypes.cpp
+++ b/lib/IR/StandardTypes.cpp
@@ -28,6 +28,32 @@
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
//===----------------------------------------------------------------------===//