[llvm] [SelectionDAG] Split sd_use_iterator into sd_user_iterator and sd_use_iterator. (PR #120531)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 19 07:40:25 PST 2024
================
@@ -837,29 +835,72 @@ END_TWO_BYTE_PACK()
}
};
+ class user_iterator {
+ friend class SDNode;
+ use_iterator UI;
+
+ explicit user_iterator(SDUse *op) : UI(op) {};
+
+ public:
+ using iterator_category = std::forward_iterator_tag;
+ using value_type = SDNode *;
+ using difference_type = std::ptrdiff_t;
+ using pointer = value_type *;
+ using reference = value_type &;
+
+ user_iterator() = default;
+
+ bool operator==(const user_iterator &x) const { return UI == x.UI; }
+ bool operator!=(const user_iterator &x) const { return !operator==(x); }
+
+ // /// Return true if this iterator is at the end of the uses list.
+ bool atEnd() const { return *this == user_iterator(); }
----------------
topperc wrote:
It may not be used anywhere. It exists in use_iterator and the IR equivalent of use/user_iterator. The implementation is based on IR's user_iterator which defers to use_iterator.
https://github.com/llvm/llvm-project/pull/120531
More information about the llvm-commits
mailing list