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

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 25 09:14:54 PST 2024


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

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


>From 27f4c3b8f777481e38869a8123193227caac2f2f Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 25 Jan 2024 17:07:59 +0000
Subject: [PATCH] [CodeGen] Add standard traits for
 LiveInterval::SingleLinkedListIterator

For example this will allow LiveInterval::subranges() to be used in
any_of/all_of/none_of.
---
 llvm/include/llvm/CodeGen/LiveInterval.h | 6 ++++++
 1 file changed, 6 insertions(+)

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++() {



More information about the llvm-commits mailing list