Go to the documentation of this file.
34 #ifndef LLVM_ADT_DEPTHFIRSTITERATOR_H
35 #define LLVM_ADT_DEPTHFIRSTITERATOR_H
50 template<
class SetType,
bool External>
56 template<
class SetType>
69 template <
typename NodeRef,
unsigned SmallSize=8>
75 template <
typename IterT>
82 template <
class GraphT,
85 bool ExtStorage =
false,
class GT = GraphTraits<GraphT>>
96 using ChildItTy =
typename GT::ChildIteratorType;
101 using StackElement = std::pair<NodeRef, Optional<ChildItTy>>;
104 std::vector<StackElement> VisitStack;
108 VisitStack.push_back(StackElement(
Node,
None));
116 VisitStack.push_back(StackElement(
Node,
None));
119 inline df_iterator(SetType &
S)
120 : df_iterator_storage<SetType, ExtStorage>(
S) {
124 inline void toNext() {
126 NodeRef
Node = VisitStack.back().first;
127 Optional<ChildItTy> &Opt = VisitStack.back().second;
130 Opt.emplace(GT::child_begin(
Node));
135 while (*Opt != GT::child_end(
Node)) {
136 NodeRef Next = *(*Opt)++;
140 VisitStack.push_back(StackElement(Next,
None));
147 VisitStack.pop_back();
148 }
while (!VisitStack.empty());
165 return VisitStack ==
x.VisitStack;
169 const NodeRef &
operator*()
const {
return VisitStack.back().first; }
187 VisitStack.pop_back();
188 if (!VisitStack.empty())
213 NodeRef
getPath(
unsigned n)
const {
return VisitStack[
n].first; }
241 template <
class T,
class SetTy>
246 template <
class T,
class SetTy>
251 template <
class T,
class SetTy>
261 bool External =
false>
292 template <
class T,
class SetTy>
297 template <
class T,
class SetTy>
302 template <
class T,
class SetTy>
310 #endif // LLVM_ADT_DEPTHFIRSTITERATOR_H
unsigned getPathLength() const
getPathLength - Return the length of the path from the entry node to the current node,...
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
idf_ext_iterator< T, SetTy > idf_ext_end(const T &G, SetTy &S)
df_iterator_storage(const df_iterator_storage &S)
df_iterator< T > df_end(const T &G)
std::ptrdiff_t difference_type
static df_iterator end(const GraphT &G)
void insert(IterT Begin, IterT End)
df_iterator & skipChildren()
Skips all children of the current node and traverses to next node.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
df_iterator operator++(int)
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
idf_iterator< T > idf_begin(const T &G)
df_ext_iterator< T, SetTy > df_ext_begin(const T &G, SetTy &S)
idf_iterator< T > idf_end(const T &G)
typename BaseSet::iterator iterator
idf_ext_iterator(const idf_iterator< T, SetTy, true > &V)
iterator_range< df_ext_iterator< T, SetTy > > depth_first_ext(const T &G, SetTy &S)
bool operator==(const df_iterator &x) const
std::pair< NodeId, LaneBitmask > NodeRef
const NodeRef & operator*() const
static df_iterator end(const GraphT &G, SetType &S)
idf_iterator(const df_iterator< Inverse< T >, SetTy, External > &V)
SmallPtrSetIterator< PtrType > iterator
static df_iterator begin(const GraphT &G)
typename GraphTraits< Inverse< T > > ::NodeRef value_type
df_iterator< T > df_begin(const T &G)
df_iterator & operator++()
std::pair< iterator, bool > insert(NodeRef N)
bool nodeVisited(NodeRef Node) const
df_iterator_storage(SetType &VSet)
idf_ext_iterator(const df_iterator< Inverse< T >, SetTy, true > &V)
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
NodeRef operator->() const
df_ext_iterator< T, SetTy > df_ext_end(const T &G, SetTy &S)
iterator_range< df_iterator< T > > depth_first(const T &G)
bool operator!=(const df_iterator &x) const
std::forward_iterator_tag iterator_category
NodeRef getPath(unsigned n) const
getPath - Return the n'th node in the path from the entry node to the current node.
iterator_range< idf_iterator< T > > inverse_depth_first(const T &G)
static df_iterator begin(const GraphT &G, SetType &S)
A range adaptor for a pair of iterators.
iterator_range< idf_ext_iterator< T, SetTy > > inverse_depth_first_ext(const T &G, SetTy &S)
idf_ext_iterator< T, SetTy > idf_ext_begin(const T &G, SetTy &S)
df_ext_iterator(const df_iterator< T, SetTy, true > &V)
The same transformation can work with an even modulo with the addition of a and shrink the compare RHS by the same amount Unless the target supports that transformation probably isn t worthwhile The transformation can also easily be made to work with non zero equality for n
bool contains(ConstPtrType Ptr) const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.