[OCaml] Expose Llvm_executionengine.ExecutionEngine.create_mcjit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220619 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Peter Zotov
2014-10-25 18:49:56 +00:00
parent 71fe4f0197
commit 60d3f5918d
4 changed files with 142 additions and 53 deletions

View File

@@ -200,6 +200,24 @@ llvm_ee_create_jit(LLVMModuleRef M, value OptLevel) {
return JIT;
}
/* llmodule -> llcompileroption -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
llvm_ee_create_mcjit(LLVMModuleRef M, value OptRecord) {
LLVMExecutionEngineRef MCJIT;
char *Error;
struct LLVMMCJITCompilerOptions Options = {
.OptLevel = Int_val(Field(OptRecord, 0)),
.CodeModel = Int_val(Field(OptRecord, 1)),
.NoFramePointerElim = Int_val(Field(OptRecord, 2)),
.EnableFastISel = Int_val(Field(OptRecord, 3)),
.MCJMM = NULL
};
if (LLVMCreateMCJITCompilerForModule(&MCJIT, M, &Options,
sizeof(Options), &Error))
llvm_raise(llvm_ee_error_exn, Error);
return MCJIT;
}
/* ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_dispose(LLVMExecutionEngineRef EE) {
LLVMDisposeExecutionEngine(EE);