[llvm-commits] [PATCH] Make Inits FoldingSetNodes

David A. Greene greened at obbligato.org
Thu Jul 14 14:08:48 PDT 2011


Chris Lattner <clattner at apple.com> writes:

> On Jul 14, 2011, at 8:13 AM, David A. Greene wrote:

> What you're implementing here is a way to unique init's.  Folding set
> is a map data structure that is useful when the "key" is very
> expensive to represent.  As such, it makes sense for vectors of
> arguments, but doesn't make sense for trivial things.  If you want to
> unique a CodeInit, just use:
>
> StringMap<CodeInit*> TheCodeInits;
>
> See lib/VMCore/Type.cpp which uniques llvm IR types as an example.

Yes, this can be done.  I made the base Init a FoldingSet node so
there would be one pool of Inits.  If you think multiple pools is
better, I guess I can do that.



More information about the llvm-commits mailing list