[llvm-commits] [llvm] r94600 - /llvm/trunk/include/llvm/ValueSymbolTable.h
Devang Patel
dpatel at apple.com
Wed Jan 27 09:31:23 PST 2010
On Jan 26, 2010, at 6:15 PM, Chris Lattner wrote:
>
> On Jan 26, 2010, at 2:03 PM, Devang Patel wrote:
>
>> Author: dpatel
>> Date: Tue Jan 26 16:03:41 2010
>> New Revision: 94600
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=94600&view=rev
>> Log:
>> Before existing NamedMDNode entry in the symbol table, remove any existing entry with the same name.
>
> Ok, but why doesn't this use the existing ValueSymbolTable class? Why are NamedMDNodes different than functions?
I tried but,
- ValueSymbolTable renames value in case of conflicts.
- SymbolTableListTraits are tied to standard symbol table instance.
Second reason specially sent me in a loop, so I created new class.
-
Devang
> I know you don't want to use "the same" ValueSymbolTable instance that functions live in to hold the NamedMDNode, but it seems that Module can have *two* ValueSymbolTable's, no?
>
> -Chris
>
>>
>> Modified:
>> llvm/trunk/include/llvm/ValueSymbolTable.h
>>
>> Modified: llvm/trunk/include/llvm/ValueSymbolTable.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ValueSymbolTable.h?rev=94600&r1=94599&r2=94600&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ValueSymbolTable.h (original)
>> +++ llvm/trunk/include/llvm/ValueSymbolTable.h Tue Jan 26 16:03:41 2010
>> @@ -194,9 +194,15 @@
>> /// @name Mutators
>> /// @{
>> public:
>> - /// insert - The method inserts a new entry into the stringmap.
>> + /// insert - The method inserts a new entry into the stringmap. This will
>> + /// replace existing entry, if any.
>> void insert(StringRef Name, NamedMDNode *Node) {
>> - (void) mmap.GetOrCreateValue(Name, Node);
>> + StringMapEntry<NamedMDNode *> &Entry =
>> + mmap.GetOrCreateValue(Name, Node);
>> + if (Entry.getValue() != Node) {
>> + mmap.remove(&Entry);
>> + (void) mmap.GetOrCreateValue(Name, Node);
>> + }
>> }
>>
>> /// This method removes a NamedMDNode from the symbol table.
>>
>>
>> _______________________________________________
>> 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