Go to the documentation of this file.
9 #ifndef LLVM_ADT_ILIST_ITERATOR_H
10 #define LLVM_ADT_ILIST_ITERATOR_H
16 #include <type_traits>
20 namespace ilist_detail {
33 using pointer =
typename OptionsT::const_pointer;
34 using reference =
typename OptionsT::const_reference;
43 template <
class T>
static void increment(T *&
I) {
I = Access::getNext(*
I); }
44 template <
class T>
static void decrement(T *&
I) {
I = Access::getPrev(*
I); }
49 template <
class T>
static void increment(T *&
I) {
I = Access::getPrev(*
I); }
50 template <
class T>
static void decrement(T *&
I) {
I = Access::getNext(*
I); }
56 template <
class OptionsT,
bool IsReverse,
bool IsConst>
75 using node_pointer =
typename Traits::node_pointer;
76 using node_reference =
typename Traits::node_reference;
78 node_pointer NodePtr =
nullptr;
90 template <
bool RHSIsConst>
92 std::enable_if_t<IsConst || !RHSIsConst, void *> =
nullptr)
93 : NodePtr(
RHS.NodePtr) {}
97 template <
bool RHSIsConst>
98 std::enable_if_t<IsConst || !RHSIsConst, ilist_iterator &>
100 NodePtr =
RHS.NodePtr;
132 false>::node_reference>(*NodePtr));
138 assert(!NodePtr->isKnownSentinel());
145 return LHS.NodePtr ==
RHS.NodePtr;
148 return LHS.NodePtr !=
RHS.NodePtr;
153 NodePtr = IsReverse ? NodePtr->getNext() : NodePtr->getPrev();
157 NodePtr = IsReverse ? NodePtr->getPrev() : NodePtr->getNext();
172 node_pointer
getNodePtr()
const {
return static_cast<node_pointer
>(NodePtr); }
175 bool isEnd()
const {
return NodePtr ? NodePtr->isSentinel() :
false; }
184 template <
class OptionsT,
bool IsConst>
191 template <
class OptionsT,
bool IsConst>
193 :
simplify_type<ilist_iterator<OptionsT, false, IsConst>> {};
197 #endif // LLVM_ADT_ILIST_ITERATOR_H
static void decrement(T *&I)
ilist_iterator operator--(int)
reference operator*() const
This is an optimization pass for GlobalISel generic memory operations.
node_pointer getNodePtr() const
Get the underlying ilist_node.
Replace within non kernel function use of LDS with pointer
ilist_iterator< OptionsT, IsReverse, false > getNonConst() const
Const-cast.
ilist_iterator(pointer NP)
typename OptionsT::const_reference const_reference
alloca< 16 x float >, align 16 %tmp2=alloca< 16 x float >, align 16 store< 16 x float > %A,< 16 x float > *%tmp %s=bitcast< 16 x float > *%tmp to i8 *%s2=bitcast< 16 x float > *%tmp2 to i8 *call void @llvm.memcpy.i64(i8 *%s, i8 *%s2, i64 64, i32 16) %R=load< 16 x float > *%tmp2 ret< 16 x float > %R } declare void @llvm.memcpy.i64(i8 *nocapture, i8 *nocapture, i64, i32) nounwind which compiles to:_foo:subl $140, %esp movaps %xmm3, 112(%esp) movaps %xmm2, 96(%esp) movaps %xmm1, 80(%esp) movaps %xmm0, 64(%esp) movl 60(%esp), %eax movl %eax, 124(%esp) movl 56(%esp), %eax movl %eax, 120(%esp) movl 52(%esp), %eax< many many more 32-bit copies > movaps(%esp), %xmm0 movaps 16(%esp), %xmm1 movaps 32(%esp), %xmm2 movaps 48(%esp), %xmm3 addl $140, %esp ret On Nehalem, it may even be cheaper to just use movups when unaligned than to fall back to lower-granularity chunks. Implement processor-specific optimizations for parity with GCC on these processors. GCC does two optimizations:1. ix86_pad_returns inserts a noop before ret instructions if immediately preceded by a conditional branch or is the target of a jump. 2. ix86_avoid_jump_misspredicts inserts noops in cases where a 16-byte block of code contains more than 3 branches. The first one is done for all AMDs, Core2, and "Generic" The second one is done for:Atom, Pentium Pro, all AMDs, Pentium 4, Nocona, Core 2, and "Generic" Testcase:int x(int a) { return(a &0xf0)> >4 tmp
std::enable_if_t< IsConst||!RHSIsConst, ilist_iterator & > operator=(const ilist_iterator< OptionsT, IsReverse, RHSIsConst > &RHS)
ilist_iterator(reference NR)
pointer operator->() const
static pointer getValuePtr(node_type *N)
ilist_iterator(node_reference N)
Create from an ilist_node.
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...
friend bool operator==(const ilist_iterator &LHS, const ilist_iterator &RHS)
static SimpleType getSimplifiedValue(const iterator &Node)
typename OptionsT::pointer pointer
typename OptionsT::value_type value_type
An access class for ilist_node private API.
ilist_iterator(const ilist_iterator< OptionsT, IsReverse, RHSIsConst > &RHS, std::enable_if_t< IsConst||!RHSIsConst, void * >=nullptr)
Find const-correct node types.
ilist_iterator operator++(int)
ilist_iterator & operator++()
typename Traits::reference reference
static void decrement(T *&I)
typename OptionsT::const_reference reference
Implementation for an ilist node.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
friend bool operator!=(const ilist_iterator &LHS, const ilist_iterator &RHS)
ilist_iterator(const ilist_iterator< OptionsT, !IsReverse, IsConst > &RHS)
Explicit conversion between forward/reverse iterators.
bool isEnd() const
Check for end. Only valid if ilist_sentinel_tracking<true>.
static void increment(T *&I)
constexpr char IsConst[]
Key for Kernel::Arg::Metadata::mIsConst.
typename iterator::pointer SimpleType
std::bidirectional_iterator_tag iterator_category
const typename OptionsT::value_type value_type
ilist_iterator & operator--()
static void increment(T *&I)
Iterator for intrusive lists based on ilist_node.
typename OptionsT::const_pointer const_pointer
typename OptionsT::const_pointer pointer
ilist_iterator< OptionsT, !IsReverse, IsConst > getReverse() const
Get a reverse iterator to the same node.
typename OptionsT::reference reference
typename Traits::value_type value_type
typename Traits::pointer pointer