From 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 Mon Sep 17 00:00:00 2001
From: dim SparseSet holds a small number of objects identified by unsigned keys of
+moderate size. It uses a lot of memory, but provides operations that are
+almost as fast as a vector. Typical keys are physical registers, virtual
+registers, or numbered basic blocks. SparseSet is useful for algorithms that need very fast clear/find/insert/erase
+and fast iteration over small sets. It is not intended for building composite
+data structures.
@@ -97,6 +99,7 @@ option
for ( ... ) {
std::vector<foo> V;
- use V;
+ // make use of V.
}
@@ -1006,7 +1009,7 @@ for ( ... ) {
std::vector<foo> V;
for ( ... ) {
- use V;
+ // make use of V.
V.clear();
}
@@ -1488,6 +1491,24 @@ href="#dss_densemap">DenseMap has.
+ "llvm/ADT/SparseSet.h"
+
+
+
"llvm/ADT/FoldingSet.h"
@@ -1608,6 +1629,29 @@ factors, and produces a lot of malloc traffic. It should be avoided.
+ImmutableSet is an immutable (functional) set implementation based on an AVL +tree. +Adding or removing elements is done through a Factory object and results in the +creation of a new ImmutableSet object. +If an ImmutableSet already exists with the given contents, then the existing one +is returned; equality is compared with a FoldingSetNodeID. +The time and space complexity of add or remove operations is logarithmic in the +size of the original set. + +
+There is no method for returning an element of the set, you can only check for +membership. + +
There are several aspects of DenseMap that you should be aware of, however. The -iterators in a densemap are invalidated whenever an insertion occurs, unlike +iterators in a DenseMap are invalidated whenever an insertion occurs, unlike map. Also, because DenseMap allocates space for a large number of key/value pairs (it starts with 64 by default), it will waste a lot of space if your keys or values are large. Finally, you must implement a partial specialization of @@ -1736,6 +1780,14 @@ DenseMapInfo for the key that you want, if it isn't already supported. This is required to tell DenseMap about two special marker values (which can never be inserted into the map) that it needs internally.
++DenseMap's find_as() method supports lookup operations using an alternate key +type. This is useful in cases where the normal key type is expensive to +construct, but cheap to compare against. The DenseMapInfo is responsible for +defining the appropriate comparison and hashing methods for each alternate +key type used. +
+ @@ -1814,6 +1866,25 @@ it can be edited again.+ImmutableMap is an immutable (functional) map implementation based on an AVL +tree. +Adding or removing elements is done through a Factory object and results in the +creation of a new ImmutableMap object. +If an ImmutableMap already exists with the given key set, then the existing one +is returned; equality is compared with a FoldingSetNodeID. +The time and space complexity of add or remove operations is logarithmic in the +size of the original map. + +
Replacing individual instructions
+Including "llvm/Transforms/Utils/BasicBlockUtils.h" permits use of two very useful replace functions: ReplaceInstWithValue @@ -2504,6 +2575,7 @@ and ReplaceInstWithInst.
Replacing multiple uses of Users and Values
+You can use Value::replaceAllUsesWith and User::replaceUsesOfWith to change more than one use at a time. See the @@ -3234,13 +3308,12 @@ helpful member functions that try to make common operations easy.
Constructing a Module is easy. You can optionally +
Constructing a Module is easy. You can optionally provide a name for it (probably based on the name of the translation unit).
+