Add (very basic) bindings for ModuleProvider.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44899 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Gordon Henriksen
2007-12-12 01:04:30 +00:00
parent 772de516b6
commit 1ae6135fa3
7 changed files with 90 additions and 0 deletions

View File

@@ -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. *)

View File

@@ -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"

View File

@@ -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;
}