1 /*===-- llvm-c/Support.h - C Interface Types declarations ---------*- C -*-===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
8 |*===----------------------------------------------------------------------===*|
10 |* This file defines types used by the C interface to LLVM. *|
12 \*===----------------------------------------------------------------------===*/
14 #ifndef LLVM_C_TYPES_H
15 #define LLVM_C_TYPES_H
17 #include "llvm-c/DataTypes.h"
18 #include "llvm-c/ExternC.h"
23 * @defgroup LLVMCSupportTypes Types and Enumerations
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).
44 * Used to pass regions of memory through LLVM interfaces.
46 * @see llvm::MemoryBuffer
48 typedef struct LLVMOpaqueMemoryBuffer
*LLVMMemoryBufferRef
;
51 * The top-level container for all LLVM global data. See the LLVMContext class.
53 typedef struct LLVMOpaqueContext
*LLVMContextRef
;
56 * The top-level container for all other LLVM Intermediate Representation (IR)
61 typedef struct LLVMOpaqueModule
*LLVMModuleRef
;
64 * Each value in the LLVM IR has a type, an LLVMTypeRef.
68 typedef struct LLVMOpaqueType
*LLVMTypeRef
;
71 * Represents an individual value in LLVM IR.
73 * This models llvm::Value.
75 typedef struct LLVMOpaqueValue
*LLVMValueRef
;
78 * Represents a basic block of instructions in LLVM IR.
80 * This models llvm::BasicBlock.
82 typedef struct LLVMOpaqueBasicBlock
*LLVMBasicBlockRef
;
85 * Represents an LLVM Metadata.
87 * This models llvm::Metadata.
89 typedef struct LLVMOpaqueMetadata
*LLVMMetadataRef
;
92 * Represents an LLVM Named Metadata Node.
94 * This models llvm::NamedMDNode.
96 typedef struct LLVMOpaqueNamedMDNode
*LLVMNamedMDNodeRef
;
99 * Represents an entry in a Global Object's metadata attachments.
101 * This models std::pair<unsigned, MDNode *>
103 typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry
;
106 * Represents an LLVM basic block builder.
108 * This models llvm::IRBuilder.
110 typedef struct LLVMOpaqueBuilder
*LLVMBuilderRef
;
113 * Represents an LLVM debug info builder.
115 * This models llvm::DIBuilder.
117 typedef struct LLVMOpaqueDIBuilder
*LLVMDIBuilderRef
;
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.
124 typedef struct LLVMOpaqueModuleProvider
*LLVMModuleProviderRef
;
126 /** @see llvm::PassManagerBase */
127 typedef struct LLVMOpaquePassManager
*LLVMPassManagerRef
;
129 /** @see llvm::PassRegistry */
130 typedef struct LLVMOpaquePassRegistry
*LLVMPassRegistryRef
;
133 * Used to get the users and usees of a Value.
136 typedef struct LLVMOpaqueUse
*LLVMUseRef
;
139 * Used to represent an attributes.
141 * @see llvm::Attribute
143 typedef struct LLVMOpaqueAttributeRef
*LLVMAttributeRef
;
146 * @see llvm::DiagnosticInfo
148 typedef struct LLVMOpaqueDiagnosticInfo
*LLVMDiagnosticInfoRef
;
153 typedef struct LLVMComdat
*LLVMComdatRef
;
156 * @see llvm::Module::ModuleFlagEntry
158 typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry
;
161 * @see llvm::JITEventListener
163 typedef struct LLVMOpaqueJITEventListener
*LLVMJITEventListenerRef
;
166 * @see llvm::object::Binary
168 typedef struct LLVMOpaqueBinary
*LLVMBinaryRef
;