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());
140 return cast<VecTy *>(Val)->empty();
145 return Val.
isNull() ? 0 : 1;
146 return cast<VecTy *>(Val)->size();
158 return cast<VecTy *>(Val)->begin();
165 return cast<VecTy *>(Val)->end();
191 assert(!Val.
isNull() &&
"can't index into an empty vector");
192 if (isa<EltTy>(Val)) {
193 assert(i == 0 &&
"tinyvector index out of range");
194 return cast<EltTy>(Val);
197 assert(i < cast<VecTy *>(Val)->
size() &&
"tinyvector index out of range");
198 return (*cast<VecTy *>(Val))[i];
204 return cast<EltTy>(Val);
205 return cast<VecTy *>(Val)->front();
211 return cast<EltTy>(Val);
212 return cast<VecTy *>(Val)->back();
224 if (isa<EltTy>(Val)) {
225 EltTy V = cast<EltTy>(Val);
226 Val =
new VecTy({V, NewVal});
231 cast<VecTy *>(Val)->push_back(NewVal);
239 cast<VecTy *>(Val)->pop_back();
244 if (isa<EltTy>(Val)) {
248 cast<VecTy *>(Val)->clear();
253 assert(
I >=
begin() &&
"Iterator to erase is out of bounds.");
254 assert(
I <
end() &&
"Erasing at past-the-end iterator.");
257 if (isa<EltTy>(Val)) {
263 return cast<VecTy *>(Val)->erase(
I);
269 assert(S >=
begin() &&
"Range to erase is out of bounds.");
270 assert(S <=
E &&
"Trying to erase invalid range.");
271 assert(
E <=
end() &&
"Trying to erase past the end.");
273 if (isa<EltTy>(Val)) {
274 if (S ==
begin() && S !=
E)
277 return cast<VecTy *>(Val)->erase(S,
E);
283 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
284 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
287 return std::prev(
end());
289 assert(!Val.
isNull() &&
"Null value with non-end insert iterator.");
290 if (isa<EltTy>(Val)) {
291 EltTy V = cast<EltTy>(Val);
298 return cast<VecTy *>(Val)->insert(
I, Elt);
301 template<
typename ItTy>
303 assert(
I >= this->
begin() &&
"Insertion iterator is out of bounds.");
304 assert(I <= this->
end() &&
"Inserting past the end of the vector.");
311 if (std::next(
From) == To) {
317 }
else if (isa<EltTy>(Val)) {
318 EltTy V = cast<EltTy>(Val);
320 cast<VecTy *>(Val)->push_back(V);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
BlockVerifier::State From
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the PointerUnion class, which is a discriminated union of pointer types.
This file defines the SmallVector class.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
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 EltTy * data() 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.