• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1(*===-- llvm_bitwriter.mli - LLVM OCaml Interface -------------*- OCaml -*-===*
2 *
3 *                     The LLVM Compiler Infrastructure
4 *
5 * This file is distributed under the University of Illinois Open Source
6 * License. See LICENSE.TXT for details.
7 *
8 *===----------------------------------------------------------------------===*)
9
10(** Bitcode writer.
11
12    This interface provides an OCaml API for the LLVM bitcode writer, the
13    classes in the Bitwriter library. *)
14
15(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at
16    [path]. Returns [true] if successful, [false] otherwise. *)
17external write_bitcode_file
18  : Llvm.llmodule -> string -> bool
19  = "llvm_write_bitcode_file"
20
21(** [write_bitcode_to_fd ~unbuffered fd m] writes the bitcode for module
22    [m] to the channel [c]. If [unbuffered] is [true], after every write the fd
23    will be flushed. Returns [true] if successful, [false] otherwise. *)
24external write_bitcode_to_fd
25  : ?unbuffered:bool -> Llvm.llmodule -> Unix.file_descr -> bool
26  = "llvm_write_bitcode_to_fd"
27
28(** [write_bitcode_to_memory_buffer m] returns a memory buffer containing
29    the bitcode for module [m]. *)
30external write_bitcode_to_memory_buffer
31  : Llvm.llmodule -> Llvm.llmemorybuffer
32  = "llvm_write_bitcode_to_memory_buffer"
33
34(** [output_bitcode ~unbuffered c m] writes the bitcode for module [m]
35    to the channel [c]. If [unbuffered] is [true], after every write the fd
36    will be flushed. Returns [true] if successful, [false] otherwise. *)
37val output_bitcode : ?unbuffered:bool -> out_channel -> Llvm.llmodule -> bool
38