diff options
Diffstat (limited to 'contrib/llvm/bindings/ocaml/bitwriter')
4 files changed, 0 insertions, 119 deletions
diff --git a/contrib/llvm/bindings/ocaml/bitwriter/Makefile b/contrib/llvm/bindings/ocaml/bitwriter/Makefile deleted file mode 100644 index cec0a59..0000000 --- a/contrib/llvm/bindings/ocaml/bitwriter/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -##===- bindings/ocaml/bitwriter/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_bitwriter interface. -# -##===----------------------------------------------------------------------===## - -LEVEL := ../../.. -LIBRARYNAME := llvm_bitwriter -UsedComponents := bitwriter -UsedOcamlInterfaces := llvm - -include ../Makefile.ocaml diff --git a/contrib/llvm/bindings/ocaml/bitwriter/bitwriter_ocaml.c b/contrib/llvm/bindings/ocaml/bitwriter/bitwriter_ocaml.c deleted file mode 100644 index 53c93cb..0000000 --- a/contrib/llvm/bindings/ocaml/bitwriter/bitwriter_ocaml.c +++ /dev/null @@ -1,45 +0,0 @@ -/*===-- bitwriter_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/BitWriter.h" -#include "llvm-c/Core.h" -#include "caml/alloc.h" -#include "caml/mlvalues.h" -#include "caml/memory.h" - -/*===-- Modules -----------------------------------------------------------===*/ - -/* Llvm.llmodule -> string -> bool */ -CAMLprim value llvm_write_bitcode_file(value M, value Path) { - int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path)); - return Val_bool(res == 0); -} - -/* ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool */ -CAMLprim value llvm_write_bitcode_to_fd(value U, value M, value FD) { - int Unbuffered; - int res; - - if (U == Val_int(0)) { - Unbuffered = 0; - } else { - Unbuffered = Bool_val(Field(U,0)); - } - - res = LLVMWriteBitcodeToFD((LLVMModuleRef) M, Int_val(FD), 0, Unbuffered); - return Val_bool(res == 0); -} diff --git a/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.ml b/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.ml deleted file mode 100644 index 3e69a3c..0000000 --- a/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.ml +++ /dev/null @@ -1,25 +0,0 @@ -(*===-- llvm_bitwriter.ml - LLVM Ocaml Interface ----------------*- C++ -*-===* - * - * The LLVM Compiler Infrastructure - * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. - * - *===----------------------------------------------------------------------=== - * - * This interface provides an ocaml API for the LLVM intermediate - * representation, the classes in the VMCore library. - * - *===----------------------------------------------------------------------===*) - - -(* Writes the bitcode for module the given path. Returns true if successful. *) -external write_bitcode_file : Llvm.llmodule -> string -> bool - = "llvm_write_bitcode_file" - -external write_bitcode_to_fd : ?unbuffered:bool -> Llvm.llmodule - -> Unix.file_descr -> bool - = "llvm_write_bitcode_to_fd" - -let output_bitcode ?unbuffered channel m = - write_bitcode_to_fd ?unbuffered m (Unix.descr_of_out_channel channel) diff --git a/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.mli b/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.mli deleted file mode 100644 index ea9a876..0000000 --- a/contrib/llvm/bindings/ocaml/bitwriter/llvm_bitwriter.mli +++ /dev/null @@ -1,30 +0,0 @@ -(*===-- llvm_bitwriter.mli - LLVM Ocaml Interface ---------------*- C++ -*-===* - * - * The LLVM Compiler Infrastructure - * - * This file is distributed under the University of Illinois Open Source - * License. See LICENSE.TXT for details. - * - *===----------------------------------------------------------------------===*) - -(** Bitcode writer. - - This interface provides an ocaml API for the LLVM bitcode writer, the - classes in the Bitwriter library. *) - -(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at - [path]. Returns [true] if successful, [false] otherwise. *) -external write_bitcode_file : Llvm.llmodule -> string -> bool - = "llvm_write_bitcode_file" - -(** [write_bitcode_to_fd ~unbuffered fd m] writes the bitcode for module - [m] to the channel [c]. If [unbuffered] is [true], after every write the fd - will be flushed. Returns [true] if successful, [false] otherwise. *) -external write_bitcode_to_fd : ?unbuffered:bool -> Llvm.llmodule - -> Unix.file_descr -> bool - = "llvm_write_bitcode_to_fd" - -(** [output_bitcode ~unbuffered c m] writes the bitcode for module [m] - to the channel [c]. If [unbuffered] is [true], after every write the fd - will be flushed. Returns [true] if successful, [false] otherwise. *) -val output_bitcode : ?unbuffered:bool -> out_channel -> Llvm.llmodule -> bool |