/*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This header declares the C interface to libLLVMCore.a, which implements *|
|* the LLVM intermediate representation. *|
|* *|
|* LLVM uses a polymorphic type hierarchy which C cannot represent, therefore *|
|* parameters must be passed as base types. Despite the declared types, most *|
|* of the functions provided operate only on branches of the type hierarchy. *|
|* The declared parameter names are descriptive and specify which type is *|
|* required. Additionally, each type hierarchy is documented along with the *|
|* functions that operate upon it. For more detail, refer to LLVM's C++ code. *|
|* If in doubt, refer to Core.cpp, which performs paramter downcasts in the *|
|* form unwrap<RequiredType>(Param). *|
|* *|
|* Many exotic languages can interoperate with C code but have a harder time *|
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|* tools written in such languages. *|
|* *|
|* When included into a C++ source file, also declares 'wrap' and 'unwrap' *|
|* helpers to perform opaque reference<-->pointer conversions. These helpers *|
|* are shorter and more tightly typed than writing the casts by hand when *|
|* authoring bindings. In assert builds, they will do runtime type checking. *|
|* *|
\*===----------------------------------------------------------------------===*/
#ifndef LLVM_C_CORE_H
#define LLVM_C_CORE_H
#include "llvm/System/DataTypes.h"
#ifdef __cplusplus
/* Need these includes to support the LLVM 'cast' template for the C++ 'wrap'
and 'unwrap' conversion functions. */
#include "llvm/Module.h"
#include "llvm/Support/IRBuilder.h"
extern "C" {
#endif
/* Opaque types. */
/**
* The top-level container for all LLVM global data. See the LLVMContext class.
*/
typedef struct LLVMOpaqueContext *LLVMContextRef;
/**
* The top-level container for all other LLVM Intermediate Representation (IR)
* objects. See the llvm::Module class.
*/
typedef struct LLVMOpaqueModule *LLVMModuleRef;
/**
* Each value in the LLVM IR has a type, an LLVMTypeRef. See the llvm::Type
* class.
*/
typedef struct LLVMOpaqueType *LLVMTypeRef;
/**
* When building recursive types using LLVMRefineType, LLVMTypeRef values may
* become invalid; use LLVMTypeHandleRef to resolve this problem. See the
* llvm::AbstractTypeHolder class.
*/
typedef struct LLVMOpaqueTypeHandle *LLVMTypeHandleRef;
typedef struct LLVMOpaqueValue *LLVMValueRef;
typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
/* Used to provide a module to JIT or interpreter.
* See the llvm::ModuleProvider class.
*/
typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
/* Used to provide a module to JIT or interpreter.
* See the llvm::MemoryBuffer class.
*/
typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
/** See the llvm::PassManagerBase class. */
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
/**
* Used to iterate through the uses of a Value, allowing access to all Values
* that use this Value. See the llvm::Use and llvm::value_use_iterator classes.
*/
typedef struct LLVMOpaqueUseIterator *LLVMUseIteratorRef;
typedef enum {
LLVMZExtAttribute = 1<<0,
LLVMSExtAttribute = 1<<1,
LLVMNoReturnAttribute = 1<<2,
LLVMInRegAttribute = 1<<3,
LLVMStructRetAttribute = 1<<4,
LLVMNoUnwindAttribute = 1<<5,
LLVMNoAliasAttribute = 1<<6,
LLVMByValAttribute = 1<<7,
LLVMNestAttribute = 1<<8,
LLVMReadNoneAttribute = 1<<9,
LLVMReadOnlyAttribute = 1<<10,
LLVMNoInlineAttribute = 1<<11,
LLVMAlwaysInlineAttribute = 1<<12,
LLVMOptimizeForSizeAttribute = 1<<13,
LLVMStackProtectAttribute = 1<<14,
LLVMStackProtectReqAttribute = 1<<15,
LLVMNoCaptureAttribute = 1<<21,
LLVMNoRedZoneAttribute = 1<<22,
LLVMNoImplicitFloatAttribute = 1<<23,
LLVMNakedAttribute = 1<<24,
LLVMInlineHintAttribute = 1<<25
} LLVMAttribute;
typedef enum {
LLVMRet = 1,
LLVMBr = 2,
LLVMSwitch = 3,
LLVMInvoke = 4,
LLVMUnwind = 5,
LLVMUnreachable = 6,
LLVMAdd = 7,
LLVMFAdd = 8,
LLVMSub = 9,
LLVMFSub = 10,
LLVMMul = 11,
LLVMFMul = 12,
LLVMUDiv = 13,
LLVMSDiv = 14,
LLVMFDiv = 15,
LLVMURem = 16,
LLVMSRem = 17,
LLVMFRem = 18,
LLVMShl = 19,
LLVMLShr = 20,
LLVMAShr = 21,
LLVMAnd = 22,
LLVMOr = 23,
LLVMXor = 24,