LLVM  8.0.1
Classes | Public Types | Public Member Functions | List of all members
llvm::SetVector< T, Vector, Set > Class Template Reference

A vector that has set insertion semantics. More...

#include "llvm/ADT/SetVector.h"

Inheritance diagram for llvm::SetVector< T, Vector, Set >:
Inheritance graph
[legend]

Public Types

using value_type = T
 
using key_type = T
 
using reference = T &
 
using const_reference = const T &
 
using set_type = Set
 
using vector_type = Vector
 
using iterator = typename vector_type::const_iterator
 
using const_iterator = typename vector_type::const_iterator
 
using reverse_iterator = typename vector_type::const_reverse_iterator
 
using const_reverse_iterator = typename vector_type::const_reverse_iterator
 
using size_type = typename vector_type::size_type
 

Public Member Functions

 SetVector ()=default
 Construct an empty SetVector. More...
 
template<typename It >
 SetVector (It Start, It End)
 Initialize a SetVector with a range of elements. More...
 
ArrayRef< TgetArrayRef () const
 
Vector takeVector ()
 Clear the SetVector and return the underlying vector. More...
 
bool empty () const
 Determine if the SetVector is empty or not. More...
 
size_type size () const
 Determine the number of elements in the SetVector. More...
 
iterator begin ()
 Get an iterator to the beginning of the SetVector. More...
 
const_iterator begin () const
 Get a const_iterator to the beginning of the SetVector. More...
 
iterator end ()
 Get an iterator to the end of the SetVector. More...
 
const_iterator end () const
 Get a const_iterator to the end of the SetVector. More...
 
reverse_iterator rbegin ()
 Get an reverse_iterator to the end of the SetVector. More...
 
const_reverse_iterator rbegin () const
 Get a const_reverse_iterator to the end of the SetVector. More...
 
reverse_iterator rend ()
 Get a reverse_iterator to the beginning of the SetVector. More...
 
const_reverse_iterator rend () const
 Get a const_reverse_iterator to the beginning of the SetVector. More...
 
const Tfront () const
 Return the first element of the SetVector. More...
 
const Tback () const
 Return the last element of the SetVector. More...
 
const_reference operator[] (size_type n) const
 Index into the SetVector. More...
 
bool insert (const value_type &X)
 Insert a new element into the SetVector. More...
 
template<typename It >
void insert (It Start, It End)
 Insert a range of elements into the SetVector. More...
 
bool remove (const value_type &X)
 Remove an item from the set vector. More...
 
iterator erase (iterator I)
 Erase a single element from the set vector. More...
 
template<typename UnaryPredicate >
bool remove_if (UnaryPredicate P)
 Remove items from the set vector based on a predicate function. More...
 
size_type count (const key_type &key) const
 Count the number of elements of a given key in the SetVector. More...
 
void clear ()
 Completely clear the SetVector. More...
 
void pop_back ()
 Remove the last element of the SetVector. More...
 
LLVM_NODISCARD T pop_back_val ()
 
bool operator== (const SetVector &that) const
 
bool operator!= (const SetVector &that) const
 
template<class STy >
bool set_union (const STy &S)
 Compute This := This u S, return whether 'This' changed. More...
 
template<class STy >
void set_subtract (const STy &S)
 Compute This := This - B TODO: We should be able to use set_subtract from SetOperations.h, but SetVector interface is inconsistent with DenseSet. More...
 

Detailed Description

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
class llvm::SetVector< T, Vector, Set >

A vector that has set insertion semantics.

This adapter class provides a way to keep a set of things that also has the property of a deterministic iteration order. The order of iteration is the order of insertion.

Definition at line 41 of file SetVector.h.

Member Typedef Documentation

◆ const_iterator

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::const_iterator = typename vector_type::const_iterator

Definition at line 50 of file SetVector.h.

◆ const_reference

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::const_reference = const T&

Definition at line 46 of file SetVector.h.

