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