25#define GEN_DIRECTIVES_IMPL
26#include "llvm/Frontend/OpenMP/OMP.inc"
49 auto firstLoopAssociated =
52 if (getDirectiveAssociation(*It) == Association::Loop)
60 auto Begin = firstLoopAssociated(Leafs);
61 if (Begin == Leafs.end())
66 if (
End == Leafs.end())
69 for (;
End != Leafs.end(); ++
End) {
70 if (getDirectiveAssociation(*
End) != Association::Loop)
78 auto Idx =
static_cast<std::size_t
>(
D);
79 if (
Idx >= Directive_enumSize)
81 const auto *Row = LeafConstructTable[LeafConstructTableOrdering[
Idx]];
82 return ArrayRef(&Row[2],
static_cast<int>(Row[1]));
88 auto Idx =
static_cast<size_t>(
D);
89 assert(
Idx < Directive_enumSize &&
"Invalid directive");
90 const auto *Row = LeafConstructTable[LeafConstructTableOrdering[
Idx]];
92 return ArrayRef(&Row[0], &Row[0] + 1);
98 using IteratorTy = ArrayTy::iterator;
101 IteratorTy Iter = Leafs.
begin();
105 for (; Iter != Range.begin(); ++Iter)
107 if (!Range.empty()) {
110 assert(Comp != OMPD_unknown);
116 assert(Iter == Leafs.
end() &&
"Malformed directive");
118 }
while (Iter != Leafs.
end());
146 if (GivenLeafs.size() == 1)
147 return GivenLeafs.front();
148 RawLeafs[1] =
static_cast<Directive>(GivenLeafs.size());
150 auto Iter = std::lower_bound(
151 LeafConstructTable, LeafConstructTableEndDirective,
152 static_cast<std::decay_t<decltype(*LeafConstructTable)
>>(RawLeafs.
data()),
153 [](
const llvm::omp::Directive *RowA,
const llvm::omp::Directive *RowB) {
154 const auto *BeginA = &RowA[2];
155 const auto *EndA = BeginA + static_cast<int>(RowA[1]);
156 const auto *BeginB = &RowB[2];
157 const auto *EndB = BeginB + static_cast<int>(RowB[1]);
158 if (BeginA == EndA && BeginB == EndB)
159 return static_cast<int>(RowA[0]) < static_cast<int>(RowB[0]);
160 return std::lexicographical_compare(BeginA, EndA, BeginB, EndB);
163 if (Iter == std::end(LeafConstructTable))
169 if (FoundLeafs == GivenLeafs)
178 if (Leafs.
size() <= 1)
181 return Range.begin() == Leafs.
begin() && Range.end() == Leafs.
end();
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
static iterator_range< ArrayRef< Directive >::iterator > getFirstCompositeRange(iterator_range< ArrayRef< Directive >::iterator > Leafs)
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
ArrayRef< T > drop_front(size_t N=1) const
Drop the first N elements of the array.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
void append(ItTy in_start, ItTy in_end)
Add the specified range to the end of the SmallVector.
void push_back(const T &Elt)
pointer data()
Return a pointer to the vector's buffer, even if empty().
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
A range adaptor for a pair of iterators.
bool isCombinedConstruct(Directive D)
ArrayRef< Directive > getLeafOrCompositeConstructs(Directive D, SmallVectorImpl< Directive > &Output)
bool isCompositeConstruct(Directive D)
Directive getCompoundConstruct(ArrayRef< Directive > Parts)
bool isLeafConstruct(Directive D)
ArrayRef< Directive > getLeafConstructsOrSelf(Directive D)
ArrayRef< Directive > getLeafConstructs(Directive D)
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.