llvm.org GIT mirror llvm / 0dd27da
Expose the optimization level for the jit in ocaml. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97610 91177308-0d34-0410-b5e6-96231b3b80d8 Erick Tryzelaar 10 years ago
3 changed file(s) with 10 addition(s) and 31 deletion(s). Raw diff Collapse all Expand all
186186 return Interp;
187187 }
188188
189 /* llmodule -> ExecutionEngine.t */
189 /* llmodule -> int -> ExecutionEngine.t */
190190 CAMLprim LLVMExecutionEngineRef
191 llvm_ee_create_jit(LLVMModuleRef M) {
191 llvm_ee_create_jit(LLVMModuleRef M, value OptLevel) {
192192 LLVMExecutionEngineRef JIT;
193193 char *Error;
194 if (LLVMCreateJITCompilerForModule(&JIT, M, 3, &Error))
195 llvm_raise(llvm_ee_error_exn, Error);
196 return JIT;
197 }
198
199 /* llmodule -> ExecutionEngine.t */
200 CAMLprim LLVMExecutionEngineRef
201 llvm_ee_create_fast_jit(LLVMModuleRef M) {
202 LLVMExecutionEngineRef JIT;
203 char *Error;
204 if (LLVMCreateJITCompiler(&JIT, M, 0, &Error))
194 if (LLVMCreateJITCompilerForModule(&JIT, M, Int_val(OptLevel), &Error))
205195 llvm_raise(llvm_ee_error_exn, Error);
206196 return JIT;
207197 }
5959 = "llvm_ee_create"
6060 external create_interpreter: Llvm.llmodule -> t
6161 = "llvm_ee_create_interpreter"
62 external create_jit: Llvm.llmodule -> t
62 external create_jit: Llvm.llmodule -> int -> t
6363 = "llvm_ee_create_jit"
64 external create_fast_jit: Llvm.llmodule -> t
65 = "llvm_ee_create_fast_jit"
6664 external dispose: t -> unit
6765 = "llvm_ee_dispose"
6866 external add_module: Llvm.llmodule -> t -> unit
9898 See the function [llvm::EngineBuilder::create]. *)
9999 val create_interpreter: Llvm.llmodule -> t
100100
101 (** [create_jit m] creates a new JIT (just-in-time compiler), taking
102 ownership of the module [m] if successful. This function creates a JIT
103 which favors code quality over compilation speed. Raises [Error msg] if an
104 error occurrs. The execution engine is not garbage collected and must be
105 destroyed with [dispose ee].
101 (** [create_jit m optlevel] creates a new JIT (just-in-time compiler), taking
102 ownership of the module [m] if successful with the desired optimization
103 level [optlevel]. Raises [Error msg] if an error occurrs. The execution
104 engine is not garbage collected and must be destroyed with [dispose ee].
106105 See the function [llvm::EngineBuilder::create]. *)
107 val create_jit: Llvm.llmodule -> t
108
109 (** [create_fast_jit m] creates a new JIT (just-in-time compiler) which
110 favors compilation speed over code quality. It takes ownership of the
111 module [m] if successful. Raises [Error msg] if an error occurrs. The
112 execution engine is not garbage collected and must be destroyed with
113 [dispose ee].
114 See the function [llvm::EngineBuilder::create]. *)
115 val create_fast_jit: Llvm.llmodule -> t
116
106 val create_jit : Llvm.llmodule -> int -> t
107
117108 (** [dispose ee] releases the memory used by the execution engine and must be
118109 invoked to avoid memory leaks. *)
119110 val dispose: t -> unit