[llvm] r232517 - Remove LookupSymbol(StringRef) and optimize LookupSymbol(Twine).
Yaron Keren
yaron.keren at gmail.com
Tue Mar 17 11:55:30 PDT 2015
Author: yrnkrn
Date: Tue Mar 17 13:55:30 2015
New Revision: 232517
URL: http://llvm.org/viewvc/llvm-project?rev=232517&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/lib/MC/MCContext.cpp
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=232517&r1=232516&r2=232517&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Tue Mar 17 13:55:30 2015
@@ -236,7 +236,6 @@ namespace llvm {
MCSymbol *getOrCreateFrameAllocSymbol(StringRef FuncName, unsigned Idx);
/// Get the symbol for \p Name, or null.
- MCSymbol *LookupSymbol(StringRef Name) const;
MCSymbol *LookupSymbol(const Twine &Name) const;
/// getSymbols - Get a reference for the symbol table for clients that
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=232517&r1=232516&r2=232517&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Tue Mar 17 13:55:30 2015
@@ -219,14 +219,10 @@ MCSymbol *MCContext::GetDirectionalLocal
return getOrCreateDirectionalLocalSymbol(LocalLabelVal, Instance);
}
-MCSymbol *MCContext::LookupSymbol(StringRef Name) const {
- return Symbols.lookup(Name);
-}
-
MCSymbol *MCContext::LookupSymbol(const Twine &Name) const {
SmallString<128> NameSV;
- Name.toVector(NameSV);
- return LookupSymbol(NameSV.str());
+ StringRef NameRef = Name.toStringRef(NameSV);
+ return Symbols.lookup(NameRef);
}
//===----------------------------------------------------------------------===//
@@ -249,7 +245,7 @@ MCContext::getMachOSection(StringRef Seg
Name += Section;
// Do the lookup, if we have a hit, return it.
- const MCSectionMachO *&Entry = MachOUniquingMap[Name.str()];
+ const MCSectionMachO *&Entry = MachOUniquingMap[Name];
if (Entry)
return Entry;
More information about the llvm-commits
mailing list