LLVM 20.0.0git
|
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient operations: insert an element into a class of its own, union two classes, and find the class for a given element. More...
#include "llvm/ADT/EquivalenceClasses.h"
Classes | |
class | member_iterator |
Public Types | |
using | iterator = typename std::set< ECValue, ECValueComparator >::const_iterator |
iterator* - Provides a way to iterate over all values in the set. | |
Public Member Functions | |
EquivalenceClasses ()=default | |
EquivalenceClasses (const EquivalenceClasses &RHS) | |
const EquivalenceClasses & | operator= (const EquivalenceClasses &RHS) |
iterator | begin () const |
iterator | end () const |
bool | empty () const |
member_iterator | member_begin (iterator I) const |
member_iterator | member_end () const |
iterator | findValue (const ElemTy &V) const |
findValue - Return an iterator to the specified value. | |
const ElemTy & | getLeaderValue (const ElemTy &V) const |
getLeaderValue - Return the leader for the specified value that is in the set. | |
const ElemTy & | getOrInsertLeaderValue (const ElemTy &V) |
getOrInsertLeaderValue - Return the leader for the specified value that is in the set. | |
unsigned | getNumClasses () const |
getNumClasses - Return the number of equivalence classes in this set. | |
iterator | insert (const ElemTy &Data) |
insert - Insert a new value into the union/find set, ignoring the request if the value already exists. | |
member_iterator | findLeader (iterator I) const |
findLeader - Given a value in the set, return a member iterator for the equivalence class it is in. | |
member_iterator | findLeader (const ElemTy &V) const |
member_iterator | unionSets (const ElemTy &V1, const ElemTy &V2) |
union - Merge the two equivalence sets for the specified values, inserting them if they do not already exist in the equivalence set. | |
member_iterator | unionSets (member_iterator L1, member_iterator L2) |
bool | isEquivalent (const ElemTy &V1, const ElemTy &V2) const |
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient operations: insert an element into a class of its own, union two classes, and find the class for a given element.
In addition to these modification methods, it is possible to iterate over all of the equivalence classes and all of the elements in a class.
This implementation is an efficient implementation that only stores one copy of the element being indexed per entry in the set, and allows any arbitrary type to be indexed (as long as it can be ordered with operator< or a comparator is provided).
Here is a simple example using integers:
This example prints: 4 5 1 2
Definition at line 60 of file EquivalenceClasses.h.
using llvm::EquivalenceClasses< ElemTy, Compare >::iterator = typename std::set<ECValue, ECValueComparator>::const_iterator |
iterator* - Provides a way to iterate over all values in the set.
Definition at line 164 of file EquivalenceClasses.h.
|
default |
|
inline |
Definition at line 143 of file EquivalenceClasses.h.
References llvm::EquivalenceClasses< ElemTy, Compare >::operator=(), and RHS.
|
inline |
Definition at line 167 of file EquivalenceClasses.h.
Referenced by llvm::computeMinimumValueSizes(), and llvm::EquivalenceClasses< ElemTy, Compare >::getNumClasses().
|
inline |
Definition at line 170 of file EquivalenceClasses.h.
|
inline |
Definition at line 168 of file EquivalenceClasses.h.
Referenced by llvm::computeMinimumValueSizes(), and llvm::EquivalenceClasses< ElemTy, Compare >::getNumClasses().
|
inline |
Definition at line 232 of file EquivalenceClasses.h.
References llvm::EquivalenceClasses< ElemTy, Compare >::findLeader().
|
inline |
findLeader - Given a value in the set, return a member iterator for the equivalence class it is in.
This does the path-compression part that makes union-find "union findy". This returns an end iterator if the value is not in the equivalence class.
Definition at line 228 of file EquivalenceClasses.h.
References I, and llvm::EquivalenceClasses< ElemTy, Compare >::member_end().
Referenced by llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), llvm::EquivalenceClasses< ElemTy, Compare >::getLeaderValue(), llvm::EquivalenceClasses< ElemTy, Compare >::getOrInsertLeaderValue(), llvm::EquivalenceClasses< ElemTy, Compare >::isEquivalent(), and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
|
inline |
findValue - Return an iterator to the specified value.
If it does not exist, end() is returned.
Definition at line 184 of file EquivalenceClasses.h.
Referenced by llvm::MemoryDepChecker::areDepsSafe().
|
inline |
getLeaderValue - Return the leader for the specified value that is in the set.
It is an error to call this method for a value that is not yet in the set. For that, call getOrInsertLeaderValue(V).
Definition at line 191 of file EquivalenceClasses.h.
References assert(), llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), llvm::EquivalenceClasses< ElemTy, Compare >::member_end(), and MI.
Referenced by llvm::MemoryDepChecker::areDepsSafe().
|
inline |
getNumClasses - Return the number of equivalence classes in this set.
Note that this is a linear time operation.
Definition at line 208 of file EquivalenceClasses.h.
References llvm::EquivalenceClasses< ElemTy, Compare >::begin(), E, llvm::EquivalenceClasses< ElemTy, Compare >::end(), I, and NC.
|
inline |
getOrInsertLeaderValue - Return the leader for the specified value that is in the set.
If the member is not in the set, it is inserted, then returned.
Definition at line 200 of file EquivalenceClasses.h.
References assert(), llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), llvm::EquivalenceClasses< ElemTy, Compare >::insert(), llvm::EquivalenceClasses< ElemTy, Compare >::member_end(), and MI.
Referenced by llvm::computeMinimumValueSizes().
|
inline |
insert - Insert a new value into the union/find set, ignoring the request if the value already exists.
Definition at line 220 of file EquivalenceClasses.h.
References llvm::Data.
Referenced by llvm::EquivalenceClasses< ElemTy, Compare >::getOrInsertLeaderValue(), llvm::EquivalenceClasses< ElemTy, Compare >::operator=(), and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
|
inline |
Definition at line 264 of file EquivalenceClasses.h.
References llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), and llvm::EquivalenceClasses< ElemTy, Compare >::member_end().
Referenced by CompareSCEVComplexity().
|
inline |
Definition at line 174 of file EquivalenceClasses.h.
References I.
Referenced by llvm::MemoryDepChecker::areDepsSafe(), llvm::computeMinimumValueSizes(), and llvm::EquivalenceClasses< ElemTy, Compare >::operator=().
|
inline |
Definition at line 178 of file EquivalenceClasses.h.
Referenced by llvm::MemoryDepChecker::areDepsSafe(), llvm::computeMinimumValueSizes(), llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), llvm::EquivalenceClasses< ElemTy, Compare >::getLeaderValue(), llvm::EquivalenceClasses< ElemTy, Compare >::getOrInsertLeaderValue(), llvm::EquivalenceClasses< ElemTy, Compare >::isEquivalent(), llvm::EquivalenceClasses< ElemTy, Compare >::operator=(), and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
|
inline |
Definition at line 147 of file EquivalenceClasses.h.
References E, I, llvm::EquivalenceClasses< ElemTy, Compare >::insert(), llvm::EquivalenceClasses< ElemTy, Compare >::member_begin(), llvm::EquivalenceClasses< ElemTy, Compare >::member_end(), MI, RHS, and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
Referenced by llvm::EquivalenceClasses< ElemTy, Compare >::EquivalenceClasses().
|
inline |
union - Merge the two equivalence sets for the specified values, inserting them if they do not already exist in the equivalence set.
Definition at line 238 of file EquivalenceClasses.h.
References llvm::EquivalenceClasses< ElemTy, Compare >::findLeader(), llvm::EquivalenceClasses< ElemTy, Compare >::insert(), and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
Referenced by CompareSCEVComplexity(), llvm::computeMinimumValueSizes(), llvm::EquivalenceClasses< ElemTy, Compare >::operator=(), and llvm::EquivalenceClasses< ElemTy, Compare >::unionSets().
|
inline |
Definition at line 242 of file EquivalenceClasses.h.
References assert(), and llvm::EquivalenceClasses< ElemTy, Compare >::member_end().