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-exception 6 * 7 *===----------------------------------------------------------------------===*) 8 9(** Bitcode writer. 10 11 This interface provides an OCaml API for the LLVM bitcode writer, the 12 classes in the Bitwriter library. *) 13 14(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at 15 [path]. Returns [true] if successful, [false] otherwise. *) 16external write_bitcode_file 17 : Llvm.llmodule -> string -> bool 18 = "llvm_write_bitcode_file" 19 20(** [write_bitcode_to_fd ~unbuffered fd m] writes the bitcode for module 21 [m] to the channel [c]. If [unbuffered] is [true], after every write the fd 22 will be flushed. Returns [true] if successful, [false] otherwise. *) 23external write_bitcode_to_fd 24 : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool 25 = "llvm_write_bitcode_to_fd" 26 27(** [write_bitcode_to_memory_buffer m] returns a memory buffer containing 28 the bitcode for module [m]. *) 29external write_bitcode_to_memory_buffer 30 : Llvm.llmodule -> Llvm.llmemorybuffer 31 = "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 fd 35 will be flushed. Returns [true] if successful, [false] otherwise. *) 36val output_bitcode : ?unbuffered:bool -> out_channel -> Llvm.llmodule -> bool 37