20#ifndef LLVM_ADT_SETVECTOR_H
21#define LLVM_ADT_SETVECTOR_H
38template <
typename T,
typename Vector = std::vector<T>,
39 typename Set = DenseSet<T>>
48 using iterator =
typename vector_type::const_iterator;
68 return std::move(vector_);
73 return vector_.empty();
78 return vector_.size();
83 return vector_.begin();
88 return vector_.begin();
103 return vector_.rbegin();
108 return vector_.rbegin();
113 return vector_.rend();
118 return vector_.rend();
123 assert(!
empty() &&
"Cannot call front() on empty SetVector!");
124 return vector_.front();
129 assert(!
empty() &&
"Cannot call back() on empty SetVector!");
130 return vector_.back();
135 assert(n < vector_.size() &&
"SetVector access out of range!");
142 bool result = set_.insert(
X).second;
144 vector_.push_back(
X);
149 template<
typename It>
151 for (; Start != End; ++Start)
152 if (set_.insert(*Start).second)
153 vector_.push_back(*Start);
159 typename vector_type::iterator
I =
find(vector_,
X);
160 assert(
I != vector_.end() &&
"Corrupted SetVector instances!");
173 assert(set_.count(V) &&
"Corrupted SetVector instances!");
175 return vector_.erase(
I);
191 template <
typename UnaryPredicate>
193 typename vector_type::iterator
I =
195 if (
I == vector_.end())
197 vector_.erase(
I, vector_.end());
203 return set_.find(key) != set_.end();
209 return set_.count(key);
220 assert(!
empty() &&
"Cannot remove an element from an empty SetVector!");
232 return vector_ == that.vector_;
236 return vector_ != that.vector_;
244 bool Changed =
false;
246 for (
typename STy::const_iterator
SI = S.begin(), SE = S.end();
SI != SE;
259 for (
typename STy::const_iterator
SI = S.begin(), SE = S.end();
SI != SE;
266 vector_.swap(
RHS.vector_);
274 template <
typename UnaryPredicate>
275 class TestAndEraseFromSet {
280 TestAndEraseFromSet(UnaryPredicate P,
set_type &set_)
283 template <
typename ArgumentT>
284 bool operator()(
const ArgumentT &
Arg) {
299template <
typename T,
unsigned N>
301 :
public SetVector<T, SmallVector<T, N>, SmallDenseSet<T, N>> {
306 template<
typename It>
317template<
typename T,
typename V,
typename S>
324template<
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.
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.
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.
ArrayRef< T > getArrayRef() const
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 T & front() const
Return the first element of the SetVector.
bool operator!=(const SetVector &that) const
void clear()
Completely clear the SetVector.
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.
const T & back() const
Return the last element of the SetVector.
typename vector_type::const_iterator iterator
SetVector(It Start, It End)
Initialize a SetVector with a range of elements.
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
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.