From d1531a23494e5d9ead23f6640cd39e4ee7f90b39 Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Sat, 25 Oct 2014 18:49:56 +0000 Subject: [OCaml] Expose Llvm_executionengine.ExecutionEngine.create_mcjit. llvm-svn: 220619 --- .../ocaml/executionengine/executionengine_ocaml.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'llvm/bindings/ocaml/executionengine/executionengine_ocaml.c') diff --git a/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c b/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c index 4896c74..49e64f3 100644 --- a/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c +++ b/llvm/bindings/ocaml/executionengine/executionengine_ocaml.c @@ -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); -- cgit v1.1