106f32e7eSjoerg /*===-- llvm-c/Support.h - C Interface Types declarations ---------*- C -*-===*\ 206f32e7eSjoerg |* *| 306f32e7eSjoerg |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| 406f32e7eSjoerg |* Exceptions. *| 506f32e7eSjoerg |* See https://llvm.org/LICENSE.txt for license information. *| 606f32e7eSjoerg |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| 706f32e7eSjoerg |* *| 806f32e7eSjoerg |*===----------------------------------------------------------------------===*| 906f32e7eSjoerg |* *| 1006f32e7eSjoerg |* This file defines types used by the C interface to LLVM. *| 1106f32e7eSjoerg |* *| 1206f32e7eSjoerg \*===----------------------------------------------------------------------===*/ 1306f32e7eSjoerg 1406f32e7eSjoerg #ifndef LLVM_C_TYPES_H 1506f32e7eSjoerg #define LLVM_C_TYPES_H 1606f32e7eSjoerg 1706f32e7eSjoerg #include "llvm-c/DataTypes.h" 18*da58b97aSjoerg #include "llvm-c/ExternC.h" 1906f32e7eSjoerg 20*da58b97aSjoerg LLVM_C_EXTERN_C_BEGIN 2106f32e7eSjoerg 2206f32e7eSjoerg /** 2306f32e7eSjoerg * @defgroup LLVMCSupportTypes Types and Enumerations 2406f32e7eSjoerg * 2506f32e7eSjoerg * @{ 2606f32e7eSjoerg */ 2706f32e7eSjoerg 2806f32e7eSjoerg typedef int LLVMBool; 2906f32e7eSjoerg 3006f32e7eSjoerg /* Opaque types. */ 3106f32e7eSjoerg 3206f32e7eSjoerg /** 3306f32e7eSjoerg * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore 3406f32e7eSjoerg * parameters must be passed as base types. Despite the declared types, most 3506f32e7eSjoerg * of the functions provided operate only on branches of the type hierarchy. 3606f32e7eSjoerg * The declared parameter names are descriptive and specify which type is 3706f32e7eSjoerg * required. Additionally, each type hierarchy is documented along with the 3806f32e7eSjoerg * functions that operate upon it. For more detail, refer to LLVM's C++ code. 3906f32e7eSjoerg * If in doubt, refer to Core.cpp, which performs parameter downcasts in the 4006f32e7eSjoerg * form unwrap<RequiredType>(Param). 4106f32e7eSjoerg */ 4206f32e7eSjoerg 4306f32e7eSjoerg /** 4406f32e7eSjoerg * Used to pass regions of memory through LLVM interfaces. 4506f32e7eSjoerg * 4606f32e7eSjoerg * @see llvm::MemoryBuffer 4706f32e7eSjoerg */ 4806f32e7eSjoerg typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef; 4906f32e7eSjoerg 5006f32e7eSjoerg /** 5106f32e7eSjoerg * The top-level container for all LLVM global data. See the LLVMContext class. 5206f32e7eSjoerg */ 5306f32e7eSjoerg typedef struct LLVMOpaqueContext *LLVMContextRef; 5406f32e7eSjoerg 5506f32e7eSjoerg /** 5606f32e7eSjoerg * The top-level container for all other LLVM Intermediate Representation (IR) 5706f32e7eSjoerg * objects. 5806f32e7eSjoerg * 5906f32e7eSjoerg * @see llvm::Module 6006f32e7eSjoerg */ 6106f32e7eSjoerg typedef struct LLVMOpaqueModule *LLVMModuleRef; 6206f32e7eSjoerg 6306f32e7eSjoerg /** 6406f32e7eSjoerg * Each value in the LLVM IR has a type, an LLVMTypeRef. 6506f32e7eSjoerg * 6606f32e7eSjoerg * @see llvm::Type 6706f32e7eSjoerg */ 6806f32e7eSjoerg typedef struct LLVMOpaqueType *LLVMTypeRef; 6906f32e7eSjoerg 7006f32e7eSjoerg /** 7106f32e7eSjoerg * Represents an individual value in LLVM IR. 7206f32e7eSjoerg * 7306f32e7eSjoerg * This models llvm::Value. 7406f32e7eSjoerg */ 7506f32e7eSjoerg typedef struct LLVMOpaqueValue *LLVMValueRef; 7606f32e7eSjoerg 7706f32e7eSjoerg /** 7806f32e7eSjoerg * Represents a basic block of instructions in LLVM IR. 7906f32e7eSjoerg * 8006f32e7eSjoerg * This models llvm::BasicBlock. 8106f32e7eSjoerg */ 8206f32e7eSjoerg typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef; 8306f32e7eSjoerg 8406f32e7eSjoerg /** 8506f32e7eSjoerg * Represents an LLVM Metadata. 8606f32e7eSjoerg * 8706f32e7eSjoerg * This models llvm::Metadata. 8806f32e7eSjoerg */ 8906f32e7eSjoerg typedef struct LLVMOpaqueMetadata *LLVMMetadataRef; 9006f32e7eSjoerg 9106f32e7eSjoerg /** 9206f32e7eSjoerg * Represents an LLVM Named Metadata Node. 9306f32e7eSjoerg * 9406f32e7eSjoerg * This models llvm::NamedMDNode. 9506f32e7eSjoerg */ 9606f32e7eSjoerg typedef struct LLVMOpaqueNamedMDNode *LLVMNamedMDNodeRef; 9706f32e7eSjoerg 9806f32e7eSjoerg /** 9906f32e7eSjoerg * Represents an entry in a Global Object's metadata attachments. 10006f32e7eSjoerg * 10106f32e7eSjoerg * This models std::pair<unsigned, MDNode *> 10206f32e7eSjoerg */ 10306f32e7eSjoerg typedef struct LLVMOpaqueValueMetadataEntry LLVMValueMetadataEntry; 10406f32e7eSjoerg 10506f32e7eSjoerg /** 10606f32e7eSjoerg * Represents an LLVM basic block builder. 10706f32e7eSjoerg * 10806f32e7eSjoerg * This models llvm::IRBuilder. 10906f32e7eSjoerg */ 11006f32e7eSjoerg typedef struct LLVMOpaqueBuilder *LLVMBuilderRef; 11106f32e7eSjoerg 11206f32e7eSjoerg /** 11306f32e7eSjoerg * Represents an LLVM debug info builder. 11406f32e7eSjoerg * 11506f32e7eSjoerg * This models llvm::DIBuilder. 11606f32e7eSjoerg */ 11706f32e7eSjoerg typedef struct LLVMOpaqueDIBuilder *LLVMDIBuilderRef; 11806f32e7eSjoerg 11906f32e7eSjoerg /** 12006f32e7eSjoerg * Interface used to provide a module to JIT or interpreter. 12106f32e7eSjoerg * This is now just a synonym for llvm::Module, but we have to keep using the 12206f32e7eSjoerg * different type to keep binary compatibility. 12306f32e7eSjoerg */ 12406f32e7eSjoerg typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef; 12506f32e7eSjoerg 12606f32e7eSjoerg /** @see llvm::PassManagerBase */ 12706f32e7eSjoerg typedef struct LLVMOpaquePassManager *LLVMPassManagerRef; 12806f32e7eSjoerg 12906f32e7eSjoerg /** @see llvm::PassRegistry */ 13006f32e7eSjoerg typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef; 13106f32e7eSjoerg 13206f32e7eSjoerg /** 13306f32e7eSjoerg * Used to get the users and usees of a Value. 13406f32e7eSjoerg * 13506f32e7eSjoerg * @see llvm::Use */ 13606f32e7eSjoerg typedef struct LLVMOpaqueUse *LLVMUseRef; 13706f32e7eSjoerg 13806f32e7eSjoerg /** 13906f32e7eSjoerg * Used to represent an attributes. 14006f32e7eSjoerg * 14106f32e7eSjoerg * @see llvm::Attribute 14206f32e7eSjoerg */ 14306f32e7eSjoerg typedef struct LLVMOpaqueAttributeRef *LLVMAttributeRef; 14406f32e7eSjoerg 14506f32e7eSjoerg /** 14606f32e7eSjoerg * @see llvm::DiagnosticInfo 14706f32e7eSjoerg */ 14806f32e7eSjoerg typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef; 14906f32e7eSjoerg 15006f32e7eSjoerg /** 15106f32e7eSjoerg * @see llvm::Comdat 15206f32e7eSjoerg */ 15306f32e7eSjoerg typedef struct LLVMComdat *LLVMComdatRef; 15406f32e7eSjoerg 15506f32e7eSjoerg /** 15606f32e7eSjoerg * @see llvm::Module::ModuleFlagEntry 15706f32e7eSjoerg */ 15806f32e7eSjoerg typedef struct LLVMOpaqueModuleFlagEntry LLVMModuleFlagEntry; 15906f32e7eSjoerg 16006f32e7eSjoerg /** 16106f32e7eSjoerg * @see llvm::JITEventListener 16206f32e7eSjoerg */ 16306f32e7eSjoerg typedef struct LLVMOpaqueJITEventListener *LLVMJITEventListenerRef; 16406f32e7eSjoerg 16506f32e7eSjoerg /** 16606f32e7eSjoerg * @see llvm::object::Binary 16706f32e7eSjoerg */ 16806f32e7eSjoerg typedef struct LLVMOpaqueBinary *LLVMBinaryRef; 16906f32e7eSjoerg 17006f32e7eSjoerg /** 17106f32e7eSjoerg * @} 17206f32e7eSjoerg */ 17306f32e7eSjoerg 174*da58b97aSjoerg LLVM_C_EXTERN_C_END 17506f32e7eSjoerg 17606f32e7eSjoerg #endif 177