[llvm-commits] [PATCH] PR12156, SmallPtrMap

Stepan Dyatkovskiy STPWORLD at narod.ru
Mon Mar 26 01:19:17 PDT 2012


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
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: smallptrmap-2.patch
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120326/93f6a8ab/attachment.ksh>


More information about the llvm-commits mailing list