summaryrefslogtreecommitdiff
path: root/bindings
diff options
context:
space:
mode:
authorErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-02 23:59:00 +0000
committerErick Tryzelaar <idadesub@users.sourceforge.net>2010-03-02 23:59:00 +0000
commit16609f3c5c26ba34603ae0d7ebab86fb11a72722 (patch)
tree7072d503c07f4c3370ed067787f84d7cc93c0ff7 /bindings
parentdf7df075b723e926e51555bf5aff6e231279a479 (diff)
downloadllvm-16609f3c5c26ba34603ae0d7ebab86fb11a72722.tar.gz
llvm-16609f3c5c26ba34603ae0d7ebab86fb11a72722.tar.bz2
llvm-16609f3c5c26ba34603ae0d7ebab86fb11a72722.tar.xz
Remove module providers from ocaml.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/bitreader/bitreader_ocaml.c9
-rw-r--r--bindings/ocaml/bitreader/llvm_bitreader.ml5
-rw-r--r--bindings/ocaml/bitreader/llvm_bitreader.mli14
-rw-r--r--bindings/ocaml/executionengine/executionengine_ocaml.c37
-rw-r--r--bindings/ocaml/executionengine/llvm_executionengine.ml12
-rw-r--r--bindings/ocaml/executionengine/llvm_executionengine.mli57
-rw-r--r--bindings/ocaml/llvm/llvm.ml11
-rw-r--r--bindings/ocaml/llvm/llvm.mli30
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c8
9 files changed, 71 insertions, 112 deletions
diff --git a/bindings/ocaml/bitreader/bitreader_ocaml.c b/bindings/ocaml/bitreader/bitreader_ocaml.c
index 318c7038e2..ef72ce213d 100644
--- a/bindings/ocaml/bitreader/bitreader_ocaml.c
+++ b/bindings/ocaml/bitreader/bitreader_ocaml.c
@@ -46,17 +46,16 @@ static void llvm_raise(value Prototype, char *Message) {
/*===-- Modules -----------------------------------------------------------===*/
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
-CAMLprim value llvm_get_module_provider(LLVMContextRef C,
- LLVMMemoryBufferRef MemBuf) {
+CAMLprim value llvm_get_module(LLVMContextRef C, LLVMMemoryBufferRef MemBuf) {
CAMLparam0();
CAMLlocal2(Variant, MessageVal);
char *Message;
- LLVMModuleProviderRef MP;
- if (LLVMGetBitcodeModuleProviderInContext(C, MemBuf, &MP, &Message))
+ LLVMModuleRef M;
+ if (LLVMGetBitcodeModuleInContext(C, MemBuf, &M, &Message))
llvm_raise(llvm_bitreader_error_exn, Message);
- CAMLreturn((value) MP);
+ CAMLreturn((value) M);
}
/* Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule */
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.ml b/bindings/ocaml/bitreader/llvm_bitreader.ml
index 88587cbe1e..8b9d01d8fb 100644
--- a/bindings/ocaml/bitreader/llvm_bitreader.ml
+++ b/bindings/ocaml/bitreader/llvm_bitreader.ml
@@ -13,9 +13,8 @@ exception Error of string
external register_exns : exn -> unit = "llvm_register_bitreader_exns"
let _ = register_exns (Error "")
-external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer ->
- Llvm.llmoduleprovider
- = "llvm_get_module_provider"
+external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_get_module"
external parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_bitcode"
diff --git a/bindings/ocaml/bitreader/llvm_bitreader.mli b/bindings/ocaml/bitreader/llvm_bitreader.mli
index 5648b35fee..5e2240974a 100644
--- a/bindings/ocaml/bitreader/llvm_bitreader.mli
+++ b/bindings/ocaml/bitreader/llvm_bitreader.mli
@@ -14,14 +14,12 @@
exception Error of string
-(** [get_module_provider context mb] reads the bitcode for a new
- module provider [m] from the memory buffer [mb] in the context [context].
- Returns [m] if successful, or raises [Error msg] otherwise, where [msg] is a
- description of the error encountered. See the function
- [llvm::getBitcodeModuleProvider]. *)
-external get_module_provider : Llvm.llcontext -> Llvm.llmemorybuffer ->
- Llvm.llmoduleprovider
- = "llvm_get_module_provider"
+(** [get_module context mb] reads the bitcode for a new module [m] from the
+ memory buffer [mb] in the context [context]. Returns [m] if successful, or
+ raises [Error msg] otherwise, where [msg] is a description of the error
+ encountered. See the function [llvm::getBitcodeModule]. *)
+external get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
+ = "llvm_get_module"
(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the
memory buffer [mb] in the context [context]. Returns [m] if successful, or
diff --git a/bindings/ocaml/executionengine/executionengine_ocaml.c b/bindings/ocaml/executionengine/executionengine_ocaml.c
index 072d583bf8..bc2b08196b 100644
--- a/bindings/ocaml/executionengine/executionengine_ocaml.c
+++ b/bindings/ocaml/executionengine/executionengine_ocaml.c
@@ -168,41 +168,41 @@ CAMLprim value llvm_genericvalue_as_nativeint(value GenVal) {
/*--... Operations on execution engines ....................................--*/
-/* llmoduleprovider -> ExecutionEngine.t */
-CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleProviderRef MP) {
+/* llmodule -> ExecutionEngine.t */
+CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleRef M) {
LLVMExecutionEngineRef Interp;
char *Error;
- if (LLVMCreateExecutionEngine(&Interp, MP, &Error))
+ if (LLVMCreateExecutionEngineForModule(&Interp, M, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
-/* llmoduleprovider -> ExecutionEngine.t */
+/* llmodule -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_interpreter(LLVMModuleProviderRef MP) {
+llvm_ee_create_interpreter(LLVMModuleRef M) {
LLVMExecutionEngineRef Interp;
char *Error;
- if (LLVMCreateInterpreter(&Interp, MP, &Error))
+ if (LLVMCreateInterpreterForModule(&Interp, M, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
-/* llmoduleprovider -> ExecutionEngine.t */
+/* llmodule -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_jit(LLVMModuleProviderRef MP) {
+llvm_ee_create_jit(LLVMModuleRef M) {
LLVMExecutionEngineRef JIT;
char *Error;
- if (LLVMCreateJITCompiler(&JIT, MP, 3, &Error))
+ if (LLVMCreateJITCompilerForModule(&JIT, M, 3, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return JIT;
}
-/* llmoduleprovider -> ExecutionEngine.t */
+/* llmodule -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
-llvm_ee_create_fast_jit(LLVMModuleProviderRef MP) {
+llvm_ee_create_fast_jit(LLVMModuleRef M) {
LLVMExecutionEngineRef JIT;
char *Error;
- if (LLVMCreateJITCompiler(&JIT, MP, 0, &Error))
+ if (LLVMCreateJITCompiler(&JIT, M, 0, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return JIT;
}
@@ -213,19 +213,18 @@ CAMLprim value llvm_ee_dispose(LLVMExecutionEngineRef EE) {
return Val_unit;
}
-/* llmoduleprovider -> ExecutionEngine.t -> unit */
-CAMLprim value llvm_ee_add_mp(LLVMModuleProviderRef MP,
- LLVMExecutionEngineRef EE) {
- LLVMAddModuleProvider(EE, MP);
+/* llmodule -> ExecutionEngine.t -> unit */
+CAMLprim value llvm_ee_add_mp(LLVMModuleRef M, LLVMExecutionEngineRef EE) {
+ LLVMAddModule(EE, M);
return Val_unit;
}
-/* llmoduleprovider -> ExecutionEngine.t -> llmodule */
-CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleProviderRef MP,
+/* llmodule -> ExecutionEngine.t -> llmodule */
+CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleRef M,
LLVMExecutionEngineRef EE) {
LLVMModuleRef RemovedModule;
char *Error;
- if (LLVMRemoveModuleProvider(EE, MP, &RemovedModule, &Error))
+ if (LLVMRemoveModule(EE, M, &RemovedModule, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return RemovedModule;
}
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.ml b/bindings/ocaml/executionengine/llvm_executionengine.ml
index c9e8f18b22..921d424ad5 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.ml
+++ b/bindings/ocaml/executionengine/llvm_executionengine.ml
@@ -56,19 +56,19 @@ module ExecutionEngine = struct
call into LLVM. *)
let _ = register_exns (Error "")
- external create: Llvm.llmoduleprovider -> t
+ external create: Llvm.llmodule -> t
= "llvm_ee_create"
- external create_interpreter: Llvm.llmoduleprovider -> t
+ external create_interpreter: Llvm.llmodule -> t
= "llvm_ee_create_interpreter"
- external create_jit: Llvm.llmoduleprovider -> t
+ external create_jit: Llvm.llmodule -> t
= "llvm_ee_create_jit"
- external create_fast_jit: Llvm.llmoduleprovider -> t
+ external create_fast_jit: Llvm.llmodule -> t
= "llvm_ee_create_fast_jit"
external dispose: t -> unit
= "llvm_ee_dispose"
- external add_module_provider: Llvm.llmoduleprovider -> t -> unit
+ external add_module: Llvm.llmodule -> t -> unit
= "llvm_ee_add_mp"
- external remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
+ external remove_module: Llvm.llmodule -> t -> Llvm.llmodule
= "llvm_ee_remove_mp"
external find_function: string -> t -> Llvm.llvalue option
= "llvm_ee_find_function"
diff --git a/bindings/ocaml/executionengine/llvm_executionengine.mli b/bindings/ocaml/executionengine/llvm_executionengine.mli
index 6c2fdfb786..ec469fcf04 100644
--- a/bindings/ocaml/executionengine/llvm_executionengine.mli
+++ b/bindings/ocaml/executionengine/llvm_executionengine.mli
@@ -85,48 +85,47 @@ module ExecutionEngine: sig
invoking a static compiler and generating a native executable. *)
type t
- (** [create mp] creates a new execution engine, taking ownership of the
- 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::EngineBuilder::create]. *)
- val create: Llvm.llmoduleprovider -> t
+ (** [create m] creates a new execution engine, taking ownership of the
+ module [m] 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::EngineBuilder::create]. *)
+ val create: Llvm.llmodule -> 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].
+ (** [create_interpreter m] creates a new interpreter, taking ownership of the
+ module [m] 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::EngineBuilder::create]. *)
- val create_interpreter: Llvm.llmoduleprovider -> t
+ val create_interpreter: Llvm.llmodule -> t
- (** [create_jit mp] creates a new JIT (just-in-time compiler), taking
- ownership of the module provider [mp] if successful. This function creates
- 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].
+ (** [create_jit m] creates a new JIT (just-in-time compiler), taking
+ ownership of the module [m] if successful. This function creates 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::EngineBuilder::create]. *)
- val create_jit: Llvm.llmoduleprovider -> t
+ val create_jit: Llvm.llmodule -> t
- (** [create_fast_jit mp] creates a new JIT (just-in-time compiler) which
+ (** [create_fast_jit m] creates a new JIT (just-in-time compiler) which
favors compilation speed over code quality. It takes 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].
+ module [m] 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::EngineBuilder::create]. *)
- val create_fast_jit: Llvm.llmoduleprovider -> t
+ val create_fast_jit: Llvm.llmodule -> t
(** [dispose ee] releases the memory used by the execution engine and must be
invoked to avoid memory leaks. *)
val dispose: t -> unit
- (** [add_module_provider mp ee] adds the module provider [mp] to the execution
- engine [ee]. *)
- val add_module_provider: Llvm.llmoduleprovider -> t -> unit
+ (** [add_module m ee] adds the module [m] to the execution engine [ee]. *)
+ val add_module: Llvm.llmodule -> t -> unit
- (** [remove_module_provider mp ee] removes the module provider [mp] from the
- execution engine [ee], disposing of [mp] and the module referenced by
- [mp]. Raises [Error msg] if an error occurs. *)
- val remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
+ (** [remove_module m ee] removes the module [m] from the execution engine
+ [ee], disposing of [m] and the module referenced by [mp]. Raises
+ [Error msg] if an error occurs. *)
+ val remove_module: Llvm.llmodule -> t -> Llvm.llmodule
(** [find_function n ee] finds the function named [n] defined in any of the
modules owned by the execution engine [ee]. Returns [None] if the function
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 7b906d2684..407c1fc6c6 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -16,7 +16,6 @@ type llvalue
type lluse
type llbasicblock
type llbuilder
-type llmoduleprovider
type llmemorybuffer
module TypeKind = struct
@@ -948,14 +947,6 @@ external build_is_not_null : llvalue -> string -> llbuilder -> llvalue
external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_ptrdiff"
-(*===-- Module providers --------------------------------------------------===*)
-
-module ModuleProvider = struct
- external create : llmodule -> llmoduleprovider
- = "LLVMCreateModuleProviderForExistingModule"
- external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
-end
-
(*===-- Memory buffers ----------------------------------------------------===*)
@@ -972,7 +963,7 @@ module PassManager = struct
type 'a t
type any = [ `Module | `Function ]
external create : unit -> [ `Module ] t = "llvm_passmanager_create"
- external create_function : llmoduleprovider -> [ `Function ] t
+ external create_function : llmodule -> [ `Function ] t
= "LLVMCreateFunctionPassManager"
external run_module : llmodule -> [ `Module ] t -> bool
= "llvm_passmanager_run_module"
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index cf06d5a984..3ea7ad482d 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -49,10 +49,6 @@ type llbasicblock
class. *)
type llbuilder
-(** Used to provide a module to JIT or interpreter.
- See the [llvm::ModuleProvider] class. *)
-type llmoduleprovider
-
(** Used to efficiently handle large buffers of read-only binary data.
See the [llvm::MemoryBuffer] class. *)
type llmemorybuffer
@@ -2198,20 +2194,6 @@ external build_is_not_null : llvalue -> string -> llbuilder -> llvalue
external build_ptrdiff : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_ptrdiff"
-(** {6 Module providers} *)
-
-module ModuleProvider : sig
- (** [create_module_provider m] encapsulates [m] in a module provider and takes
- ownership of the module. See the constructor
- [llvm::ExistingModuleProvider::ExistingModuleProvider]. *)
- external create : llmodule -> llmoduleprovider
- = "LLVMCreateModuleProviderForExistingModule"
-
- (** [dispose_module_provider mp] destroys the module provider [mp] as well as
- the contained module. *)
- external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
-end
-
(** {6 Memory buffers} *)
@@ -2243,12 +2225,12 @@ module PassManager : sig
See the constructor of [llvm::PassManager]. *)
external create : unit -> [ `Module ] t = "llvm_passmanager_create"
- (** [PassManager.create_function mp] constructs a new function-by-function
- pass pipeline over the module provider [mp]. It does not take ownership of
- [mp]. This type of pipeline is suitable for code generation and JIT
- compilation tasks.
+ (** [PassManager.create_function m] constructs a new function-by-function
+ pass pipeline over the module [m]. It does not take ownership of [m].
+ This type of pipeline is suitable for code generation and JIT compilation
+ tasks.
See the constructor of [llvm::FunctionPassManager]. *)
- external create_function : llmoduleprovider -> [ `Function ] t
+ external create_function : llmodule -> [ `Function ] t
= "LLVMCreateFunctionPassManager"
(** [run_module m pm] initializes, executes on the module [m], and finalizes
@@ -2278,7 +2260,7 @@ module PassManager : sig
external finalize : [ `Function ] t -> bool = "llvm_passmanager_finalize"
(** Frees the memory of a pass pipeline. For function pipelines, does not free
- the module provider.
+ the module.
See the destructor of [llvm::BasePassManager]. *)
external dispose : [< any ] t -> unit = "llvm_passmanager_dispose"
end
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 4bcc764a83..d526a05a51 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -1752,14 +1752,6 @@ CAMLprim LLVMValueRef llvm_build_ptrdiff(LLVMValueRef LHS, LLVMValueRef RHS,
return LLVMBuildPtrDiff(Builder_val(B), LHS, RHS, String_val(Name));
}
-/*===-- Module Providers --------------------------------------------------===*/
-
-/* llmoduleprovider -> unit */
-CAMLprim value llvm_dispose_module_provider(LLVMModuleProviderRef MP) {
- LLVMDisposeModuleProvider(MP);
- return Val_unit;
-}
-
/*===-- Memory buffers ----------------------------------------------------===*/