diff options
Diffstat (limited to 'bindings/ocaml/executionengine')
-rw-r--r-- | bindings/ocaml/executionengine/executionengine_ocaml.c | 8 | ||||
-rw-r--r-- | bindings/ocaml/executionengine/llvm_executionengine.ml | 3 | ||||
-rw-r--r-- | bindings/ocaml/executionengine/llvm_executionengine.mli | 11 |
3 files changed, 16 insertions, 6 deletions
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c index 647759f..072d583 100644 --- a/bindings/ocaml/executionengine/executionengine_ocaml.c +++ b/bindings/ocaml/executionengine/executionengine_ocaml.c @@ -24,11 +24,15 @@ #include <string.h> #include <assert.h> -/* Force the LLVM interpreter, JIT, and native target to be linked in. */ +/* Force the LLVM interpreter and JIT to be linked in. */ void llvm_initialize(void) { LLVMLinkInInterpreter(); LLVMLinkInJIT(); - LLVMInitializeNativeTarget(); +} + +/* unit -> bool */ +CAMLprim value llvm_initialize_native_target(value Unit) { + return Val_bool(LLVMInitializeNativeTarget()); } /* Can't use the recommended caml_named_value mechanism for backwards diff --git a/bindings/ocaml/executionengine/llvm_executionengine.ml b/bindings/ocaml/executionengine/llvm_executionengine.ml index cf9acc7..c9e8f18 100644 --- a/bindings/ocaml/executionengine/llvm_executionengine.ml +++ b/bindings/ocaml/executionengine/llvm_executionengine.ml @@ -109,3 +109,6 @@ module ExecutionEngine = struct *) end + +external initialize_native_target : unit -> bool + = "llvm_initialize_native_target" diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli index 17da1df..6c2fdfb 100644 --- a/bindings/ocaml/executionengine/llvm_executionengine.mli +++ b/bindings/ocaml/executionengine/llvm_executionengine.mli @@ -89,14 +89,14 @@ module ExecutionEngine: sig module provider [mp] if successful. Creates a JIT if possible, else falls back to an interpreter. Raises [Error msg] if an error occurrs. The execution engine is not garbage collected and must be destroyed with - [dispose ee]. See the function [llvm::ExecutionEngine::create]. *) + [dispose ee]. See the function [llvm::EngineBuilder::create]. *) val create: Llvm.llmoduleprovider -> t (** [create_interpreter mp] creates a new interpreter, taking ownership of the module provider [mp] if successful. Raises [Error msg] if an error occurrs. The execution engine is not garbage collected and must be destroyed with [dispose ee]. - See the function [llvm::ExecutionEngine::create]. *) + See the function [llvm::EngineBuilder::create]. *) val create_interpreter: Llvm.llmoduleprovider -> t (** [create_jit mp] creates a new JIT (just-in-time compiler), taking @@ -104,7 +104,7 @@ module ExecutionEngine: sig a JIT which favors code quality over compilation speed. Raises [Error msg] if an error occurrs. The execution engine is not garbage collected and must be destroyed with [dispose ee]. - See the function [llvm::ExecutionEngine::create]. *) + See the function [llvm::EngineBuilder::create]. *) val create_jit: Llvm.llmoduleprovider -> t (** [create_fast_jit mp] creates a new JIT (just-in-time compiler) which @@ -112,7 +112,7 @@ module ExecutionEngine: sig module provider [mp] if successful. Raises [Error msg] if an error occurrs. The execution engine is not garbage collected and must be destroyed with [dispose ee]. - See the function [llvm::ExecutionEngine::create]. *) + See the function [llvm::EngineBuilder::create]. *) val create_fast_jit: Llvm.llmoduleprovider -> t (** [dispose ee] releases the memory used by the execution engine and must be @@ -161,3 +161,6 @@ module ExecutionEngine: sig [ee]. *) val target_data: t -> Llvm_target.TargetData.t end + +external initialize_native_target : unit -> bool + = "llvm_initialize_native_target" |