Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Classes |Public Types |Public Member Functions |List of all members
llvm::PriorityWorklist< T, VectorT, MapT > Class Template Reference

A FILO worklist that prioritizes on re-insertion without duplication.More...

#include "llvm/ADT/PriorityWorklist.h"

Inheritance diagram for llvm::PriorityWorklist< T, VectorT, MapT >:
Inheritance graph
[legend]

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.
 
constTback ()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 >::valueinsert (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.
 

Detailed Description

template<typenameT, typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
class llvm::PriorityWorklist< T, VectorT, MapT >

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.

Member Typedef Documentation

◆ const_reference

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
usingllvm::PriorityWorklist<T, VectorT,MapT >::const_reference =constT&

Definition at line60 of filePriorityWorklist.h.

◆ key_type

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
usingllvm::PriorityWorklist<T, VectorT,MapT >::key_type =T

Definition at line58 of filePriorityWorklist.h.

◆ reference

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
usingllvm::PriorityWorklist<T, VectorT,MapT >::reference =T&

Definition at line59 of filePriorityWorklist.h.

◆ size_type

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
usingllvm::PriorityWorklist<T, VectorT,MapT >::size_type = typename MapT::size_type

Definition at line61 of filePriorityWorklist.h.

◆ value_type

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
usingllvm::PriorityWorklist<T, VectorT,MapT >::value_type =T

Definition at line57 of filePriorityWorklist.h.

Constructor & Destructor Documentation

◆ PriorityWorklist()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
llvm::PriorityWorklist<T, VectorT,MapT >::PriorityWorklist()
default

Construct an emptyPriorityWorklist.

Member Function Documentation

◆ back()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
constT &llvm::PriorityWorklist<T, VectorT,MapT >::back() const
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().

◆ clear()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
voidllvm::PriorityWorklist<T, VectorT,MapT >::clear()
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()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
size_typellvm::PriorityWorklist<T, VectorT,MapT >::count(constkey_typekey) const
inline

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

Returns
0 if the element is not in thePriorityWorklist, 1 if it is.

Definition at line78 of filePriorityWorklist.h.

◆ empty()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
boolllvm::PriorityWorklist<T, VectorT,MapT >::empty() const
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().

◆ erase()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
boolllvm::PriorityWorklist<T, VectorT,MapT >::erase(constTX)
inline

Erase an item from the worklist.

Note that this is constant time due to the nature of the worklist implementation.

Definition at line162 of filePriorityWorklist.h.

Referencesassert(),I,T, andX.

◆ erase_if()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
template<typename UnaryPredicate >
boolllvm::PriorityWorklist<T, VectorT,MapT >::erase_if(UnaryPredicate P)
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:

V.erase(remove_if(V,P), V.end());
#define P(N)
auto remove_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::remove_if which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1778

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

Returns
true if any element is removed.

Definition at line193 of filePriorityWorklist.h.

ReferencesE,I,P,llvm::remove_if(), andT.

◆ insert()[1/2]

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
boolllvm::PriorityWorklist<T, VectorT,MapT >::insert(constTX)
inline

Insert a new element into thePriorityWorklist.

Returns
true if the element was inserted into thePriorityWorklist.

Definition at line90 of filePriorityWorklist.h.

Referencesassert(),Index,T, andX.

Referenced byllvm::appendReversedLoopsToWorklist(),llvm::FunctionToLoopPassAdaptor::run(),llvm::ModuleToPostOrderCGSCCPassAdaptor::run(), andllvm::sinkRegionForLoopNest().

◆ insert()[2/2]

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
template<typename SequenceT >
std::enable_if_t<!std::is_convertible< SequenceT,T >::value >llvm::PriorityWorklist<T, VectorT,MapT >::insert(SequenceT && Input)
inline

Insert a sequence of new elements into thePriorityWorklist.

Definition at line113 of filePriorityWorklist.h.

ReferencesIndex, andT.

◆ pop_back()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
voidllvm::PriorityWorklist<T, VectorT,MapT >::pop_back()
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().

◆ pop_back_val()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
Tllvm::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().

◆ size()

template<typenameT , typename VectorT = std::vector<T>, typenameMapT = DenseMap<T, ptrdiff_t>>
size_typellvm::PriorityWorklist<T, VectorT,MapT >::size() const
inline

Returns the number of elements in the worklist.

Definition at line72 of filePriorityWorklist.h.


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

Generated on Sun Jul 20 2025 19:35:15 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp