10 #ifndef LLVM_ADT_ILIST_ITERATOR_H 11 #define LLVM_ADT_ILIST_ITERATOR_H 17 #include <type_traits> 21 namespace ilist_detail {
27 using pointer =
typename OptionsT::pointer;
34 using pointer =
typename OptionsT::const_pointer;
35 using reference =
typename OptionsT::const_reference;
44 template <
class T>
static void increment(
T *&
I) { I = Access::getNext(*I); }
45 template <
class T>
static void decrement(
T *&
I) { I = Access::getPrev(*I); }
50 template <
class T>
static void increment(
T *&
I) { I = Access::getPrev(*I); }
51 template <
class T>
static void decrement(
T *&
I) { I = Access::getNext(*I); }
57 template <
class OptionsT,
bool IsReverse,
bool IsConst>
76 using node_pointer =
typename Traits::node_pointer;
77 using node_reference =
typename Traits::node_reference;
91 template <
bool RHSIsConst>
94 typename std::enable_if<IsConst || !RHSIsConst, void *>::type =
nullptr)
95 : NodePtr(RHS.NodePtr) {}
99 template <
bool RHSIsConst>
100 typename std::enable_if<IsConst || !RHSIsConst, ilist_iterator &>::type
102 NodePtr = RHS.NodePtr;
134 false>::node_reference>(*NodePtr));
140 assert(!NodePtr->isKnownSentinel());
141 return *Access::getValuePtr(NodePtr);
147 return LHS.NodePtr == RHS.NodePtr;
150 return LHS.NodePtr != RHS.NodePtr;
155 NodePtr = IsReverse ? NodePtr->
getNext() : NodePtr->getPrev();
159 NodePtr = IsReverse ? NodePtr->
getPrev() : NodePtr->getNext();
177 bool isEnd()
const {
return NodePtr ? NodePtr->isSentinel() :
false; }
186 template <
class OptionsT,
bool IsConst>
193 template <
class OptionsT,
bool IsConst>
195 :
simplify_type<ilist_iterator<OptionsT, false, IsConst>> {};
199 #endif // LLVM_ADT_ILIST_ITERATOR_H typename OptionsT::const_reference reference
typename Traits::reference reference
const typename OptionsT::value_type value_type
This class represents lattice values for constants.
ilist_iterator(node_reference N)
Create from an ilist_node.
typename OptionsT::const_pointer pointer
bool isEnd() const
Check for end. Only valid if ilist_sentinel_tracking<true>.
block Block Frequency true
static void decrement(T *&I)
std::bidirectional_iterator_tag iterator_category
typename Traits::pointer pointer
Implementation for an ilist node.
typename iterator::pointer SimpleType
typename Traits::value_type value_type
APInt operator*(APInt a, uint64_t RHS)
ilist_iterator(reference NR)
typename OptionsT::reference reference
ilist_iterator< OptionsT, IsReverse, false > getNonConst() const
Const-cast.
typename OptionsT::value_type value_type
pointer operator->() const
node_pointer getNodePtr() const
Get the underlying ilist_node.
friend bool operator==(const ilist_iterator &LHS, const ilist_iterator &RHS)
static ilist_node_impl< OptionsT > * getPrev(ilist_node_impl< OptionsT > &N)
std::enable_if< IsConst||!RHSIsConst, ilist_iterator & >::type operator=(const ilist_iterator< OptionsT, IsReverse, RHSIsConst > &RHS)
std::shared_ptr< Node > NodePtr
Short-hand for a Node pointer.
static SimpleType getSimplifiedValue(const iterator &Node)
static void increment(T *&I)
ilist_iterator operator++(int)
ilist_iterator(pointer NP)
Find const-correct node types.
reference operator*() const
An access class for ilist_node private API.
Iterator for intrusive lists based on ilist_node.
friend bool operator!=(const ilist_iterator &LHS, const ilist_iterator &RHS)
ilist_iterator & operator++()
typename OptionsT::const_reference const_reference
ilist_iterator(const ilist_iterator< OptionsT, IsReverse, RHSIsConst > &RHS, typename std::enable_if< IsConst||!RHSIsConst, void *>::type=nullptr)
ilist_iterator(const ilist_iterator< OptionsT, !IsReverse, IsConst > &RHS)
Explicit conversion between forward/reverse iterators.
typename OptionsT::pointer pointer
ilist_iterator operator--(int)
ilist_iterator & operator--()
ilist_iterator< OptionsT, !IsReverse, IsConst > getReverse() const
Get a reverse iterator to the same node.
constexpr char IsConst[]
Key for Kernel::Arg::Metadata::mIsConst.
typename OptionsT::const_pointer const_pointer
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
static void decrement(T *&I)
static ilist_node_impl< OptionsT > * getNext(ilist_node_impl< OptionsT > &N)
static void increment(T *&I)