20#ifndef LLVM_ADT_SETVECTOR_H
21#define LLVM_ADT_SETVECTOR_H
49template <
typename T,
typename Vector = std::vector<T>,
50 typename Set = DenseSet<T>>
59 using iterator =
typename vector_type::const_iterator;
79 return std::move(vector_);
84 return vector_.empty();
89 return vector_.size();
94 return vector_.begin();
99 return vector_.begin();
104 return vector_.end();
109 return vector_.end();
114 return vector_.rbegin();
119 return vector_.rbegin();
124 return vector_.rend();
129 return vector_.rend();
134 assert(!
empty() &&
"Cannot call front() on empty SetVector!");
135 return vector_.front();
140 assert(!
empty() &&
"Cannot call back() on empty SetVector!");
141 return vector_.back();
146 assert(n < vector_.size() &&
"SetVector access out of range!");
153 bool result = set_.insert(
X).second;
155 vector_.push_back(
X);
160 template<
typename It>
162 for (; Start !=
End; ++Start)
163 if (set_.insert(*Start).second)
164 vector_.push_back(*Start);
170 typename vector_type::iterator
I =
find(vector_,
X);
171 assert(
I != vector_.end() &&
"Corrupted SetVector instances!");
184 assert(set_.count(V) &&
"Corrupted SetVector instances!");
186 return vector_.erase(
I);
202 template <
typename UnaryPredicate>
204 typename vector_type::iterator
I =
206 if (
I == vector_.end())
208 vector_.erase(
I, vector_.end());
214 return set_.find(key) != set_.end();
220 return set_.count(key);
231 assert(!
empty() &&
"Cannot remove an element from an empty SetVector!");
243 return vector_ == that.vector_;
247 return vector_ != that.vector_;
255 bool Changed =
false;
257 for (
typename STy::const_iterator
SI = S.begin(), SE = S.end();
SI != SE;
270 for (
typename STy::const_iterator
SI = S.begin(), SE = S.end();
SI != SE;
277 vector_.swap(
RHS.vector_);
285 template <
typename UnaryPredicate>
286 class TestAndEraseFromSet {
291 TestAndEraseFromSet(UnaryPredicate P,
set_type &set_)
294 template <
typename ArgumentT>
295 bool operator()(
const ArgumentT &
Arg) {
310template <
typename T,
unsigned N>
312 :
public SetVector<T, SmallVector<T, N>, SmallDenseSet<T, N>> {
317 template<
typename It>
328template<
typename T,
typename V,
typename S>
335template<
typename T,
unsigned N>
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
This file defines the DenseSet and SmallDenseSet classes.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
A vector that has set insertion semantics.
const_iterator end() const
Get a const_iterator to the end of the SetVector.
size_type size() const
Determine the number of elements in the SetVector.
typename vector_type::const_iterator const_iterator
size_type count(const key_type &key) const
Count the number of elements of a given key in the SetVector.
typename Vector::value_type value_type
reverse_iterator rend()
Get a reverse_iterator to the beginning of the SetVector.
iterator erase(const_iterator I)
Erase a single element from the set vector.
bool contains(const key_type &key) const
Check if the SetVector contains the given key.
typename Set::key_type key_type
SetVector()=default
Construct an empty SetVector.
bool remove_if(UnaryPredicate P)
Remove items from the set vector based on a predicate function.
bool remove(const value_type &X)
Remove an item from the set vector.
reverse_iterator rbegin()
Get an reverse_iterator to the end of the SetVector.
const_reference operator[](size_type n) const
Index into the SetVector.
bool insert(const value_type &X)
Insert a new element into the SetVector.
const_reverse_iterator rend() const
Get a const_reverse_iterator to the beginning of the SetVector.
void pop_back()
Remove the last element of the SetVector.
typename vector_type::const_reverse_iterator const_reverse_iterator
const value_type & front() const
Return the first element of the SetVector.
bool operator!=(const SetVector &that) const
void clear()
Completely clear the SetVector.
const value_type & const_reference
const_reverse_iterator rbegin() const
Get a const_reverse_iterator to the end of the SetVector.
bool set_union(const STy &S)
Compute This := This u S, return whether 'This' changed.
typename vector_type::size_type size_type
bool empty() const
Determine if the SetVector is empty or not.
Vector takeVector()
Clear the SetVector and return the underlying vector.
typename vector_type::const_iterator iterator
value_type pop_back_val()
SetVector(It Start, It End)
Initialize a SetVector with a range of elements.
const value_type & back() const
Return the last element of the SetVector.
const_iterator begin() const
Get a const_iterator to the beginning of the SetVector.
typename vector_type::const_reverse_iterator reverse_iterator
iterator begin()
Get an iterator to the beginning of the SetVector.
bool operator==(const SetVector &that) const
ArrayRef< value_type > getArrayRef() const
void swap(SetVector< T, Vector, Set > &RHS)
void insert(It Start, It End)
Insert a range of elements into the SetVector.
void set_subtract(const STy &S)
Compute This := This - B TODO: We should be able to use set_subtract from SetOperations....
iterator end()
Get an iterator to the end of the SetVector.
A SetVector that performs no allocations if smaller than a certain size.
SmallSetVector(It Start, It End)
Initialize a SmallSetVector with a range of elements.
This is an optimization pass for GlobalISel generic memory operations.
auto find(R &&Range, const T &Val)
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly.
auto remove_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly.
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.