[llvm] [ADT][TableGen] Add UniquingSet, a FoldingSet with typed keys (PR #219630)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 29 01:04:51 PDT 2026
================
@@ -389,6 +403,11 @@ class FoldingSetBase : public DebugEpochBase {
/// it is not already in the folding set. InsertPos must be obtained from
/// FindNodeOrInsertPos for an ID that \p N profiles identically to.
LLVM_ABI void InsertNode(Node *N, void *InsertPos);
+
+ /// Encode \p Hash, which must not be NotAHash, as the token InsertNode takes.
+ static void *encodeInsertPos(uint32_t Hash) {
+ return reinterpret_cast<void *>(static_cast<uintptr_t>(Hash));
+ }
----------------
kazutakahirata wrote:
Could we have both `encodeInsertPos` and `decodeInsertPos` here and then remove the duplicate in `FoldingSet.cpp`?
https://github.com/llvm/llvm-project/pull/219630
More information about the llvm-commits
mailing list