diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-12 01:04:30 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-12 01:04:30 +0000 |
commit | 1ae6135fa37eb061499d079b9b33dc82dcc1283f (patch) | |
tree | 2b885952bef39a4e82c353bd5880762d77517054 /bindings | |
parent | 772de516b6851e679d3da9e5171712b9c3122019 (diff) | |
download | external_llvm-1ae6135fa37eb061499d079b9b33dc82dcc1283f.zip external_llvm-1ae6135fa37eb061499d079b9b33dc82dcc1283f.tar.gz external_llvm-1ae6135fa37eb061499d079b9b33dc82dcc1283f.tar.bz2 |
Add (very basic) bindings for ModuleProvider.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r-- | bindings/ocaml/llvm/llvm.ml | 8 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm.mli | 17 | ||||
-rw-r--r-- | bindings/ocaml/llvm/llvm_ocaml.c | 8 |
3 files changed, 33 insertions, 0 deletions
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml index d9ef2d3..6ede179 100644 --- a/bindings/ocaml/llvm/llvm.ml +++ b/bindings/ocaml/llvm/llvm.ml @@ -14,6 +14,7 @@ type lltypehandle type llvalue type llbasicblock type llbuilder +type llmoduleprovider type type_kind = Void_type @@ -427,6 +428,13 @@ external build_shufflevector : llvalue -> llvalue -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_shufflevector" +(*===-- Module providers --------------------------------------------------===*) +external create_module_provider : llmodule -> llmoduleprovider + = "LLVMCreateModuleProviderForExistingModule" +external dispose_module_provider : llmoduleprovider -> unit + = "llvm_dispose_module_provider" + + (*===-- Non-Externs -------------------------------------------------------===*) (* These functions are built using the externals, so must be declared late. *) diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli index 02bb58c..2bc3e1a 100644 --- a/bindings/ocaml/llvm/llvm.mli +++ b/bindings/ocaml/llvm/llvm.mli @@ -40,6 +40,9 @@ type llbasicblock class. **) type llbuilder +(** Used to provide a module to JIT or interpreter. **) +type llmoduleprovider + (** The kind of an [lltype], the result of [classify_type ty]. See the [llvm::Type::TypeID] enumeration. **) type type_kind = @@ -1217,3 +1220,17 @@ external build_insertelement : llvalue -> llvalue -> llvalue -> string -> See the method [llvm::LLVMBuilder::CreateShuffleVector]. **) external build_shufflevector : llvalue -> llvalue -> llvalue -> string -> llbuilder -> llvalue = "llvm_build_shufflevector" + + +(*===-- Module providers --------------------------------------------------===*) + +(** [create_module_provider m] encapsulates [m] in a module provider and takes + ownership of the module. See the constructor + [llvm::ExistingModuleProvider::ExistingModuleProvider]. **) +external create_module_provider : llmodule -> llmoduleprovider + = "LLVMCreateModuleProviderForExistingModule" + +(** [dispose_module_provider mp] destroys the module provider [mp] as well as + the contained module. **) +external dispose_module_provider : llmoduleprovider -> unit + = "llvm_dispose_module_provider" diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c index 342d890..f9d7e6f 100644 --- a/bindings/ocaml/llvm/llvm_ocaml.c +++ b/bindings/ocaml/llvm/llvm_ocaml.c @@ -1047,3 +1047,11 @@ CAMLprim LLVMValueRef llvm_build_shufflevector(LLVMValueRef V1, LLVMValueRef V2, return LLVMBuildShuffleVector(Builder_val(B), V1, V2, Mask, String_val(Name)); } + +/*===-- Module Providers --------------------------------------------------===*/ + +/* llmoduleprovider -> unit */ +CAMLprim value llvm_dispose_module_provider(LLVMModuleProviderRef MP) { + LLVMDisposeModuleProvider(MP); + return Val_unit; +} |