blob: d1fc302767baca1fe9ea9d767cddd1bf2da98bdc [file] [log] [blame]
Gordon Henriksenbbc65972007-12-11 00:20:48 +00001/*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\
2|* *|
3|* The LLVM Compiler Infrastructure *|
4|* *|
Chris Lattner7ed47a12007-12-29 19:59:42 +00005|* This file is distributed under the University of Illinois Open Source *|
6|* License. See LICENSE.TXT for details. *|
Gordon Henriksenbbc65972007-12-11 00:20:48 +00007|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* This header declares the C interface to libLLVMBitReader.a, which *|
11|* implements input of the LLVM bitcode format. *|
12|* *|
13|* Many exotic languages can interoperate with C code but have a harder time *|
14|* with C++ due to name mangling. So in addition to C, this interface enables *|
15|* tools written in such languages. *|
16|* *|
17\*===----------------------------------------------------------------------===*/
18
Benjamin Kramer00e08fc2014-08-13 16:26:38 +000019#ifndef LLVM_C_BITREADER_H
20#define LLVM_C_BITREADER_H
Gordon Henriksenbbc65972007-12-11 00:20:48 +000021
Eric Christophercca8dbe2015-12-18 01:46:52 +000022#include "llvm-c/Types.h"
Gordon Henriksenbbc65972007-12-11 00:20:48 +000023
24#ifdef __cplusplus
25extern "C" {
26#endif
27
Gregory Szorc6244b512012-03-21 03:54:29 +000028/**
29 * @defgroup LLVMCBitReader Bit Reader
30 * @ingroup LLVMC
31 *
32 * @{
33 */
Gordon Henriksenbbc65972007-12-11 00:20:48 +000034
Gordon Henriksenda1435f2007-12-19 22:30:40 +000035/* Builds a module from the bitcode in the specified memory buffer, returning a
36 reference to the module via the OutModule parameter. Returns 0 on success.
Rafael Espindola8d184ad2015-12-18 23:46:42 +000037 Optionally returns a human-readable error message via OutMessage.
38
39 This is deprecated. Use LLVMParseBitcode2. */
Rafael Espindola1fef99c2015-12-18 03:04:52 +000040LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule,
41 char **OutMessage);
Gordon Henriksenbbc65972007-12-11 00:20:48 +000042
Rafael Espindola8d184ad2015-12-18 23:46:42 +000043/* Builds a module from the bitcode in the specified memory buffer, returning a
44 reference to the module via the OutModule parameter. Returns 0 on success. */
45LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf,
46 LLVMModuleRef *OutModule);
47
48/* This is deprecated. Use LLVMParseBitcodeInContext2. */
Chris Lattnerd686c8e2010-01-09 22:27:07 +000049LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef,
50 LLVMMemoryBufferRef MemBuf,
51 LLVMModuleRef *OutModule, char **OutMessage);
Owen Andersonc8897d92009-07-02 07:17:57 +000052
Rafael Espindola8d184ad2015-12-18 23:46:42 +000053LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef,
54 LLVMMemoryBufferRef MemBuf,
55 LLVMModuleRef *OutModule);
56
Erick Tryzelaardf7df072010-03-02 23:58:54 +000057/** Reads a module from the specified path, returning via the OutMP parameter
58 a module provider which performs lazy deserialization. Returns 0 on success.
Rafael Espindola8d184ad2015-12-18 23:46:42 +000059 Optionally returns a human-readable error message via OutMessage.
60 This is deprecated. Use LLVMGetBitcodeModuleInContext2. */
Erick Tryzelaardf7df072010-03-02 23:58:54 +000061LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
62 LLVMMemoryBufferRef MemBuf,
Rafael Espindola1fef99c2015-12-18 03:04:52 +000063 LLVMModuleRef *OutM, char **OutMessage);
Gordon Henriksenbbc65972007-12-11 00:20:48 +000064
Rafael Espindola8d184ad2015-12-18 23:46:42 +000065/** Reads a module from the specified path, returning via the OutMP parameter a
66 * module provider which performs lazy deserialization. Returns 0 on success. */
67LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
68 LLVMMemoryBufferRef MemBuf,
69 LLVMModuleRef *OutM);
70
71/* This is deprecated. Use LLVMGetBitcodeModule2. */
Erick Tryzelaardf7df072010-03-02 23:58:54 +000072LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
73 char **OutMessage);
74
Rafael Espindola8d184ad2015-12-18 23:46:42 +000075LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM);
76
Gregory Szorc6244b512012-03-21 03:54:29 +000077/**
78 * @}
79 */
80
Gordon Henriksenbbc65972007-12-11 00:20:48 +000081#ifdef __cplusplus
82}
83#endif
84
85#endif