summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2017-06-23 23:25:28 +0000
committerLang Hames <lhames@gmail.com>2017-06-23 23:25:28 +0000
commitcd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d (patch)
treede5c655184f5e9f11f2af90a3ab42d4ac10b6e1f /llvm/unittests/ExecutionEngine
parent7aacb659dad5ecdaa984406e0c6cc9a087f44e1b (diff)
downloadbcm5719-llvm-cd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d.tar.gz
bcm5719-llvm-cd9d49b605cc0c3283bc6f2ad4c38f8e1a525e7d.zip
[ORC] Re-apply r306166 and r306168 with fix for regression test.
llvm-svn: 306182
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp8
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp2
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp13
-rw-r--r--llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h48
4 files changed, 38 insertions, 33 deletions
diff --git a/llvm/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp
index 213c460aa67..f65dc0cd609 100644
--- a/llvm/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/LazyEmittingLayerTest.cpp
@@ -14,9 +14,9 @@
namespace {
struct MockBaseLayer {
- typedef int ModuleSetHandleT;
- ModuleSetHandleT addModuleSet(
- std::list<std::unique_ptr<llvm::Module>>,
+ typedef int ModuleHandleT;
+ ModuleHandleT addModule(
+ std::shared_ptr<llvm::Module>,
std::unique_ptr<llvm::RuntimeDyld::MemoryManager> MemMgr,
std::unique_ptr<llvm::JITSymbolResolver> Resolver) {
EXPECT_FALSE(MemMgr);
@@ -27,7 +27,7 @@ struct MockBaseLayer {
TEST(LazyEmittingLayerTest, Empty) {
MockBaseLayer M;
llvm::orc::LazyEmittingLayer<MockBaseLayer> L(M);
- L.addModuleSet(std::list<std::unique_ptr<llvm::Module>>(), nullptr, nullptr);
+ L.addModule(std::unique_ptr<llvm::Module>(), nullptr, nullptr);
}
}
diff --git a/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp b/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
index 6da2894ae0e..2fdf9e8b737 100644
--- a/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/ObjectTransformLayerTest.cpp
@@ -314,7 +314,7 @@ TEST(ObjectTransformLayerTest, Main) {
// compile.
NullResolver Resolver;
NullManager Manager;
- CompileLayer.addModuleSet(std::vector<llvm::Module *>(), &Manager, &Resolver);
+ CompileLayer.addModule(std::shared_ptr<llvm::Module>(), &Manager, &Resolver);
// Make sure that the calls from ObjectTransformLayer to ObjectLinkingLayer
// compile.
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index e8ba16a472b..2900a9c9276 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -65,8 +65,9 @@ protected:
CompileContext *CCtx = static_cast<CompileContext*>(Ctx);
auto *ET = CCtx->APIExecTest;
CCtx->M = ET->createTestModule(ET->TM->getTargetTriple());
- CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, wrap(CCtx->M.get()),
- myResolver, nullptr);
+ LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(CCtx->M.release()));
+ CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, SM, myResolver, nullptr);
+ LLVMOrcDisposeSharedModuleRef(SM);
CCtx->Compiled = true;
LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(JITStack, "main");
LLVMOrcSetIndirectStubPointer(JITStack, "foo", MainAddr);
@@ -87,8 +88,10 @@ TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
+ LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(M.release()));
LLVMOrcModuleHandle H =
- LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
+ LLVMOrcAddEagerlyCompiledIR(JIT, SM, myResolver, nullptr);
+ LLVMOrcDisposeSharedModuleRef(SM);
MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
int Result = MainFn();
EXPECT_EQ(Result, 42)
@@ -111,8 +114,10 @@ TEST_F(OrcCAPIExecutionTest, TestLazyIRCompilation) {
LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
+ LLVMSharedModuleRef SM = LLVMOrcMakeSharedModule(wrap(M.release()));
LLVMOrcModuleHandle H =
- LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
+ LLVMOrcAddLazilyCompiledIR(JIT, SM, myResolver, nullptr);
+ LLVMOrcDisposeSharedModuleRef(SM);
MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
int Result = MainFn();
EXPECT_EQ(Result, 42)
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
index 24320034a17..d7049ef00e6 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcTestCommon.h
@@ -106,65 +106,65 @@ public:
};
template <typename HandleT,
- typename AddModuleSetFtor,
- typename RemoveModuleSetFtor,
+ typename AddModuleFtor,
+ typename RemoveModuleFtor,
typename FindSymbolFtor,
typename FindSymbolInFtor>
class MockBaseLayer {
public:
- typedef HandleT ModuleSetHandleT;
+ typedef HandleT ModuleHandleT;
- MockBaseLayer(AddModuleSetFtor &&AddModuleSet,
- RemoveModuleSetFtor &&RemoveModuleSet,
+ MockBaseLayer(AddModuleFtor &&AddModule,
+ RemoveModuleFtor &&RemoveModule,
FindSymbolFtor &&FindSymbol,
FindSymbolInFtor &&FindSymbolIn)
- : AddModuleSet(AddModuleSet), RemoveModuleSet(RemoveModuleSet),
+ : AddModule(AddModule), RemoveModule(RemoveModule),
FindSymbol(FindSymbol), FindSymbolIn(FindSymbolIn)
{}
- template <typename ModuleSetT, typename MemoryManagerPtrT,
+ template <typename ModuleT, typename MemoryManagerPtrT,
typename SymbolResolverPtrT>
- ModuleSetHandleT addModuleSet(ModuleSetT Ms, MemoryManagerPtrT MemMgr,
- SymbolResolverPtrT Resolver) {
- return AddModuleSet(std::move(Ms), std::move(MemMgr), std::move(Resolver));
+ ModuleHandleT addModule(ModuleT Ms, MemoryManagerPtrT MemMgr,
+ SymbolResolverPtrT Resolver) {
+ return AddModule(std::move(Ms), std::move(MemMgr), std::move(Resolver));
}
- void removeModuleSet(ModuleSetHandleT H) {
- RemoveModuleSet(H);
+ void removeModule(ModuleHandleT H) {
+ RemoveModule(H);
}
JITSymbol findSymbol(const std::string &Name, bool ExportedSymbolsOnly) {
return FindSymbol(Name, ExportedSymbolsOnly);
}
- JITSymbol findSymbolIn(ModuleSetHandleT H, const std::string &Name,
+ JITSymbol findSymbolIn(ModuleHandleT H, const std::string &Name,
bool ExportedSymbolsOnly) {
return FindSymbolIn(H, Name, ExportedSymbolsOnly);
}
private:
- AddModuleSetFtor AddModuleSet;
- RemoveModuleSetFtor RemoveModuleSet;
+ AddModuleFtor AddModule;
+ RemoveModuleFtor RemoveModule;
FindSymbolFtor FindSymbol;
FindSymbolInFtor FindSymbolIn;
};
-template <typename ModuleSetHandleT,
- typename AddModuleSetFtor,
- typename RemoveModuleSetFtor,
+template <typename ModuleHandleT,
+ typename AddModuleFtor,
+ typename RemoveModuleFtor,
typename FindSymbolFtor,
typename FindSymbolInFtor>
-MockBaseLayer<ModuleSetHandleT, AddModuleSetFtor, RemoveModuleSetFtor,
+MockBaseLayer<ModuleHandleT, AddModuleFtor, RemoveModuleFtor,
FindSymbolFtor, FindSymbolInFtor>
-createMockBaseLayer(AddModuleSetFtor &&AddModuleSet,
- RemoveModuleSetFtor &&RemoveModuleSet,
+createMockBaseLayer(AddModuleFtor &&AddModule,
+ RemoveModuleFtor &&RemoveModule,
FindSymbolFtor &&FindSymbol,
FindSymbolInFtor &&FindSymbolIn) {
- return MockBaseLayer<ModuleSetHandleT, AddModuleSetFtor, RemoveModuleSetFtor,
+ return MockBaseLayer<ModuleHandleT, AddModuleFtor, RemoveModuleFtor,
FindSymbolFtor, FindSymbolInFtor>(
- std::forward<AddModuleSetFtor>(AddModuleSet),
- std::forward<RemoveModuleSetFtor>(RemoveModuleSet),
+ std::forward<AddModuleFtor>(AddModule),
+ std::forward<RemoveModuleFtor>(RemoveModule),
std::forward<FindSymbolFtor>(FindSymbol),
std::forward<FindSymbolInFtor>(FindSymbolIn));
}
OpenPOWER on IntegriCloud