diff options
author | Renato Golin <renato.golin@linaro.org> | 2015-07-11 13:42:48 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2015-07-11 13:42:48 +0000 |
commit | 9d9be7dd36cab786d36d3917d5d34835be95341a (patch) | |
tree | 296a8ebe6308b4b2bdce498ddcd5f894b6052e49 /llvm/unittests/ExecutionEngine | |
parent | ef28aad9f4a93ba4afa846837109fcca5e68889a (diff) | |
download | bcm5719-llvm-9d9be7dd36cab786d36d3917d5d34835be95341a.tar.gz bcm5719-llvm-9d9be7dd36cab786d36d3917d5d34835be95341a.zip |
Revert "[ExecutionEngine] Use std::function rather than a function pointer for the LazyFunctionCreator."
This reverts commit r241962, as it was breaking all ARM buildbots.
It also reverts the two subsequent related commits:
r241974: "[ExecutionEngine] Add a static cast to the unittest for r241962 to suppress a warning."
r241973: "[ExecutionEngine] Remove cruft and fix a couple of warnings in the test case for r241962."
llvm-svn: 241983
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
-rw-r--r-- | llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp index cd2bc561ccc..f65ec96d944 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp @@ -199,68 +199,4 @@ TEST_F(MCJITTest, multiple_decl_lookups) { EXPECT_EQ(A, B) << "Repeat calls to getPointerToFunction fail."; } -typedef void * (*FunctionHandlerPtr)(const std::string &str); - -TEST_F(MCJITTest, lazy_function_creator_pointer) { - SKIP_UNSUPPORTED_PLATFORM; - - Function *Foo = insertExternalReferenceToFunction<int32_t(void)>(M.get(), - "\1Foo"); - startFunction<int32_t(void)>(M.get(), "Parent"); - CallInst *Call = Builder.CreateCall(Foo, {}); - Builder.CreateRet(Call); - - createJIT(std::move(M)); - - // Set up the lazy function creator that records the name of the last - // unresolved external function found in the module. Using a function pointer - // prevents us from capturing local variables, which is why this is static. - static std::string UnresolvedExternal; - FunctionHandlerPtr UnresolvedHandler = [] (const std::string &str) { - UnresolvedExternal = str; - return (void *)(uintptr_t)-1; - }; - TheJIT->InstallLazyFunctionCreator(UnresolvedHandler); - - // JIT the module. - TheJIT->finalizeObject(); - - // Verify that our handler was called. - EXPECT_EQ(UnresolvedExternal, "Foo"); -} - -TEST_F(MCJITTest, lazy_function_creator_lambda) { - SKIP_UNSUPPORTED_PLATFORM; - - Function *Foo1 = insertExternalReferenceToFunction<int32_t(void)>(M.get(), - "\1Foo1"); - Function *Foo2 = insertExternalReferenceToFunction<int32_t(void)>(M.get(), - "\1Foo2"); - startFunction<int32_t(void)>(M.get(), "Parent"); - CallInst *Call1 = Builder.CreateCall(Foo1, {}); - CallInst *Call2 = Builder.CreateCall(Foo2, {}); - Value *Result = Builder.CreateAdd(Call1, Call2); - Builder.CreateRet(Result); - - createJIT(std::move(M)); - - // Set up the lazy function creator that records the name of unresolved - // external functions in the module. - std::vector<std::string> UnresolvedExternals; - auto UnresolvedHandler = [&UnresolvedExternals] (const std::string &str) { - UnresolvedExternals.push_back(str); - return (void *)(uintptr_t)-1; - }; - TheJIT->InstallLazyFunctionCreator(UnresolvedHandler); - - // JIT the module. - TheJIT->finalizeObject(); - - // Verify that our handler was called for each unresolved function. - auto I = UnresolvedExternals.begin(), E = UnresolvedExternals.end(); - EXPECT_EQ(UnresolvedExternals.size(), static_cast<size_t>(2)); - EXPECT_FALSE(std::find(I, E, "Foo1") == E); - EXPECT_FALSE(std::find(I, E, "Foo2") == E); -} - } |