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