From ab70b63a71abc741f12ed5ba2ff438fe44f46e5d Mon Sep 17 00:00:00 2001 From: max Date: Tue, 30 May 2023 10:46:55 -0500 Subject: [PATCH] [MLIR][CAPI] Move `DenseMapInfo` 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 --- mlir/include/mlir/CAPI/Support.h | 21 --------------------- mlir/lib/Bindings/Python/PybindUtils.h | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/mlir/include/mlir/CAPI/Support.h b/mlir/include/mlir/CAPI/Support.h index e42413d..f3e8a67 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 { - static inline MlirTypeID getEmptyKey() { - auto *pointer = llvm::DenseMapInfo::getEmptyKey(); - return mlirTypeIDCreate(pointer); - } - static inline MlirTypeID getTombstoneKey() { - auto *pointer = llvm::DenseMapInfo::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 41de7e9..2a8da20 100644 --- a/mlir/lib/Bindings/Python/PybindUtils.h +++ b/mlir/lib/Bindings/Python/PybindUtils.h @@ -354,4 +354,25 @@ private: } // namespace mlir +namespace llvm { + +template <> +struct DenseMapInfo { + static inline MlirTypeID getEmptyKey() { + auto *pointer = llvm::DenseMapInfo::getEmptyKey(); + return mlirTypeIDCreate(pointer); + } + static inline MlirTypeID getTombstoneKey() { + auto *pointer = llvm::DenseMapInfo::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 -- 2.7.4