[llvm] [LLVM] Add option to store Parent-pointer in ilist_node_base (PR #94224)
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 3 08:58:12 PDT 2024
================
@@ -42,6 +45,48 @@ template <> class ilist_node_base<true> {
ilist_node_base *getPrev() const { return PrevAndSentinel.getPointer(); }
ilist_node_base *getNext() const { return Next; }
+ void setNodeBaseParent(void) {}
+ inline void getNodeBaseParent() const {}
+
+ bool isSentinel() const { return PrevAndSentinel.getInt(); }
+ bool isKnownSentinel() const { return isSentinel(); }
+ void initializeSentinel() { PrevAndSentinel.setInt(true); }
+};
+
+template <class ParentPtrTy> class ilist_node_base<false, ParentPtrTy> {
----------------
dexonsmith wrote:
Can this inherit from `<false, void>` to reduce code duplication? Or if that's confusing, extract a common base class for the previous/next logic?
https://github.com/llvm/llvm-project/pull/94224
More information about the llvm-commits
mailing list