Make operation names hashable.
authorRiver Riddle <riverriddle@google.com>
Wed, 28 Nov 2018 04:32:31 +0000 (20:32 -0800)
committerjpienaar <jpienaar@google.com>
Fri, 29 Mar 2019 21:10:41 +0000 (14:10 -0700)
PiperOrigin-RevId: 223104253

mlir/include/mlir/IR/OperationSupport.h

index 09ca94d63ef61ff19a9421e26998ee5fa999a768..ee5cecb6bb458763c25f6fbb9e022b7b519be9fd 100644 (file)
@@ -187,6 +187,11 @@ inline bool operator!=(OperationName lhs, OperationName rhs) {
   return lhs.getAsOpaquePointer() != rhs.getAsOpaquePointer();
 }
 
+// Make operation names hashable.
+inline llvm::hash_code hash_value(OperationName arg) {
+  return llvm::hash_value(arg.getAsOpaquePointer());
+}
+
 /// This represents an operation in an abstracted form, suitable for use with
 /// the builder APIs.  This object is a large and heavy weight object meant to
 /// be used as a temporary object on the stack.  It is generally unwise to put