1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

Remove LookupSymbol(StringRef) and optimize LookupSymbol(Twine).

Same as MakeArgString in r232465, keep only LookupSymbol(Twine)
while making sure it handles the StringRef like cases efficiently
using twine::toStringRef.

llvm-svn: 232517
This commit is contained in:
Yaron Keren 2015-03-17 18:55:30 +00:00
parent 3eb169f31f
commit 167e29e58f
2 changed files with 3 additions and 8 deletions

View File

@ -236,7 +236,6 @@ namespace llvm {
MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx); MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx);
/// Get the symbol for \p Name, or null. /// Get the symbol for \p Name, or null.
MCSymbol *LookupSymbol(StringRef Name) const;
MCSymbol *LookupSymbol(const Twine &Name) const; MCSymbol *LookupSymbol(const Twine &Name) const;
/// getSymbols - Get a reference for the symbol table for clients that /// getSymbols - Get a reference for the symbol table for clients that

View File

@ -219,14 +219,10 @@ MCSymbol *MCContext::GetDirectionalLocalSymbol(unsigned LocalLabelVal,
return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance); return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
} }
MCSymbol *MCContext::LookupSymbol(StringRef Name) const {
return Symbols.lookup(Name);
}
MCSymbol *MCContext::LookupSymbol(const Twine &Name) const { MCSymbol *MCContext::LookupSymbol(const Twine &Name) const {
SmallString<128> NameSV; SmallString<128> NameSV;
Name.toVector(NameSV); StringRef NameRef = Name.toStringRef(NameSV);
return LookupSymbol(NameSV.str()); return Symbols.lookup(NameRef);
} }
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -249,7 +245,7 @@ MCContext::getMachOSection(StringRef Segment, StringRef Section,
Name += Section; Name += Section;
// Do the lookup, if we have a hit, return it. // Do the lookup, if we have a hit, return it.
const MCSectionMachO *&Entry = MachOUniquingMap[Name.str()]; const MCSectionMachO *&Entry = MachOUniquingMap[Name];
if (Entry) if (Entry)
return Entry; return Entry;