diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -1784,6 +1784,23 @@ Pred predicate = pred; } +//===----------------------------------------------------------------------===// +// TypeTrait definitions +//===----------------------------------------------------------------------===// + +// TypeTrait represents a trait regarding a type. +// TODO: Remove this class in favor of using Trait. +class TypeTrait; + +// These classes are used to define type specific traits. +class NativeTypeTrait : NativeTrait, TypeTrait; +class ParamNativeTypeTrait + : ParamNativeTrait, TypeTrait; +class GenInternalTypeTrait + : GenInternalTrait, TypeTrait; +class PredTypeTrait + : PredTrait, TypeTrait; + //===----------------------------------------------------------------------===// // OpTrait definitions //===----------------------------------------------------------------------===// diff --git a/mlir/include/mlir/IR/StorageUniquerSupport.h b/mlir/include/mlir/IR/StorageUniquerSupport.h --- a/mlir/include/mlir/IR/StorageUniquerSupport.h +++ b/mlir/include/mlir/IR/StorageUniquerSupport.h @@ -57,6 +57,25 @@ // StorageUserBase //===----------------------------------------------------------------------===// +namespace storage_user_base_impl { +/// Returns true if this given Trait ID matches the IDs of any of the provided +/// trait types `Traits`. +template