LLVM: llvm::SetVector< T, Vector, Set, N (original) (raw)

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

#include "[llvm/ADT/SetVector.h](SetVector%5F8h%5Fsource.html)"

Inherited by llvm::SmallSetVector< Value *, 4 >, llvm::SmallSetVector< const Value *, 4 >, llvm::SmallSetVector< MachineInstr *, 32 >, llvm::SmallSetVector< LiveInterval *, 8 >, llvm::SmallSetVector< SUnit *, 8 >, llvm::SmallSetVector< const Record *, 16 >, llvm::SmallSetVector< const BasicBlock *, 4 >, llvm::SmallSetVector< DepTy, 2 >, llvm::SmallSetVector< MemberTy, 8 >, llvm::SmallSetVector< Instruction *, 8 >, llvm::SmallSetVector< int, 8 >, llvm::SmallSetVector< const MachineBasicBlock *, 16 >, llvm::SmallSetVector< const LiveInterval *, 4 >, and llvm::SmallSetVector< Register, 8 >.

Public Types
using value_type = typename Vector::value_type
using key_type = typename Set::key_type
using reference = value_type &
using const_reference = const value_type &
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.
template
SetVector (It Start, It End)
Initialize a SetVector with a range of elements.
template<typename Range>
SetVector (llvm::from_range_t, Range &&R)
ArrayRef< value_type > getArrayRef () const
Vector takeVector ()
Clear the SetVector and return the underlying vector.
bool empty () const
Determine if the SetVector is empty or not.
size_type size () const
Determine the number of elements in the SetVector.
iterator begin ()
Get an iterator to the beginning of the SetVector.
const_iterator begin () const
Get a const_iterator to the beginning of the SetVector.
iterator end ()
Get an iterator to the end of the SetVector.
const_iterator end () const
Get a const_iterator to the end of the SetVector.
reverse_iterator rbegin ()
Get an reverse_iterator to the end of the SetVector.
const_reverse_iterator rbegin () const
Get a const_reverse_iterator to the end of the SetVector.
reverse_iterator rend ()
Get a reverse_iterator to the beginning of the SetVector.
const_reverse_iterator rend () const
Get a const_reverse_iterator to the beginning of the SetVector.
const value_type & front () const
Return the first element of the SetVector.
const value_type & back () const
Return the last element 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.
template
void insert (It Start, It End)
Insert a range of elements into the SetVector.
template<typename Range>
void insert_range (Range &&R)
bool remove (const value_type &X)
Remove an item from the set vector.
iterator erase (const_iterator I)
Erase a single element from the set vector.
template
bool remove_if (UnaryPredicate P)
Remove items from the set vector based on a predicate function.
bool contains (const_arg_type key) const
Check if the SetVector contains the given key.
size_type count (const_arg_type key) const
Count the number of elements of a given key in the SetVector.
void clear ()
Completely clear the SetVector.
void pop_back ()
Remove the last element of the SetVector.
value_type pop_back_val ()
bool operator== (const SetVector &that) const
bool operator!= (const SetVector &that) const
template
bool set_union (const STy &S)
Compute This := This u S, return whether 'This' changed.
template
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.
void swap (SetVector< T, Vector, Set, N > &RHS)

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>
class llvm::SetVector< T, Vector, Set, N >

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.

The key and value types are derived from the Set and Vector types respectively. This allows the vector-type operations and set-type operations to have different types.

No constraint is placed on the key and value types, although it is assumed that value_type can be converted into key_type for insertion. Users must be aware of any loss of information in this conversion. For example, setting value_type to float and key_type to int can produce very surprising results, but it is not explicitly disallowed.

The parameter N specifies the "small" size of the container, which is the number of elements upto which a linear scan over the Vector will be used when searching for elements instead of checking Set, due to it being better for performance. A value of 0 means that this mode of operation is not used, and is the default value.

Definition at line 57 of file SetVector.h.

const_iterator

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

const_reference

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

const_reverse_iterator

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

iterator

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

key_type

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

reference

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

reverse_iterator

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

set_type

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

size_type

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

value_type

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

vector_type

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

SetVector() [2/3]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template

SetVector() [3/3]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template<typename Range>

back()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

