9#ifndef LLVM_ADT_TINYPTRVECTOR_H
10#define LLVM_ADT_TINYPTRVECTOR_H
28template <
typename EltTy>
46 if (
VecTy *V = Val.template dyn_cast<VecTy*>())
51 if (
VecTy *V = Val.template dyn_cast<VecTy*>())
65 if (Val.template is<EltTy>()) {
69 Val =
new VecTy(*
RHS.Val.template get<VecTy*>());
74 if (
RHS.Val.template is<EltTy>()) {
75 Val.template get<VecTy*>()->clear();
76 Val.template get<VecTy*>()->push_back(
RHS.front());
78 *Val.template get<VecTy*>() = *
RHS.Val.template get<VecTy*>();
84 RHS.Val = (EltTy)
nullptr;
98 if (
VecTy *V = Val.template dyn_cast<VecTy*>()) {
99 if (
RHS.Val.template is<EltTy>()) {
101 V->push_back(
RHS.front());
139 if (Val.template is<EltTy>())
141 return *Val.template get<VecTy*>();
148 if (Val.template is<EltTy>())
150 return *Val.template get<VecTy*>();
165 if (Val.
isNull())
return true;
166 if (
VecTy *Vec = Val.template dyn_cast<VecTy*>())
174 if (Val.template is<EltTy>())
176 return Val.template get<VecTy*>()->size();
185 if (Val.template is<EltTy>())
188 return Val.template get<VecTy *>()->begin();
192 if (Val.template is<EltTy>())
195 return Val.template get<VecTy *>()->end();
218 assert(!Val.
isNull() &&
"can't index into an empty vector");
219 if (Val.template is<EltTy>()) {
220 assert(i == 0 &&
"tinyvector index out of range");
221 return Val.template get<EltTy>();
224 assert(i < Val.template get<VecTy*>()->size() &&
225 "tinyvector index out of range");
226 return (*Val.template get<VecTy*>())[i];
231 if (Val.template is<EltTy>())
232 return Val.template get<EltTy>();
233 return Val.template get<VecTy*>()->front();
238 if (Val.template is<EltTy>())
239 return Val.template get<EltTy>();
240 return Val.template get<VecTy*>()->back();
252 if (Val.template is<EltTy>()) {
253 EltTy V = Val.template get<EltTy>();
255 Val.template get<VecTy*>()->push_back(V);
259 Val.template get<VecTy*>()->push_back(NewVal);
264 if (Val.template is<EltTy>())
265 Val = (EltTy)
nullptr;
266 else if (
VecTy *Vec = Val.template get<VecTy*>())
272 if (Val.template is<EltTy>()) {
274 }
else if (
VecTy *Vec = Val.template dyn_cast<VecTy*>()) {
282 assert(
I >=
begin() &&
"Iterator to erase is out of bounds.");
283 assert(
I <
end() &&
"Erasing at past-the-end iterator.");
286 if (Val.template is<EltTy>()) {
289 }
else if (
VecTy *Vec = Val.template dyn_cast<VecTy*>()) {
292 return Vec->erase(
I);
298 assert(S >=
begin() &&
"Range to erase is out of bounds.");
299 assert(S <=
E &&
"Trying to erase invalid range.");
300 assert(
E <=
end() &&
"Trying to erase past the end.");
302 if (Val.template is<EltTy>()) {
303 if (S ==
begin() && S !=
E)
305 }
else if (
VecTy *Vec = Val.template dyn_cast<VecTy*>()) {
306 return Vec->erase(S,
E);
312 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
313 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
316 return std::prev(
end());
318 assert(!Val.
isNull() &&
"Null value with non-end insert iterator.");
319 if (Val.template is<EltTy>()) {
320 EltTy V = Val.template get<EltTy>();
327 return Val.template get<VecTy*>()->insert(
I, Elt);
330 template<
typename ItTy>
332 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
333 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
340 if (std::next(
From) == To) {
346 }
else if (Val.template is<EltTy>()) {
347 EltTy V = Val.template get<EltTy>();
349 Val.template get<VecTy*>()->push_back(V);
BlockVerifier::State From
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
Given that RA is a live value
This file defines the PointerUnion class, which is a discriminated union of pointer types.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
bool isNull() const
Test if the pointer held in the union is null, regardless of which type it is.
First const * getAddrOfPtr1() const
If the union is set to the first pointer type get an address pointing to it.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
TinyPtrVector - This class is specialized for cases where there are normally 0 or 1 element in a vect...
reverse_iterator rbegin()
const EltTy * const_iterator
TinyPtrVector(std::initializer_list< EltTy > IL)
void push_back(EltTy NewVal)
TinyPtrVector & operator=(TinyPtrVector &&RHS)
std::reverse_iterator< const_iterator > const_reverse_iterator
const_reverse_iterator rbegin() const
TinyPtrVector(ArrayRef< EltTy > Elts)
Constructor from an ArrayRef.
std::reverse_iterator< iterator > reverse_iterator
const_iterator begin() const
iterator erase(iterator I)
TinyPtrVector & operator=(const TinyPtrVector &RHS)
TinyPtrVector(const TinyPtrVector &RHS)
const_reverse_iterator rend() const
const_iterator end() const
iterator insert(iterator I, const EltTy &Elt)
iterator erase(iterator S, iterator E)
SmallVector< EltTy, 4 > VecTy
typename VecTy::value_type value_type
TinyPtrVector(TinyPtrVector &&RHS)
iterator insert(iterator I, ItTy From, ItTy To)
EltTy operator[](unsigned i) const
TinyPtrVector(size_t Count, EltTy Value)
LLVM Value Representation.
This is an optimization pass for GlobalISel generic memory operations.