20#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_INSTRINTERVAL_H
21#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_INSTRINTERVAL_H
45 assert(&R == &
Other.R &&
"Iterators belong to different regions!");
49 return !(*
this ==
Other);
52 assert(
I !=
nullptr &&
"already at end()!");
63 I =
I !=
nullptr ?
I->getPrevNode() : R.bottom();
71 template <typename HT = std::enable_if<std::is_same<T, T *&>::value>>
85 assert((Top == Bottom || Top->comesBefore(Bottom)) &&
86 "Top should come before Bottom!");
89 assert(!Elems.
empty() &&
"Expected non-empty Elems!");
93 if (
I->comesBefore(Top))
95 else if (Bottom->comesBefore(
I))
100 assert(((Top ==
nullptr && Bottom ==
nullptr) ||
101 (Top !=
nullptr && Bottom !=
nullptr)) &&
102 "Either none or both should be null");
103 return Top ==
nullptr;
108 return (Top ==
I || Top->comesBefore(
I)) &&
109 (
I == Bottom ||
I->comesBefore(Bottom));
117 return iterator(Bottom !=
nullptr ? Bottom->getNextNode() :
nullptr, *
this);
123 return iterator(Bottom !=
nullptr ? Bottom->getNextNode() :
nullptr,
128 return Top ==
Other.Top && Bottom ==
Other.Bottom;
144 return Other.Bottom->comesBefore(Top) || Bottom->comesBefore(
Other.Top);
159 if (Bottom->comesBefore(
Other.Top) ||
Other.Bottom->comesBefore(Top))
164 auto NewTopI = Top->comesBefore(
Other.Top) ?
Other.Top : Top;
165 auto NewBottomI = Bottom->comesBefore(
Other.Bottom) ? Bottom :
Other.Bottom;
166 return Interval(NewTopI, NewBottomI);
183 if (Top != Intersection.Top)
184 Result.emplace_back(Top, Intersection.Top->getPrevNode());
186 if (Intersection.Bottom != Bottom)
187 Result.emplace_back(Intersection.Bottom->getNextNode(), Bottom);
193 auto Diff = *
this -
Other;
194 assert(Diff.size() == 1 &&
"Expected a single interval!");
207 auto *NewTop = Top->comesBefore(
Other.Top) ? Top :
Other.Top;
208 auto *NewBottom = Bottom->comesBefore(
Other.Bottom) ?
Other.Bottom : Bottom;
209 return {NewTop, NewBottom};
214 template <
typename HelperT = T>
215 std::enable_if_t<std::is_same<HelperT, Instruction>::value,
void>
218 assert(
I->getIterator() != BeforeIt &&
"Can't move `I` before itself!");
221 if (std::next(
I->getIterator()) == BeforeIt)
224 T *NewTop = Top->getIterator() == BeforeIt ?
I
225 :
I == Top ? Top->getNextNode()
227 T *NewBottom = std::next(Bottom->getIterator()) == BeforeIt ?
I
228 :
I == Bottom ? Bottom->getPrevNode()
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
bool empty() const
empty - Check if the array is empty.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
This class implements an extremely fast bulk output stream that can only output to a stream.
A simple iterator for iterating the interval.
bool operator!=(const IntervalIterator &Other) const
IntervalIterator & operator--()
IntervalIterator(T *I, IntervalType &R)
std::bidirectional_iterator_tag iterator_category
bool operator==(const IntervalIterator &Other) const
IntervalIterator operator++(int)
std::ptrdiff_t difference_type
IntervalIterator & operator++()
IntervalIterator operator--(int)
Interval(T *Top, T *Bottom)
SmallVector< Interval, 2 > operator-(const Interval &Other)
Difference operation. This returns up to two intervals.
bool operator==(const Interval &Other) const
Equality.
Interval getUnionInterval(const Interval &Other)
\Returns a single interval that spans across both this and Other.
LLVM_DUMP_METHOD void dump() const
bool contains(T *I) const
Interval getSingleDiff(const Interval &Other)
\Returns the interval difference this - Other.
bool operator!=(const Interval &Other) const
Inequality.
Interval(ArrayRef< T * > Elems)
IntervalIterator< T, Interval > iterator
bool disjoint(const Interval &Other) const
\Returns true if this and Other have nothing in common.
bool comesBefore(const Interval &Other) const
\Returns true if this interval comes before Other in program order.
void print(raw_ostream &OS) const
Interval intersection(const Interval &Other) const
\Returns the intersection between this and Other.
std::enable_if_t< std::is_same< HelperT, Instruction >::value, void > notifyMoveInstr(HelperT *I, decltype(I->getIterator()) BeforeIt)
Update the interval when I is about to be moved before Before.
auto drop_begin(T &&RangeOrContainer, size_t N=1)
Return a range covering RangeOrContainer with the first N elements excluded.