37 lines · plain
1(*===-- llvm_bitwriter.mli - LLVM OCaml Interface -------------*- OCaml -*-===*2 *3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4 * See https://llvm.org/LICENSE.txt for license information.5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6 *7 *===----------------------------------------------------------------------===*)8 9(** Bitcode writer.10 11 This interface provides an OCaml API for the LLVM bitcode writer, the12 classes in the Bitwriter library. *)13 14(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at15 [path]. Returns [true] if successful, [false] otherwise. *)16external write_bitcode_file17 : Llvm.llmodule -> string -> bool18 = "llvm_write_bitcode_file"19 20(** [write_bitcode_to_fd ~unbuffered fd m] writes the bitcode for module21 [m] to the channel [c]. If [unbuffered] is [true], after every write the fd22 will be flushed. Returns [true] if successful, [false] otherwise. *)23external write_bitcode_to_fd24 : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool25 = "llvm_write_bitcode_to_fd"26 27(** [write_bitcode_to_memory_buffer m] returns a memory buffer containing28 the bitcode for module [m]. *)29external write_bitcode_to_memory_buffer30 : Llvm.llmodule -> Llvm.llmemorybuffer31 = "llvm_write_bitcode_to_memory_buffer"32 33(** [output_bitcode ~unbuffered c m] writes the bitcode for module [m]34 to the channel [c]. If [unbuffered] is [true], after every write the fd35 will be flushed. Returns [true] if successful, [false] otherwise. *)36val output_bitcode : ?unbuffered:bool -> out_channel -> Llvm.llmodule -> bool37