package llvm
Install
Dune Dependency
Authors
Maintainers
Sources
md5=c81299338fdd29961ec659f0239e6d8c
sha512=186c8b9f2b5ed61150214b7e8046f08f66bfbcad3af3dc946c4840ff57ca9fcbc0f15c32f8b062b9cc331bdb02a8315afaad6d3810a3b56d7348db2fd376699a
doc/llvm_executionengine_static/Llvm_executionengine/index.html
Module Llvm_executionengine
Source
JIT Interpreter.
This interface provides an OCaml API for LLVM execution engine (JIT/ interpreter), the classes in the ExecutionEngine
library.
initialize ()
initializes the backend corresponding to the host. Returns true
if initialization is successful; false
indicates that there is no such backend or it is unable to emit object code via MCJIT.
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.
type llcompileroptions = {
opt_level : int;
code_model : Llvm_target.CodeModel.t;
no_framepointer_elim : bool;
enable_fast_isel : bool;
}
MCJIT compiler options. See llvm::TargetOptions
.
Default MCJIT compiler options: { opt_level = 0; code_model = CodeModel.JIT_default; no_framepointer_elim = false; enable_fast_isel = false }
create m optlevel
creates a new MCJIT just-in-time compiler, taking ownership of the module m
if successful with the desired optimization level optlevel
. Raises Error msg
if an error occurrs. The execution engine is not garbage collected and must be destroyed with dispose ee
.
Run initialize
before using this function.
See the function llvm::EngineBuilder::create
.
dispose ee
releases the memory used by the execution engine and must be invoked to avoid memory leaks.
add_module m ee
adds the module m
to the execution engine ee
.
remove_module m ee
removes the module m
from the execution engine ee
. Raises Error msg
if an error occurs.
run_static_ctors ee
executes the static constructors of each module in the execution engine ee
.
run_static_dtors ee
executes the static destructors of each module in the execution engine ee
.
data_layout ee
is the data layout of the execution engine ee
.
add_global_mapping gv ptr ee
tells the execution engine ee
that the global gv
is at the specified location ptr
, which must outlive gv
and ee
. All uses of gv
in the compiled code will refer to ptr
.
get_global_value_address id typ ee
returns a pointer to the identifier id
as type typ
, which will be a pointer type for a value, and which will be live as long as id
and ee
are. Caution: this function finalizes, i.e. forces code generation, all loaded modules. Further modifications to the modules will not have any effect.
get_function_address fn typ ee
returns a pointer to the function fn
as type typ
, which will be a pointer type for a function (e.g. (int -> int) typ
), and which will be live as long as fn
and ee
are. Caution: this function finalizes, i.e. forces code generation, all loaded modules. Further modifications to the modules will not have any effect.