summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ExecutionEngine
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2009-07-18 00:42:18 +0000
committerReid Kleckner <reid@kleckner.net>2009-07-18 00:42:18 +0000
commitfc8a2d5a8390952029e1c47a623e046b744f44d4 (patch)
tree628f6fa3e2de0310edd1fed1e72a666dc19bf884 /llvm/unittests/ExecutionEngine
parent91ff94d6d9befda562a1384f43ecde6e43b9db99 (diff)
downloadbcm5719-llvm-fc8a2d5a8390952029e1c47a623e046b744f44d4.tar.gz
bcm5719-llvm-fc8a2d5a8390952029e1c47a623e046b744f44d4.zip
Add EngineBuilder to ExecutionEngine in favor of the five optional argument EE::create().
Also a test commit. llvm-svn: 76276
Diffstat (limited to 'llvm/unittests/ExecutionEngine')
-rw-r--r--llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp6
-rw-r--r--llvm/unittests/ExecutionEngine/JIT/JITTest.cpp23
2 files changed, 17 insertions, 12 deletions
diff --git a/llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp
index 8fa5c4c107d..7e2104ef8e0 100644
--- a/llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp
+++ b/llvm/unittests/ExecutionEngine/JIT/JITEventListenerTest.cpp
@@ -66,7 +66,9 @@ class JITEventListenerTest : public testing::Test {
protected:
JITEventListenerTest()
: M(new Module("module", getGlobalContext())),
- EE(ExecutionEngine::createJIT(new ExistingModuleProvider(M))) {
+ EE(EngineBuilder(M)
+ .setEngineToCreate(EngineBuilder::ENG_JIT)
+ .create()) {
}
Module *M;
@@ -232,7 +234,7 @@ TEST_F(JITEventListenerTest, MatchesMachineCodeInfo) {
class JITEnvironment : public testing::Environment {
virtual void SetUp() {
- // Required for ExecutionEngine::createJIT to create a JIT.
+ // Required to create a JIT.
InitializeNativeTarget();
}
};
diff --git a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
index 211b6adf47d..b46ff8adf63 100644
--- a/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
+++ b/llvm/unittests/ExecutionEngine/JIT/JITTest.cpp
@@ -1,4 +1,4 @@
-//===- JITEmitter.cpp - Unit tests for the JIT code emitter ---------------===//
+//===- JITTest.cpp - Unit tests for the JIT -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -18,6 +18,7 @@
#include "llvm/Function.h"
#include "llvm/GlobalValue.h"
#include "llvm/GlobalVariable.h"
+#include "llvm/LLVMContext.h"
#include "llvm/Module.h"
#include "llvm/ModuleProvider.h"
#include "llvm/Support/IRBuilder.h"
@@ -60,12 +61,13 @@ TEST(JIT, GlobalInFunction) {
// memory is more easily tested.
MemMgr->setPoisonMemory(true);
std::string Error;
- OwningPtr<ExecutionEngine> JIT(ExecutionEngine::createJIT(
- MP,
- &Error,
- MemMgr,
- CodeGenOpt::Default,
- false)); // This last argument enables the fix.
+ OwningPtr<ExecutionEngine> JIT(EngineBuilder(MP)
+ .setEnginePreference(EngineBuilder::JITONLY)
+ .setErrorStr(&Error)
+ .setJITMemoryManager(MemMgr)
+ // The next line enables the fix:
+ .setAllocateGVsWithCode(false)
+ .create());
ASSERT_EQ(Error, "");
// Create a global variable.
@@ -115,11 +117,12 @@ TEST(JIT, GlobalInFunction) {
EXPECT_EQ(3, *GPtr);
}
-// TODO(rnk): This seems to only run once for both tests, which is unexpected.
-// That works just fine, but we shouldn't duplicate the code.
+// This code is copied from JITEventListenerTest, but it only runs once for all
+// the tests in this directory. Everything seems fine, but that's strange
+// behavior.
class JITEnvironment : public testing::Environment {
virtual void SetUp() {
- // Required for ExecutionEngine::createJIT to create a JIT.
+ // Required to create a JIT.
InitializeNativeTarget();
}
};
OpenPOWER on IntegriCloud