Go to the documentation of this file.
14 #ifndef LLVM_ADT_IMMUTABLEMAP_H
15 #define LLVM_ADT_IMMUTABLEMAP_H
27 template <
typename T,
typename S>
61 template <
typename KeyT,
typename ValT,
62 typename ValInfo = ImutKeyValueInfo<KeyT,ValT>>
85 const bool Canonicalize;
88 Factory(
bool canonicalize =
true) : Canonicalize(canonicalize) {}
91 :
F(Alloc), Canonicalize(canonicalize) {}
100 TreeTy *
T =
F.add(Old.
Root.get(), std::pair<key_type, data_type>(K,
D));
115 return Root ?
Root->contains(K) :
false;
172 if (
T)
return &
T->getValue().second;
182 return Root ? &(
Root->getMaxElement()->getValue()) :
nullptr;
192 ID.AddPointer(
M.Root.get());
201 template <
typename KeyT,
typename ValT,
202 typename ValInfo = ImutKeyValueInfo<KeyT,ValT>>
228 :
Root(
X.getRootWithoutRetain()),
Factory(
F.getTreeFactory()) {}
244 Factory->add(
Root.get(), std::pair<key_type, data_type>(K,
D));
254 return Root ?
Root->contains(K) :
false;
302 if (
T)
return &
T->getValue().second;
312 return Root ? &(
Root->getMaxElement()->getValue()) :
nullptr;
322 ID.AddPointer(
M.Root.get());
330 #endif // LLVM_ADT_IMMUTABLEMAP_H
static bool isEqual(key_type_ref L, key_type_ref R)
typename ValInfo::data_type data_type
const value_type & value_type_ref
typename ValInfo::data_type_ref data_type_ref
This is an optimization pass for GlobalISel generic memory operations.
ImmutableMap(const TreeTy *R)
Constructs a map from a pointer to a tree root.
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
const std::pair< T, S > value_type
static key_type_ref KeyOfValue(value_type_ref V)
key_type_ref getKey() const
value_type * getMaxElement() const
getMaxElement - Returns the <key,value> pair in the ImmutableMap for which key is the highest in the ...
static ImmutableMapRef getEmptyMap(FactoryTy *F)
ImmutableMapRef(const TreeTy *R, FactoryTy *F)
Constructs a map from a pointer to a tree root.
Factory(bool canonicalize=true)
static bool isLess(key_type_ref L, key_type_ref R)
typename ValInfo::data_type data_type
Generic iterator that wraps a T::TreeTy::iterator and exposes iterator::getValue() on dereference.
static bool isEqual(key_type_ref LHS, key_type_ref RHS)
bool contains(key_type_ref K) const
LLVM_NODISCARD ImmutableMap add(ImmutableMap Old, key_type_ref K, data_type_ref D)
Factory & operator=(const Factory &)=delete
void Profile(FoldingSetNodeID &ID) const
ImutKeyValueInfo -Traits class used by ImmutableMap.
bool operator==(const ImmutableMap &RHS) const
Factory(BumpPtrAllocator &Alloc, bool canonicalize=true)
bool contains(key_type_ref K) const
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static void Profile(FoldingSetNodeID &ID, const ImmutableMap &M)
bool operator!=(const ImmutableMapRef &RHS) const
data_type * lookup(key_type_ref K) const
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void Profile(FoldingSetNodeID &ID, const ImmutableMapRef &M)
Allocate memory in an ever growing pool, as if by bump-pointer.
static void Profile(FoldingSetNodeID &ID, value_type_ref X)
ImmutableMap getEmptyMap()
static bool isLess(key_type_ref LHS, key_type_ref RHS)
typename ValInfo::key_type_ref key_type_ref
typename ValInfo::key_type key_type
typename ValInfo::value_type value_type
bool operator==(const ImmutableMapRef &RHS) const
ImmutableMapRef(const ImmutableMap< KeyT, ValT > &X, typename ImmutableMap< KeyT, ValT >::Factory &F)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
ImmutableMapRef add(key_type_ref K, data_type_ref D) const
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
ImmutableMapRef remove(key_type_ref K) const
ImmutableMap< KeyT, ValT > asImmutableMap() const
typename ValInfo::data_type_ref data_type_ref
unsigned getHeight() const
typename ValInfo::value_type value_type
typename ValInfo::value_type_ref value_type_ref
key_type_ref getKey() const
unsigned getHeight() const
typename ValInfo::key_type_ref key_type_ref
#define LLVM_NODISCARD
LLVM_NODISCARD - Warn if a type or return value is discarded.
data_type_ref getData() const
IntrusiveRefCntPtr< TreeTy > Root
TreeTy * getRootWithoutRetain() const
bool operator!=(const ImmutableMap &RHS) const
typename ValInfo::key_type key_type
IntrusiveRefCntPtr< TreeTy > Root
data_type * lookup(key_type_ref K) const
typename TreeTy::Factory FactoryTy
InstrProfLookupTrait::data_type data_type
TreeTy::Factory * getTreeFactory() const
static bool isDataEqual(data_type_ref L, data_type_ref R)
typename ValInfo::value_type_ref value_type_ref
data_type_ref getData() const
static data_type_ref DataOfValue(value_type_ref V)
static void Profile(FoldingSetNodeID &ID, value_type_ref V)
LLVM_NODISCARD ImmutableMap remove(ImmutableMap Old, key_type_ref K)
A smart pointer to a reference-counted object that inherits from RefCountedBase or ThreadSafeRefCount...
void Profile(FoldingSetNodeID &ID) const
ImutAVLFactory< ImutInfo > Factory
value_type * getMaxElement() const
getMaxElement - Returns the <key,value> pair in the ImmutableMap for which key is the highest in the ...