summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/ValueSymbolTable.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-27 21:09:10 +0000
committerChris Lattner <sabre@nondot.org>2008-06-27 21:09:10 +0000
commite43649fa621e2b6b437c67b00c88ae384ba20c2c (patch)
treeb745389029855f1856088315c9a4776dc5c45bca /llvm/lib/VMCore/ValueSymbolTable.cpp
parentd9f84134027d026eaaf4926195a2e6c958bb359d (diff)
downloadbcm5719-llvm-e43649fa621e2b6b437c67b00c88ae384ba20c2c.tar.gz
bcm5719-llvm-e43649fa621e2b6b437c67b00c88ae384ba20c2c.zip
Add a new version of Module::getFunction that takes a const char* instead
of a std::string. This avoids copying the string to the heap in common cases. Patch by Pratik Solanki! llvm-svn: 52834
Diffstat (limited to 'llvm/lib/VMCore/ValueSymbolTable.cpp')
-rw-r--r--llvm/lib/VMCore/ValueSymbolTable.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/ValueSymbolTable.cpp b/llvm/lib/VMCore/ValueSymbolTable.cpp
index fb7c0d8509b..f527863e1b5 100644
--- a/llvm/lib/VMCore/ValueSymbolTable.cpp
+++ b/llvm/lib/VMCore/ValueSymbolTable.cpp
@@ -54,6 +54,14 @@ Value *ValueSymbolTable::lookup(const std::string &Name) const {
return 0;
}
+Value *ValueSymbolTable::lookup(const char *NameBegin,
+ const char *NameEnd) const {
+ const_iterator VI = vmap.find(NameBegin, NameEnd);
+ if (VI != vmap.end()) // We found the symbol
+ return VI->getValue();
+ return 0;
+}
+
// Insert a value into the symbol table with the specified name...
//
void ValueSymbolTable::reinsertValue(Value* V) {
OpenPOWER on IntegriCloud