9#ifndef LLVM_LIB_TRANSFORMS_OBJCARC_BLOTMAPVECTOR_H
10#define LLVM_LIB_TRANSFORMS_OBJCARC_BLOTMAPVECTOR_H
28 using VectorTy = std::vector<std::pair<KeyT, ValueT>>;
32#ifdef EXPENSIVE_CHECKS
34 assert(Vector.size() >= Map.size());
37 assert(
I->second < Vector.size());
38 assert(Vector[
I->second].first ==
I->first);
40 for (
typename VectorTy::const_iterator
I = Vector.begin(),
E = Vector.end();
42 assert(!
I->first || (Map.count(
I->first) &&
43 Map[
I->first] ==
size_t(
I - Vector.begin())));
56 std::pair<typename MapTy::iterator, bool> Pair = Map.try_emplace(Arg);
58 size_t Num = Vector.size();
59 Pair.first->second = Num;
60 Vector.push_back(std::make_pair(Arg,
ValueT()));
61 return Vector[Num].second;
63 return Vector[Pair.first->second].second;
66 std::pair<iterator, bool>
insert(
const std::pair<KeyT, ValueT> &InsertPair) {
67 std::pair<typename MapTy::iterator, bool> Pair =
68 Map.insert(std::make_pair(InsertPair.first,
size_t(0)));
70 size_t Num = Vector.size();
71 Pair.first->second = Num;
72 Vector.push_back(InsertPair);
73 return std::make_pair(Vector.begin() + Num,
true);
75 return std::make_pair(Vector.begin() + Pair.first->second,
false);
82 return Vector.begin() + It->second;
89 return Vector.begin() + It->second;
99 Vector[It->second].first =
KeyT();
109 assert(Map.empty() == Vector.empty());
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
This file defines the DenseMap class.
An associative container with fast insertion-order (deterministic) iteration over its elements.
const_iterator begin() const
void blot(const KeyT &Key)
This is similar to erase, but instead of removing the element from the vector, it just zeros out the ...
iterator find(const KeyT &Key)
typename VectorTy::iterator iterator
typename VectorTy::const_iterator const_iterator
ValueT & operator[](const KeyT &Arg)
std::pair< iterator, bool > insert(const std::pair< KeyT, ValueT > &InsertPair)
const_iterator end() const
const_iterator find(const KeyT &Key) const
This is an optimization pass for GlobalISel generic memory operations.