1(*===-- llvm_bitreader.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 reader.
10
11    This interface provides an OCaml API for the LLVM bitcode reader, the
12    classes in the Bitreader library. *)
13
14exception Error of string
15
16(** [get_module context mb] reads the bitcode for a new module [m] from the
17    memory buffer [mb] in the context [context].  Returns [m] if successful, or
18    raises [Error msg] otherwise, where [msg] is a description of the error
19    encountered. See the function [llvm::getBitcodeModule]. *)
20val get_module : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
21
22(** [parse_bitcode context mb] parses the bitcode for a new module [m] from the
23    memory buffer [mb] in the context [context]. Returns [m] if successful, or
24    raises [Error msg] otherwise, where [msg] is a description of the error
25    encountered. See the function [llvm::ParseBitcodeFile]. *)
26val parse_bitcode : Llvm.llcontext -> Llvm.llmemorybuffer -> Llvm.llmodule
27