20#ifndef LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_INSTRINTERVAL_H
21#define LLVM_TRANSFORMS_VECTORIZE_SANDBOXVECTORIZER_INSTRINTERVAL_H
46 assert(&R == &
Other.R &&
"Iterators belong to different regions!");
50 return !(*
this ==
Other);
53 assert(
I !=
nullptr &&
"already at end()!");
64 I =
I !=
nullptr ?
I->getPrevNode() : R.bottom();
72 template <typename HT = std::enable_if<std::is_same<T, T *&>::value>>
86 assert((Top == Bottom || Top->comesBefore(Bottom)) &&
87 "Top should come before Bottom!");
90 assert(!Elems.
empty() &&
"Expected non-empty Elems!");
94 if (
I->comesBefore(Top))
96 else if (Bottom->comesBefore(
I))
101 assert(((Top ==
nullptr && Bottom ==
nullptr) ||
102 (Top !=
nullptr && Bottom !=
nullptr)) &&
103 "Either none or both should be null");
104 return Top ==
nullptr;
109 return (Top ==
I || Top->comesBefore(
I)) &&
110 (
I == Bottom ||
I->comesBefore(Bottom));
114 return Top == Elm->getNextNode() || Bottom == Elm->getPrevNode();
122 return iterator(Bottom !=
nullptr ? Bottom->getNextNode() :
nullptr, *
this);
128 return iterator(Bottom !=
nullptr ? Bottom->getNextNode() :
nullptr,
133 return Top ==
Other.Top && Bottom ==
Other.Bottom;
158 if (Bottom->comesBefore(
Other.Top) ||
Other.Bottom->comesBefore(Top))
163 auto NewTopI = Top->comesBefore(
Other.Top) ?
Other.Top : Top;
164 auto NewBottomI = Bottom->comesBefore(
Other.Bottom) ? Bottom :
Other.Bottom;
165 return Interval(NewTopI, NewBottomI);
182 if (Top != Intersection.Top)
183 Result.emplace_back(Top, Intersection.Top->getPrevNode());
185 if (Intersection.Bottom != Bottom)
186 Result.emplace_back(Intersection.Bottom->getNextNode(), Bottom);
192 auto Diff = *
this -
Other;
193 assert(Diff.size() == 1 &&
"Expected a single interval!");
206 auto *NewTop = Top->comesBefore(
Other.Top) ? Top :
Other.Top;
207 auto *NewBottom = Bottom->comesBefore(
Other.Bottom) ?
Other.Bottom : Bottom;
208 return {NewTop, NewBottom};
213 template <
typename HelperT = T>
214 std::enable_if_t<std::is_same<HelperT, Instruction>::value,
void>
217 assert(
I->getIterator() != BeforeIt &&
"Can't move `I` before itself!");
220 if (std::next(
I->getIterator()) == BeforeIt)
223 T *NewTop = Top->getIterator() == BeforeIt ?
I
224 :
I == Top ? Top->getNextNode()
226 T *NewBottom = std::next(Bottom->getIterator()) == BeforeIt ?
I
227 :
I == Bottom ? Bottom->getPrevNode()
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_TEMPLATE_ABI
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
std::pair< uint64_t, uint64_t > Interval
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.
bool touches(T *Elm) const
\Returns true if Elm is right before the top or right after the bottom.
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.