[llvm-commits] [PATCH] PR12156, SmallPtrMap

Stepan Dyatkovskiy STPWORLD at narod.ru
Fri Mar 30 00:34:04 PDT 2012

Hi all. I reworked my patch again.
In MultiImplMap class I added "bool DenseMapCompatible" template parameter that makes it DenseMap compatible. For DenseMapCompatible = true user should present map implementations with DenseMap specific methods, though.
SmallMap became special case of MultiImplMap that uses FlatArrayMap for small mode, DenseMap for big mode and that set DenseMapCompatible = true.

Please find reworked patch in attachment for review.


28.03.2012, 21:06, "Stepan Dyatkovskiy" <STPWORLD at narod.ru>:

>  Hello guys!
>  So, what do you think about new SmallMap implementation?
>  -Stepan.
>  26.03.2012, 12:19, "Stepan Dyatkovskiy" <STPWORLD at narod.ru>:
>>   Hi all. Please find reworked patch in attachment.
>>   I implemented SmallMap class (not SmallPtrMap). It uses flat array in small mode and DenseMap in big mode. It also fully compatible with DenseMap.
>>   Also you can use more customizable MultiImplMap template. It needs 3 params: map for small mode, map for big mode and number of elements that triggers map from small mode to big one.
>>   Small map was tested within the unittests and I also tested it by replacing DenseMap with SmallMap in some places of llvm.
>>   -Stepan.
>>   13.03.2012, 20:59, "Jakob Stoklund Olesen" <stoklund at 2pi.dk>:
>>>    On Mar 13, 2012, at 5:47 AM, Stepan Dyatkovskiy <stpworld at narod.ru> wrote:
>>>>     Hi all. Please find in attachment SmallPtrMap implementation for review.
>>>>     It works exactly like a SmallPtrSet, but arrays of pointers was replaced with arrays of pair<ptr,item>.
>>>>     I also implemented the unit tests for new class it is also included into patch.
>>>    Hi Stepan,
>>>    Sorry I missed the original PR, or I would have commented earlier.
>>>    I know Daniel asked for this, but why implement a SmallPtrMap instead of a SmallMap? The SmallPtrSet is limited to pointers because it can cast to void* and avoid a lot of the template code duplication. This class can't do that because it still has the StoredTy template argument.
>>>    It also irks me to see most of DenseMap.h duplicated. Couldn't you just use a DenseMap member for the 'big' mode?
>>>    Thanks for working on this!
>>>    /jakob
>>   _______________________________________________
>>   llvm-commits mailing list
>>   llvm-commits at cs.uiuc.edu
>>   http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: smallptrmap-2.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120330/de20e5b6/attachment.ksh>

More information about the llvm-commits mailing list