9#ifndef LLVM_ADT_TINYPTRVECTOR_H
10#define LLVM_ADT_TINYPTRVECTOR_H
28template <
typename EltTy>
46 if (
VecTy *V = dyn_cast_if_present<VecTy *>(Val))
51 if (
VecTy *V = dyn_cast_if_present<VecTy *>(Val))
65 if (isa<EltTy>(Val)) {
69 Val =
new VecTy(*cast<VecTy *>(
RHS.Val));
74 if (isa<EltTy>(
RHS.Val)) {
75 cast<VecTy *>(Val)->clear();
76 cast<VecTy *>(Val)->push_back(
RHS.front());
78 *cast<VecTy *>(Val) = *cast<VecTy *>(
RHS.Val);
84 RHS.Val = (EltTy)
nullptr;
98 if (
VecTy *V = dyn_cast_if_present<VecTy *>(Val)) {
99 if (isa<EltTy>(
RHS.Val)) {
101 V->push_back(
RHS.front());
141 return *cast<VecTy *>(Val);
150 return *cast<VecTy *>(Val);
165 if (Val.
isNull())
return true;
166 if (
VecTy *Vec = dyn_cast_if_present<VecTy *>(Val))
176 return cast<VecTy *>(Val)->size();
188 return cast<VecTy *>(Val)->begin();
195 return cast<VecTy *>(Val)->end();
218 assert(!Val.
isNull() &&
"can't index into an empty vector");
219 if (isa<EltTy>(Val)) {
220 assert(i == 0 &&
"tinyvector index out of range");
221 return cast<EltTy>(Val);
224 assert(i < cast<VecTy *>(Val)->
size() &&
"tinyvector index out of range");
225 return (*cast<VecTy *>(Val))[i];
231 return cast<EltTy>(Val);
232 return cast<VecTy *>(Val)->front();
238 return cast<EltTy>(Val);
239 return cast<VecTy *>(Val)->back();
251 if (isa<EltTy>(Val)) {
252 EltTy V = cast<EltTy>(Val);
254 cast<VecTy *>(Val)->push_back(V);
258 cast<VecTy *>(Val)->push_back(NewVal);
264 Val = (EltTy)
nullptr;
265 else if (
VecTy *Vec = cast<VecTy *>(Val))
271 if (isa<EltTy>(Val)) {
273 }
else if (
VecTy *Vec = dyn_cast_if_present<VecTy *>(Val)) {
281 assert(
I >=
begin() &&
"Iterator to erase is out of bounds.");
282 assert(
I <
end() &&
"Erasing at past-the-end iterator.");
285 if (isa<EltTy>(Val)) {
288 }
else if (
VecTy *Vec = dyn_cast_if_present<VecTy *>(Val)) {
291 return Vec->erase(
I);
297 assert(S >=
begin() &&
"Range to erase is out of bounds.");
298 assert(S <=
E &&
"Trying to erase invalid range.");
299 assert(
E <=
end() &&
"Trying to erase past the end.");
301 if (isa<EltTy>(Val)) {
302 if (S ==
begin() && S !=
E)
304 }
else if (
VecTy *Vec = dyn_cast_if_present<VecTy *>(Val)) {
305 return Vec->erase(S,
E);
311 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
312 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
315 return std::prev(
end());
317 assert(!Val.
isNull() &&
"Null value with non-end insert iterator.");
318 if (isa<EltTy>(Val)) {
319 EltTy V = cast<EltTy>(Val);
326 return cast<VecTy *>(Val)->insert(
I, Elt);
329 template<
typename ItTy>
331 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
332 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
339 if (std::next(
From) == To) {
345 }
else if (isa<EltTy>(Val)) {
346 EltTy V = cast<EltTy>(Val);
348 cast<VecTy *>(Val)->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.