mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-15 10:39:47 +00:00
Avoid duplicate search by reusing the iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f14bb8f5e6
commit
4805bf59b9
@ -503,7 +503,7 @@ void RuntimeDyldImpl::resolveExternalSymbols() {
|
|||||||
} else {
|
} else {
|
||||||
// We found the symbol in our global table. It was probably in a
|
// We found the symbol in our global table. It was probably in a
|
||||||
// Module that we loaded previously.
|
// Module that we loaded previously.
|
||||||
SymbolLoc SymLoc = GlobalSymbolTable.lookup(Name);
|
SymbolLoc SymLoc = Loc->second;
|
||||||
Addr = getSectionLoadAddress(SymLoc.first) + SymLoc.second;
|
Addr = getSectionLoadAddress(SymLoc.first) + SymLoc.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,18 +308,20 @@ public:
|
|||||||
void *getSymbolAddress(StringRef Name) {
|
void *getSymbolAddress(StringRef Name) {
|
||||||
// FIXME: Just look up as a function for now. Overly simple of course.
|
// FIXME: Just look up as a function for now. Overly simple of course.
|
||||||
// Work in progress.
|
// Work in progress.
|
||||||
if (GlobalSymbolTable.find(Name) == GlobalSymbolTable.end())
|
SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
|
||||||
|
if (pos == GlobalSymbolTable.end())
|
||||||
return 0;
|
return 0;
|
||||||
SymbolLoc Loc = GlobalSymbolTable.lookup(Name);
|
SymbolLoc Loc = pos->second;
|
||||||
return getSectionAddress(Loc.first) + Loc.second;
|
return getSectionAddress(Loc.first) + Loc.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getSymbolLoadAddress(StringRef Name) {
|
uint64_t getSymbolLoadAddress(StringRef Name) {
|
||||||
// FIXME: Just look up as a function for now. Overly simple of course.
|
// FIXME: Just look up as a function for now. Overly simple of course.
|
||||||
// Work in progress.
|
// Work in progress.
|
||||||
if (GlobalSymbolTable.find(Name) == GlobalSymbolTable.end())
|
SymbolTableMap::const_iterator pos = GlobalSymbolTable.find(Name);
|
||||||
|
if (pos == GlobalSymbolTable.end())
|
||||||
return 0;
|
return 0;
|
||||||
SymbolLoc Loc = GlobalSymbolTable.lookup(Name);
|
SymbolLoc Loc = pos->second;
|
||||||
return getSectionLoadAddress(Loc.first) + Loc.second;
|
return getSectionLoadAddress(Loc.first) + Loc.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user