xref: /aosp_15_r20/external/llvm/include/llvm-c/BitWriter.h (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker /*===-- llvm-c/BitWriter.h - BitWriter Library C Interface ------*- C++ -*-===*\
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 |* This header declares the C interface to libLLVMBitWriter.a, which          *|
11*9880d681SAndroid Build Coastguard Worker |* implements output of the LLVM bitcode format.                              *|
12*9880d681SAndroid Build Coastguard Worker |*                                                                            *|
13*9880d681SAndroid Build Coastguard Worker |* Many exotic languages can interoperate with C code but have a harder time  *|
14*9880d681SAndroid Build Coastguard Worker |* with C++ due to name mangling. So in addition to C, this interface enables *|
15*9880d681SAndroid Build Coastguard Worker |* tools written in such languages.                                           *|
16*9880d681SAndroid Build Coastguard Worker |*                                                                            *|
17*9880d681SAndroid Build Coastguard Worker \*===----------------------------------------------------------------------===*/
18*9880d681SAndroid Build Coastguard Worker 
19*9880d681SAndroid Build Coastguard Worker #ifndef LLVM_C_BITWRITER_H
20*9880d681SAndroid Build Coastguard Worker #define LLVM_C_BITWRITER_H
21*9880d681SAndroid Build Coastguard Worker 
22*9880d681SAndroid Build Coastguard Worker #include "llvm-c/Types.h"
23*9880d681SAndroid Build Coastguard Worker 
24*9880d681SAndroid Build Coastguard Worker #ifdef __cplusplus
25*9880d681SAndroid Build Coastguard Worker extern "C" {
26*9880d681SAndroid Build Coastguard Worker #endif
27*9880d681SAndroid Build Coastguard Worker 
28*9880d681SAndroid Build Coastguard Worker /**
29*9880d681SAndroid Build Coastguard Worker  * @defgroup LLVMCBitWriter Bit Writer
30*9880d681SAndroid Build Coastguard Worker  * @ingroup LLVMC
31*9880d681SAndroid Build Coastguard Worker  *
32*9880d681SAndroid Build Coastguard Worker  * @{
33*9880d681SAndroid Build Coastguard Worker  */
34*9880d681SAndroid Build Coastguard Worker 
35*9880d681SAndroid Build Coastguard Worker /*===-- Operations on modules ---------------------------------------------===*/
36*9880d681SAndroid Build Coastguard Worker 
37*9880d681SAndroid Build Coastguard Worker /** Writes a module to the specified path. Returns 0 on success. */
38*9880d681SAndroid Build Coastguard Worker int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
39*9880d681SAndroid Build Coastguard Worker 
40*9880d681SAndroid Build Coastguard Worker /** Writes a module to an open file descriptor. Returns 0 on success. */
41*9880d681SAndroid Build Coastguard Worker int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
42*9880d681SAndroid Build Coastguard Worker                          int Unbuffered);
43*9880d681SAndroid Build Coastguard Worker 
44*9880d681SAndroid Build Coastguard Worker /** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
45*9880d681SAndroid Build Coastguard Worker     descriptor. Returns 0 on success. Closes the Handle. */
46*9880d681SAndroid Build Coastguard Worker int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
47*9880d681SAndroid Build Coastguard Worker 
48*9880d681SAndroid Build Coastguard Worker /** Writes a module to a new memory buffer and returns it. */
49*9880d681SAndroid Build Coastguard Worker LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M);
50*9880d681SAndroid Build Coastguard Worker 
51*9880d681SAndroid Build Coastguard Worker /**
52*9880d681SAndroid Build Coastguard Worker  * @}
53*9880d681SAndroid Build Coastguard Worker  */
54*9880d681SAndroid Build Coastguard Worker 
55*9880d681SAndroid Build Coastguard Worker #ifdef __cplusplus
56*9880d681SAndroid Build Coastguard Worker }
57*9880d681SAndroid Build Coastguard Worker #endif
58*9880d681SAndroid Build Coastguard Worker 
59*9880d681SAndroid Build Coastguard Worker #endif
60