Types.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*===-- llvm-c/Support.h - C Interface Types declarations ---------*- 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 file defines types used by the C interface to LLVM. *|
  11. |* *|
  12. \*===----------------------------------------------------------------------===*/
  13. #ifndef LLVM_C_TYPES_H
  14. #define LLVM_C_TYPES_H
  15. #include "DataTypes.h"
  16. #include "ExternC.h"
  17. LLVM_C_EXTERN_C_BEGIN
  18. /**
  19. * @defgroup LLVMCSupportTypes Types and Enumerations
  20. *
  21. * @{
  22. */
  23. typedef int LLVMBool;
  24. /* Opaque types. */
  25. /**
  26. * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore
  27. * parameters must be passed as base types. Despite the declared types, most
  28. * of the functions provided operate only on branches of the type hierarchy.
  29. * The declared parameter names are descriptive and specify which type is
  30. * required. Additionally, each type hierarchy is documented along with the
  31. * functions that operate upon it. For more detail, refer to LLVM's C++ code.
  32. * If in doubt, refer to Core.cpp, which performs parameter downcasts in the
  33. * form unwrap<RequiredType>(Param).
  34. */
  35. /**
  36. * Used to pass regions of memory through LLVM interfaces.
  37. *
  38. * @see llvm::MemoryBuffer
  39. */
  40. typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
  41. /**
  42. * The top-level container for all LLVM global data. See the LLVMContext class.
  43. */
  44. typedef struct LLVMOpaqueContext *LLVMContextRef;
  45. /**
  46. * The top-level container for all other LLVM Intermediate Representation (IR)
  47. * objects.
  48. *
  49. * @see llvm::Module
  50. */
  51. typedef struct LLVMOpaqueModule *LLVMModuleRef;
  52. /**
  53. * Each value in the LLVM IR has a type, an LLVMTypeRef.
  54. *
  55. * @see llvm::Type
  56. */
  57. typedef struct LLVMOpaqueType *LLVMTypeRef;
  58. /**
  59. * Represents an individual value in LLVM IR.
  60. *
  61. * This models llvm::Value.
  62. */
  63. typedef struct LLVMOpaqueValue *LLVMValueRef;
  64. /**
  65. * Represents a basic block of instructions in LLVM IR.
  66. *
  67. * This models llvm::BasicBlock.
  68. */
  69. typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
  70. /**
  71. * Represents an LLVM Metadata.
  72. *
  73. * This models llvm::Metadata.
  74. */
  75. typedef struct LLVMOpaqueMetadata *LLVMMetadataRef;
  76. /**
  77. * Represents an LLVM Named Metadata Node.
  78. *
  79. * This models llvm::NamedMDNode.
  80. */
  81. typedef struct LLVMOpaqueNamedMDNode *LLVMNamedMDNodeRef;
  82. /**
  83. * Represents an entry in a Global Object's metadata attachments.
  84. *
  85. * This models std::pair<unsigned, MDNode *>
  86. */
  87. typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry;
  88. /**
  89. * Represents an LLVM basic block builder.
  90. *
  91. * This models llvm::IRBuilder.
  92. */
  93. typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
  94. /**
  95. * Represents an LLVM debug info builder.
  96. *
  97. * This models llvm::DIBuilder.
  98. */
  99. typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef;
  100. /**
  101. * Interface used to provide a module to JIT or interpreter.
  102. * This is now just a synonym for llvm::Module, but we have to keep using the
  103. * different type to keep binary compatibility.
  104. */
  105. typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
  106. /** @see llvm::PassManagerBase */
  107. typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
  108. /**
  109. * Used to get the users and usees of a Value.
  110. *
  111. * @see llvm::Use */
  112. typedef struct LLVMOpaqueUse *LLVMUseRef;
  113. /**
  114. * @see llvm::OperandBundleDef
  115. */
  116. typedef struct LLVMOpaqueOperandBundle *LLVMOperandBundleRef;
  117. /**
  118. * Used to represent an attributes.
  119. *
  120. * @see llvm::Attribute
  121. */
  122. typedef struct LLVMOpaqueAttributeRef *LLVMAttributeRef;
  123. /**
  124. * @see llvm::DiagnosticInfo
  125. */
  126. typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
  127. /**
  128. * @see llvm::Comdat
  129. */
  130. typedef struct LLVMComdat *LLVMComdatRef;
  131. /**
  132. * @see llvm::Module::ModuleFlagEntry
  133. */
  134. typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry;
  135. /**
  136. * @see llvm::JITEventListener
  137. */
  138. typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef;
  139. /**
  140. * @see llvm::object::Binary
  141. */
  142. typedef struct LLVMOpaqueBinary *LLVMBinaryRef;
  143. /**
  144. * @}
  145. */
  146. LLVM_C_EXTERN_C_END
  147. #endif