summaryrefslogtreecommitdiffstats
path: root/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2016-08-01 20:49:11 +0000
committerLang Hames <lhames@gmail.com>2016-08-01 20:49:11 +0000
commitad4a911feac0150f6bc5400ee9a8732adfd35f36 (patch)
tree8bad2b7d3e29a6a018d970c25530c6cce02373a2 /llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
parent317d42c1eae27a05d1b9a7dbbc3c8a7036eaaf91 (diff)
downloadbcm5719-llvm-ad4a911feac0150f6bc5400ee9a8732adfd35f36.tar.gz
bcm5719-llvm-ad4a911feac0150f6bc5400ee9a8732adfd35f36.zip
[ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.
This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class that is capable of lazy materialization (i.e. the symbol definition needn't be emitted until the address is requested). This can be used to support common and weak symbols in the JIT (though this is not implemented in this patch). For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver. For space efficiency a new class, JITEvaluatedSymbol, is introduced that behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an address and symbol flags. Instances of JITEvaluatedSymbol can be used in symbol-tables to avoid paying the space cost of the materializer. llvm-svn: 277386
Diffstat (limited to 'llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp')
-rw-r--r--llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
index 7fb328babfe..bb93271f596 100644
--- a/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
+++ b/llvm/lib/ExecutionEngine/MCJIT/MCJIT.cpp
@@ -46,7 +46,7 @@ ExecutionEngine*
MCJIT::createJIT(std::unique_ptr<Module> M,
std::string *ErrorStr,
std::shared_ptr<MCJITMemoryManager> MemMgr,
- std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver,
+ std::shared_ptr<JITSymbolResolver> Resolver,
std::unique_ptr<TargetMachine> TM) {
// Try to register the program as a source of symbols to resolve against.
//
@@ -67,7 +67,7 @@ MCJIT::createJIT(std::unique_ptr<Module> M,
MCJIT::MCJIT(std::unique_ptr<Module> M, std::unique_ptr<TargetMachine> TM,
std::shared_ptr<MCJITMemoryManager> MemMgr,
- std::shared_ptr<RuntimeDyld::SymbolResolver> Resolver)
+ std::shared_ptr<JITSymbolResolver> Resolver)
: ExecutionEngine(TM->createDataLayout(), std::move(M)), TM(std::move(TM)),
Ctx(nullptr), MemMgr(std::move(MemMgr)),
Resolver(*this, std::move(Resolver)), Dyld(*this->MemMgr, this->Resolver),
@@ -276,14 +276,14 @@ void MCJIT::finalizeModule(Module *M) {
finalizeLoadedModules();
}
-RuntimeDyld::SymbolInfo MCJIT::findExistingSymbol(const std::string &Name) {
+JITSymbol MCJIT::findExistingSymbol(const std::string &Name) {
SmallString<128> FullName;
Mangler::getNameWithPrefix(FullName, Name, getDataLayout());
if (void *Addr = getPointerToGlobalIfAvailable(FullName))
- return RuntimeDyld::SymbolInfo(static_cast<uint64_t>(
- reinterpret_cast<uintptr_t>(Addr)),
- JITSymbolFlags::Exported);
+ return JITSymbol(static_cast<uint64_t>(
+ reinterpret_cast<uintptr_t>(Addr)),
+ JITSymbolFlags::Exported);
return Dyld.getSymbol(FullName);
}
@@ -316,8 +316,8 @@ uint64_t MCJIT::getSymbolAddress(const std::string &Name,
return findSymbol(Name, CheckFunctionsOnly).getAddress();
}
-RuntimeDyld::SymbolInfo MCJIT::findSymbol(const std::string &Name,
- bool CheckFunctionsOnly) {
+JITSymbol MCJIT::findSymbol(const std::string &Name,
+ bool CheckFunctionsOnly) {
MutexGuard locked(lock);
// First, check to see if we already have this symbol.
@@ -367,7 +367,7 @@ RuntimeDyld::SymbolInfo MCJIT::findSymbol(const std::string &Name,
if (LazyFunctionCreator) {
auto Addr = static_cast<uint64_t>(
reinterpret_cast<uintptr_t>(LazyFunctionCreator(Name)));
- return RuntimeDyld::SymbolInfo(Addr, JITSymbolFlags::Exported);
+ return JITSymbol(Addr, JITSymbolFlags::Exported);
}
return nullptr;
@@ -644,7 +644,7 @@ void MCJIT::NotifyFreeingObject(const object::ObjectFile& Obj) {
L->NotifyFreeingObject(Obj);
}
-RuntimeDyld::SymbolInfo
+JITSymbol
LinkingSymbolResolver::findSymbol(const std::string &Name) {
auto Result = ParentEngine.findSymbol(Name, false);
// If the symbols wasn't found and it begins with an underscore, try again
OpenPOWER on IntegriCloud