◆ const_reverse_iterator

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::const_reverse_iterator = typename vector_type::const_reverse_iterator

Definition at line 52 of file SetVector.h.

◆ iterator

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::iterator = typename vector_type::const_iterator

Definition at line 49 of file SetVector.h.

◆ key_type

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::key_type = T

Definition at line 44 of file SetVector.h.

◆ reference

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::reference = T&

Definition at line 45 of file SetVector.h.

◆ reverse_iterator

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::reverse_iterator = typename vector_type::const_reverse_iterator

Definition at line 51 of file SetVector.h.

◆ set_type

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::set_type = Set

Definition at line 47 of file SetVector.h.

◆ size_type

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::size_type = typename vector_type::size_type

Definition at line 53 of file SetVector.h.

◆ value_type

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::value_type = T

Definition at line 43 of file SetVector.h.

◆ vector_type

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
using llvm::SetVector< T, Vector, Set >::vector_type = Vector

Definition at line 48 of file SetVector.h.

Constructor & Destructor Documentation

◆ SetVector() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
llvm::SetVector< T, Vector, Set >::SetVector ( )
default

Construct an empty SetVector.

◆ SetVector() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
template<typename It >
llvm::SetVector< T, Vector, Set >::SetVector ( It  Start,
It  End 
)
inline

Initialize a SetVector with a range of elements.

Definition at line 60 of file SetVector.h.

Member Function Documentation

◆ back()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const T& llvm::SetVector< T, Vector, Set >::back ( ) const
inline

◆ begin() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
iterator llvm::SetVector< T, Vector, Set >::begin ( )
inline

◆ begin() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const_iterator llvm::SetVector< T, Vector, Set >::begin ( ) const
inline

Get a const_iterator to the beginning of the SetVector.

Definition at line 88 of file SetVector.h.

◆ clear()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
void llvm::SetVector< T, Vector, Set >::clear ( )
inline

◆ count()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
size_type llvm::SetVector< T, Vector, Set >::count ( const key_type key) const
inline

◆ empty()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
bool llvm::SetVector< T, Vector, Set >::empty ( ) const
inline

◆ end() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
iterator llvm::SetVector< T, Vector, Set >::end ( )
inline

◆ end() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const_iterator llvm::SetVector< T, Vector, Set >::end ( ) const
inline

Get a const_iterator to the end of the SetVector.

Definition at line 98 of file SetVector.h.

◆ erase()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
iterator llvm::SetVector< T, Vector, Set >::erase ( iterator  I)
inline

Erase a single element from the set vector.

Returns
an iterator pointing to the next element that followed the element erased. This is the end of the SetVector if the last element is erased.

Definition at line 172 of file SetVector.h.

◆ front()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const T& llvm::SetVector< T, Vector, Set >::front ( ) const
inline

Return the first element of the SetVector.

Definition at line 123 of file SetVector.h.

Referenced by getPHIDestReg().

◆ getArrayRef()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
ArrayRef<T> llvm::SetVector< T, Vector, Set >::getArrayRef ( ) const
inline

Definition at line 64 of file SetVector.h.

Referenced by getMinVisibility().

◆ insert() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
bool llvm::SetVector< T, Vector, Set >::insert ( const value_type X)
inline

◆ insert() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
template<typename It >
void llvm::SetVector< T, Vector, Set >::insert ( It  Start,
It  End 
)
inline

Insert a range of elements into the SetVector.

Definition at line 151 of file SetVector.h.

◆ operator!=()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
bool llvm::SetVector< T, Vector, Set >::operator!= ( const SetVector< T, Vector, Set > &  that) const
inline

Definition at line 238 of file SetVector.h.

◆ operator==()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
bool llvm::SetVector< T, Vector, Set >::operator== ( const SetVector< T, Vector, Set > &  that) const
inline

Definition at line 234 of file SetVector.h.

◆ operator[]()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const_reference llvm::SetVector< T, Vector, Set >::operator[] ( size_type  n) const
inline

