109467b48Spatrick /*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\ 209467b48Spatrick |* *| 309467b48Spatrick |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 409467b48Spatrick |* Exceptions. *| 509467b48Spatrick |* See https://llvm.org/LICENSE.txt for license information. *| 609467b48Spatrick |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 709467b48Spatrick |* *| 809467b48Spatrick |*===----------------------------------------------------------------------===*| 909467b48Spatrick |* *| 1009467b48Spatrick |* This header declares the C interface to libLLVMBitReader.a, which *| 1109467b48Spatrick |* implements input of the LLVM bitcode format. *| 1209467b48Spatrick |* *| 1309467b48Spatrick |* Many exotic languages can interoperate with C code but have a harder time *| 1409467b48Spatrick |* with C++ due to name mangling. So in addition to C, this interface enables *| 1509467b48Spatrick |* tools written in such languages. *| 1609467b48Spatrick |* *| 1709467b48Spatrick \*===----------------------------------------------------------------------===*/ 1809467b48Spatrick 1909467b48Spatrick #ifndef LLVM_C_BITREADER_H 2009467b48Spatrick #define LLVM_C_BITREADER_H 2109467b48Spatrick 2209467b48Spatrick #include "llvm-c/ExternC.h" 2309467b48Spatrick #include "llvm-c/Types.h" 2409467b48Spatrick 2509467b48Spatrick LLVM_C_EXTERN_C_BEGIN 2609467b48Spatrick 2709467b48Spatrick /** 2809467b48Spatrick * @defgroup LLVMCBitReader Bit Reader 2909467b48Spatrick * @ingroup LLVMC 3009467b48Spatrick * 3109467b48Spatrick * @{ 3209467b48Spatrick */ 3309467b48Spatrick 3409467b48Spatrick /* Builds a module from the bitcode in the specified memory buffer, returning a 3509467b48Spatrick reference to the module via the OutModule parameter. Returns 0 on success. 3609467b48Spatrick Optionally returns a human-readable error message via OutMessage. 3709467b48Spatrick 3809467b48Spatrick This is deprecated. Use LLVMParseBitcode2. */ 3909467b48Spatrick LLVMBool LLVMParseBitcode(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutModule, 4009467b48Spatrick char **OutMessage); 4109467b48Spatrick 4209467b48Spatrick /* Builds a module from the bitcode in the specified memory buffer, returning a 4309467b48Spatrick reference to the module via the OutModule parameter. Returns 0 on success. */ 4409467b48Spatrick LLVMBool LLVMParseBitcode2(LLVMMemoryBufferRef MemBuf, 4509467b48Spatrick LLVMModuleRef *OutModule); 4609467b48Spatrick 4709467b48Spatrick /* This is deprecated. Use LLVMParseBitcodeInContext2. */ 4809467b48Spatrick LLVMBool LLVMParseBitcodeInContext(LLVMContextRef ContextRef, 4909467b48Spatrick LLVMMemoryBufferRef MemBuf, 5009467b48Spatrick LLVMModuleRef *OutModule, char **OutMessage); 5109467b48Spatrick 5209467b48Spatrick LLVMBool LLVMParseBitcodeInContext2(LLVMContextRef ContextRef, 5309467b48Spatrick LLVMMemoryBufferRef MemBuf, 5409467b48Spatrick LLVMModuleRef *OutModule); 5509467b48Spatrick 5609467b48Spatrick /** Reads a module from the specified path, returning via the OutMP parameter 5709467b48Spatrick a module provider which performs lazy deserialization. Returns 0 on success. 5809467b48Spatrick Optionally returns a human-readable error message via OutMessage. 5909467b48Spatrick This is deprecated. Use LLVMGetBitcodeModuleInContext2. */ 6009467b48Spatrick LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef, 6109467b48Spatrick LLVMMemoryBufferRef MemBuf, 6209467b48Spatrick LLVMModuleRef *OutM, char **OutMessage); 6309467b48Spatrick 64*d415bd75Srobert /** Reads a module from the given memory buffer, returning via the OutMP 65*d415bd75Srobert * parameter a module provider which performs lazy deserialization. 66*d415bd75Srobert * 67*d415bd75Srobert * Returns 0 on success. 68*d415bd75Srobert * 69*d415bd75Srobert * Takes ownership of \p MemBuf if (and only if) the module was read 70*d415bd75Srobert * successfully. */ 7109467b48Spatrick LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef, 7209467b48Spatrick LLVMMemoryBufferRef MemBuf, 7309467b48Spatrick LLVMModuleRef *OutM); 7409467b48Spatrick 7509467b48Spatrick /* This is deprecated. Use LLVMGetBitcodeModule2. */ 7609467b48Spatrick LLVMBool LLVMGetBitcodeModule(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM, 7709467b48Spatrick char **OutMessage); 7809467b48Spatrick 7909467b48Spatrick LLVMBool LLVMGetBitcodeModule2(LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM); 8009467b48Spatrick 8109467b48Spatrick /** 8209467b48Spatrick * @} 8309467b48Spatrick */ 8409467b48Spatrick 8509467b48Spatrick LLVM_C_EXTERN_C_END 8609467b48Spatrick 8709467b48Spatrick #endif 88