LLVM 22.0.0git
|
A vector that has set insertion semantics. More...
#include "llvm/ADT/SetVector.h"
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<typename It> | |
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<typename It> | |
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<typename UnaryPredicate> | |
bool | remove_if (UnaryPredicate P) |
Remove items from the set vector based on a predicate function. | |
bool | contains (const key_type &key) const |
Check if the SetVector contains the given key. | |
size_type | count (const key_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<class STy> | |
bool | set_union (const STy &S) |
Compute This := This u S, return whether 'This' changed. | |
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. | |
void | swap (SetVector< T, Vector, Set, N > &RHS) |
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. In particular, this is useful when storing pointers as "Foo *" values but looking them up as "const Foo *" keys.
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 59 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::const_iterator = typename vector_type::const_iterator |
Definition at line 72 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::const_reference = const value_type & |
Definition at line 68 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::const_reverse_iterator = typename vector_type::const_reverse_iterator |
Definition at line 74 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::iterator = typename vector_type::const_iterator |
Definition at line 71 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::key_type = typename Set::key_type |
Definition at line 66 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::reference = value_type & |
Definition at line 67 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::reverse_iterator = typename vector_type::const_reverse_iterator |
Definition at line 73 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::set_type = Set |
Definition at line 69 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::size_type = typename vector_type::size_type |
Definition at line 75 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::value_type = typename Vector::value_type |
Definition at line 65 of file SetVector.h.
using llvm::SetVector< T, Vector, Set, N >::vector_type = Vector |
Definition at line 70 of file SetVector.h.
|
default |
Construct an empty SetVector.
|
inline |
Initialize a SetVector with a range of elements.
Definition at line 82 of file SetVector.h.
|
inline |
Definition at line 87 of file SetVector.h.
|
inline |
Return the last element of the SetVector.
Definition at line 155 of file SetVector.h.
Referenced by llvm::ControlFlowHub::finalize(), llvm::SetVector< EdgeType * >::pop_back(), llvm::SetVector< EdgeType * >::pop_back_val(), and sortBlocks().
|
inline |
Get an iterator to the beginning of the SetVector.
Definition at line 109 of file SetVector.h.
Referenced by llvm::rdf::Liveness::computeLiveIns(), llvm::MachO::convertToInterfaceFile(), llvm::SetTheory::expand(), formLCSSAForInstructionsImpl(), llvm::promoteLoopAccessesToScalars(), llvm::MemorySSAUpdater::removeMemoryAccess(), replaceConditionalBranchesOnConstant(), llvm::coro::sinkSpillUsesAfterCoroBegin(), splitPredecessorsOfLoopExit(), and unswitchNontrivialInvariants().
|
inline |
Get a const_iterator to the beginning of the SetVector.
Definition at line 114 of file SetVector.h.
|
inline |
Completely clear the SetVector.
Definition at line 284 of file SetVector.h.
Referenced by analyzeLoopUnrollCost(), findBestInsertionSet(), fixIrreducible(), pred_L(), llvm::MemorySSAUpdater::removeMemoryAccess(), llvm::InlinerPass::run(), succ_L(), and transformResourcePointers().
|
inlinenodiscard |
Check if the SetVector contains the given key.
Definition at line 269 of file SetVector.h.
Referenced by llvm::InterleavedAccessInfo::analyzeInterleaving(), canRewriteGEPAsOffset(), computePath(), containsReg(), llvm::convertUsersOfConstantsToInstructions(), llvm::SetVector< EdgeType * >::count(), gatherPossiblyVectorizableLoads(), getSameOpcode(), insertTrivialPHIs(), and llvm::MemorySSAUpdater::updateForClonedLoop().
|
inlinenodiscard |
Count the number of elements of a given key in the SetVector.
Definition at line 279 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().
|
inline |
Determine if the SetVector is empty or not.
Definition at line 99 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().
|
inline |
Get an iterator to the end of the SetVector.
Definition at line 119 of file SetVector.h.
Referenced by llvm::rdf::Liveness::computeLiveIns(), llvm::SetTheory::expand(), formLCSSAForInstructionsImpl(), llvm::MemorySSAUpdater::removeMemoryAccess(), replaceConditionalBranchesOnConstant(), and llvm::coro::sinkSpillUsesAfterCoroBegin().
|
inline |
Get a const_iterator to the end of the SetVector.
Definition at line 124 of file SetVector.h.
|
inline |
Erase a single element from the set vector.
Definition at line 222 of file SetVector.h.
|
inline |
Return the first element of the SetVector.
Definition at line 149 of file SetVector.h.
Referenced by llvm::ControlFlowHub::finalize().
|
inline |
Definition at line 90 of file SetVector.h.
Referenced by llvm::MDNode::concatenate(), llvm::CodeExtractor::extractCodeRegion(), llvm::ControlFlowHub::finalize(), getCodeExtractorArguments(), llvm::MDNode::getMostGenericAliasScope(), llvm::FunctionImporter::importFunctions(), insertParsePoints(), llvm::MDNode::intersect(), and llvm::AA::isPotentiallyAffectedByBarrier().
|
inline |
Insert a new element into the SetVector.
Definition at line 168 of file SetVector.h.
Referenced by 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(), 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(), llvm::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().
|
inline |
Insert a range of elements into the SetVector.
Definition at line 188 of file SetVector.h.
|
inline |
Definition at line 193 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().
|
inline |
Definition at line 306 of file SetVector.h.
|
inline |
Definition at line 302 of file SetVector.h.
|
inline |
Index into the SetVector.
Definition at line 161 of file SetVector.h.
|
inline |
Remove the last element of the SetVector.
Definition at line 290 of file SetVector.h.
Referenced by llvm::SetVector< EdgeType * >::pop_back_val(), and sortBlocks().
|
inlinenodiscard |
Definition at line 296 of file SetVector.h.
Referenced by analyzeLoopUnrollCost(), computeLiveInValues(), eliminateDeadCode(), llvm::LiveRangeEdit::eliminateDeadDefs(), llvm::ReassociatePass::run(), llvm::SimplifyInstructionsInBlock(), and sortBlocks().
|
inline |
Get an reverse_iterator to the end of the SetVector.
Definition at line 129 of file SetVector.h.
|
inline |
Get a const_reverse_iterator to the end of the SetVector.
Definition at line 134 of file SetVector.h.
|
inline |
Remove an item from the set vector.
Definition at line 198 of file SetVector.h.
Referenced by llvm::InterleavedAccessInfo::analyzeInterleaving(), computeFunctionSummary(), computeLiveInValues(), findLiveSetAtInst(), llvm::SetVector< EdgeType * >::set_subtract(), and splitPredecessorsOfLoopExit().
|
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:
However, SetVector doesn't expose non-const iterators, making any algorithm like remove_if impossible to use.
Definition at line 247 of file SetVector.h.
Referenced by llvm::MDNode::intersect().
|
inline |
Get a reverse_iterator to the beginning of the SetVector.
Definition at line 139 of file SetVector.h.
|
inline |
Get a const_reverse_iterator to the beginning of the SetVector.
Definition at line 144 of file SetVector.h.
|
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 328 of file SetVector.h.
Referenced by computeLiveInValues().
|
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 314 of file SetVector.h.
Referenced by computeLiveInValues(), and llvm::BlockCoverageInference::getDependencies().
|
inline |
Determine the number of elements in the SetVector.
Definition at line 104 of file SetVector.h.
Referenced by analyzeLoopUnrollCost(), canRewriteGEPAsOffset(), llvm::Attributor::checkForAllUses(), computeFunctionSummary(), llvm::rdf::Liveness::computeLiveIns(), computeLiveInValues(), llvm::rdf::Liveness::computePhiInfo(), llvm::ControlFlowHub::finalize(), llvm::FunctionPropertiesUpdater::finish(), llvm::rdf::Liveness::getAllReachingDefs(), getCodeExtractorArguments(), getLeastCommonType(), getPlanEntry(), getSameOpcode(), llvm::FunctionImporter::importFunctions(), isFunctionMallocLike(), llvm::LiveRangeCalc::isJointlyDominated(), isReturnNonNull(), lowerStatepointMetaArgs(), llvm::removeUnreachableBlocks(), replaceAndRecursivelySimplifyImpl(), sinkScalarOperands(), sortBlocks(), and unswitchNontrivialInvariants().
|
inline |
Definition at line 333 of file SetVector.h.
|
inline |
Clear the SetVector and return the underlying vector.
Definition at line 93 of file SetVector.h.
Referenced by computeFunctionSummary(), computeVariableSummary(), llvm::AliasSet::getPointers(), llvm::FunctionImporter::ImportMapTy::getSourceModules(), lowerStatepointMetaArgs(), llvm::memprof::RawMemProfReader::peekBuildIds(), llvm::removeUnreachableBlocks(), and llvm::slpvectorizer::BoUpSLP::reorderBottomToTop().