begin() [1/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

Get an iterator to the beginning of the SetVector.

Definition at line 106 of file SetVector.h.

Referenced by llvm::rdf::Liveness::computeLiveIns(), llvm::MachO::convertToInterfaceFile(), llvm::SetTheory::expand(), llvm::finalizeBundle(), formLCSSAForInstructionsImpl(), llvm::AAPotentialConstantValues::getAssumedMinTrailingZeros(), llvm::promoteLoopAccessesToScalars(), llvm::MemorySSAUpdater::removeMemoryAccess(), replaceConditionalBranchesOnConstant(), llvm::coro::sinkSpillUsesAfterCoroBegin(), splitPredecessorsOfLoopExit(), and unswitchNontrivialInvariants().

begin() [2/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

clear()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

contains()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

count()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

Count the number of elements of a given key in the SetVector.

Returns

0 if the element is not in the SetVector, 1 if it is.

Definition at line 262 of file SetVector.h.

Referenced by addMappingsFromTLI(), buildClonedLoops(), definedInCaller(), definedInRegion(), deleteDeadBlocksFromLoop(), eliminateDeadCode(), eraseLifetimeMarkersOnInputs(), findBestInsertionSet(), findExtractedInputToOverallInputMapping(), llvm::CodeExtractor::findInputsOutputs(), getCommonExitBlock(), getPotentialCopiesOfMemoryValue(), llvm::MemorySSAUpdater::removeBlocks(), shouldEmitDWARF(), llvm::SimplifyInstructionsInBlock(), sortBlocks(), tryInterleave(), and unswitchNontrivialInvariants().

empty()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

Determine if the SetVector is empty or not.

Definition at line 100 of file SetVector.h.

Referenced by analyzeLoopUnrollCost(), llvm::SetVector< EdgeType * >::back(), computeLiveInValues(), eliminateDeadCode(), llvm::LiveRangeEdit::eliminateDeadDefs(), llvm::rdf::DeadCodeElimination::erase(), llvm::CodeExtractor::extractCodeRegion(), llvm::SetVector< EdgeType * >::front(), gatherPossiblyVectorizableLoads(), llvm::MDNode::getMostGenericAliasScope(), interpretValues(), llvm::SetVector< EdgeType * >::pop_back(), pred_L(), llvm::MemorySSAUpdater::removeMemoryAccess(), llvm::removeUnreachableBlocks(), llvm::ReassociatePass::run(), llvm::PlaceSafepointsPass::runImpl(), llvm::SimplifyInstructionsInBlock(), sortBlocks(), llvm::SplitIndirectBrCriticalEdges(), splitPredecessorsOfLoopExit(), succ_L(), and tryInterleave().

end() [1/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

end() [2/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

erase()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

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 205 of file SetVector.h.

front()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

getArrayRef()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

insert() [1/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

Insert a new element into the SetVector.

Returns

true if the element was inserted into the SetVector.

Definition at line 151 of file SetVector.h.

Referenced by affectedValuesAreEphemeral(), analyzeExitPHIsForOutputUses(), llvm::InterleavedAccessInfo::analyzeInterleaving(), analyzeLoopUnrollCost(), llvm::CombinerHelper::applyExtendThroughPhis(), buildClonedLoops(), llvm::calculateRegisterUsageForPlan(), canRewriteGEPAsOffset(), collectMemAccessInfo(), collectPromotionCandidates(), computeBlocksDominatingExits(), computeFunctionSummary(), computeKillSet(), llvm::rdf::Liveness::computeLiveIns(), computeLiveInValues(), computeLiveOutSeed(), llvm::rdf::Liveness::computePhiInfo(), llvm::MDNode::concatenate(), llvm::MachO::convertToInterfaceFile(), llvm::convertUsersOfConstantsToInstructions(), DCEInstruction(), deleteDeadBlocksFromLoop(), llvm::HexagonFrameLowering::determineCalleeSaves(), eraseLifetimeMarkersOnInputs(), llvm::HexagonEvaluator::evaluate(), llvm::SetTheory::evaluate(), llvm::ControlFlowHub::finalize(), llvm::finalizeBundle(), llvm::CodeExtractor::findAllocas(), findBestInsertionSet(), llvm::CodeExtractor::findInputsOutputs(), llvm::FunctionPropertiesUpdater::finish(), fixIrreducible(), llvm::InstCombinerImpl::foldOpIntoPhi(), formLCSSAForInstructionsImpl(), llvm::rdf::Liveness::getAllReachingDefs(), getLeastCommonType(), llvm::MDNode::getMostGenericAliasScope(), llvm::DWARFYAML::Data::getNonEmptySectionNames(), getPlanEntry(), llvm::AliasSet::getPointers(), getPotentialCopiesOfMemoryValue(), getSameOpcode(), llvm::FunctionImporter::ImportMapTy::getSourceModules(), hasHazard(), llvm::FunctionImporter::importFunctions(), llvm::SetVector< EdgeType * >::insert(), llvm::SetVector< EdgeType * >::insert_range(), insertIfNamed(), insertTrivialPHIs(), isFunctionMallocLike(), llvm::LiveRangeCalc::isJointlyDominated(), llvm::AA::isPotentiallyAffectedByBarrier(), isReturnNonNull(), isVectorPromotionViable(), LinearizeExprTree(), lowerStatepointMetaArgs(), NegateValue(), llvm::memprof::RawMemProfReader::peekBuildIds(), phiNodeReplacement(), pred_L(), remapExtractedInputs(), llvm::MemorySSAUpdater::removeMemoryAccess(), llvm::removeUnreachableBlocks(), slpvectorizer::BoUpSLP::reorderBottomToTop(), replaceAndRecursivelySimplifyImpl(), llvm::AttributorCGSCCPass::run(), llvm::AttributorLightCGSCCPass::run(), llvm::AttributorLightPass::run(), llvm::AttributorPass::run(), llvm::InlinerPass::run(), llvm::PlaceSafepointsPass::runImpl(), runIPSCCP(), llvm::SetVector< EdgeType * >::set_union(), llvm::SetVector< EdgeType * >::SetVector(), simplifyAndDCEInstruction(), simplifyOneLoop(), sinkScalarOperands(), llvm::coro::sinkSpillUsesAfterCoroBegin(), sortBlocks(), succ_L(), tryInterleave(), llvm::UnrollLoop(), unswitchNontrivialInvariants(), and updateCGAndAnalysisManagerForPass().

insert() [2/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template

insert_range()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template<typename Range>

Definition at line 176 of file SetVector.h.

Referenced by computeFunctionSummary(), llvm::rdf::Liveness::computeLiveIns(), computeLiveInValues(), llvm::SetTheory::evaluate(), findBestInsertionSet(), llvm::FunctionPropertiesUpdater::finish(), gatherPossiblyVectorizableLoads(), getPlanEntry(), getPotentialCopiesOfMemoryValue(), insertParsePoints(), isFunctionMallocLike(), llvm::SplitIndirectBrCriticalEdges(), llvm::UnrollLoop(), and updateCGAndAnalysisManagerForPass().

operator!=()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

operator==()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

operator[]()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

pop_back()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

pop_back_val()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

rbegin() [1/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

rbegin() [2/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

remove()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

remove_if()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template

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());

bool remove_if(UnaryPredicate P)

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

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 230 of file SetVector.h.

Referenced by llvm::MDNode::intersect().

rend() [1/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

rend() [2/2]

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

set_subtract()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template

set_union()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

template

size()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

Determine the number of elements in the SetVector.

Definition at line 103 of file SetVector.h.

Referenced by affectedValuesAreEphemeral(), analyzeLoopUnrollCost(), canRewriteGEPAsOffset(), llvm::Attributor::checkForAllUses(), computeFunctionSummary(), llvm::rdf::Liveness::computeLiveIns(), computeLiveInValues(), llvm::rdf::Liveness::computePhiInfo(), llvm::ControlFlowHub::finalize(), llvm::finalizeBundle(), llvm::FunctionPropertiesUpdater::finish(), llvm::rdf::Liveness::getAllReachingDefs(), getCodeExtractorArguments(), getLeastCommonType(), getPlanEntry(), getSameOpcode(), hasHazard(), llvm::FunctionImporter::importFunctions(), isFunctionMallocLike(), llvm::LiveRangeCalc::isJointlyDominated(), isReturnNonNull(), lowerStatepointMetaArgs(), llvm::removeUnreachableBlocks(), replaceAndRecursivelySimplifyImpl(), sinkScalarOperands(), sortBlocks(), and unswitchNontrivialInvariants().

swap()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>

takeVector()

template<typename T, typename Vector = SmallVector<T, 0>, typename Set = DenseSet, unsigned N = 0>


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