1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071(*===-- llvm_executionengine.ml - LLVM OCaml Interface --------*- OCaml -*-===*
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===----------------------------------------------------------------------===*)exceptionErrorofstringlet()=Callback.register_exception"Llvm_executionengine.Error"(Error"")externalinitialize:unit->bool="llvm_ee_initialize"typellexecutionenginetypellcompileroptions={opt_level:int;code_model:Llvm_target.CodeModel.t;no_framepointer_elim:bool;enable_fast_isel:bool;}letdefault_compiler_options={opt_level=0;code_model=Llvm_target.CodeModel.JITDefault;no_framepointer_elim=false;enable_fast_isel=false}externalcreate:?options:llcompileroptions->Llvm.llmodule->llexecutionengine="llvm_ee_create"externaldispose:llexecutionengine->unit="llvm_ee_dispose"externaladd_module:Llvm.llmodule->llexecutionengine->unit="llvm_ee_add_module"externalremove_module:Llvm.llmodule->llexecutionengine->unit="llvm_ee_remove_module"externalrun_static_ctors:llexecutionengine->unit="llvm_ee_run_static_ctors"externalrun_static_dtors:llexecutionengine->unit="llvm_ee_run_static_dtors"externaldata_layout:llexecutionengine->Llvm_target.DataLayout.t="llvm_ee_get_data_layout"externaladd_global_mapping_:Llvm.llvalue->nativeint->llexecutionengine->unit="llvm_ee_add_global_mapping"externalget_global_value_address_:string->llexecutionengine->nativeint="llvm_ee_get_global_value_address"externalget_function_address_:string->llexecutionengine->nativeint="llvm_ee_get_function_address"letadd_global_mappingllvalptree=add_global_mapping_llval(Ctypes.raw_address_of_ptr(Ctypes.to_voidpptr))eeletget_global_value_addressnametypee=letvptr=get_global_value_address_nameeeinifNativeint.to_intvptr<>0thenletopenCtypesin!@(coerce(ptrvoid)(ptrtyp)(ptr_of_raw_addressvptr))elseraise(Error("Value "^name^" not found"))letget_function_addressnametypee=letfptr=get_function_address_nameeeinifNativeint.to_intfptr<>0thenletopenCtypesincoerce(ptrvoid)typ(ptr_of_raw_addressfptr)elseraise(Error("Function "^name^" not found"))(* The following are not bound. Patches are welcome.
target_machine : llexecutionengine -> Llvm_target.TargetMachine.t
*)