git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181168
91177308-0d34-0410-b5e6-
96231b3b80d8
-set(LLVM_LINK_COMPONENTS jit nativecodegen)
+set(LLVM_LINK_COMPONENTS jit mcjit nativecodegen)
set(LLVM_REQUIRES_EH 1)
add_llvm_example(ExceptionDemo
set(LLVM_REQUIRES_EH 1)
add_llvm_example(ExceptionDemo
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/Verifier.h"
//===----------------------------------------------------------------------===//
#include "llvm/Analysis/Verifier.h"
-#include "llvm/ExecutionEngine/ExecutionEngine.h"
-#include "llvm/ExecutionEngine/JIT.h"
+#include "llvm/ExecutionEngine/MCJIT.h"
+#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/IRBuilder.h"
Opts.JITExceptionHandling = true;
llvm::InitializeNativeTarget();
Opts.JITExceptionHandling = true;
llvm::InitializeNativeTarget();
+ llvm::InitializeNativeTargetAsmPrinter();
llvm::LLVMContext &context = llvm::getGlobalContext();
llvm::IRBuilder<> theBuilder(context);
// Make the module, which holds all the code.
llvm::Module *module = new llvm::Module("my cool jit", context);
llvm::LLVMContext &context = llvm::getGlobalContext();
llvm::IRBuilder<> theBuilder(context);
// Make the module, which holds all the code.
llvm::Module *module = new llvm::Module("my cool jit", context);
+ llvm::JITMemoryManager *MemMgr = new llvm::SectionMemoryManager();
+
// Build engine with JIT
llvm::EngineBuilder factory(module);
factory.setEngineKind(llvm::EngineKind::JIT);
factory.setAllocateGVsWithCode(false);
factory.setTargetOptions(Opts);
// Build engine with JIT
llvm::EngineBuilder factory(module);
factory.setEngineKind(llvm::EngineKind::JIT);
factory.setAllocateGVsWithCode(false);
factory.setTargetOptions(Opts);
+ factory.setJITMemoryManager(MemMgr);
+ factory.setUseMCJIT(true);
llvm::ExecutionEngine *executionEngine = factory.create();
{
llvm::ExecutionEngine *executionEngine = factory.create();
{
fpm,
"throwCppException");
fpm,
"throwCppException");
+ executionEngine->finalizeObject();
+
fprintf(stderr, "\nBegin module dump:\n\n");
module->dump();
fprintf(stderr, "\nBegin module dump:\n\n");
module->dump();