[llvm-commits] [PATCH] Make Inits FoldingSetNodes
Chris Lattner
clattner at apple.com
Thu Jul 14 14:24:34 PDT 2011
On Jul 14, 2011, at 2:08 PM, David A. Greene wrote:
> 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.
Yep, thanks Dave. It might be best to just ignore FoldingSet all-together and just use map<std::vector<...>, RecInit*> or whatever. This avoids the space overhead of the foldingsetnode base class.
-Chris
More information about the llvm-commits
mailing list