[Mlir-commits] [mlir] ab70b63 - [MLIR][CAPI] Move `DenseMapInfo<MlirTypeID>`
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue May 30 10:04:47 PDT 2023
Author: max
Date: 2023-05-30T12:03:56-05:00
New Revision: ab70b63a71abc741f12ed5ba2ff438fe44f46e5d
URL: https://github.com/llvm/llvm-project/commit/ab70b63a71abc741f12ed5ba2ff438fe44f46e5d
DIFF: https://github.com/llvm/llvm-project/commit/ab70b63a71abc741f12ed5ba2ff438fe44f46e5d.diff
LOG: [MLIR][CAPI] Move `DenseMapInfo<MlirTypeID>`
I mistakenly put this in `mlir/CAPI/Support.h` at some point during the flurry of refactoring of `TypeCaster`s but as @jpienaar rightly pointed out, it doesn't belong there.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D151669
Added:
Modified:
mlir/include/mlir/CAPI/Support.h
mlir/lib/Bindings/Python/PybindUtils.h
Removed:
################################################################################
diff --git a/mlir/include/mlir/CAPI/Support.h b/mlir/include/mlir/CAPI/Support.h
index e42413dbe6d28..f3e8a67e0ac36 100644
--- a/mlir/include/mlir/CAPI/Support.h
+++ b/mlir/include/mlir/CAPI/Support.h
@@ -44,25 +44,4 @@ inline mlir::LogicalResult unwrap(MlirLogicalResult res) {
DEFINE_C_API_METHODS(MlirTypeID, mlir::TypeID)
DEFINE_C_API_PTR_METHODS(MlirTypeIDAllocator, mlir::TypeIDAllocator)
-namespace llvm {
-
-template <>
-struct DenseMapInfo<MlirTypeID> {
- static inline MlirTypeID getEmptyKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
- return mlirTypeIDCreate(pointer);
- }
- static inline MlirTypeID getTombstoneKey() {
- auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
- return mlirTypeIDCreate(pointer);
- }
- static inline unsigned getHashValue(const MlirTypeID &val) {
- return mlirTypeIDHashValue(val);
- }
- static inline bool isEqual(const MlirTypeID &lhs, const MlirTypeID &rhs) {
- return mlirTypeIDEqual(lhs, rhs);
- }
-};
-} // namespace llvm
-
#endif // MLIR_CAPI_SUPPORT_H
diff --git a/mlir/lib/Bindings/Python/PybindUtils.h b/mlir/lib/Bindings/Python/PybindUtils.h
index 41de7e9b46695..2a8da20bee049 100644
--- a/mlir/lib/Bindings/Python/PybindUtils.h
+++ b/mlir/lib/Bindings/Python/PybindUtils.h
@@ -354,4 +354,25 @@ class Sliceable {
} // namespace mlir
+namespace llvm {
+
+template <>
+struct DenseMapInfo<MlirTypeID> {
+ static inline MlirTypeID getEmptyKey() {
+ auto *pointer = llvm::DenseMapInfo<void *>::getEmptyKey();
+ return mlirTypeIDCreate(pointer);
+ }
+ static inline MlirTypeID getTombstoneKey() {
+ auto *pointer = llvm::DenseMapInfo<void *>::getTombstoneKey();
+ return mlirTypeIDCreate(pointer);
+ }
+ static inline unsigned getHashValue(const MlirTypeID &val) {
+ return mlirTypeIDHashValue(val);
+ }
+ static inline bool isEqual(const MlirTypeID &lhs, const MlirTypeID &rhs) {
+ return mlirTypeIDEqual(lhs, rhs);
+ }
+};
+} // namespace llvm
+
#endif // MLIR_BINDINGS_PYTHON_PYBINDUTILS_H
More information about the Mlir-commits
mailing list