aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/ocaml/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/ocaml/llvm')
-rw-r--r--bindings/ocaml/llvm/CMakeLists.txt11
-rw-r--r--bindings/ocaml/llvm/META.llvm.in8
-rw-r--r--bindings/ocaml/llvm/Makefile2
-rw-r--r--bindings/ocaml/llvm/llvm.ml4
-rw-r--r--bindings/ocaml/llvm/llvm.mli12
-rw-r--r--bindings/ocaml/llvm/llvm_ocaml.c14
6 files changed, 46 insertions, 5 deletions
diff --git a/bindings/ocaml/llvm/CMakeLists.txt b/bindings/ocaml/llvm/CMakeLists.txt
new file mode 100644
index 0000000..4956fa4
--- /dev/null
+++ b/bindings/ocaml/llvm/CMakeLists.txt
@@ -0,0 +1,11 @@
+add_ocaml_library(llvm
+ OCAML llvm
+ C llvm_ocaml
+ LLVM core support)
+
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/META.llvm.in"
+ "${LLVM_LIBRARY_DIR}/ocaml/META.llvm")
+
+install(FILES "${LLVM_LIBRARY_DIR}/ocaml/META.llvm"
+ DESTINATION lib/ocaml)
diff --git a/bindings/ocaml/llvm/META.llvm.in b/bindings/ocaml/llvm/META.llvm.in
index f9808c7..92896e3 100644
--- a/bindings/ocaml/llvm/META.llvm.in
+++ b/bindings/ocaml/llvm/META.llvm.in
@@ -61,6 +61,14 @@ package "scalar_opts" (
archive(native) = "llvm_scalar_opts.cmxa"
)
+package "transform_utils" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Transform utilities for LLVM"
+ archive(byte) = "llvm_transform_utils.cma"
+ archive(native) = "llvm_transform_utils.cmxa"
+)
+
package "vectorize" (
requires = "llvm"
version = "@PACKAGE_VERSION@"
diff --git a/bindings/ocaml/llvm/Makefile b/bindings/ocaml/llvm/Makefile
index fb682c7..c0785a1 100644
--- a/bindings/ocaml/llvm/Makefile
+++ b/bindings/ocaml/llvm/Makefile
@@ -13,7 +13,7 @@
LEVEL := ../../..
LIBRARYNAME := llvm
-UsedComponents := core transformutils
+UsedComponents := core
UsedOcamlLibs := llvm
ExtraLibs := -lstdc++
diff --git a/bindings/ocaml/llvm/llvm.ml b/bindings/ocaml/llvm/llvm.ml
index 0df4d40..9a3cb1f 100644
--- a/bindings/ocaml/llvm/llvm.ml
+++ b/bindings/ocaml/llvm/llvm.ml
@@ -313,7 +313,6 @@ external mdkind_id : llcontext -> string -> llmdkind = "llvm_mdkind_id"
(*===-- Modules -----------------------------------------------------------===*)
external create_module : llcontext -> string -> llmodule = "llvm_create_module"
external dispose_module : llmodule -> unit = "llvm_dispose_module"
-external clone_module : llmodule -> llmodule = "LLVMCloneModule"
external target_triple: llmodule -> string
= "llvm_target_triple"
external set_target_triple: string -> llmodule -> unit
@@ -460,6 +459,7 @@ external clear_metadata : llvalue -> llmdkind -> unit = "llvm_clear_metadata"
(*--... Operations on metadata .......,.....................................--*)
external mdstring : llcontext -> string -> llvalue = "llvm_mdstring"
external mdnode : llcontext -> llvalue array -> llvalue = "llvm_mdnode"
+external mdnull : llcontext -> llvalue = "llvm_mdnull"
external get_mdstring : llvalue -> string option = "llvm_get_mdstring"
external get_named_metadata : llmodule -> string -> llvalue array
= "llvm_get_namedmd"
@@ -1300,6 +1300,8 @@ external build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
(*--... Miscellaneous instructions .........................................--*)
external build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
llvalue = "llvm_build_phi"
+external build_empty_phi : lltype -> string -> llbuilder -> llvalue
+ = "llvm_build_empty_phi"
external build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue
= "llvm_build_call"
external build_select : llvalue -> llvalue -> llvalue -> string -> llbuilder ->
diff --git a/bindings/ocaml/llvm/llvm.mli b/bindings/ocaml/llvm/llvm.mli
index e5e90c3..dcda027 100644
--- a/bindings/ocaml/llvm/llvm.mli
+++ b/bindings/ocaml/llvm/llvm.mli
@@ -431,9 +431,6 @@ val create_module : llcontext -> string -> llmodule
[llvm::Module::~Module]. *)
val dispose_module : llmodule -> unit
-(** [clone_module m] returns an exact copy of module [m]. *)
-val clone_module : llmodule -> llmodule
-
(** [target_triple m] is the target specifier for the module [m], something like
[i686-apple-darwin8]. See the method [llvm::Module::getTargetTriple]. *)
val target_triple: llmodule -> string
@@ -822,6 +819,9 @@ val mdstring : llcontext -> string -> llvalue
See the method [llvm::MDNode::get]. *)
val mdnode : llcontext -> llvalue array -> llvalue
+(** [mdnull c ] returns a null MDNode in context [c]. *)
+val mdnull : llcontext -> llvalue
+
(** [get_mdstring v] returns the MDString.
See the method [llvm::MDString::getString] *)
val get_mdstring : llvalue -> string option
@@ -2422,6 +2422,12 @@ val build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
val build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
llvalue
+(** [build_empty_phi ty name b] creates a
+ [%name = phi %ty] instruction at the position specified by
+ the instruction builder [b]. [ty] is the type of the instruction.
+ See the method [llvm::LLVMBuilder::CreatePHI]. *)
+val build_empty_phi : lltype -> string -> llbuilder -> llvalue
+
(** [build_call fn args name b] creates a
[%name = call %fn(args...)]
instruction at the position specified by the instruction builder [b].
diff --git a/bindings/ocaml/llvm/llvm_ocaml.c b/bindings/ocaml/llvm/llvm_ocaml.c
index 63c235d..3889f92 100644
--- a/bindings/ocaml/llvm/llvm_ocaml.c
+++ b/bindings/ocaml/llvm/llvm_ocaml.c
@@ -666,6 +666,11 @@ CAMLprim LLVMValueRef llvm_mdnode(LLVMContextRef C, value ElementVals) {
Wosize_val(ElementVals));
}
+/* llcontext -> llvalue */
+CAMLprim LLVMValueRef llvm_mdnull(LLVMContextRef C) {
+ return NULL;
+}
+
/* llvalue -> string option */
CAMLprim value llvm_get_mdstring(LLVMValueRef V) {
CAMLparam0();
@@ -2186,6 +2191,15 @@ CAMLprim LLVMValueRef llvm_build_phi(value Incoming, value Name, value B) {
return PhiNode;
}
+/* lltype -> string -> llbuilder -> value */
+CAMLprim LLVMValueRef llvm_build_empty_phi(LLVMTypeRef Type, value Name, value B) {
+ LLVMValueRef PhiNode;
+
+ return LLVMBuildPhi(Builder_val(B), Type, String_val(Name));
+
+ return PhiNode;
+}
+
/* llvalue -> llvalue array -> string -> llbuilder -> llvalue */
CAMLprim LLVMValueRef llvm_build_call(LLVMValueRef Fn, value Params,
value Name, value B) {