LLVM 20.0.0git |
A FILO worklist that prioritizes on re-insertion without duplication.More...
#include "llvm/ADT/PriorityWorklist.h"
Public Types | |
using | value_type =T |
using | key_type =T |
using | reference =T & |
using | const_reference =constT & |
using | size_type = typename MapT::size_type |
Public Member Functions | |
PriorityWorklist ()=default | |
Construct an emptyPriorityWorklist. | |
bool | empty ()const |
Determine if thePriorityWorklist is empty or not. | |
size_type | size ()const |
Returns the number of elements in the worklist. | |
size_type | count (constkey_type &key)const |
Count the number of elements of a given key in thePriorityWorklist. | |
constT & | back ()const |
Return the last element of thePriorityWorklist. | |
bool | insert (constT &X) |
Insert a new element into thePriorityWorklist. | |
template<typename SequenceT > | |
std::enable_if_t<!std::is_convertible< SequenceT,T >::value > | insert (SequenceT &&Input) |
Insert a sequence of new elements into thePriorityWorklist. | |
void | pop_back () |
Remove the last element of thePriorityWorklist. | |
T | pop_back_val () |
bool | erase (constT &X) |
Erase an item from the worklist. | |
template<typename UnaryPredicate > | |
bool | erase_if (UnaryPredicateP) |
Erase items from the set vector based on a predicate function. | |
void | clear () |
Reverse the items in thePriorityWorklist. | |
A FILO worklist that prioritizes on re-insertion without duplication.
This is very similar to aSetVector
with the primary difference that while re-insertion does not create a duplicate, it does adjust the visitation order to respect the last insertion point. This can be useful when the visit order needs to be prioritized based on insertion point without actually having duplicate visits.
Note that this doesn't prevent re-insertion of elements which have been visited – if you need to break cycles, a set will still be necessary.
The typeT
must be default constructable to a null value that will be ignored. It is an error to insert such a value, and popping elements will never produce such a value. It is expected to be used with common nullable types like pointers or optionals.
Internally this uses a vector to store the worklist and a map to identify existing elements in the worklist. Both of these may be customized, but the map must support the basicDenseMap API for mapping from a T to an integer index into the vector.
A partial specialization is provided to automatically select aSmallVector and aSmallDenseMap if custom data structures are not provided.
Definition at line55 of filePriorityWorklist.h.
usingllvm::PriorityWorklist<T, VectorT,MapT >::const_reference =constT& |
Definition at line60 of filePriorityWorklist.h.
usingllvm::PriorityWorklist<T, VectorT,MapT >::key_type =T |
Definition at line58 of filePriorityWorklist.h.
usingllvm::PriorityWorklist<T, VectorT,MapT >::reference =T& |
Definition at line59 of filePriorityWorklist.h.
usingllvm::PriorityWorklist<T, VectorT,MapT >::size_type = typename MapT::size_type |
Definition at line61 of filePriorityWorklist.h.
usingllvm::PriorityWorklist<T, VectorT,MapT >::value_type =T |
Definition at line57 of filePriorityWorklist.h.
| default |
Construct an emptyPriorityWorklist.
| inline |
Return the last element of thePriorityWorklist.
Definition at line83 of filePriorityWorklist.h.
Referencesassert(), andllvm::PriorityWorklist< T, VectorT, MapT >::empty().
Referenced byllvm::PriorityWorklist< T, VectorT, MapT >::pop_back(), andllvm::PriorityWorklist< T, VectorT, MapT >::pop_back_val().
| inline |
Reverse the items in thePriorityWorklist.
This does an in-place reversal. Other kinds of reverse aren't easy to support in the face of the worklist semantics. Completely clear thePriorityWorklist
Definition at line211 of filePriorityWorklist.h.
Count the number of elements of a given key in thePriorityWorklist.
Definition at line78 of filePriorityWorklist.h.
| inline |
Determine if thePriorityWorklist is empty or not.
Definition at line67 of filePriorityWorklist.h.
Referenced byllvm::PriorityWorklist< T, VectorT, MapT >::back(),llvm::PriorityWorklist< T, VectorT, MapT >::pop_back(),llvm::IRCEPass::run(),llvm::LoopAccessInfoPrinterPass::run(),llvm::FunctionToLoopPassAdaptor::run(),llvm::LoopUnrollPass::run(),llvm::ModuleToPostOrderCGSCCPassAdaptor::run(),llvm::sinkRegionForLoopNest(), andtryToUnrollAndJamLoop().
| inline |
Erase 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,PriorityWorklist doesn't expose non-const iterators, making any algorithm like remove_if impossible to use.
Definition at line193 of filePriorityWorklist.h.
ReferencesE,I,P,llvm::remove_if(), andT.
Insert a new element into thePriorityWorklist.
Definition at line90 of filePriorityWorklist.h.
Referencesassert(),Index,T, andX.
Referenced byllvm::appendReversedLoopsToWorklist(),llvm::FunctionToLoopPassAdaptor::run(),llvm::ModuleToPostOrderCGSCCPassAdaptor::run(), andllvm::sinkRegionForLoopNest().
| inline |
Insert a sequence of new elements into thePriorityWorklist.
Definition at line113 of filePriorityWorklist.h.
| inline |
Remove the last element of thePriorityWorklist.
Definition at line144 of filePriorityWorklist.h.
Referencesassert(),llvm::PriorityWorklist< T, VectorT, MapT >::back(),llvm::PriorityWorklist< T, VectorT, MapT >::empty(), andT.
Referenced byllvm::PriorityWorklist< T, VectorT, MapT >::pop_back_val().
| inline |
Definition at line153 of filePriorityWorklist.h.
Referencesllvm::PriorityWorklist< T, VectorT, MapT >::back(), andllvm::PriorityWorklist< T, VectorT, MapT >::pop_back().
Referenced byllvm::IRCEPass::run(),llvm::LoopAccessInfoPrinterPass::run(),llvm::FunctionToLoopPassAdaptor::run(),llvm::LoopUnrollPass::run(),llvm::ModuleToPostOrderCGSCCPassAdaptor::run(),llvm::sinkRegionForLoopNest(), andtryToUnrollAndJamLoop().
| inline |
Returns the number of elements in the worklist.
Definition at line72 of filePriorityWorklist.h.