Index into the SetVector.

Definition at line 135 of file SetVector.h.

◆ pop_back()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
void llvm::SetVector< T, Vector, Set >::pop_back ( )
inline

Remove the last element of the SetVector.

Definition at line 222 of file SetVector.h.

Referenced by llvm::LiveRangeEdit::eliminateDeadDefs(), getNarrowIntrinsic(), and llvm::SetVector< llvm::SUnit *>::pop_back_val().

◆ pop_back_val()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
LLVM_NODISCARD T llvm::SetVector< T, Vector, Set >::pop_back_val ( )
inline

Definition at line 228 of file SetVector.h.

Referenced by isNotExclusivelyConstantDerived(), and llvm::SIInstrInfo::moveToVALU().

◆ rbegin() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
reverse_iterator llvm::SetVector< T, Vector, Set >::rbegin ( )
inline

Get an reverse_iterator to the end of the SetVector.

Definition at line 103 of file SetVector.h.

Referenced by containsNewBackedge().

◆ rbegin() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const_reverse_iterator llvm::SetVector< T, Vector, Set >::rbegin ( ) const
inline

Get a const_reverse_iterator to the end of the SetVector.

Definition at line 108 of file SetVector.h.

◆ remove()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
bool llvm::SetVector< T, Vector, Set >::remove ( const value_type X)
inline

Remove an item from the set vector.

Definition at line 158 of file SetVector.h.

Referenced by llvm::LiveRangeEdit::eraseVirtReg(), llvm::rdf::DataFlowGraph::getNextShadow(), and tryToVectorizeHorReductionOrInstOperands().

◆ remove_if()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
template<typename UnaryPredicate >
bool llvm::SetVector< T, Vector, Set >::remove_if ( UnaryPredicate  P)
inline

Remove items from the set vector based on a predicate function.

This is intended to be equivalent to the following code, if we could write it:

V.erase(remove_if(V, P), V.end());

However, SetVector doesn't expose non-const iterators, making any algorithm like remove_if impossible to use.

Returns
true if any element is removed.

Definition at line 200 of file SetVector.h.

Referenced by llvm::NodeSet::remove_if().

◆ rend() [1/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
reverse_iterator llvm::SetVector< T, Vector, Set >::rend ( )
inline

Get a reverse_iterator to the beginning of the SetVector.

Definition at line 113 of file SetVector.h.

Referenced by containsNewBackedge().

◆ rend() [2/2]

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
const_reverse_iterator llvm::SetVector< T, Vector, Set >::rend ( ) const
inline

Get a const_reverse_iterator to the beginning of the SetVector.

Definition at line 118 of file SetVector.h.

◆ set_subtract()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
template<class STy >
void llvm::SetVector< T, Vector, Set >::set_subtract ( const STy &  S)
inline

Compute This := This - B TODO: We should be able to use set_subtract from SetOperations.h, but SetVector interface is inconsistent with DenseSet.

Definition at line 261 of file SetVector.h.

Referenced by computeLiveInValues().

◆ set_union()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
template<class STy >
bool llvm::SetVector< T, Vector, Set >::set_union ( const STy &  S)
inline

Compute This := This u S, return whether 'This' changed.

TODO: We should be able to use set_union from SetOperations.h, but SetVector interface is inconsistent with DenseSet.

Definition at line 246 of file SetVector.h.

Referenced by computeLiveInValues().

◆ size()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
size_type llvm::SetVector< T, Vector, Set >::size ( ) const
inline

◆ takeVector()

template<typename T, typename Vector = std::vector<T>, typename Set = DenseSet<T>>
Vector llvm::SetVector< T, Vector, Set >::takeVector ( )
inline

Clear the SetVector and return the underlying vector.

Definition at line 67 of file SetVector.h.

Referenced by computeFunctionSummary(), and computeVariableSummary().


The documentation for this class was generated from the following file: