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