blob: 3b2eb16c024d78534773489a0d4a68a0f7f65383 [file] [log] [blame]
Gordon Henriksen2a8cd892007-12-23 16:59:28 +00001//===-- ExecutionEngineBindings.cpp - C bindings for EEs ------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattnerf3ebc3f2007-12-29 20:36:04 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Gordon Henriksen2a8cd892007-12-23 16:59:28 +00007//
8//===----------------------------------------------------------------------===//
9//
10// This file defines the C bindings for the ExecutionEngine library.
11//
12//===----------------------------------------------------------------------===//
13
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000014#include "llvm-c/ExecutionEngine.h"
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000015#include "llvm/ExecutionEngine/ExecutionEngine.h"
Chandler Carruthed0881b2012-12-03 16:50:05 +000016#include "llvm/ExecutionEngine/GenericValue.h"
Filip Pizlo3fdbaff2013-05-22 02:46:43 +000017#include "llvm/ExecutionEngine/RTDyldMemoryManager.h"
Filip Pizlodec20e42013-05-01 20:59:00 +000018#include "llvm/IR/DerivedTypes.h"
19#include "llvm/IR/Module.h"
Torok Edwin56d06592009-07-11 20:10:48 +000020#include "llvm/Support/ErrorHandling.h"
Sanjay Pateld9fb62e2015-06-01 21:56:56 +000021#include "llvm/Target/TargetOptions.h"
Anton Korobeynikov579f0712008-02-20 11:08:44 +000022#include <cstring>
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000023
24using namespace llvm;
25
Chandler Carruthf58e3762014-04-22 03:04:17 +000026#define DEBUG_TYPE "jit"
27
Eric Christopher04d4e932013-04-22 22:47:22 +000028// Wrapping the C bindings types.
Filip Pizlodec20e42013-05-01 20:59:00 +000029DEFINE_SIMPLE_CONVERSION_FUNCTIONS(GenericValue, LLVMGenericValueRef)
Eric Christopher04d4e932013-04-22 22:47:22 +000030
Eric Christopher04d4e932013-04-22 22:47:22 +000031
Diego Novillocd973c42015-07-27 18:27:23 +000032static LLVMTargetMachineRef wrap(const TargetMachine *P) {
Juergen Ributzka5fe955c2014-01-23 19:23:28 +000033 return
34 reinterpret_cast<LLVMTargetMachineRef>(const_cast<TargetMachine*>(P));
35}
36
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000037/*===-- Operations on generic values --------------------------------------===*/
38
39LLVMGenericValueRef LLVMCreateGenericValueOfInt(LLVMTypeRef Ty,
40 unsigned long long N,
Chris Lattner25963c62010-01-09 22:27:07 +000041 LLVMBool IsSigned) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000042 GenericValue *GenVal = new GenericValue();
43 GenVal->IntVal = APInt(unwrap<IntegerType>(Ty)->getBitWidth(), N, IsSigned);
44 return wrap(GenVal);
45}
46
47LLVMGenericValueRef LLVMCreateGenericValueOfPointer(void *P) {
48 GenericValue *GenVal = new GenericValue();
49 GenVal->PointerVal = P;
50 return wrap(GenVal);
51}
52
53LLVMGenericValueRef LLVMCreateGenericValueOfFloat(LLVMTypeRef TyRef, double N) {
54 GenericValue *GenVal = new GenericValue();
55 switch (unwrap(TyRef)->getTypeID()) {
56 case Type::FloatTyID:
57 GenVal->FloatVal = N;
58 break;
59 case Type::DoubleTyID:
60 GenVal->DoubleVal = N;
61 break;
62 default:
Torok Edwinfbcc6632009-07-14 16:55:14 +000063 llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000064 }
65 return wrap(GenVal);
66}
67
68unsigned LLVMGenericValueIntWidth(LLVMGenericValueRef GenValRef) {
69 return unwrap(GenValRef)->IntVal.getBitWidth();
70}
71
72unsigned long long LLVMGenericValueToInt(LLVMGenericValueRef GenValRef,
Chris Lattner25963c62010-01-09 22:27:07 +000073 LLVMBool IsSigned) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000074 GenericValue *GenVal = unwrap(GenValRef);
75 if (IsSigned)
76 return GenVal->IntVal.getSExtValue();
77 else
78 return GenVal->IntVal.getZExtValue();
79}
80
81void *LLVMGenericValueToPointer(LLVMGenericValueRef GenVal) {
82 return unwrap(GenVal)->PointerVal;
83}
84
85double LLVMGenericValueToFloat(LLVMTypeRef TyRef, LLVMGenericValueRef GenVal) {
86 switch (unwrap(TyRef)->getTypeID()) {
87 case Type::FloatTyID:
88 return unwrap(GenVal)->FloatVal;
89 case Type::DoubleTyID:
90 return unwrap(GenVal)->DoubleVal;
91 default:
Torok Edwinfbcc6632009-07-14 16:55:14 +000092 llvm_unreachable("LLVMGenericValueToFloat supports only float and double.");
Gordon Henriksen2a8cd892007-12-23 16:59:28 +000093 }
94}
95
96void LLVMDisposeGenericValue(LLVMGenericValueRef GenVal) {
97 delete unwrap(GenVal);
98}
99
100/*===-- Operations on execution engines -----------------------------------===*/
101
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000102LLVMBool LLVMCreateExecutionEngineForModule(LLVMExecutionEngineRef *OutEE,
103 LLVMModuleRef M,
104 char **OutError) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000105 std::string Error;
Rafael Espindola2a8a2792014-08-19 04:04:25 +0000106 EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
Reid Klecknerfc8a2d52009-07-18 00:42:18 +0000107 builder.setEngineKind(EngineKind::Either)
108 .setErrorStr(&Error);
109 if (ExecutionEngine *EE = builder.create()){
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000110 *OutEE = wrap(EE);
111 return 0;
112 }
113 *OutError = strdup(Error.c_str());
114 return 1;
115}
116
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000117LLVMBool LLVMCreateInterpreterForModule(LLVMExecutionEngineRef *OutInterp,
118 LLVMModuleRef M,
119 char **OutError) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000120 std::string Error;
Rafael Espindola2a8a2792014-08-19 04:04:25 +0000121 EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
Reid Klecknerfc8a2d52009-07-18 00:42:18 +0000122 builder.setEngineKind(EngineKind::Interpreter)
123 .setErrorStr(&Error);
124 if (ExecutionEngine *Interp = builder.create()) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000125 *OutInterp = wrap(Interp);
126 return 0;
127 }
128 *OutError = strdup(Error.c_str());
129 return 1;
130}
131
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000132LLVMBool LLVMCreateJITCompilerForModule(LLVMExecutionEngineRef *OutJIT,
133 LLVMModuleRef M,
134 unsigned OptLevel,
135 char **OutError) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000136 std::string Error;
Rafael Espindola2a8a2792014-08-19 04:04:25 +0000137 EngineBuilder builder(std::unique_ptr<Module>(unwrap(M)));
Reid Klecknerfc8a2d52009-07-18 00:42:18 +0000138 builder.setEngineKind(EngineKind::JIT)
139 .setErrorStr(&Error)
140 .setOptLevel((CodeGenOpt::Level)OptLevel);
141 if (ExecutionEngine *JIT = builder.create()) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000142 *OutJIT = wrap(JIT);
143 return 0;
144 }
145 *OutError = strdup(Error.c_str());
146 return 1;
147}
148
Filip Pizlo85e0d272013-05-01 22:58:00 +0000149void LLVMInitializeMCJITCompilerOptions(LLVMMCJITCompilerOptions *PassedOptions,
150 size_t SizeOfPassedOptions) {
151 LLVMMCJITCompilerOptions options;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000152 memset(&options, 0, sizeof(options)); // Most fields are zero by default.
Filip Pizlo85e0d272013-05-01 22:58:00 +0000153 options.CodeModel = LLVMCodeModelJITDefault;
Filip Pizlo85e0d272013-05-01 22:58:00 +0000154
155 memcpy(PassedOptions, &options,
156 std::min(sizeof(options), SizeOfPassedOptions));
157}
158
159LLVMBool LLVMCreateMCJITCompilerForModule(
160 LLVMExecutionEngineRef *OutJIT, LLVMModuleRef M,
161 LLVMMCJITCompilerOptions *PassedOptions, size_t SizeOfPassedOptions,
162 char **OutError) {
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000163 LLVMMCJITCompilerOptions options;
164 // If the user passed a larger sized options struct, then they were compiled
165 // against a newer LLVM. Tell them that something is wrong.
166 if (SizeOfPassedOptions > sizeof(options)) {
167 *OutError = strdup(
Filip Pizlo85e0d272013-05-01 22:58:00 +0000168 "Refusing to use options struct that is larger than my own; assuming "
169 "LLVM library mismatch.");
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000170 return 1;
171 }
172
173 // Defend against the user having an old version of the API by ensuring that
174 // any fields they didn't see are cleared. We must defend against fields being
175 // set to the bitwise equivalent of zero, and assume that this means "do the
176 // default" as if that option hadn't been available.
Filip Pizlo85e0d272013-05-01 22:58:00 +0000177 LLVMInitializeMCJITCompilerOptions(&options, sizeof(options));
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000178 memcpy(&options, PassedOptions, SizeOfPassedOptions);
179
180 TargetOptions targetOptions;
Filip Pizlo85e0d272013-05-01 22:58:00 +0000181 targetOptions.EnableFastISel = options.EnableFastISel;
Akira Hatanakaddf76aa2015-05-23 01:14:08 +0000182 std::unique_ptr<Module> Mod(unwrap(M));
183
184 if (Mod)
185 // Set function attribute "no-frame-pointer-elim" based on
186 // NoFramePointerElim.
Akira Hatanakae36505c2015-05-26 20:17:20 +0000187 for (auto &F : *Mod) {
188 auto Attrs = F.getAttributes();
189 auto Value = options.NoFramePointerElim ? "true" : "false";
190 Attrs = Attrs.addAttribute(F.getContext(), AttributeSet::FunctionIndex,
191 "no-frame-pointer-elim", Value);
192 F.setAttributes(Attrs);
193 }
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000194
195 std::string Error;
Akira Hatanakaddf76aa2015-05-23 01:14:08 +0000196 EngineBuilder builder(std::move(Mod));
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000197 builder.setEngineKind(EngineKind::JIT)
198 .setErrorStr(&Error)
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000199 .setOptLevel((CodeGenOpt::Level)options.OptLevel)
Filip Pizlo85e0d272013-05-01 22:58:00 +0000200 .setCodeModel(unwrap(options.CodeModel))
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000201 .setTargetOptions(targetOptions);
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000202 if (options.MCJMM)
Lang Hames4a5697e2014-12-03 00:51:19 +0000203 builder.setMCJITMemoryManager(
204 std::unique_ptr<RTDyldMemoryManager>(unwrap(options.MCJMM)));
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000205 if (ExecutionEngine *JIT = builder.create()) {
206 *OutJIT = wrap(JIT);
207 return 0;
208 }
209 *OutError = strdup(Error.c_str());
210 return 1;
211}
212
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000213void LLVMDisposeExecutionEngine(LLVMExecutionEngineRef EE) {
214 delete unwrap(EE);
215}
216
217void LLVMRunStaticConstructors(LLVMExecutionEngineRef EE) {
Amaury Sechet74f4ce62016-01-15 00:23:34 +0000218 unwrap(EE)->finalizeObject();
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000219 unwrap(EE)->runStaticConstructorsDestructors(false);
220}
221
222void LLVMRunStaticDestructors(LLVMExecutionEngineRef EE) {
Amaury Sechet74f4ce62016-01-15 00:23:34 +0000223 unwrap(EE)->finalizeObject();
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000224 unwrap(EE)->runStaticConstructorsDestructors(true);
225}
226
227int LLVMRunFunctionAsMain(LLVMExecutionEngineRef EE, LLVMValueRef F,
228 unsigned ArgC, const char * const *ArgV,
229 const char * const *EnvP) {
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000230 unwrap(EE)->finalizeObject();
Benjamin Kramerf5e2fc42015-05-29 19:43:39 +0000231
232 std::vector<std::string> ArgVec(ArgV, ArgV + ArgC);
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000233 return unwrap(EE)->runFunctionAsMain(unwrap<Function>(F), ArgVec, EnvP);
234}
235
236LLVMGenericValueRef LLVMRunFunction(LLVMExecutionEngineRef EE, LLVMValueRef F,
237 unsigned NumArgs,
238 LLVMGenericValueRef *Args) {
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000239 unwrap(EE)->finalizeObject();
240
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000241 std::vector<GenericValue> ArgVec;
242 ArgVec.reserve(NumArgs);
243 for (unsigned I = 0; I != NumArgs; ++I)
244 ArgVec.push_back(*unwrap(Args[I]));
245
246 GenericValue *Result = new GenericValue();
247 *Result = unwrap(EE)->runFunction(unwrap<Function>(F), ArgVec);
248 return wrap(Result);
249}
250
251void LLVMFreeMachineCodeForFunction(LLVMExecutionEngineRef EE, LLVMValueRef F) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000252}
253
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000254void LLVMAddModule(LLVMExecutionEngineRef EE, LLVMModuleRef M){
Rafael Espindola2a8a2792014-08-19 04:04:25 +0000255 unwrap(EE)->addModule(std::unique_ptr<Module>(unwrap(M)));
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000256}
257
Erick Tryzelaarad0e0cb2010-03-02 23:58:54 +0000258LLVMBool LLVMRemoveModule(LLVMExecutionEngineRef EE, LLVMModuleRef M,
259 LLVMModuleRef *OutMod, char **OutError) {
260 Module *Mod = unwrap(M);
261 unwrap(EE)->removeModule(Mod);
262 *OutMod = wrap(Mod);
263 return 0;
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000264}
265
Chris Lattner25963c62010-01-09 22:27:07 +0000266LLVMBool LLVMFindFunction(LLVMExecutionEngineRef EE, const char *Name,
267 LLVMValueRef *OutFn) {
Gordon Henriksen2a8cd892007-12-23 16:59:28 +0000268 if (Function *F = unwrap(EE)->FindFunctionNamed(Name)) {
269 *OutFn = wrap(F);
270 return 0;
271 }
272 return 1;
273}
Erick Tryzelaar8ac07c22008-03-27 00:27:14 +0000274
Filip Pizlo85e0d272013-05-01 22:58:00 +0000275void *LLVMRecompileAndRelinkFunction(LLVMExecutionEngineRef EE,
276 LLVMValueRef Fn) {
Eric Christopher79cc1e32014-09-02 22:28:02 +0000277 return nullptr;
Duncan Sands330134b2010-07-19 09:33:13 +0000278}
279
Erick Tryzelaar8ac07c22008-03-27 00:27:14 +0000280LLVMTargetDataRef LLVMGetExecutionEngineTargetData(LLVMExecutionEngineRef EE) {
Mehdi Aminia3fcefb2015-07-16 16:34:23 +0000281 return wrap(&unwrap(EE)->getDataLayout());
Erick Tryzelaar8ac07c22008-03-27 00:27:14 +0000282}
Gordon Henriksen9f337542008-06-20 02:16:11 +0000283
Juergen Ributzka5fe955c2014-01-23 19:23:28 +0000284LLVMTargetMachineRef
285LLVMGetExecutionEngineTargetMachine(LLVMExecutionEngineRef EE) {
286 return wrap(unwrap(EE)->getTargetMachine());
287}
288
Gordon Henriksen9f337542008-06-20 02:16:11 +0000289void LLVMAddGlobalMapping(LLVMExecutionEngineRef EE, LLVMValueRef Global,
290 void* Addr) {
291 unwrap(EE)->addGlobalMapping(unwrap<GlobalValue>(Global), Addr);
292}
Chris Lattner41b43da2009-01-21 18:11:10 +0000293
294void *LLVMGetPointerToGlobal(LLVMExecutionEngineRef EE, LLVMValueRef Global) {
Andrew Kaylor31be5ef2013-04-29 17:49:40 +0000295 unwrap(EE)->finalizeObject();
296
Chris Lattner41b43da2009-01-21 18:11:10 +0000297 return unwrap(EE)->getPointerToGlobal(unwrap<GlobalValue>(Global));
298}
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000299
Peter Zotovc433cd72014-12-22 18:53:11 +0000300uint64_t LLVMGetGlobalValueAddress(LLVMExecutionEngineRef EE, const char *Name) {
301 return unwrap(EE)->getGlobalValueAddress(Name);
302}
303
304uint64_t LLVMGetFunctionAddress(LLVMExecutionEngineRef EE, const char *Name) {
305 return unwrap(EE)->getFunctionAddress(Name);
306}
307
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000308/*===-- Operations on memory managers -------------------------------------===*/
309
310namespace {
311
312struct SimpleBindingMMFunctions {
Anders Waldenborg9515b312013-09-30 19:11:32 +0000313 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection;
314 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection;
315 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory;
316 LLVMMemoryManagerDestroyCallback Destroy;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000317};
318
319class SimpleBindingMemoryManager : public RTDyldMemoryManager {
320public:
321 SimpleBindingMemoryManager(const SimpleBindingMMFunctions& Functions,
322 void *Opaque);
Alexander Kornienkof817c1c2015-04-11 02:11:45 +0000323 ~SimpleBindingMemoryManager() override;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000324
Craig Topperb51ff602014-03-08 07:51:20 +0000325 uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
326 unsigned SectionID,
327 StringRef SectionName) override;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000328
Craig Topperb51ff602014-03-08 07:51:20 +0000329 uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
330 unsigned SectionID, StringRef SectionName,
331 bool isReadOnly) override;
332
333 bool finalizeMemory(std::string *ErrMsg) override;
334
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000335private:
336 SimpleBindingMMFunctions Functions;
337 void *Opaque;
338};
339
340SimpleBindingMemoryManager::SimpleBindingMemoryManager(
341 const SimpleBindingMMFunctions& Functions,
342 void *Opaque)
343 : Functions(Functions), Opaque(Opaque) {
344 assert(Functions.AllocateCodeSection &&
345 "No AllocateCodeSection function provided!");
346 assert(Functions.AllocateDataSection &&
347 "No AllocateDataSection function provided!");
348 assert(Functions.FinalizeMemory &&
349 "No FinalizeMemory function provided!");
350 assert(Functions.Destroy &&
351 "No Destroy function provided!");
352}
353
354SimpleBindingMemoryManager::~SimpleBindingMemoryManager() {
355 Functions.Destroy(Opaque);
356}
357
358uint8_t *SimpleBindingMemoryManager::allocateCodeSection(
Filip Pizlo7aa695e02013-10-02 00:59:25 +0000359 uintptr_t Size, unsigned Alignment, unsigned SectionID,
360 StringRef SectionName) {
361 return Functions.AllocateCodeSection(Opaque, Size, Alignment, SectionID,
362 SectionName.str().c_str());
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000363}
364
365uint8_t *SimpleBindingMemoryManager::allocateDataSection(
Filip Pizlo7aa695e02013-10-02 00:59:25 +0000366 uintptr_t Size, unsigned Alignment, unsigned SectionID,
367 StringRef SectionName, bool isReadOnly) {
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000368 return Functions.AllocateDataSection(Opaque, Size, Alignment, SectionID,
Filip Pizlo7aa695e02013-10-02 00:59:25 +0000369 SectionName.str().c_str(),
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000370 isReadOnly);
371}
372
373bool SimpleBindingMemoryManager::finalizeMemory(std::string *ErrMsg) {
Craig Topper2617dcc2014-04-15 06:32:26 +0000374 char *errMsgCString = nullptr;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000375 bool result = Functions.FinalizeMemory(Opaque, &errMsgCString);
376 assert((result || !errMsgCString) &&
377 "Did not expect an error message if FinalizeMemory succeeded");
378 if (errMsgCString) {
379 if (ErrMsg)
380 *ErrMsg = errMsgCString;
381 free(errMsgCString);
382 }
383 return result;
384}
385
386} // anonymous namespace
387
388LLVMMCJITMemoryManagerRef LLVMCreateSimpleMCJITMemoryManager(
389 void *Opaque,
Anders Waldenborg9515b312013-09-30 19:11:32 +0000390 LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection,
391 LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection,
392 LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory,
393 LLVMMemoryManagerDestroyCallback Destroy) {
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000394
395 if (!AllocateCodeSection || !AllocateDataSection || !FinalizeMemory ||
396 !Destroy)
Craig Topper2617dcc2014-04-15 06:32:26 +0000397 return nullptr;
Filip Pizlo3fdbaff2013-05-22 02:46:43 +0000398
399 SimpleBindingMMFunctions functions;
400 functions.AllocateCodeSection = AllocateCodeSection;
401 functions.AllocateDataSection = AllocateDataSection;
402 functions.FinalizeMemory = FinalizeMemory;
403 functions.Destroy = Destroy;
404 return wrap(new SimpleBindingMemoryManager(functions, Opaque));
405}
406
407void LLVMDisposeMCJITMemoryManager(LLVMMCJITMemoryManagerRef MM) {
408 delete unwrap(MM);
409}
410