<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> <link rel="Start" href="index.html"> <link rel="previous" href="Llvm_executionengine.GenericValue.html"> <link rel="Up" href="Llvm_executionengine.html"> <link title="Index of types" rel=Appendix href="index_types.html"> <link title="Index of exceptions" rel=Appendix href="index_exceptions.html"> <link title="Index of values" rel=Appendix href="index_values.html"> <link title="Index of modules" rel=Appendix href="index_modules.html"> <link title="Llvm" rel="Chapter" href="Llvm.html"> <link title="Llvm_analysis" rel="Chapter" href="Llvm_analysis.html"> <link title="Llvm_bitreader" rel="Chapter" href="Llvm_bitreader.html"> <link title="Llvm_bitwriter" rel="Chapter" href="Llvm_bitwriter.html"> <link title="Llvm_executionengine" rel="Chapter" href="Llvm_executionengine.html"> <link title="Llvm_scalar_opts" rel="Chapter" href="Llvm_scalar_opts.html"> <link title="Llvm_target" rel="Chapter" href="Llvm_target.html"><title>Llvm_executionengine.ExecutionEngine</title> </head> <body> <div class="navbar"><a href="Llvm_executionengine.GenericValue.html">Previous</a> <a href="Llvm_executionengine.html">Up</a> </div> <center><h1>Module <a href="type_Llvm_executionengine.ExecutionEngine.html">Llvm_executionengine.ExecutionEngine</a></h1></center> <br> <pre><span class="keyword">module</span> ExecutionEngine: <code class="code"><span class="keyword">sig</span></code> <a href="Llvm_executionengine.ExecutionEngine.html">..</a> <code class="code"><span class="keyword">end</span></code></pre><hr width="100%"> <pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre> <div class="info"> An execution engine is either a JIT compiler or an interpreter, capable of directly loading an LLVM module and executing its functions without first invoking a static compiler and generating a native executable.<br> </div> <pre><span class="keyword">val</span> <a name="VALcreate"></a>create : <code class="type"><a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a> -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">create m</code> creates a new execution engine, taking ownership of the module <code class="code">m</code> if successful. Creates a JIT if possible, else falls back to an interpreter. Raises <code class="code"><span class="constructor">Error</span> msg</code> if an error occurrs. The execution engine is not garbage collected and must be destroyed with <code class="code">dispose ee</code>. See the function <code class="code">llvm::<span class="constructor">EngineBuilder</span>::create</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALcreate_interpreter"></a>create_interpreter : <code class="type"><a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a> -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">create_interpreter m</code> creates a new interpreter, taking ownership of the module <code class="code">m</code> if successful. Raises <code class="code"><span class="constructor">Error</span> msg</code> if an error occurrs. The execution engine is not garbage collected and must be destroyed with <code class="code">dispose ee</code>. See the function <code class="code">llvm::<span class="constructor">EngineBuilder</span>::create</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALcreate_jit"></a>create_jit : <code class="type"><a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a> -> int -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a></code></pre><div class="info"> <code class="code">create_jit m optlevel</code> creates a new JIT (just-in-time compiler), taking ownership of the module <code class="code">m</code> if successful with the desired optimization level <code class="code">optlevel</code>. Raises <code class="code"><span class="constructor">Error</span> msg</code> if an error occurrs. The execution engine is not garbage collected and must be destroyed with <code class="code">dispose ee</code>. See the function <code class="code">llvm::<span class="constructor">EngineBuilder</span>::create</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALdispose"></a>dispose : <code class="type"><a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">dispose ee</code> releases the memory used by the execution engine and must be invoked to avoid memory leaks.<br> </div> <pre><span class="keyword">val</span> <a name="VALadd_module"></a>add_module : <code class="type"><a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a> -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">add_module m ee</code> adds the module <code class="code">m</code> to the execution engine <code class="code">ee</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALremove_module"></a>remove_module : <code class="type"><a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a> -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> <a href="Llvm.html#TYPEllmodule">Llvm.llmodule</a></code></pre><div class="info"> <code class="code">remove_module m ee</code> removes the module <code class="code">m</code> from the execution engine <code class="code">ee</code>, disposing of <code class="code">m</code> and the module referenced by <code class="code">mp</code>. Raises <code class="code"><span class="constructor">Error</span> msg</code> if an error occurs.<br> </div> <pre><span class="keyword">val</span> <a name="VALfind_function"></a>find_function : <code class="type">string -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> <a href="Llvm.html#TYPEllvalue">Llvm.llvalue</a> option</code></pre><div class="info"> <code class="code">find_function n ee</code> finds the function named <code class="code">n</code> defined in any of the modules owned by the execution engine <code class="code">ee</code>. Returns <code class="code"><span class="constructor">None</span></code> if the function is not found and <code class="code"><span class="constructor">Some</span> f</code> otherwise.<br> </div> <pre><span class="keyword">val</span> <a name="VALrun_function"></a>run_function : <code class="type"><a href="Llvm.html#TYPEllvalue">Llvm.llvalue</a> -><br> <a href="Llvm_executionengine.GenericValue.html#TYPEt">Llvm_executionengine.GenericValue.t</a> array -><br> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> <a href="Llvm_executionengine.GenericValue.html#TYPEt">Llvm_executionengine.GenericValue.t</a></code></pre><div class="info"> <code class="code">run_function f args ee</code> synchronously executes the function <code class="code">f</code> with the arguments <code class="code">args</code>, which must be compatible with the parameter types.<br> </div> <pre><span class="keyword">val</span> <a name="VALrun_static_ctors"></a>run_static_ctors : <code class="type"><a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">run_static_ctors ee</code> executes the static constructors of each module in the execution engine <code class="code">ee</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALrun_static_dtors"></a>run_static_dtors : <code class="type"><a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">run_static_dtors ee</code> executes the static destructors of each module in the execution engine <code class="code">ee</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALrun_function_as_main"></a>run_function_as_main : <code class="type"><a href="Llvm.html#TYPEllvalue">Llvm.llvalue</a> -><br> string array -><br> (string * string) array -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> int</code></pre><div class="info"> <code class="code">run_function_as_main f args env ee</code> executes the function <code class="code">f</code> as a main function, passing it <code class="code">argv</code> and <code class="code">argc</code> according to the string array <code class="code">args</code>, and <code class="code">envp</code> as specified by the array <code class="code">env</code>. Returns the integer return value of the function.<br> </div> <pre><span class="keyword">val</span> <a name="VALfree_machine_code"></a>free_machine_code : <code class="type"><a href="Llvm.html#TYPEllvalue">Llvm.llvalue</a> -> <a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> unit</code></pre><div class="info"> <code class="code">free_machine_code f ee</code> releases the memory in the execution engine <code class="code">ee</code> used to store the machine code for the function <code class="code">f</code>.<br> </div> <pre><span class="keyword">val</span> <a name="VALtarget_data"></a>target_data : <code class="type"><a href="Llvm_executionengine.ExecutionEngine.html#TYPEt">t</a> -> <a href="Llvm_target.TargetData.html#TYPEt">Llvm_target.TargetData.t</a></code></pre><div class="info"> <code class="code">target_data ee</code> is the target data owned by the execution engine <code class="code">ee</code>.<br> </div> </body></html>