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