summaryrefslogtreecommitdiff
path: root/src/ir/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/ir/utils.h')
-rw-r--r--src/ir/utils.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ir/utils.h b/src/ir/utils.h
index 69d5f8e63..7abc87b5e 100644
--- a/src/ir/utils.h
+++ b/src/ir/utils.h
@@ -82,9 +82,17 @@ struct ExpressionAnalyzer {
return flexibleEqual(left, right, comparer);
}
+ // Returns true if the expression is handled by the hasher.
+ using ExprHasher = std::function<bool(Expression*, size_t&)>;
+ static bool nothingHasher(Expression*, size_t&) { return false; }
+
+ static size_t flexibleHash(Expression* curr, ExprHasher hasher);
+
// hash an expression, ignoring superficial details like specific internal
// names
- static size_t hash(Expression* curr);
+ static size_t hash(Expression* curr) {
+ return flexibleHash(curr, nothingHasher);
+ }
// hash an expression, ignoring child nodes.
static size_t shallowHash(Expression* curr);