This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Provide a pointer_map<T> template
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 24 Jun 2013 14:13:58 +0200 (CEST)
- Subject: Re: [PATCH] Provide a pointer_map<T> template
- References: <alpine dot LNX dot 2 dot 00 dot 1306191223000 dot 22313 at zhemvz dot fhfr dot qr> <alpine dot LNX dot 2 dot 00 dot 1306191439370 dot 22313 at zhemvz dot fhfr dot qr>
On Wed, 19 Jun 2013, Richard Biener wrote:
> On Wed, 19 Jun 2013, Richard Biener wrote:
>
> >
> > This templates the pointer-map implementation (actually it copies
> > the implementation, leaving the old interface unchanged) providing
> > a templated value type. That's suitable to replace the various
> > users requesting a pointer-to-integer-type map, like I noticed
> > for the two LTO tree recording mechanisms. Which in turn saves
> > memory on 64bit hosts (and should be less heavy-weight on the cache).
> > Not very much, but a quarter of the old pointer-map memory usage.
> >
> > LTO bootstrap and regtest running on x86_64-unknown-linux-gnu.
> >
> > In theory we can typedef pointer_map<void *> pointer_map_t, but
> > that requires touching all pointer_map_t users to drop the
> > leading 'struct' and eventually include pointer-set.h.
> >
> > I changed the insert () interface to get another output as to
> > whether the slot was present to avoid the need to have a special
> > "not present" value. That also makes it unnecessary to zero
> > the values array.
> >
> > Any comments?
> >
> > If not then I'll comb over existing pointer -> integer type map
> > users and convert them.
>
> Added the dominance.c one and changed the implementation to
> "inherit" from pointer-set instead, sharing a bit more code.
>
> The pointer-map template is also type-safe for the value array
> so converting all pointer-map users will make the code a tiny
> bit prettier.
>
> The remaining integer type cases seem to store integer types
> as large as pointer types so they fall in the same category
> (but eventually they chose that large type for no good reason).
>
> Old patch LTO bootstrapped and tested on x86_64-unknown-linux-gnu.
>
> Any objections?
None and thus installed.
Richard.