[llvm-commits] [PATCH] PR12156, SmallPtrMap

Stepan Dyatkovskiy STPWORLD at narod.ru
Wed Mar 28 10:06:15 PDT 2012


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



More information about the llvm-commits mailing list