r213879 - Use MCJIT.
Rafael Espindola
rafael.espindola at gmail.com
Thu Jul 24 10:13:10 PDT 2014
Author: rafael
Date: Thu Jul 24 12:13:09 2014
New Revision: 213879
URL: http://llvm.org/viewvc/llvm-project?rev=213879&view=rev
Log:
Use MCJIT.
Modified:
cfe/trunk/examples/clang-interpreter/CMakeLists.txt
cfe/trunk/examples/clang-interpreter/main.cpp
Modified: cfe/trunk/examples/clang-interpreter/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/CMakeLists.txt?rev=213879&r1=213878&r2=213879&view=diff
==============================================================================
--- cfe/trunk/examples/clang-interpreter/CMakeLists.txt (original)
+++ cfe/trunk/examples/clang-interpreter/CMakeLists.txt Thu Jul 24 12:13:09 2014
@@ -1,7 +1,7 @@
set(LLVM_LINK_COMPONENTS
Core
ExecutionEngine
- JIT
+ MCJIT
Support
native
)
Modified: cfe/trunk/examples/clang-interpreter/main.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/main.cpp?rev=213879&r1=213878&r2=213879&view=diff
==============================================================================
--- cfe/trunk/examples/clang-interpreter/main.cpp (original)
+++ cfe/trunk/examples/clang-interpreter/main.cpp Thu Jul 24 12:13:09 2014
@@ -18,7 +18,7 @@
#include "clang/Frontend/TextDiagnosticPrinter.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
+#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Host.h"
@@ -45,6 +45,7 @@ std::string GetExecutablePath(const char
static llvm::ExecutionEngine *createExecutionEngine(llvm::Module *M,
std::string *ErrorStr) {
llvm::EngineBuilder EB = llvm::EngineBuilder(M)
+ .setUseMCJIT(true)
.setEngineKind(llvm::EngineKind::Either)
.setErrorStr(ErrorStr);
return EB.create();
@@ -52,6 +53,7 @@ static llvm::ExecutionEngine *createExec
static int Execute(llvm::Module *Mod, char * const *envp) {
llvm::InitializeNativeTarget();
+ llvm::InitializeNativeTargetAsmPrinter();
std::string Error;
std::unique_ptr<llvm::ExecutionEngine> EE(createExecutionEngine(Mod, &Error));
@@ -70,6 +72,7 @@ static int Execute(llvm::Module *Mod, ch
std::vector<std::string> Args;
Args.push_back(Mod->getModuleIdentifier());
+ EE->finalizeObject();
return EE->runFunctionAsMain(EntryFn, Args, envp);
}
More information about the cfe-commits
mailing list