BitWriter.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*===-- llvm-c/BitWriter.h - BitWriter Library C Interface ------*- C++ -*-===*\
  2. |* *|
  3. |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
  4. |* Exceptions. *|
  5. |* See https://llvm.org/LICENSE.txt for license information. *|
  6. |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
  7. |* *|
  8. |*===----------------------------------------------------------------------===*|
  9. |* *|
  10. |* This header declares the C interface to libLLVMBitWriter.a, which *|
  11. |* implements output 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. #ifndef LLVM_C_BITWRITER_H
  19. #define LLVM_C_BITWRITER_H
  20. #include "llvm-c/ExternC.h"
  21. #include "llvm-c/Types.h"
  22. LLVM_C_EXTERN_C_BEGIN
  23. /**
  24. * @defgroup LLVMCBitWriter Bit Writer
  25. * @ingroup LLVMC
  26. *
  27. * @{
  28. */
  29. /*===-- Operations on modules ---------------------------------------------===*/
  30. /** Writes a module to the specified path. Returns 0 on success. */
  31. int LLVMWriteBitcodeToFile(LLVMModuleRef M, const char *Path);
  32. /** Writes a module to an open file descriptor. Returns 0 on success. */
  33. int LLVMWriteBitcodeToFD(LLVMModuleRef M, int FD, int ShouldClose,
  34. int Unbuffered);
  35. /** Deprecated for LLVMWriteBitcodeToFD. Writes a module to an open file
  36. descriptor. Returns 0 on success. Closes the Handle. */
  37. int LLVMWriteBitcodeToFileHandle(LLVMModuleRef M, int Handle);
  38. /** Writes a module to a new memory buffer and returns it. */
  39. LLVMMemoryBufferRef LLVMWriteBitcodeToMemoryBuffer(LLVMModuleRef M);
  40. /**
  41. * @}
  42. */
  43. LLVM_C_EXTERN_C_END
  44. #endif