llvm-6502/include/llvm/ADT
Chandler Carruth dd9d38d57b Introduce a SmallDenseMap container that re-uses the existing DenseMap
implementation.

This type includes an inline bucket array which is used initially. Once
it is exceeded, an array of 64 buckets is allocated on the heap. The
bucket count grows from there as needed. Some highlights of this
implementation:

- The inline buffer is very carefully aligned, and so supports types
  with alignment constraints.
- It works hard to avoid aliasing issues.
- Supports types with non-trivial constructors, destructors, copy
  constructions, etc. It works reasonably hard to minimize copies and
  unnecessary initialization. The most common initialization is to set
  keys to the empty key, and so that should be fast if at all possible.

This class has a performance / space trade-off. It tries to optimize for
relatively small maps, and so packs the inline bucket array densely into
the object. It will be marginally slower than a normal DenseMap in a few
use patterns, so it isn't appropriate everywhere.

The unit tests for DenseMap have been generalized a bit to support
running over different map implementations in addition to different
key/value types. They've then been automatically extended to cover the
new container through the magic of GoogleTest's typed tests.

All of this is still a bit rough though. I'm going to be cleaning up
some aspects of the implementation, documenting things better, and
adding tests which include non-trivial types. As soon as I'm comfortable
with the correctness, I plan to switch existing users of SmallMap over
to this class as it is already more correct w.r.t. construction and
destruction of objects iin the map.

Thanks to Benjamin Kramer for all the reviews of this and the lead-up
patches. That said, more review on this would really be appreciated. As
I've noted a few times, I'm quite surprised how hard it is to get the
semantics for a hashtable-based map container with a small buffer
optimization correct. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158638 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-17 09:05:09 +00:00
..
APFloat.h Express the number of ULPs in fpaccuracy metadata as a real rather than a 2012-04-10 08:22:43 +00:00
APInt.h Add move semantics to APInt. 2012-06-02 08:39:08 +00:00
APSInt.h
ArrayRef.h Use the most basic superclass of SmallVector in ArrayRef. 2012-04-28 16:22:26 +00:00
BitVector.h Provide move semantics for (Small)BitVector. 2012-06-01 18:52:53 +00:00
DAGDeltaAlgorithm.h
DeltaAlgorithm.h
DenseMap.h Introduce a SmallDenseMap container that re-uses the existing DenseMap 2012-06-17 09:05:09 +00:00
DenseMapInfo.h Fix various issues (or do cleanups) found by enabling certain MSVC warnings. 2012-02-13 06:30:56 +00:00
DenseSet.h
DepthFirstIterator.h
edit_distance.h Add function for computing the edit distance of two arrays. 2012-02-15 22:13:07 +00:00
EquivalenceClasses.h
FlatArrayMap.h SmallMap, FlatArrayMap::copyFrom 2012-06-14 16:59:43 +00:00
FoldingSet.h Add a FoldingSetVector datastructure which is analogous to a SetVector, 2012-05-03 23:38:34 +00:00
GraphTraits.h
Hashing.h Hashing: Remove outdated comment. Support for reserved hash values was removed in r151865. 2012-06-09 15:33:28 +00:00
ilist_node.h
ilist.h Fixes the MSVC build. 2012-03-14 22:36:10 +00:00
ImmutableIntervalMap.h
ImmutableList.h
ImmutableMap.h
ImmutableSet.h Constify (trivially) ImmutableSet::iterator::getVisitState(). 2012-05-07 19:24:40 +00:00
IndexedMap.h SparseSet: Add support for key-derived indexes and arbitrary key types. 2012-04-20 20:05:28 +00:00
InMemoryStruct.h
IntEqClasses.h
IntervalMap.h Add a few missing 'template' keywords 2012-03-11 02:22:41 +00:00
IntrusiveRefCntPtr.h IntrusiveRefCntPtr: Simplify operator= as suggested by Richard Smith. 2012-05-31 22:25:25 +00:00
MultiImplMap.h Reapply the SmallMap patch with a fix. 2012-04-25 18:01:58 +00:00
NullablePtr.h
Optional.h
OwningPtr.h revert r148688 too, this isn't safe for DenseMap use. When DenseMap resizes, it will need to copy around arbitrary pointers 2012-01-23 15:10:41 +00:00
PackedVector.h
PointerIntPair.h PointerUnion::getAddrOf() does not need to be template since we can only 2012-03-06 07:14:54 +00:00
PointerUnion.h Add a few missing 'template' keywords 2012-03-11 02:22:41 +00:00
PostOrderIterator.h
PriorityQueue.h
SCCIterator.h
ScopedHashTable.h
SetOperations.h
SetVector.h add a method to improve compatibility with SmallVector. 2011-12-20 00:03:41 +00:00
SmallBitVector.h Merge the SmallBitVector and BitVector unit tests with gtest's typed test magic and bring SmallBitVector up to date. 2012-06-16 10:51:07 +00:00
SmallMap.h Reapply the SmallMap patch with a fix. 2012-04-25 18:01:58 +00:00
SmallPtrSet.h SmallPtrSet: Reuse DenseMapInfo's pointer hash function instead of inventing a bad one ourselves. 2012-04-18 10:37:32 +00:00
SmallSet.h allow clients of SmallSet to specify their own comparison function for the set. 2012-01-05 17:35:07 +00:00
SmallString.h stop hiding SmallVector's append that takes a count + element. 2012-04-21 21:02:03 +00:00
SmallVector.h Update SmallVector to support move semantics if the host does. 2012-05-02 05:39:15 +00:00
SparseBitVector.h What's better than fixing and simplifying broken hash functions? 2012-03-07 09:54:06 +00:00
SparseSet.h SparseSet: Add support for key-derived indexes and arbitrary key types. 2012-04-20 20:05:28 +00:00
Statistic.h
STLExtras.h SparseSet: Add support for key-derived indexes and arbitrary key types. 2012-04-20 20:05:28 +00:00
StringExtras.h Move ftostr into its last user (cppbackend) and simplify it a bit. 2012-03-23 11:26:29 +00:00
StringMap.h Make StringMap's copy ctor non-explicit. 2012-04-14 09:04:57 +00:00
StringRef.h Add doxygen comments. 2012-05-11 23:34:39 +00:00
StringSet.h
StringSwitch.h
TinyPtrVector.h add some helper methods to make the type more uniform. 2012-05-28 01:29:59 +00:00
Trie.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
Triple.h Remove the PTX back-end and all of its artifacts (triple, etc.) 2012-05-24 21:38:21 +00:00
Twine.h Convert assert(0) to llvm_unreachable 2012-02-05 22:14:15 +00:00
UniqueVector.h
ValueMap.h Disambiguate call to operator==. 2012-05-19 19:32:11 +00:00
VariadicFunction.h As Doug pointed out (and I really should know), it is perfectly easy to 2011-12-17 10:20:15 +00:00