15b389bb83c753f6399238720d8a24dc55f3dc46
[oota-llvm.git] / bindings / ocaml / bitreader / llvm_bitreader.mli
1 (*===-- llvm_bitreader.mli - LLVM Ocaml Interface ---------------*- C++ -*-===*
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 reader.
11
12     This interface provides an ocaml API for the LLVM bitcode reader, the
13     classes in the Bitreader library. *)
14
15 exception Error of string
16
17 (** [read_bitcode_file path] reads the bitcode for a new module [m] from the
18     file at [path]. Returns [Success m] if successful, and [Failure msg]
19     otherwise, where [msg] is a description of the error encountered.
20     See the function [llvm::getBitcodeModuleProvider]. *)
21 external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
22                              = "llvm_get_module_provider"
23
24 (** [parse_bitcode mb] parses the bitcode for a new module [m] from the memory
25     buffer [mb]. Returns [Success m] if successful, and [Failure msg] otherwise,
26     where [msg] is a description of the error encountered.
27     See the function [llvm::ParseBitcodeFile]. *)
28 external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
29                        = "llvm_parse_bitcode"