LLVM: llvm::EquivalenceClasses< ElemTy > Class Template Reference (original) (raw)
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](EquivalenceClasses%5F8h%5Fsource.html)"
| Public Member Functions | |
|---|---|
| EquivalenceClasses ()=default | |
| EquivalenceClasses (const EquivalenceClasses &RHS) | |
| EquivalenceClasses & | operator= (const EquivalenceClasses &RHS) |
| iterator | begin () const |
| iterator | end () const |
| bool | empty () const |
| member_iterator | member_begin (const ECValue &ECV) const |
| member_iterator | member_end () const |
| iterator_range< member_iterator > | members (const ECValue &ECV) const |
| iterator_range< member_iterator > | members (const ElemTy &V) const |
| bool | contains (const ElemTy &V) const |
| Returns true if V is contained an equivalence class. | |
| 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. | |
| const ECValue & | insert (const ElemTy &Data) |
| insert - Insert a new value into the union/find set, ignoring the request if the value already exists. | |
| bool | erase (const ElemTy &V) |
| erase - Erase a value from the union/find set, return "true" if erase succeeded, or "false" when the value was not found. | |
| member_iterator | findLeader (const ElemTy &V) const |
| findLeader - Given a value in the set, return a member iterator for the equivalence class it is in. | |
| member_iterator | findLeader (const ECValue &ECV) 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 |
template
class llvm::EquivalenceClasses< ElemTy >
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 implements DenseMapInfo).
Here is a simple example using integers:
EC.unionSets(1, 2);
EC.insert(4); EC.insert(5);
EC.unionSets(5, 1);
for (EquivalenceClasses::iterator I = EC.begin(), E = EC.end();
if (->isLeader()) continue;
cerr << *MI << " ";
cerr << "\n";
}
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
EquivalenceClasses()=default
typename SmallVector< const ECValue * >::const_iterator iterator
iterator* - Provides a way to iterate over all values in the set.
This example prints: 4 5 1 2
Definition at line 62 of file EquivalenceClasses.h.
◆ iterator
iterator* - Provides a way to iterate over all values in the set.
Definition at line 158 of file EquivalenceClasses.h.
◆ EquivalenceClasses() [2/2]
◆ begin()
◆ contains()
◆ empty()
◆ end()
◆ erase()
erase - Erase a value from the union/find set, return "true" if erase succeeded, or "false" when the value was not found.
Definition at line 233 of file EquivalenceClasses.h.
◆ findLeader() [1/2]
◆ findLeader() [2/2]
◆ getLeaderValue()
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 190 of file EquivalenceClasses.h.
◆ getNumClasses()
getNumClasses - Return the number of equivalence classes in this set.
Note that this is a linear time operation.
Definition at line 207 of file EquivalenceClasses.h.
◆ getOrInsertLeaderValue()
◆ insert()
◆ isEquivalent()
◆ member_begin()
◆ member_end()
◆ members() [1/2]
◆ members() [2/2]
◆ operator=()
◆ unionSets() [1/2]
◆ unionSets() [2/2]
The documentation for this class was generated from the following file:
- include/llvm/ADT/EquivalenceClasses.h