aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2013-11-03 08:27:22 +0000
committerPeter Zotov <whitequark@whitequark.org>2013-11-03 08:27:22 +0000
commit1185582dfd542883194d262c5bf92b16e1e037c2 (patch)
tree6ac4fd2378b331d8e2a82a59eb2642ceb9bc3ab3 /bindings
parent6ca1789ac6aad8043ac68c9bb05785d569db5c80 (diff)
downloadexternal_llvm-1185582dfd542883194d262c5bf92b16e1e037c2.zip
external_llvm-1185582dfd542883194d262c5bf92b16e1e037c2.tar.gz
external_llvm-1185582dfd542883194d262c5bf92b16e1e037c2.tar.bz2
[OCaml] Implement Llvm_vectorize bindings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193950 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings')
-rw-r--r--bindings/ocaml/llvm/META.llvm.in8
-rw-r--r--bindings/ocaml/transforms/Makefile2
-rw-r--r--bindings/ocaml/transforms/vectorize/Makefile19
-rw-r--r--bindings/ocaml/transforms/vectorize/llvm_vectorize.ml15
-rw-r--r--bindings/ocaml/transforms/vectorize/llvm_vectorize.mli25
-rw-r--r--bindings/ocaml/transforms/vectorize/vectorize_ocaml.c38
6 files changed, 106 insertions, 1 deletions
diff --git a/bindings/ocaml/llvm/META.llvm.in b/bindings/ocaml/llvm/META.llvm.in
index fdb3253..019e047 100644
--- a/bindings/ocaml/llvm/META.llvm.in
+++ b/bindings/ocaml/llvm/META.llvm.in
@@ -54,6 +54,14 @@ package "scalar_opts" (
archive(native) = "llvm_scalar_opts.cmxa"
)
+package "vectorize" (
+ requires = "llvm"
+ version = "@PACKAGE_VERSION@"
+ description = "Vector Transforms for LLVM"
+ archive(byte) = "llvm_vectorize.cma"
+ archive(native) = "llvm_vectorize.cmxa"
+)
+
package "target" (
requires = "llvm"
version = "@PACKAGE_VERSION@"
diff --git a/bindings/ocaml/transforms/Makefile b/bindings/ocaml/transforms/Makefile
index 05fcd90..4f6d5cb 100644
--- a/bindings/ocaml/transforms/Makefile
+++ b/bindings/ocaml/transforms/Makefile
@@ -8,7 +8,7 @@
##===----------------------------------------------------------------------===##
LEVEL := ../../..
-DIRS = scalar ipo
+DIRS = scalar ipo vectorize
ocamldoc:
$(Verb) for i in $(DIRS) ; do \
diff --git a/bindings/ocaml/transforms/vectorize/Makefile b/bindings/ocaml/transforms/vectorize/Makefile
new file mode 100644
index 0000000..5a854d1
--- /dev/null
+++ b/bindings/ocaml/transforms/vectorize/Makefile
@@ -0,0 +1,19 @@
+##===- bindings/ocaml/transforms/vectorize/Makefile --------*- Makefile -*-===##
+#
+# The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+#
+# This is the makefile for the Objective Caml Llvm_vectorize_opts interface.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL := ../../../..
+LIBRARYNAME := llvm_vectorize
+UsedComponents := vectorize
+UsedOcamlInterfaces := llvm
+
+include ../../Makefile.ocaml
diff --git a/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml b/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml
new file mode 100644
index 0000000..4fc53c6
--- /dev/null
+++ b/bindings/ocaml/transforms/vectorize/llvm_vectorize.ml
@@ -0,0 +1,15 @@
+(*===-- llvm_vectorize.ml - LLVM OCaml Interface --------------*- OCaml -*-===*
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===*)
+
+external add_bb_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_bb_vectorize"
+external add_loop_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_loop_vectorize"
+external add_slp_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_slp_vectorize"
diff --git a/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli b/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli
new file mode 100644
index 0000000..0253039
--- /dev/null
+++ b/bindings/ocaml/transforms/vectorize/llvm_vectorize.mli
@@ -0,0 +1,25 @@
+(*===-- llvm_vectorize.mli - LLVM OCaml Interface -------------*- OCaml -*-===*
+ *
+ * The LLVM Compiler Infrastructure
+ *
+ * This file is distributed under the University of Illinois Open Source
+ * License. See LICENSE.TXT for details.
+ *
+ *===----------------------------------------------------------------------===*)
+
+(** Vectorize Transforms.
+
+ This interface provides an OCaml API for LLVM vectorize transforms, the
+ classes in the [LLVMVectorize] library. *)
+
+(** See the [llvm::createBBVectorizePass] function. *)
+external add_bb_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_bb_vectorize"
+
+(** See the [llvm::createLoopVectorizePass] function. *)
+external add_loop_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_loop_vectorize"
+
+(** See [llvm::createSLPVectorizerPass] function. *)
+external add_slp_vectorize : [<Llvm.PassManager.any] Llvm.PassManager.t -> unit
+ = "llvm_add_slp_vectorize"
diff --git a/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c b/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c
new file mode 100644
index 0000000..1c81049
--- /dev/null
+++ b/bindings/ocaml/transforms/vectorize/vectorize_ocaml.c
@@ -0,0 +1,38 @@
+/*===-- vectorize_ocaml.c - LLVM OCaml Glue ---------------------*- C++ -*-===*\
+|* *|
+|* The LLVM Compiler Infrastructure *|
+|* *|
+|* This file is distributed under the University of Illinois Open Source *|
+|* License. See LICENSE.TXT for details. *|
+|* *|
+|*===----------------------------------------------------------------------===*|
+|* *|
+|* This file glues LLVM's OCaml interface to its C interface. These functions *|
+|* are by and large transparent wrappers to the corresponding C functions. *|
+|* *|
+|* Note that these functions intentionally take liberties with the CAMLparamX *|
+|* macros, since most of the parameters are not GC heap objects. *|
+|* *|
+\*===----------------------------------------------------------------------===*/
+
+#include "llvm-c/Transforms/Vectorize.h"
+#include "caml/mlvalues.h"
+#include "caml/misc.h"
+
+/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
+CAMLprim value llvm_add_bb_vectorize(LLVMPassManagerRef PM) {
+ LLVMAddBBVectorizePass(PM);
+ return Val_unit;
+}
+
+/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
+CAMLprim value llvm_add_loop_vectorize(LLVMPassManagerRef PM) {
+ LLVMAddLoopVectorizePass(PM);
+ return Val_unit;
+}
+
+/* [<Llvm.PassManager.any] Llvm.PassManager.t -> unit */
+CAMLprim value llvm_add_slp_vectorize(LLVMPassManagerRef PM) {
+ LLVMAddSLPVectorizePass(PM);
+ return Val_unit;
+}