[llvm] [CodeGen] Add standard traits for LiveInterval::SingleLinkedListIterator (PR #79473)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 09:15:23 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-regalloc

Author: Jay Foad (jayfoad)

<details>
<summary>Changes</summary>

For example this will allow LiveInterval::subranges() to be used in
any_of/all_of/none_of.


---
Full diff: https://github.com/llvm/llvm-project/pull/79473.diff


1 Files Affected:

- (modified) llvm/include/llvm/CodeGen/LiveInterval.h (+6) 


``````````diff
diff --git a/llvm/include/llvm/CodeGen/LiveInterval.h b/llvm/include/llvm/CodeGen/LiveInterval.h
index 590a48b17cce926..ad8dec68c073c09 100644
--- a/llvm/include/llvm/CodeGen/LiveInterval.h
+++ b/llvm/include/llvm/CodeGen/LiveInterval.h
@@ -731,6 +731,12 @@ namespace llvm {
       T *P;
 
     public:
+      using difference_type = ptrdiff_t;
+      using value_type = T;
+      using pointer = T *;
+      using reference = T &;
+      using iterator_category = std::forward_iterator_tag;
+
       SingleLinkedListIterator(T *P) : P(P) {}
 
       SingleLinkedListIterator<T> &operator++() {

``````````

</details>


https://github.com/llvm/llvm-project/pull/79473


More information about the llvm-commits mailing list