2007-09-18 03:18:57 +00:00
|
|
|
/*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
|
|
|
|
|* *|
|
|
|
|
|* The LLVM Compiler Infrastructure *|
|
|
|
|
|* *|
|
2007-12-29 19:59:42 +00:00
|
|
|
|* This file is distributed under the University of Illinois Open Source *|
|
|
|
|
|* License. See LICENSE.TXT for details. *|
|
2007-09-18 03:18:57 +00:00
|
|
|
|* *|
|
|
|
|
|*===----------------------------------------------------------------------===*|
|
|
|
|
|* *|
|
|
|
|
|* This header declares the C interface to libLLVMCore.a, which implements *|
|
|
|
|
|* the LLVM intermediate representation. *|
|
|
|
|
|* *|
|
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#ifndef LLVM_C_CORE_H
|
|
|
|
#define LLVM_C_CORE_H
|
|
|
|
|
2010-11-29 18:47:54 +00:00
|
|
|
#include "llvm/Support/DataTypes.h"
|
2009-08-16 23:36:46 +00:00
|
|
|
|
2013-04-04 17:40:53 +00:00
|
|
|
#ifdef __cplusplus
|
2007-09-18 03:18:57 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMC LLVM-C: C interface to LLVM
|
|
|
|
*
|
|
|
|
* This module exposes parts of the LLVM library as a C API.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCTransforms Transforms
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCore Core
|
|
|
|
*
|
|
|
|
* This modules provide an interface to libLLVMCore, which implements
|
|
|
|
* the LLVM intermediate representation as well as other related types
|
|
|
|
* and utilities.
|
|
|
|
*
|
|
|
|
* 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.
|
2012-08-10 18:26:20 +00:00
|
|
|
* If in doubt, refer to Core.cpp, which performs parameter downcasts in the
|
2012-03-21 03:54:29 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypes Types and Enumerations
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2010-01-09 22:27:07 +00:00
|
|
|
typedef int LLVMBool;
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Opaque types. */
|
2007-12-30 17:46:33 +00:00
|
|
|
|
2009-07-01 16:58:40 +00:00
|
|
|
/**
|
2012-03-21 03:54:29 +00:00
|
|
|
* The top-level container for all LLVM global data. See the LLVMContext class.
|
2009-07-01 16:58:40 +00:00
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
typedef struct LLVMOpaqueContext *LLVMContextRef;
|
2009-07-01 16:58:40 +00:00
|
|
|
|
2007-12-30 17:46:33 +00:00
|
|
|
/**
|
|
|
|
* The top-level container for all other LLVM Intermediate Representation (IR)
|
2012-03-21 03:54:29 +00:00
|
|
|
* objects.
|
|
|
|
*
|
|
|
|
* @see llvm::Module
|
2007-12-30 17:46:33 +00:00
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef struct LLVMOpaqueModule *LLVMModuleRef;
|
2007-12-30 17:46:33 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 03:54:29 +00:00
|
|
|
* Each value in the LLVM IR has a type, an LLVMTypeRef.
|
|
|
|
*
|
|
|
|
* @see llvm::Type
|
2007-12-30 17:46:33 +00:00
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef struct LLVMOpaqueType *LLVMTypeRef;
|
2007-12-30 17:46:33 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Represents an individual value in LLVM IR.
|
|
|
|
*
|
|
|
|
* This models llvm::Value.
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef struct LLVMOpaqueValue *LLVMValueRef;
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-08-10 18:26:20 +00:00
|
|
|
* Represents a basic block of instructions in LLVM IR.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* This models llvm::BasicBlock.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents an LLVM basic block builder.
|
|
|
|
*
|
|
|
|
* This models llvm::IRBuilder.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Interface used to provide a module to JIT or interpreter.
|
|
|
|
* This is now just a synonym for llvm::Module, but we have to keep using the
|
|
|
|
* different type to keep binary compatibility.
|
2007-12-19 22:30:40 +00:00
|
|
|
*/
|
2007-12-12 01:04:30 +00:00
|
|
|
typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Used to provide a module to JIT or interpreter.
|
|
|
|
*
|
|
|
|
* @see llvm::MemoryBuffer
|
2007-12-19 22:30:40 +00:00
|
|
|
*/
|
|
|
|
typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/** @see llvm::PassManagerBase */
|
2008-03-16 04:20:44 +00:00
|
|
|
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/** @see llvm::PassRegistry */
|
2010-10-07 17:55:47 +00:00
|
|
|
typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Used to get the users and usees of a Value.
|
|
|
|
*
|
|
|
|
* @see llvm::Use */
|
2010-03-02 20:32:28 +00:00
|
|
|
typedef struct LLVMOpaqueUse *LLVMUseRef;
|
2009-10-12 04:01:02 +00:00
|
|
|
|
2008-04-28 17:37:06 +00:00
|
|
|
typedef enum {
|
2008-09-25 21:00:45 +00:00
|
|
|
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,
|
2009-07-17 18:07:26 +00:00
|
|
|
LLVMReadOnlyAttribute = 1<<10,
|
2009-07-17 18:57:16 +00:00
|
|
|
LLVMNoInlineAttribute = 1<<11,
|
|
|
|
LLVMAlwaysInlineAttribute = 1<<12,
|
|
|
|
LLVMOptimizeForSizeAttribute = 1<<13,
|
|
|
|
LLVMStackProtectAttribute = 1<<14,
|
|
|
|
LLVMStackProtectReqAttribute = 1<<15,
|
2010-03-03 23:51:25 +00:00
|
|
|
LLVMAlignment = 31<<16,
|
2009-07-17 18:57:16 +00:00
|
|
|
LLVMNoCaptureAttribute = 1<<21,
|
|
|
|
LLVMNoRedZoneAttribute = 1<<22,
|
|
|
|
LLVMNoImplicitFloatAttribute = 1<<23,
|
2010-02-06 01:16:28 +00:00
|
|
|
LLVMNakedAttribute = 1<<24,
|
2010-03-03 23:51:25 +00:00
|
|
|
LLVMInlineHintAttribute = 1<<25,
|
2011-10-06 12:13:32 +00:00
|
|
|
LLVMStackAlignment = 7<<26,
|
|
|
|
LLVMReturnsTwice = 1 << 29,
|
|
|
|
LLVMUWTable = 1 << 30,
|
2012-01-25 07:40:15 +00:00
|
|
|
LLVMNonLazyBind = 1 << 31
|
|
|
|
|
2013-01-23 06:41:41 +00:00
|
|
|
/* FIXME: These attributes are currently not included in the C API as
|
2012-09-02 14:19:21 +00:00
|
|
|
a temporary measure until the API/ABI impact to the C API is understood
|
|
|
|
and the path forward agreed upon.
|
2013-01-23 06:41:41 +00:00
|
|
|
LLVMAddressSafety = 1ULL << 32,
|
2013-08-23 11:53:55 +00:00
|
|
|
LLVMStackProtectStrongAttribute = 1ULL<<33,
|
|
|
|
LLVMCold = 1ULL << 34,
|
2013-12-19 02:14:12 +00:00
|
|
|
LLVMOptimizeNone = 1ULL << 35,
|
|
|
|
LLVMInAllocaAttribute = 1ULL << 36
|
2012-09-02 14:19:21 +00:00
|
|
|
*/
|
2008-09-25 21:00:45 +00:00
|
|
|
} LLVMAttribute;
|
2008-04-28 17:37:06 +00:00
|
|
|
|
2009-10-12 04:01:02 +00:00
|
|
|
typedef enum {
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Terminator Instructions */
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMRet = 1,
|
|
|
|
LLVMBr = 2,
|
|
|
|
LLVMSwitch = 3,
|
2010-02-15 20:50:51 +00:00
|
|
|
LLVMIndirectBr = 4,
|
|
|
|
LLVMInvoke = 5,
|
2011-08-02 06:20:17 +00:00
|
|
|
/* removed 6 due to API changes */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMUnreachable = 7,
|
2010-02-15 20:50:51 +00:00
|
|
|
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Standard Binary Operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMAdd = 8,
|
|
|
|
LLVMFAdd = 9,
|
|
|
|
LLVMSub = 10,
|
|
|
|
LLVMFSub = 11,
|
|
|
|
LLVMMul = 12,
|
|
|
|
LLVMFMul = 13,
|
|
|
|
LLVMUDiv = 14,
|
|
|
|
LLVMSDiv = 15,
|
|
|
|
LLVMFDiv = 16,
|
|
|
|
LLVMURem = 17,
|
|
|
|
LLVMSRem = 18,
|
|
|
|
LLVMFRem = 19,
|
2010-02-15 20:50:51 +00:00
|
|
|
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Logical Operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMShl = 20,
|
|
|
|
LLVMLShr = 21,
|
|
|
|
LLVMAShr = 22,
|
|
|
|
LLVMAnd = 23,
|
|
|
|
LLVMOr = 24,
|
|
|
|
LLVMXor = 25,
|
2010-02-15 20:50:51 +00:00
|
|
|
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Memory Operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMAlloca = 26,
|
|
|
|
LLVMLoad = 27,
|
|
|
|
LLVMStore = 28,
|
|
|
|
LLVMGetElementPtr = 29,
|
2010-02-15 20:50:51 +00:00
|
|
|
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Cast Operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMTrunc = 30,
|
|
|
|
LLVMZExt = 31,
|
|
|
|
LLVMSExt = 32,
|
|
|
|
LLVMFPToUI = 33,
|
|
|
|
LLVMFPToSI = 34,
|
|
|
|
LLVMUIToFP = 35,
|
|
|
|
LLVMSIToFP = 36,
|
|
|
|
LLVMFPTrunc = 37,
|
|
|
|
LLVMFPExt = 38,
|
|
|
|
LLVMPtrToInt = 39,
|
|
|
|
LLVMIntToPtr = 40,
|
|
|
|
LLVMBitCast = 41,
|
2013-11-15 01:34:59 +00:00
|
|
|
LLVMAddrSpaceCast = 60,
|
2010-02-15 20:50:51 +00:00
|
|
|
|
2010-02-15 20:53:17 +00:00
|
|
|
/* Other Operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMICmp = 42,
|
|
|
|
LLVMFCmp = 43,
|
|
|
|
LLVMPHI = 44,
|
|
|
|
LLVMCall = 45,
|
|
|
|
LLVMSelect = 46,
|
2011-10-06 12:39:34 +00:00
|
|
|
LLVMUserOp1 = 47,
|
|
|
|
LLVMUserOp2 = 48,
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMVAArg = 49,
|
|
|
|
LLVMExtractElement = 50,
|
|
|
|
LLVMInsertElement = 51,
|
|
|
|
LLVMShuffleVector = 52,
|
|
|
|
LLVMExtractValue = 53,
|
|
|
|
LLVMInsertValue = 54,
|
2011-07-27 18:59:19 +00:00
|
|
|
|
|
|
|
/* Atomic operators */
|
2011-07-27 21:00:28 +00:00
|
|
|
LLVMFence = 55,
|
2011-07-28 21:48:00 +00:00
|
|
|
LLVMAtomicCmpXchg = 56,
|
2011-07-31 06:30:59 +00:00
|
|
|
LLVMAtomicRMW = 57,
|
|
|
|
|
|
|
|
/* Exception Handling Operators */
|
2011-08-12 20:24:12 +00:00
|
|
|
LLVMResume = 58,
|
2012-02-06 21:44:22 +00:00
|
|
|
LLVMLandingPad = 59
|
2011-07-27 21:00:28 +00:00
|
|
|
|
2009-10-12 04:01:02 +00:00
|
|
|
} LLVMOpcode;
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef enum {
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMVoidTypeKind, /**< type with no size */
|
2011-12-17 00:04:22 +00:00
|
|
|
LLVMHalfTypeKind, /**< 16 bit floating point type */
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMFloatTypeKind, /**< 32 bit floating point type */
|
|
|
|
LLVMDoubleTypeKind, /**< 64 bit floating point type */
|
|
|
|
LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */
|
|
|
|
LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/
|
|
|
|
LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */
|
|
|
|
LLVMLabelTypeKind, /**< Labels */
|
|
|
|
LLVMIntegerTypeKind, /**< Arbitrary bit width integers */
|
|
|
|
LLVMFunctionTypeKind, /**< Functions */
|
|
|
|
LLVMStructTypeKind, /**< Structures */
|
|
|
|
LLVMArrayTypeKind, /**< Arrays */
|
|
|
|
LLVMPointerTypeKind, /**< Pointers */
|
2009-07-15 22:00:31 +00:00
|
|
|
LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
|
2010-09-10 20:55:01 +00:00
|
|
|
LLVMMetadataTypeKind, /**< Metadata */
|
|
|
|
LLVMX86_MMXTypeKind /**< X86 MMX */
|
2007-09-18 03:18:57 +00:00
|
|
|
} LLVMTypeKind;
|
|
|
|
|
|
|
|
typedef enum {
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMExternalLinkage, /**< Externally visible function */
|
2009-04-13 06:25:37 +00:00
|
|
|
LLVMAvailableExternallyLinkage,
|
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
|
|
|
LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
|
|
|
|
LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
|
|
|
|
equivalent. */
|
2013-11-01 17:09:14 +00:00
|
|
|
LLVMLinkOnceODRAutoHideLinkage, /**< Obsolete */
|
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
|
|
|
LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
|
|
|
|
LLVMWeakODRLinkage, /**< Same, but only replaced by something
|
|
|
|
equivalent. */
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
|
|
|
|
LLVMInternalLinkage, /**< Rename collisions when linking (static
|
|
|
|
functions) */
|
Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr. These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global. In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time. This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function. If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body. The
code generators on the other hand map weak and weak_odr linkage
to the same thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66339 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 15:45:40 +00:00
|
|
|
LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
|
2014-01-14 15:22:47 +00:00
|
|
|
LLVMDLLImportLinkage, /**< Obsolete */
|
|
|
|
LLVMDLLExportLinkage, /**< Obsolete */
|
2009-03-11 08:08:06 +00:00
|
|
|
LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
|
2010-01-27 20:34:15 +00:00
|
|
|
LLVMGhostLinkage, /**< Obsolete */
|
2009-07-20 18:22:52 +00:00
|
|
|
LLVMCommonLinkage, /**< Tentative definitions */
|
2010-07-01 21:55:59 +00:00
|
|
|
LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
|
2012-08-17 18:33:14 +00:00
|
|
|
LLVMLinkerPrivateWeakLinkage /**< Like LinkerPrivate, but is weak. */
|
2007-09-18 03:18:57 +00:00
|
|
|
} LLVMLinkage;
|
|
|
|
|
|
|
|
typedef enum {
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMDefaultVisibility, /**< The GV is visible */
|
|
|
|
LLVMHiddenVisibility, /**< The GV is hidden */
|
|
|
|
LLVMProtectedVisibility /**< The GV is protected */
|
2007-09-18 03:18:57 +00:00
|
|
|
} LLVMVisibility;
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
typedef enum {
|
|
|
|
LLVMCCallConv = 0,
|
|
|
|
LLVMFastCallConv = 8,
|
|
|
|
LLVMColdCallConv = 9,
|
2013-11-09 06:00:03 +00:00
|
|
|
LLVMWebKitJSCallConv = 12,
|
|
|
|
LLVMAnyRegCallConv = 13,
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMX86StdcallCallConv = 64,
|
|
|
|
LLVMX86FastcallCallConv = 65
|
|
|
|
} LLVMCallConv;
|
|
|
|
|
|
|
|
typedef enum {
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMIntEQ = 32, /**< equal */
|
|
|
|
LLVMIntNE, /**< not equal */
|
|
|
|
LLVMIntUGT, /**< unsigned greater than */
|
|
|
|
LLVMIntUGE, /**< unsigned greater or equal */
|
|
|
|
LLVMIntULT, /**< unsigned less than */
|
|
|
|
LLVMIntULE, /**< unsigned less or equal */
|
|
|
|
LLVMIntSGT, /**< signed greater than */
|
|
|
|
LLVMIntSGE, /**< signed greater or equal */
|
|
|
|
LLVMIntSLT, /**< signed less than */
|
|
|
|
LLVMIntSLE /**< signed less or equal */
|
2007-09-26 20:56:12 +00:00
|
|
|
} LLVMIntPredicate;
|
|
|
|
|
|
|
|
typedef enum {
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMRealPredicateFalse, /**< Always false (always folded) */
|
|
|
|
LLVMRealOEQ, /**< True if ordered and equal */
|
|
|
|
LLVMRealOGT, /**< True if ordered and greater than */
|
|
|
|
LLVMRealOGE, /**< True if ordered and greater than or equal */
|
|
|
|
LLVMRealOLT, /**< True if ordered and less than */
|
|
|
|
LLVMRealOLE, /**< True if ordered and less than or equal */
|
|
|
|
LLVMRealONE, /**< True if ordered and operands are unequal */
|
|
|
|
LLVMRealORD, /**< True if ordered (no nans) */
|
|
|
|
LLVMRealUNO, /**< True if unordered: isnan(X) | isnan(Y) */
|
|
|
|
LLVMRealUEQ, /**< True if unordered or equal */
|
|
|
|
LLVMRealUGT, /**< True if unordered or greater than */
|
|
|
|
LLVMRealUGE, /**< True if unordered, greater than, or equal */
|
|
|
|
LLVMRealULT, /**< True if unordered or less than */
|
|
|
|
LLVMRealULE, /**< True if unordered, less than, or equal */
|
|
|
|
LLVMRealUNE, /**< True if unordered or not equal */
|
|
|
|
LLVMRealPredicateTrue /**< Always true (always folded) */
|
2007-09-26 20:56:12 +00:00
|
|
|
} LLVMRealPredicate;
|
|
|
|
|
2011-08-12 20:24:12 +00:00
|
|
|
typedef enum {
|
|
|
|
LLVMLandingPadCatch, /**< A catch clause */
|
|
|
|
LLVMLandingPadFilter /**< A filter clause */
|
|
|
|
} LLVMLandingPadClauseTy;
|
|
|
|
|
2013-04-16 08:58:59 +00:00
|
|
|
typedef enum {
|
|
|
|
LLVMNotThreadLocal = 0,
|
|
|
|
LLVMGeneralDynamicTLSModel,
|
|
|
|
LLVMLocalDynamicTLSModel,
|
|
|
|
LLVMInitialExecTLSModel,
|
|
|
|
LLVMLocalExecTLSModel
|
|
|
|
} LLVMThreadLocalMode;
|
|
|
|
|
2013-04-23 13:45:37 +00:00
|
|
|
typedef enum {
|
2013-04-23 13:21:19 +00:00
|
|
|
LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */
|
|
|
|
LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees
|
|
|
|
somewhat sane results, lock free. */
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the
|
|
|
|
operations affecting a specific address,
|
2013-04-23 13:21:19 +00:00
|
|
|
a consistent ordering exists */
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort
|
|
|
|
necessary to acquire a lock to access other
|
2013-04-23 13:21:19 +00:00
|
|
|
memory with normal loads and stores. */
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with
|
|
|
|
a barrier of the sort necessary to release
|
2013-04-23 13:21:19 +00:00
|
|
|
a lock. */
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a
|
|
|
|
Release barrier (for fences and
|
2013-04-23 13:21:19 +00:00
|
|
|
operations which both read and write
|
|
|
|
memory). */
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics
|
|
|
|
for loads and Release
|
|
|
|
semantics for stores.
|
|
|
|
Additionally, it guarantees
|
|
|
|
that a total ordering exists
|
|
|
|
between all
|
|
|
|
SequentiallyConsistent
|
2013-04-23 13:21:19 +00:00
|
|
|
operations. */
|
2013-04-23 13:45:37 +00:00
|
|
|
} LLVMAtomicOrdering;
|
2013-04-23 13:21:19 +00:00
|
|
|
|
2013-04-23 13:45:37 +00:00
|
|
|
typedef enum {
|
2013-04-23 13:21:19 +00:00
|
|
|
LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
|
|
|
|
LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
|
|
|
|
LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
|
2013-10-23 17:56:29 +00:00
|
|
|
original using a signed comparison and return
|
2013-04-23 13:21:19 +00:00
|
|
|
the old one */
|
|
|
|
LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
|
2013-10-23 17:56:29 +00:00
|
|
|
original using a signed comparison and return
|
2013-04-23 13:21:19 +00:00
|
|
|
the old one */
|
|
|
|
LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
|
2013-10-23 17:56:29 +00:00
|
|
|
original using an unsigned comparison and return
|
2013-04-23 13:21:19 +00:00
|
|
|
the old one */
|
|
|
|
LLVMAtomicRMWBinOpUMin /**< Sets the value if it's greater than the
|
2013-10-23 17:56:29 +00:00
|
|
|
original using an unsigned comparison and return
|
2013-04-23 13:21:19 +00:00
|
|
|
the old one */
|
2013-04-23 13:45:37 +00:00
|
|
|
} LLVMAtomicRMWBinOp;
|
2013-04-23 13:21:19 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2011-05-15 07:20:34 +00:00
|
|
|
void LLVMInitializeCore(LLVMPassRegistryRef R);
|
|
|
|
|
2013-02-17 16:35:51 +00:00
|
|
|
/** Deallocate and destroy all ManagedStatic variables.
|
|
|
|
@see llvm::llvm_shutdown
|
|
|
|
@see ManagedStatic */
|
2013-10-23 16:57:34 +00:00
|
|
|
void LLVMShutdown(void);
|
2013-02-17 16:35:51 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
/*===-- Error handling ----------------------------------------------------===*/
|
|
|
|
|
2013-05-22 02:46:43 +00:00
|
|
|
char *LLVMCreateMessage(const char *Message);
|
2007-12-19 22:30:40 +00:00
|
|
|
void LLVMDisposeMessage(char *Message);
|
|
|
|
|
2013-10-17 01:38:28 +00:00
|
|
|
typedef void (*LLVMFatalErrorHandler)(const char *Reason);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Install a fatal error handler. By default, if LLVM detects a fatal error, it
|
|
|
|
* will call exit(1). This may not be appropriate in many contexts. For example,
|
|
|
|
* doing exit(1) will bypass many crash reporting/tracing system tools. This
|
|
|
|
* function allows you to install a callback that will be invoked prior to the
|
|
|
|
* call to exit(1).
|
|
|
|
*/
|
|
|
|
void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reset the fatal error handler. This resets LLVM's fatal error handling
|
|
|
|
* behavior to the default.
|
|
|
|
*/
|
|
|
|
void LLVMResetFatalErrorHandler(void);
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2013-11-03 00:29:47 +00:00
|
|
|
/**
|
2013-11-04 02:22:25 +00:00
|
|
|
* Enable LLVM's built-in stack trace code. This intercepts the OS's crash
|
|
|
|
* signals and prints which component of LLVM you were in at the time if the
|
|
|
|
* crash.
|
2013-11-03 00:29:47 +00:00
|
|
|
*/
|
2013-11-04 02:22:25 +00:00
|
|
|
void LLVMEnablePrettyStackTrace(void);
|
2013-11-03 00:29:47 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreContext Contexts
|
|
|
|
*
|
|
|
|
* Contexts are execution states for the core LLVM IR system.
|
|
|
|
*
|
|
|
|
* Most types are tied to a context instance. Multiple contexts can
|
|
|
|
* exist simultaneously. A single context is not thread safe. However,
|
|
|
|
* different contexts can execute on different threads simultaneously.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Create a new context.
|
|
|
|
*
|
|
|
|
* Every call to this function should be paired with a call to
|
|
|
|
* LLVMContextDispose() or the context will leak memory.
|
|
|
|
*/
|
2009-08-30 23:38:06 +00:00
|
|
|
LLVMContextRef LLVMContextCreate(void);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the global context instance.
|
|
|
|
*/
|
2009-08-30 23:38:06 +00:00
|
|
|
LLVMContextRef LLVMGetGlobalContext(void);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy a context instance.
|
|
|
|
*
|
|
|
|
* This should be called for every call to LLVMContextCreate() or memory
|
|
|
|
* will be leaked.
|
|
|
|
*/
|
2009-07-01 16:58:40 +00:00
|
|
|
void LLVMContextDispose(LLVMContextRef C);
|
|
|
|
|
2010-02-28 09:45:59 +00:00
|
|
|
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
|
|
|
|
unsigned SLen);
|
|
|
|
unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreModule Modules
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* Modules represent the top-level structure in an LLVM program. An LLVM
|
2012-03-21 03:54:29 +00:00
|
|
|
* module is effectively a translation unit or a collection of
|
|
|
|
* translation units merged together.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new, empty module in the global context.
|
|
|
|
*
|
|
|
|
* This is equivalent to calling LLVMModuleCreateWithNameInContext with
|
|
|
|
* LLVMGetGlobalContext() as the context parameter.
|
|
|
|
*
|
|
|
|
* Every invocation should be paired with LLVMDisposeModule() or memory
|
|
|
|
* will be leaked.
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new, empty module in a specific context.
|
|
|
|
*
|
|
|
|
* Every invocation should be paired with LLVMDisposeModule() or memory
|
|
|
|
* will be leaked.
|
|
|
|
*/
|
2009-07-02 07:17:57 +00:00
|
|
|
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
|
|
|
|
LLVMContextRef C);
|
2008-03-07 19:13:06 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Destroy a module instance.
|
|
|
|
*
|
|
|
|
* This must be called for every created module or memory will be
|
|
|
|
* leaked.
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMDisposeModule(LLVMModuleRef M);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the data layout for a module.
|
|
|
|
*
|
|
|
|
* @see Module::getDataLayout()
|
|
|
|
*/
|
2007-12-27 20:13:47 +00:00
|
|
|
const char *LLVMGetDataLayout(LLVMModuleRef M);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the data layout for a module.
|
|
|
|
*
|
|
|
|
* @see Module::setDataLayout()
|
|
|
|
*/
|
2007-12-27 20:13:47 +00:00
|
|
|
void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the target triple for a module.
|
|
|
|
*
|
|
|
|
* @see Module::getTargetTriple()
|
|
|
|
*/
|
2007-12-27 20:13:47 +00:00
|
|
|
const char *LLVMGetTarget(LLVMModuleRef M);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the target triple for a module.
|
|
|
|
*
|
|
|
|
* @see Module::setTargetTriple()
|
|
|
|
*/
|
2007-12-27 20:13:47 +00:00
|
|
|
void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Dump a representation of a module to stderr.
|
|
|
|
*
|
|
|
|
* @see Module::dump()
|
|
|
|
*/
|
2008-03-14 23:58:56 +00:00
|
|
|
void LLVMDumpModule(LLVMModuleRef M);
|
|
|
|
|
2012-05-09 16:54:17 +00:00
|
|
|
/**
|
|
|
|
* Print a representation of a module to a file. The ErrorMessage needs to be
|
|
|
|
* disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
|
|
|
|
*
|
|
|
|
* @see Module::print()
|
|
|
|
*/
|
|
|
|
LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
|
|
|
|
char **ErrorMessage);
|
|
|
|
|
2013-10-16 18:00:54 +00:00
|
|
|
/**
|
|
|
|
* Return a string representation of the module. Use
|
|
|
|
* LLVMDisposeMessage to free the string.
|
|
|
|
*
|
|
|
|
* @see Module::print()
|
|
|
|
*/
|
|
|
|
char *LLVMPrintModuleToString(LLVMModuleRef M);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Set inline assembly for a module.
|
|
|
|
*
|
|
|
|
* @see Module::setModuleInlineAsm()
|
|
|
|
*/
|
2010-04-10 17:52:58 +00:00
|
|
|
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the context to which this module is associated.
|
|
|
|
*
|
|
|
|
* @see Module::getContext()
|
|
|
|
*/
|
2010-11-28 20:03:44 +00:00
|
|
|
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain a Type from a module by its registered name.
|
|
|
|
*/
|
|
|
|
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of operands for named metadata in a module.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::getNamedMetadata()
|
|
|
|
*/
|
|
|
|
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char* name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the named metadata operands for a module.
|
|
|
|
*
|
|
|
|
* The passed LLVMValueRef pointer should refer to an array of
|
|
|
|
* LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
|
|
|
|
* array will be populated with the LLVMValueRef instances. Each
|
|
|
|
* instance corresponds to a llvm::MDNode.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::getNamedMetadata()
|
|
|
|
* @see llvm::MDNode::getOperand()
|
|
|
|
*/
|
|
|
|
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char* name, LLVMValueRef *Dest);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an operand to named metadata.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::getNamedMetadata()
|
|
|
|
* @see llvm::MDNode::addOperand()
|
|
|
|
*/
|
|
|
|
void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char* name,
|
|
|
|
LLVMValueRef Val);
|
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* Add a function to a module under a specified name.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::Create()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
|
|
|
|
LLVMTypeRef FunctionTy);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a Function value from a Module by its name.
|
|
|
|
*
|
|
|
|
* The returned value corresponds to a llvm::Function value.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::getFunction()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain an iterator to the first Function in a Module.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::begin()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain an iterator to the last Function in a Module.
|
|
|
|
*
|
|
|
|
* @see llvm::Module::end()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Advance a Function iterator to the next Function.
|
|
|
|
*
|
|
|
|
* Returns NULL if the iterator was already at the end and there are no more
|
|
|
|
* functions.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Decrement a Function iterator to the previous Function.
|
|
|
|
*
|
|
|
|
* Returns NULL if the iterator was already at the beginning and there are
|
|
|
|
* no previous functions.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreType Types
|
|
|
|
*
|
|
|
|
* Types represent the type of a value.
|
|
|
|
*
|
|
|
|
* Types are associated with a context instance. The context internally
|
|
|
|
* deduplicates types so there is only 1 instance of a specific type
|
|
|
|
* alive at a time. In other words, a unique type is shared among all
|
|
|
|
* consumers within a context.
|
|
|
|
*
|
|
|
|
* A Type in the C API corresponds to llvm::Type.
|
|
|
|
*
|
|
|
|
* Types have the following hierarchy:
|
|
|
|
*
|
2007-09-18 03:18:57 +00:00
|
|
|
* types:
|
|
|
|
* integer type
|
|
|
|
* real type
|
|
|
|
* function type
|
|
|
|
* sequence types:
|
|
|
|
* array type
|
|
|
|
* pointer type
|
|
|
|
* vector type
|
|
|
|
* void type
|
|
|
|
* label type
|
|
|
|
* opaque type
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* @{
|
2007-09-18 03:18:57 +00:00
|
|
|
*/
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the enumerated type of a Type instance.
|
|
|
|
*
|
|
|
|
* @see llvm::Type:getTypeID()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the type has a known size.
|
|
|
|
*
|
|
|
|
* Things that don't have a size are abstract types, labels, and void.a
|
|
|
|
*
|
|
|
|
* @see llvm::Type::isSized()
|
|
|
|
*/
|
2011-10-06 12:13:28 +00:00
|
|
|
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty);
|
2008-03-07 19:13:06 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the context to which this type instance is associated.
|
|
|
|
*
|
|
|
|
* @see llvm::Type::getContext()
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
|
|
|
|
|
2013-10-16 21:30:25 +00:00
|
|
|
/**
|
|
|
|
* Dump a representation of a type to stderr.
|
|
|
|
*
|
|
|
|
* @see llvm::Type::dump()
|
|
|
|
*/
|
|
|
|
void LLVMDumpType(LLVMTypeRef Val);
|
|
|
|
|
2013-10-22 06:58:34 +00:00
|
|
|
/**
|
|
|
|
* Return a string representation of the type. Use
|
|
|
|
* LLVMDisposeMessage to free the string.
|
|
|
|
*
|
|
|
|
* @see llvm::Type::print()
|
|
|
|
*/
|
|
|
|
char *LLVMPrintTypeToString(LLVMTypeRef Val);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeInt Integer Types
|
|
|
|
*
|
|
|
|
* Functions in this section operate on integer types.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain an integer type from a context with specified bit width.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain an integer type from the global context with a specified bit
|
|
|
|
* width.
|
|
|
|
*/
|
2008-05-04 12:55:34 +00:00
|
|
|
LLVMTypeRef LLVMInt1Type(void);
|
|
|
|
LLVMTypeRef LLVMInt8Type(void);
|
|
|
|
LLVMTypeRef LLVMInt16Type(void);
|
|
|
|
LLVMTypeRef LLVMInt32Type(void);
|
|
|
|
LLVMTypeRef LLVMInt64Type(void);
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMIntType(unsigned NumBits);
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeFloat Floating Point Types
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 16-bit floating point type from a context.
|
|
|
|
*/
|
2011-12-17 00:04:22 +00:00
|
|
|
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 32-bit floating point type from a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 64-bit floating point type from a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 80-bit floating point type (X87) from a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 128-bit floating point type (112-bit mantissa) from a
|
|
|
|
* context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a 128-bit floating point type (two 64-bits) from a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain a floating point type from the global context.
|
|
|
|
*
|
|
|
|
* These map to the functions in this group of the same name.
|
|
|
|
*/
|
2011-12-17 00:04:22 +00:00
|
|
|
LLVMTypeRef LLVMHalfType(void);
|
2008-05-04 12:55:34 +00:00
|
|
|
LLVMTypeRef LLVMFloatType(void);
|
|
|
|
LLVMTypeRef LLVMDoubleType(void);
|
|
|
|
LLVMTypeRef LLVMX86FP80Type(void);
|
|
|
|
LLVMTypeRef LLVMFP128Type(void);
|
|
|
|
LLVMTypeRef LLVMPPCFP128Type(void);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeFunction Function Types
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a function type consisting of a specified signature.
|
|
|
|
*
|
|
|
|
* The function is defined as a tuple of a return Type, a list of
|
|
|
|
* parameter types, and whether the function is variadic.
|
|
|
|
*/
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
|
|
|
|
LLVMTypeRef *ParamTypes, unsigned ParamCount,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool IsVarArg);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether a function type is variadic.
|
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the Type this function Type returns.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of parameters this function accepts.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the types of a function's parameters.
|
|
|
|
*
|
|
|
|
* The Dest parameter should point to a pre-allocated array of
|
|
|
|
* LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
|
|
|
|
* first LLVMCountParamTypes() entries in the array will be populated
|
|
|
|
* with LLVMTypeRef instances.
|
|
|
|
*
|
|
|
|
* @param FunctionTy The function type to operate on.
|
|
|
|
* @param Dest Memory address of an array to be filled with result.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeStruct Structure Types
|
|
|
|
*
|
|
|
|
* These functions relate to LLVMTypeRef instances.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new structure type in a context.
|
|
|
|
*
|
|
|
|
* A structure is specified by a list of inner elements/types and
|
|
|
|
* whether these can be packed together.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::create()
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
|
2010-01-09 22:27:07 +00:00
|
|
|
unsigned ElementCount, LLVMBool Packed);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new structure type in the global context.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::create()
|
|
|
|
*/
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool Packed);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create an empty structure in a context having a specified name.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::create()
|
|
|
|
*/
|
2011-07-14 05:53:17 +00:00
|
|
|
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the name of a structure.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::getName()
|
|
|
|
*/
|
2011-10-06 12:12:50 +00:00
|
|
|
const char *LLVMGetStructName(LLVMTypeRef Ty);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the contents of a structure type.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::setBody()
|
|
|
|
*/
|
2011-07-14 05:53:17 +00:00
|
|
|
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
|
|
|
|
unsigned ElementCount, LLVMBool Packed);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Get the number of elements defined inside the structure.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::getNumElements()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the elements within a structure.
|
|
|
|
*
|
|
|
|
* The function is passed the address of a pre-allocated array of
|
|
|
|
* LLVMTypeRef at least LLVMCountStructElementTypes() long. After
|
|
|
|
* invocation, this array will be populated with the structure's
|
|
|
|
* elements. The objects in the destination array will have a lifetime
|
|
|
|
* of the structure type itself, which is the lifetime of the context it
|
|
|
|
* is contained in.
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether a structure is packed.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::isPacked()
|
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether a structure is opaque.
|
|
|
|
*
|
|
|
|
* @see llvm::StructType::isOpaque()
|
|
|
|
*/
|
2011-07-14 16:20:28 +00:00
|
|
|
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeSequential Sequential Types
|
|
|
|
*
|
|
|
|
* Sequential types represents "arrays" of types. This is a super class
|
|
|
|
* for array, vector, and pointer types.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the type of elements within a sequential type.
|
|
|
|
*
|
|
|
|
* This works on array, vector, and pointer types.
|
|
|
|
*
|
|
|
|
* @see llvm::SequentialType::getElementType()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a fixed size array type that refers to a specific type.
|
|
|
|
*
|
|
|
|
* The created type will exist in the context that its element type
|
|
|
|
* exists in.
|
|
|
|
*
|
|
|
|
* @see llvm::ArrayType::get()
|
|
|
|
*/
|
|
|
|
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the length of an array type.
|
|
|
|
*
|
|
|
|
* This only works on types that represent arrays.
|
|
|
|
*
|
|
|
|
* @see llvm::ArrayType::getNumElements()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a pointer type that points to a defined type.
|
|
|
|
*
|
|
|
|
* The created type will exist in the context that its pointee type
|
|
|
|
* exists in.
|
|
|
|
*
|
|
|
|
* @see llvm::PointerType::get()
|
|
|
|
*/
|
|
|
|
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the address space of a pointer type.
|
|
|
|
*
|
|
|
|
* This only works on types that represent pointers.
|
|
|
|
*
|
|
|
|
* @see llvm::PointerType::getAddressSpace()
|
|
|
|
*/
|
2007-12-17 16:08:32 +00:00
|
|
|
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a vector type that contains a defined type and has a specific
|
|
|
|
* number of elements.
|
|
|
|
*
|
|
|
|
* The created type will exist in the context thats its element type
|
|
|
|
* exists in.
|
|
|
|
*
|
|
|
|
* @see llvm::VectorType::get()
|
|
|
|
*/
|
|
|
|
LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of elements in a vector type.
|
|
|
|
*
|
|
|
|
* This only works on types that represent vectors.
|
|
|
|
*
|
|
|
|
* @see llvm::VectorType::getNumElements()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreTypeOther Other Types
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a void type in a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a label type in a context.
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a X86 MMX type in a context.
|
|
|
|
*/
|
2010-09-10 21:58:02 +00:00
|
|
|
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
|
2009-08-14 00:01:31 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* These are similar to the above functions except they operate on the
|
|
|
|
* global context.
|
|
|
|
*/
|
2008-05-04 12:55:34 +00:00
|
|
|
LLVMTypeRef LLVMVoidType(void);
|
|
|
|
LLVMTypeRef LLVMLabelType(void);
|
2010-09-10 21:58:02 +00:00
|
|
|
LLVMTypeRef LLVMX86MMXType(void);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValues Values
|
|
|
|
*
|
|
|
|
* The bulk of LLVM's object model consists of values, which comprise a very
|
2007-09-18 03:18:57 +00:00
|
|
|
* rich type hierarchy.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* LLVMValueRef essentially represents llvm::Value. There is a rich
|
|
|
|
* hierarchy of classes within this type. Depending on the instance
|
2012-08-10 18:30:44 +00:00
|
|
|
* obtained, not all APIs are available.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* Callers can determine the type of an LLVMValueRef by calling the
|
2012-03-21 03:54:29 +00:00
|
|
|
* LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
|
|
|
|
* functions are defined by a macro, so it isn't obvious which are
|
|
|
|
* available by looking at the Doxygen source code. Instead, look at the
|
|
|
|
* source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
|
|
|
|
* of value names given. These value names also correspond to classes in
|
|
|
|
* the llvm::Value hierarchy.
|
|
|
|
*
|
|
|
|
* @{
|
2007-09-18 03:18:57 +00:00
|
|
|
*/
|
|
|
|
|
2008-12-19 18:39:45 +00:00
|
|
|
#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
|
|
|
|
macro(Argument) \
|
|
|
|
macro(BasicBlock) \
|
|
|
|
macro(InlineAsm) \
|
2011-10-14 20:37:56 +00:00
|
|
|
macro(MDNode) \
|
|
|
|
macro(MDString) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(User) \
|
|
|
|
macro(Constant) \
|
2011-10-14 20:37:56 +00:00
|
|
|
macro(BlockAddress) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(ConstantAggregateZero) \
|
|
|
|
macro(ConstantArray) \
|
2013-11-05 12:55:37 +00:00
|
|
|
macro(ConstantDataSequential) \
|
|
|
|
macro(ConstantDataArray) \
|
|
|
|
macro(ConstantDataVector) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(ConstantExpr) \
|
|
|
|
macro(ConstantFP) \
|
|
|
|
macro(ConstantInt) \
|
|
|
|
macro(ConstantPointerNull) \
|
|
|
|
macro(ConstantStruct) \
|
|
|
|
macro(ConstantVector) \
|
|
|
|
macro(GlobalValue) \
|
|
|
|
macro(Function) \
|
|
|
|
macro(GlobalAlias) \
|
|
|
|
macro(GlobalVariable) \
|
|
|
|
macro(UndefValue) \
|
|
|
|
macro(Instruction) \
|
|
|
|
macro(BinaryOperator) \
|
|
|
|
macro(CallInst) \
|
|
|
|
macro(IntrinsicInst) \
|
|
|
|
macro(DbgInfoIntrinsic) \
|
|
|
|
macro(DbgDeclareInst) \
|
|
|
|
macro(MemIntrinsic) \
|
|
|
|
macro(MemCpyInst) \
|
|
|
|
macro(MemMoveInst) \
|
|
|
|
macro(MemSetInst) \
|
|
|
|
macro(CmpInst) \
|
2011-10-14 20:37:56 +00:00
|
|
|
macro(FCmpInst) \
|
|
|
|
macro(ICmpInst) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(ExtractElementInst) \
|
|
|
|
macro(GetElementPtrInst) \
|
|
|
|
macro(InsertElementInst) \
|
|
|
|
macro(InsertValueInst) \
|
2011-08-12 20:24:12 +00:00
|
|
|
macro(LandingPadInst) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(PHINode) \
|
|
|
|
macro(SelectInst) \
|
|
|
|
macro(ShuffleVectorInst) \
|
|
|
|
macro(StoreInst) \
|
|
|
|
macro(TerminatorInst) \
|
|
|
|
macro(BranchInst) \
|
2011-10-14 20:37:56 +00:00
|
|
|
macro(IndirectBrInst) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(InvokeInst) \
|
|
|
|
macro(ReturnInst) \
|
|
|
|
macro(SwitchInst) \
|
|
|
|
macro(UnreachableInst) \
|
2011-07-31 06:30:59 +00:00
|
|
|
macro(ResumeInst) \
|
2013-05-06 08:55:45 +00:00
|
|
|
macro(UnaryInstruction) \
|
|
|
|
macro(AllocaInst) \
|
|
|
|
macro(CastInst) \
|
2013-11-15 01:34:59 +00:00
|
|
|
macro(AddrSpaceCastInst) \
|
2013-05-06 08:55:45 +00:00
|
|
|
macro(BitCastInst) \
|
|
|
|
macro(FPExtInst) \
|
|
|
|
macro(FPToSIInst) \
|
|
|
|
macro(FPToUIInst) \
|
|
|
|
macro(FPTruncInst) \
|
|
|
|
macro(IntToPtrInst) \
|
|
|
|
macro(PtrToIntInst) \
|
|
|
|
macro(SExtInst) \
|
|
|
|
macro(SIToFPInst) \
|
|
|
|
macro(TruncInst) \
|
|
|
|
macro(UIToFPInst) \
|
|
|
|
macro(ZExtInst) \
|
|
|
|
macro(ExtractValueInst) \
|
|
|
|
macro(LoadInst) \
|
|
|
|
macro(VAArgInst)
|
2008-12-19 18:39:45 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueGeneral General APIs
|
|
|
|
*
|
|
|
|
* Functions in this section work on all LLVMValueRef instances,
|
|
|
|
* regardless of their sub-type. They correspond to functions available
|
|
|
|
* on llvm::Value.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the type of a value.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::getType()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the string name of a value.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::getName()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
const char *LLVMGetValueName(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the string name of a value.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::setName()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMSetValueName(LLVMValueRef Val, const char *Name);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dump a representation of a value to stderr.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::dump()
|
|
|
|
*/
|
2007-10-06 00:08:49 +00:00
|
|
|
void LLVMDumpValue(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
2013-11-06 09:21:01 +00:00
|
|
|
/**
|
|
|
|
* Return a string representation of the value. Use
|
|
|
|
* LLVMDisposeMessage to free the string.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::print()
|
|
|
|
*/
|
|
|
|
char *LLVMPrintValueToString(LLVMValueRef Val);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Replace all uses of a value with another one.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::replaceAllUsesWith()
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Determine whether the specified constant instance is constant.
|
|
|
|
*/
|
|
|
|
LLVMBool LLVMIsConstant(LLVMValueRef Val);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether a value instance is undefined.
|
|
|
|
*/
|
|
|
|
LLVMBool LLVMIsUndef(LLVMValueRef Val);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert value instances between types.
|
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* Internally, an LLVMValueRef is "pinned" to a specific type. This
|
2012-03-21 03:54:29 +00:00
|
|
|
* series of functions allows you to cast an instance to a specific
|
|
|
|
* type.
|
|
|
|
*
|
|
|
|
* If the cast is not valid for the specified type, NULL is returned.
|
|
|
|
*
|
|
|
|
* @see llvm::dyn_cast_or_null<>
|
|
|
|
*/
|
2008-12-19 18:39:45 +00:00
|
|
|
#define LLVM_DECLARE_VALUE_CAST(name) \
|
|
|
|
LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
|
|
|
|
LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueUses Usage
|
|
|
|
*
|
|
|
|
* This module defines functions that allow you to inspect the uses of a
|
|
|
|
* LLVMValueRef.
|
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
|
2012-03-21 03:54:29 +00:00
|
|
|
* Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
|
|
|
|
* llvm::User and llvm::Value.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the first use of a value.
|
|
|
|
*
|
|
|
|
* Uses are obtained in an iterator fashion. First, call this function
|
|
|
|
* to obtain a reference to the first use. Then, call LLVMGetNextUse()
|
2012-08-10 18:30:44 +00:00
|
|
|
* on that instance and all subsequently obtained instances until
|
2012-03-21 03:54:29 +00:00
|
|
|
* LLVMGetNextUse() returns NULL.
|
|
|
|
*
|
|
|
|
* @see llvm::Value::use_begin()
|
|
|
|
*/
|
2010-03-02 20:32:28 +00:00
|
|
|
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the next use of a value.
|
|
|
|
*
|
|
|
|
* This effectively advances the iterator. It returns NULL if you are on
|
|
|
|
* the final use and no more are available.
|
|
|
|
*/
|
2010-03-02 20:32:28 +00:00
|
|
|
LLVMUseRef LLVMGetNextUse(LLVMUseRef U);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the user value for a user.
|
|
|
|
*
|
|
|
|
* The returned value corresponds to a llvm::User type.
|
|
|
|
*
|
|
|
|
* @see llvm::Use::getUser()
|
|
|
|
*/
|
2010-03-02 20:32:28 +00:00
|
|
|
LLVMValueRef LLVMGetUser(LLVMUseRef U);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the value this use corresponds to.
|
|
|
|
*
|
|
|
|
* @see llvm::Use::get().
|
|
|
|
*/
|
2010-03-02 20:32:28 +00:00
|
|
|
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U);
|
2009-10-12 04:01:02 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* @defgroup LLVMCCoreValueUser User value
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* Function in this group pertain to LLVMValueRef instances that descent
|
|
|
|
* from llvm::User. This includes constants, instructions, and
|
|
|
|
* operators.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain an operand at a specific index in a llvm::User value.
|
|
|
|
*
|
|
|
|
* @see llvm::User::getOperand()
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an operand at a specific index in a llvm::User value.
|
|
|
|
*
|
|
|
|
* @see llvm::User::setOperand()
|
|
|
|
*/
|
2010-08-20 14:51:22 +00:00
|
|
|
void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of operands in a llvm::User value.
|
|
|
|
*
|
|
|
|
* @see llvm::User::getNumOperands()
|
|
|
|
*/
|
2010-08-20 14:51:22 +00:00
|
|
|
int LLVMGetNumOperands(LLVMValueRef Val);
|
2009-10-12 04:01:02 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* @defgroup LLVMCCoreValueConstant Constants
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* This section contains APIs for interacting with LLVMValueRef that
|
|
|
|
* correspond to llvm::Constant instances.
|
|
|
|
*
|
|
|
|
* These functions will work for any LLVMValueRef in the llvm::Constant
|
|
|
|
* class hierarchy.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value referring to the null instance of a type.
|
|
|
|
*
|
|
|
|
* @see llvm::Constant::getNullValue()
|
|
|
|
*/
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value referring to the instance of a type
|
|
|
|
* consisting of all ones.
|
|
|
|
*
|
|
|
|
* This is only valid for integer types.
|
|
|
|
*
|
|
|
|
* @see llvm::Constant::getAllOnesValue()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value referring to an undefined value of a type.
|
|
|
|
*
|
|
|
|
* @see llvm::UndefValue::get()
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether a value instance is null.
|
|
|
|
*
|
|
|
|
* @see llvm::Constant::isNullValue()
|
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsNull(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant that is a constant pointer pointing to NULL for a
|
|
|
|
* specified type.
|
|
|
|
*/
|
2009-07-06 17:29:59 +00:00
|
|
|
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueConstantScalar Scalar constants
|
|
|
|
*
|
|
|
|
* Functions in this group model LLVMValueRef instances that correspond
|
|
|
|
* to constants referring to scalar types.
|
|
|
|
*
|
|
|
|
* For integer types, the LLVMTypeRef parameter should correspond to a
|
|
|
|
* llvm::IntegerType instance and the returned LLVMValueRef will
|
|
|
|
* correspond to a llvm::ConstantInt.
|
|
|
|
*
|
|
|
|
* For floating point types, the LLVMTypeRef returned corresponds to a
|
|
|
|
* llvm::ConstantFP.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2010-02-28 09:45:59 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain a constant value for an integer type.
|
|
|
|
*
|
|
|
|
* The returned value corresponds to a llvm::ConstantInt.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::get()
|
|
|
|
*
|
|
|
|
* @param IntTy Integer type to obtain value of.
|
|
|
|
* @param N The value the returned instance should refer to.
|
|
|
|
* @param SignExtend Whether to sign extend the produced value.
|
|
|
|
*/
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool SignExtend);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value for an integer of arbitrary precision.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::get()
|
|
|
|
*/
|
2010-11-23 02:47:22 +00:00
|
|
|
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
|
|
|
|
unsigned NumWords,
|
|
|
|
const uint64_t Words[]);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value for an integer parsed from a string.
|
|
|
|
*
|
|
|
|
* A similar API, LLVMConstIntOfStringAndSize is also available. If the
|
|
|
|
* string's length is available, it is preferred to call that function
|
|
|
|
* instead.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::get()
|
|
|
|
*/
|
2009-08-16 23:36:46 +00:00
|
|
|
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
|
|
|
|
uint8_t Radix);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value for an integer parsed from a string with
|
|
|
|
* specified length.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::get()
|
|
|
|
*/
|
2009-08-16 23:36:46 +00:00
|
|
|
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
|
|
|
|
unsigned SLen, uint8_t Radix);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant value referring to a double floating point value.
|
|
|
|
*/
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant for a floating point value parsed from a string.
|
|
|
|
*
|
|
|
|
* A similar API, LLVMConstRealOfStringAndSize is also available. It
|
|
|
|
* should be used if the input string's length is known.
|
|
|
|
*/
|
2008-02-02 01:07:50 +00:00
|
|
|
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a constant for a floating point value parsed from a string.
|
|
|
|
*/
|
2009-08-16 23:36:46 +00:00
|
|
|
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
|
|
|
|
unsigned SLen);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the zero extended value for an integer constant value.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::getZExtValue()
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the sign extended value for an integer constant value.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantInt::getSExtValue()
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
|
2009-08-16 23:36:46 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* @defgroup LLVMCCoreValueConstantComposite Composite Constants
|
|
|
|
*
|
|
|
|
* Functions in this group operate on composite constants.
|
|
|
|
*
|
|
|
|
* @{
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create a ConstantDataSequential and initialize it with a string.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* @see llvm::ConstantDataArray::getString()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
|
|
|
|
unsigned Length, LLVMBool DontNullTerminate);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create a ConstantDataSequential with string content in the global context.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* This is the same as LLVMConstStringInContext except it operates on the
|
|
|
|
* global context.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* @see LLVMConstStringInContext()
|
|
|
|
* @see llvm::ConstantDataArray::getString()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
|
|
|
|
LLVMBool DontNullTerminate);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create an anonymous ConstantStruct with the specified values.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantStruct::getAnon()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
|
|
|
|
LLVMValueRef *ConstantVals,
|
|
|
|
unsigned Count, LLVMBool Packed);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create a ConstantStruct in the global Context.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* This is the same as LLVMConstStructInContext except it operates on the
|
|
|
|
* global Context.
|
|
|
|
*
|
|
|
|
* @see LLVMConstStructInContext()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
|
|
|
|
LLVMBool Packed);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create a ConstantArray from values.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantArray::get()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
|
|
|
|
LLVMValueRef *ConstantVals, unsigned Length);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* Create a non-anonymous ConstantStruct from values.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* @see llvm::ConstantStruct::get()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2012-03-21 07:28:27 +00:00
|
|
|
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
|
|
|
LLVMValueRef *ConstantVals,
|
|
|
|
unsigned Count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a ConstantVector from values.
|
|
|
|
*
|
|
|
|
* @see llvm::ConstantVector::get()
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2012-03-21 07:28:27 +00:00
|
|
|
* @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
|
|
|
|
*
|
|
|
|
* Functions in this group correspond to APIs on llvm::ConstantExpr.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
2012-03-21 07:28:27 +00:00
|
|
|
* @see llvm::ConstantExpr.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal);
|
2009-08-19 08:36:49 +00:00
|
|
|
LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
|
|
|
|
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
|
|
|
|
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
|
|
|
|
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2009-09-03 23:34:49 +00:00
|
|
|
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2009-09-03 23:34:49 +00:00
|
|
|
LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
|
|
|
|
LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,
|
|
|
|
LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
|
|
|
LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal,
|
|
|
|
LLVMValueRef *ConstantIndices, unsigned NumIndices);
|
2009-09-03 23:34:49 +00:00
|
|
|
LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal,
|
|
|
|
LLVMValueRef *ConstantIndices,
|
|
|
|
unsigned NumIndices);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
2013-11-15 01:34:59 +00:00
|
|
|
LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal,
|
|
|
|
LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal,
|
|
|
|
LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal,
|
|
|
|
LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
|
|
|
|
LLVMTypeRef ToType);
|
|
|
|
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool isSigned);
|
2009-08-16 02:20:12 +00:00
|
|
|
LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
2007-10-06 14:29:36 +00:00
|
|
|
LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
|
|
|
|
LLVMValueRef ConstantIfTrue,
|
|
|
|
LLVMValueRef ConstantIfFalse);
|
|
|
|
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant,
|
|
|
|
LLVMValueRef IndexConstant);
|
|
|
|
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
|
|
|
|
LLVMValueRef ElementValueConstant,
|
|
|
|
LLVMValueRef IndexConstant);
|
|
|
|
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
|
|
|
|
LLVMValueRef VectorBConstant,
|
|
|
|
LLVMValueRef MaskConstant);
|
2008-11-03 22:55:43 +00:00
|
|
|
LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
|
|
|
|
unsigned NumIdx);
|
|
|
|
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
|
|
|
LLVMValueRef ElementValueConstant,
|
|
|
|
unsigned *IdxList, unsigned NumIdx);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
|
2008-12-17 21:39:50 +00:00
|
|
|
const char *AsmString, const char *Constraints,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool HasSideEffects, LLVMBool IsAlignStack);
|
2010-02-28 09:46:06 +00:00
|
|
|
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB);
|
2007-10-06 14:29:36 +00:00
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueConstantGlobals Global Values
|
|
|
|
*
|
|
|
|
* This group contains functions that operate on global values. Functions in
|
|
|
|
* this group relate to functions in the llvm::GlobalValue class tree.
|
|
|
|
*
|
|
|
|
* @see llvm::GlobalValue
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2008-03-19 01:11:35 +00:00
|
|
|
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsDeclaration(LLVMValueRef Global);
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMLinkage LLVMGetLinkage(LLVMValueRef Global);
|
|
|
|
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
|
|
|
|
const char *LLVMGetSection(LLVMValueRef Global);
|
|
|
|
void LLVMSetSection(LLVMValueRef Global, const char *Section);
|
|
|
|
LLVMVisibility LLVMGetVisibility(LLVMValueRef Global);
|
|
|
|
void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
|
2013-10-29 09:02:02 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueWithAlignment Values with alignment
|
|
|
|
*
|
|
|
|
* Functions in this group only apply to values with alignment, i.e.
|
|
|
|
* global variables, load and store instructions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the preferred alignment of the value.
|
|
|
|
* @see llvm::LoadInst::getAlignment()
|
|
|
|
* @see llvm::StoreInst::getAlignment()
|
|
|
|
* @see llvm::GlobalValue::getAlignment()
|
|
|
|
*/
|
|
|
|
unsigned LLVMGetAlignment(LLVMValueRef V);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the preferred alignment of the value.
|
|
|
|
* @see llvm::LoadInst::setAlignment()
|
|
|
|
* @see llvm::StoreInst::setAlignment()
|
|
|
|
* @see llvm::GlobalValue::setAlignment()
|
|
|
|
*/
|
|
|
|
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
|
|
|
|
*
|
|
|
|
* This group contains functions that operate on global variable values.
|
|
|
|
*
|
|
|
|
* @see llvm::GlobalVariable
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name);
|
2010-02-28 09:46:13 +00:00
|
|
|
LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
|
|
|
|
const char *Name,
|
|
|
|
unsigned AddressSpace);
|
2007-10-08 03:45:09 +00:00
|
|
|
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
|
|
|
|
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
|
|
|
|
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
|
|
|
|
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
|
|
|
|
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
|
|
|
|
void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar);
|
|
|
|
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
|
|
|
|
LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
|
|
|
|
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant);
|
2013-04-16 08:58:59 +00:00
|
|
|
LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar);
|
|
|
|
void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode);
|
|
|
|
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar);
|
|
|
|
void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
|
|
|
|
*
|
|
|
|
* This group contains function that operate on global alias values.
|
|
|
|
*
|
|
|
|
* @see llvm::GlobalAlias
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2008-12-17 21:39:50 +00:00
|
|
|
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
|
|
|
|
const char *Name);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueFunction Function values
|
|
|
|
*
|
|
|
|
* Functions in this group operate on LLVMValueRef instances that
|
|
|
|
* correspond to llvm::Function instances.
|
|
|
|
*
|
|
|
|
* @see llvm::Function
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a function from its containing module and deletes it.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::eraseFromParent()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMDeleteFunction(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the ID number from a function instance.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::getIntrinsicID()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the calling function of a function.
|
|
|
|
*
|
|
|
|
* The returned value corresponds to the LLVMCallConv enumeration.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::getCallingConv()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the calling convention of a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::setCallingConv()
|
|
|
|
*
|
|
|
|
* @param Fn Function to operate on
|
|
|
|
* @param CC LLVMCallConv to set calling convention to
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the name of the garbage collector to use during code
|
|
|
|
* generation.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::getGC()
|
|
|
|
*/
|
2008-08-17 18:44:35 +00:00
|
|
|
const char *LLVMGetGC(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the garbage collector to use during code generation.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::setGC()
|
|
|
|
*/
|
2008-08-17 18:44:35 +00:00
|
|
|
void LLVMSetGC(LLVMValueRef Fn, const char *Name);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an attribute to a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::addAttribute()
|
|
|
|
*/
|
2009-05-06 12:21:17 +00:00
|
|
|
void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
2013-04-16 23:12:43 +00:00
|
|
|
/**
|
|
|
|
* Add a target-dependent attribute to a fuction
|
|
|
|
* @see llvm::AttrBuilder::addAttribute()
|
|
|
|
*/
|
|
|
|
void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
|
|
|
|
const char *V);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain an attribute from a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::getAttributes()
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove an attribute from a function.
|
|
|
|
*/
|
2009-05-06 12:21:17 +00:00
|
|
|
void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueFunctionParameters Function Parameters
|
|
|
|
*
|
|
|
|
* Functions in this group relate to arguments/parameters on functions.
|
|
|
|
*
|
|
|
|
* Functions in this group expect LLVMValueRef instances that correspond
|
|
|
|
* to llvm::Function instances.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of parameters in a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::arg_size()
|
|
|
|
*/
|
2008-03-19 01:11:35 +00:00
|
|
|
unsigned LLVMCountParams(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the parameters in a function.
|
|
|
|
*
|
|
|
|
* The takes a pointer to a pre-allocated array of LLVMValueRef that is
|
|
|
|
* at least LLVMCountParams() long. This array will be filled with
|
|
|
|
* LLVMValueRef instances which correspond to the parameters the
|
|
|
|
* function receives. Each LLVMValueRef corresponds to a llvm::Argument
|
|
|
|
* instance.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::arg_begin()
|
|
|
|
*/
|
2008-03-19 01:11:35 +00:00
|
|
|
void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the parameter at the specified index.
|
|
|
|
*
|
|
|
|
* Parameters are indexed from 0.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::arg_begin()
|
|
|
|
*/
|
2008-03-19 01:11:35 +00:00
|
|
|
LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the function to which this argument belongs.
|
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* Unlike other functions in this group, this one takes an LLVMValueRef
|
2012-03-21 03:54:29 +00:00
|
|
|
* that corresponds to a llvm::Attribute.
|
|
|
|
*
|
|
|
|
* The returned LLVMValueRef is the llvm::Function to which this
|
|
|
|
* argument belongs.
|
|
|
|
*/
|
2008-03-19 01:11:35 +00:00
|
|
|
LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the first parameter to a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::arg_begin()
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the last parameter to a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::arg_end()
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the next parameter to a function.
|
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
|
2012-03-21 03:54:29 +00:00
|
|
|
* actually a wrapped iterator) and obtains the next parameter from the
|
|
|
|
* underlying iterator.
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the previous parameter to a function.
|
|
|
|
*
|
|
|
|
* This is the opposite of LLVMGetNextParam().
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an attribute to a function argument.
|
|
|
|
*
|
|
|
|
* @see llvm::Argument::addAttr()
|
|
|
|
*/
|
2008-09-25 21:00:45 +00:00
|
|
|
void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove an attribute from a function argument.
|
|
|
|
*
|
|
|
|
* @see llvm::Argument::removeAttr()
|
|
|
|
*/
|
2008-09-25 21:00:45 +00:00
|
|
|
void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an attribute from a function argument.
|
|
|
|
*/
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the alignment for a function parameter.
|
|
|
|
*
|
|
|
|
* @see llvm::Argument::addAttr()
|
2012-10-15 20:35:56 +00:00
|
|
|
* @see llvm::AttrBuilder::addAlignmentAttr()
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2008-04-28 17:37:06 +00:00
|
|
|
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
|
2008-03-19 01:11:35 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2012-03-21 07:28:27 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueMetadata Metadata
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a MDString value from a context.
|
|
|
|
*
|
|
|
|
* The returned instance corresponds to the llvm::MDString class.
|
|
|
|
*
|
|
|
|
* The instance is specified by string data of a specified length. The
|
|
|
|
* string content is copied, so the backing memory can be freed after
|
|
|
|
* this function returns.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
|
|
|
|
unsigned SLen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a MDString value from the global context.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a MDNode value from a context.
|
|
|
|
*
|
|
|
|
* The returned value corresponds to the llvm::MDNode class.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
|
|
|
|
unsigned Count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain a MDNode value from the global context.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the underlying string from a MDString value.
|
|
|
|
*
|
|
|
|
* @param V Instance to obtain string from.
|
|
|
|
* @param Len Memory address which will hold length of returned string.
|
|
|
|
* @return String data in MDString.
|
|
|
|
*/
|
|
|
|
const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len);
|
|
|
|
|
2012-09-19 20:29:39 +00:00
|
|
|
/**
|
|
|
|
* Obtain the number of operands from an MDNode value.
|
|
|
|
*
|
|
|
|
* @param V MDNode to get number of operands from.
|
|
|
|
* @return Number of operands of the MDNode.
|
|
|
|
*/
|
|
|
|
unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the given MDNode's operands.
|
|
|
|
*
|
|
|
|
* The passed LLVMValueRef pointer should point to enough memory to hold all of
|
|
|
|
* the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
|
|
|
|
* LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
|
|
|
|
* MDNode's operands.
|
|
|
|
*
|
|
|
|
* @param V MDNode to get the operands from.
|
|
|
|
* @param Dest Destination array for operands.
|
|
|
|
*/
|
|
|
|
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueBasicBlock Basic Block
|
|
|
|
*
|
|
|
|
* A basic block represents a single entry single exit section of code.
|
|
|
|
* Basic blocks contain a list of instructions which form the body of
|
|
|
|
* the block.
|
|
|
|
*
|
|
|
|
* Basic blocks belong to functions. They have the type of label.
|
|
|
|
*
|
|
|
|
* Basic blocks are themselves values. However, the C API models them as
|
|
|
|
* LLVMBasicBlockRef.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a basic block instance to a value type.
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2013-08-16 23:30:19 +00:00
|
|
|
* Determine whether an LLVMValueRef is itself a basic block.
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2013-08-16 23:30:19 +00:00
|
|
|
* Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the function to which a basic block belongs.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::getParent()
|
|
|
|
*/
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the terminator instruction for a basic block.
|
|
|
|
*
|
|
|
|
* If the basic block does not have a terminator (it is not well-formed
|
|
|
|
* if it doesn't), then NULL is returned.
|
|
|
|
*
|
|
|
|
* The returned LLVMValueRef corresponds to a llvm::TerminatorInst.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::getTerminator()
|
|
|
|
*/
|
2011-08-23 20:27:46 +00:00
|
|
|
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of basic blocks in a function.
|
|
|
|
*
|
|
|
|
* @param Fn Function value to operate on.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain all of the basic blocks in a function.
|
|
|
|
*
|
|
|
|
* This operates on a function value. The BasicBlocks parameter is a
|
|
|
|
* pointer to a pre-allocated array of LLVMBasicBlockRef of at least
|
|
|
|
* LLVMCountBasicBlocks() in length. This array is populated with
|
|
|
|
* LLVMBasicBlockRef instances.
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the first basic block in a function.
|
|
|
|
*
|
|
|
|
* The returned basic block can be used as an iterator. You will likely
|
|
|
|
* eventually call into LLVMGetNextBasicBlock() with it.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::begin()
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the last basic block in a function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::end()
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Advance a basic block iterator.
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Go backwards in a basic block iterator.
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the basic block that corresponds to the entry point of a
|
|
|
|
* function.
|
|
|
|
*
|
|
|
|
* @see llvm::Function::getEntryBlock()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
|
2009-08-14 00:01:31 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Append a basic block to the end of a function.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::Create()
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
|
|
|
|
LLVMValueRef Fn,
|
|
|
|
const char *Name);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Append a basic block to the end of a function using the global
|
|
|
|
* context.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::Create()
|
|
|
|
*/
|
|
|
|
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a basic block in a function before another basic block.
|
|
|
|
*
|
|
|
|
* The function to add to is determined by the function of the
|
|
|
|
* passed basic block.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::Create()
|
|
|
|
*/
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C,
|
|
|
|
LLVMBasicBlockRef BB,
|
|
|
|
const char *Name);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Insert a basic block in a function using the global context.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::Create()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB,
|
|
|
|
const char *Name);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a basic block from a function and delete it.
|
|
|
|
*
|
|
|
|
* This deletes the basic block from its containing function and deletes
|
|
|
|
* the basic block itself.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::eraseFromParent()
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a basic block from a function.
|
|
|
|
*
|
|
|
|
* This deletes the basic block from its containing function but keep
|
|
|
|
* the basic block alive.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::removeFromParent()
|
|
|
|
*/
|
2011-08-23 20:27:46 +00:00
|
|
|
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Move a basic block to before another one.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::moveBefore()
|
|
|
|
*/
|
2010-07-19 15:31:07 +00:00
|
|
|
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move a basic block to after another one.
|
|
|
|
*
|
|
|
|
* @see llvm::BasicBlock::moveAfter()
|
|
|
|
*/
|
2010-07-19 15:31:07 +00:00
|
|
|
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain the first instruction in a basic block.
|
|
|
|
*
|
|
|
|
* The returned LLVMValueRef corresponds to a llvm::Instruction
|
|
|
|
* instance.
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the last instruction in a basic block.
|
|
|
|
*
|
2013-08-16 23:30:19 +00:00
|
|
|
* The returned LLVMValueRef corresponds to an LLVM:Instruction.
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB);
|
2011-08-23 20:27:46 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueInstruction Instructions
|
|
|
|
*
|
|
|
|
* Functions in this group relate to the inspection and manipulation of
|
|
|
|
* individual instructions.
|
|
|
|
*
|
|
|
|
* In the C++ API, an instruction is modeled by llvm::Instruction. This
|
|
|
|
* class has a large number of descendents. llvm::Instruction is a
|
|
|
|
* llvm::Value and in the C API, instructions are modeled by
|
|
|
|
* LLVMValueRef.
|
|
|
|
*
|
|
|
|
* This group also contains sub-groups which operate on specific
|
|
|
|
* llvm::Instruction types, e.g. llvm::CallInst.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether an instruction has any metadata attached.
|
|
|
|
*/
|
|
|
|
int LLVMHasMetadata(LLVMValueRef Val);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return metadata associated with an instruction value.
|
|
|
|
*/
|
|
|
|
LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set metadata associated with an instruction value.
|
|
|
|
*/
|
|
|
|
void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the basic block to which an instruction belongs.
|
|
|
|
*
|
|
|
|
* @see llvm::Instruction::getParent()
|
|
|
|
*/
|
2011-08-23 20:27:46 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the instruction that occurs after the one specified.
|
|
|
|
*
|
|
|
|
* The next instruction will be from the same basic block.
|
|
|
|
*
|
|
|
|
* If this is the last instruction in a basic block, NULL will be
|
|
|
|
* returned.
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2012-06-02 10:20:22 +00:00
|
|
|
* Obtain the instruction that occurred before this one.
|
2012-03-21 03:54:29 +00:00
|
|
|
*
|
|
|
|
* If the instruction is the first instruction in a basic block, NULL
|
|
|
|
* will be returned.
|
|
|
|
*/
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove and delete an instruction.
|
|
|
|
*
|
|
|
|
* The instruction specified is removed from its containing building
|
|
|
|
* block and then deleted.
|
|
|
|
*
|
|
|
|
* @see llvm::Instruction::eraseFromParent()
|
|
|
|
*/
|
2011-10-03 20:59:18 +00:00
|
|
|
void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the code opcode for an individual instruction.
|
|
|
|
*
|
|
|
|
* @see llvm::Instruction::getOpCode()
|
|
|
|
*/
|
2011-10-14 20:37:49 +00:00
|
|
|
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the predicate of an instruction.
|
|
|
|
*
|
|
|
|
* This is only valid for instructions that correspond to llvm::ICmpInst
|
|
|
|
* or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
|
|
|
|
*
|
|
|
|
* @see llvm::ICmpInst::getPredicate()
|
|
|
|
*/
|
2011-10-06 12:13:20 +00:00
|
|
|
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
|
2008-03-19 01:11:35 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
|
|
|
|
*
|
|
|
|
* Functions in this group apply to instructions that refer to call
|
|
|
|
* sites and invocations. These correspond to C++ types in the
|
|
|
|
* llvm::CallInst class tree.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the calling convention for a call instruction.
|
|
|
|
*
|
|
|
|
* This expects an LLVMValueRef that corresponds to a llvm::CallInst or
|
|
|
|
* llvm::InvokeInst.
|
|
|
|
*
|
|
|
|
* @see llvm::CallInst::setCallingConv()
|
|
|
|
* @see llvm::InvokeInst::setCallingConv()
|
|
|
|
*/
|
2007-12-29 20:45:00 +00:00
|
|
|
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the calling convention for a call instruction.
|
|
|
|
*
|
|
|
|
* This is the opposite of LLVMSetInstructionCallConv(). Reads its
|
|
|
|
* usage.
|
|
|
|
*
|
|
|
|
* @see LLVMSetInstructionCallConv()
|
|
|
|
*/
|
2007-12-29 20:45:00 +00:00
|
|
|
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
|
2008-09-25 21:00:45 +00:00
|
|
|
void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute);
|
2012-03-21 03:54:29 +00:00
|
|
|
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
|
2008-09-25 21:00:45 +00:00
|
|
|
LLVMAttribute);
|
2012-03-21 03:54:29 +00:00
|
|
|
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
|
2008-04-28 17:37:06 +00:00
|
|
|
unsigned align);
|
2007-12-29 20:45:00 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Obtain whether a call instruction is a tail call.
|
|
|
|
*
|
|
|
|
* This only works on llvm::CallInst instructions.
|
|
|
|
*
|
|
|
|
* @see llvm::CallInst::isTailCall()
|
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsTailCall(LLVMValueRef CallInst);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set whether a call instruction is a tail call.
|
|
|
|
*
|
|
|
|
* This only works on llvm::CallInst instructions.
|
|
|
|
*
|
|
|
|
* @see llvm::CallInst::setTailCall()
|
|
|
|
*/
|
2010-01-09 22:27:07 +00:00
|
|
|
void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
|
2008-08-30 16:34:54 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the default destination basic block of a switch instruction.
|
|
|
|
*
|
|
|
|
* This only works on llvm::SwitchInst instructions.
|
|
|
|
*
|
|
|
|
* @see llvm::SwitchInst::getDefaultDest()
|
|
|
|
*/
|
2011-08-23 20:27:46 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
|
|
|
|
*
|
|
|
|
* Functions in this group only apply to instructions that map to
|
|
|
|
* llvm::PHINode instances.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an incoming value to the end of a PHI list.
|
|
|
|
*/
|
2007-10-08 18:14:39 +00:00
|
|
|
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
|
|
|
|
LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Obtain the number of incoming basic blocks to a PHI node.
|
|
|
|
*/
|
2007-10-08 18:14:39 +00:00
|
|
|
unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2013-08-16 23:30:19 +00:00
|
|
|
* Obtain an incoming value to a PHI node as an LLVMValueRef.
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2007-10-08 18:14:39 +00:00
|
|
|
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index);
|
2012-03-21 03:54:29 +00:00
|
|
|
|
|
|
|
/**
|
2013-08-16 23:30:19 +00:00
|
|
|
* Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
|
2012-03-21 03:54:29 +00:00
|
|
|
*/
|
2007-10-08 18:14:39 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreInstructionBuilder Instruction Builders
|
|
|
|
*
|
|
|
|
* An instruction builder represents a point within a basic block and is
|
|
|
|
* the exclusive means of building instructions using the C interface.
|
|
|
|
*
|
|
|
|
* @{
|
2007-09-26 20:56:12 +00:00
|
|
|
*/
|
|
|
|
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C);
|
2008-05-04 12:55:34 +00:00
|
|
|
LLVMBuilderRef LLVMCreateBuilder(void);
|
2008-03-19 03:47:18 +00:00
|
|
|
void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
|
|
|
|
LLVMValueRef Instr);
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
|
|
|
|
void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block);
|
2008-03-19 01:11:35 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder);
|
2008-12-17 21:39:50 +00:00
|
|
|
void LLVMClearInsertionPosition(LLVMBuilderRef Builder);
|
|
|
|
void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr);
|
2009-08-16 02:20:57 +00:00
|
|
|
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMDisposeBuilder(LLVMBuilderRef Builder);
|
|
|
|
|
2010-02-28 09:45:59 +00:00
|
|
|
/* Metadata */
|
|
|
|
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
|
|
|
|
LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
|
|
|
|
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
/* Terminators */
|
|
|
|
LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
|
|
|
|
LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
|
2009-08-19 08:36:49 +00:00
|
|
|
LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef *RetVals,
|
2009-08-16 02:19:59 +00:00
|
|
|
unsigned N);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest);
|
|
|
|
LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If,
|
|
|
|
LLVMBasicBlockRef Then, LLVMBasicBlockRef Else);
|
|
|
|
LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
|
|
|
|
LLVMBasicBlockRef Else, unsigned NumCases);
|
2010-02-28 09:46:06 +00:00
|
|
|
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
|
|
|
|
unsigned NumDests);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
|
|
|
|
LLVMValueRef *Args, unsigned NumArgs,
|
|
|
|
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
|
|
|
|
const char *Name);
|
2011-08-19 01:36:54 +00:00
|
|
|
LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
|
|
|
|
LLVMValueRef PersFn, unsigned NumClauses,
|
|
|
|
const char *Name);
|
2011-07-31 06:30:59 +00:00
|
|
|
LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
|
|
|
|
|
2008-01-01 05:50:53 +00:00
|
|
|
/* Add a case to the switch instruction */
|
|
|
|
void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
|
|
|
|
LLVMBasicBlockRef Dest);
|
|
|
|
|
2010-02-28 09:46:06 +00:00
|
|
|
/* Add a destination to the indirectbr instruction */
|
|
|
|
void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
|
|
|
|
|
2011-08-12 20:24:12 +00:00
|
|
|
/* Add a catch or filter clause to the landingpad instruction */
|
|
|
|
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
|
|
|
|
|
|
|
|
/* Set the 'cleanup' flag in the landingpad instruction */
|
|
|
|
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
/* Arithmetic */
|
|
|
|
LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildURem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildAShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildAnd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2010-02-28 05:51:27 +00:00
|
|
|
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op,
|
|
|
|
LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
|
2010-02-28 05:51:43 +00:00
|
|
|
LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
|
|
|
|
const char *Name);
|
2009-09-28 21:51:41 +00:00
|
|
|
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
|
|
|
|
|
|
|
|
/* Memory */
|
|
|
|
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
|
|
|
|
LLVMValueRef Val, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
|
|
|
|
LLVMValueRef Val, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
|
|
|
|
LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr);
|
|
|
|
LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
|
|
|
|
LLVMValueRef *Indices, unsigned NumIndices,
|
|
|
|
const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
|
|
|
|
LLVMValueRef *Indices, unsigned NumIndices,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
|
|
|
|
unsigned Idx, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str,
|
|
|
|
const char *Name);
|
2012-03-22 03:54:15 +00:00
|
|
|
LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
|
|
|
|
void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
|
|
|
/* Casts */
|
|
|
|
LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2013-11-15 01:34:59 +00:00
|
|
|
LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2010-02-28 05:51:27 +00:00
|
|
|
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2009-11-23 10:49:03 +00:00
|
|
|
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, /*Signed cast!*/
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
LLVMTypeRef DestTy, const char *Name);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
|
|
|
/* Comparisons */
|
|
|
|
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op,
|
|
|
|
LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
|
|
|
|
LLVMValueRef LHS, LLVMValueRef RHS,
|
|
|
|
const char *Name);
|
|
|
|
|
|
|
|
/* Miscellaneous instructions */
|
|
|
|
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn,
|
|
|
|
LLVMValueRef *Args, unsigned NumArgs,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If,
|
|
|
|
LLVMValueRef Then, LLVMValueRef Else,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef, LLVMValueRef List, LLVMTypeRef Ty,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal,
|
|
|
|
LLVMValueRef Index, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal,
|
|
|
|
LLVMValueRef EltVal, LLVMValueRef Index,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1,
|
|
|
|
LLVMValueRef V2, LLVMValueRef Mask,
|
|
|
|
const char *Name);
|
2008-11-03 22:55:43 +00:00
|
|
|
LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef, LLVMValueRef AggVal,
|
|
|
|
unsigned Index, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef, LLVMValueRef AggVal,
|
|
|
|
LLVMValueRef EltVal, unsigned Index,
|
|
|
|
const char *Name);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2009-08-16 02:19:59 +00:00
|
|
|
LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val,
|
|
|
|
const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS,
|
|
|
|
LLVMValueRef RHS, const char *Name);
|
2013-11-20 00:07:49 +00:00
|
|
|
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering,
|
|
|
|
LLVMBool singleThread, const char *Name);
|
|
|
|
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
|
2013-10-23 17:56:29 +00:00
|
|
|
LLVMValueRef PTR, LLVMValueRef Val,
|
|
|
|
LLVMAtomicOrdering ordering,
|
2013-04-23 13:21:19 +00:00
|
|
|
LLVMBool singleThread);
|
2009-08-16 02:19:59 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreModuleProvider Module Providers
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2007-12-12 01:04:30 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Changes the type of M so it can be passed to FunctionPassManagers and the
|
2010-01-27 20:34:15 +00:00
|
|
|
* JIT. They take ModuleProviders for historical reasons.
|
2007-12-12 01:04:30 +00:00
|
|
|
*/
|
|
|
|
LLVMModuleProviderRef
|
|
|
|
LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* Destroys the module M.
|
2007-12-12 01:04:30 +00:00
|
|
|
*/
|
2010-01-27 20:34:15 +00:00
|
|
|
void LLVMDisposeModuleProvider(LLVMModuleProviderRef M);
|
2007-12-12 01:04:30 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreMemoryBuffers Memory Buffers
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
|
|
|
|
LLVMMemoryBufferRef *OutMemBuf,
|
|
|
|
char **OutMessage);
|
|
|
|
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
|
|
|
|
char **OutMessage);
|
2013-02-14 19:11:28 +00:00
|
|
|
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData,
|
|
|
|
size_t InputDataLength,
|
|
|
|
const char *BufferName,
|
2013-02-14 19:39:14 +00:00
|
|
|
LLVMBool RequiresNullTerminator);
|
2013-02-14 19:11:28 +00:00
|
|
|
LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData,
|
|
|
|
size_t InputDataLength,
|
|
|
|
const char *BufferName);
|
2013-04-18 19:50:53 +00:00
|
|
|
const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
|
2013-04-16 23:12:51 +00:00
|
|
|
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
|
2007-12-19 22:30:40 +00:00
|
|
|
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
|
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCorePassRegistry Pass Registry
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2010-10-07 17:55:47 +00:00
|
|
|
|
|
|
|
/** Return the global pass registry, for use with initialization functions.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::PassRegistry::getPassRegistry */
|
2010-10-07 17:55:47 +00:00
|
|
|
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCorePassManagers Pass Managers
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Constructs a new whole-module pass pipeline. This type of pipeline is
|
|
|
|
suitable for link-time optimization and whole-module transformations.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::PassManager::PassManager */
|
2008-05-04 12:55:34 +00:00
|
|
|
LLVMPassManagerRef LLVMCreatePassManager(void);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Constructs a new function-by-function pass pipeline over the module
|
|
|
|
provider. It does not take ownership of the module provider. This type of
|
|
|
|
pipeline is suitable for code generation and JIT compilation tasks.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::FunctionPassManager::FunctionPassManager */
|
2010-03-02 23:58:54 +00:00
|
|
|
LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M);
|
|
|
|
|
|
|
|
/** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
|
2008-03-16 04:20:44 +00:00
|
|
|
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
|
|
|
|
|
|
|
|
/** Initializes, executes on the provided module, and finalizes all of the
|
|
|
|
passes scheduled in the pass manager. Returns 1 if any of the passes
|
2012-03-21 03:54:29 +00:00
|
|
|
modified the module, 0 otherwise.
|
|
|
|
@see llvm::PassManager::run(Module&) */
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Initializes all of the function passes scheduled in the function pass
|
|
|
|
manager. Returns 1 if any of the passes modified the module, 0 otherwise.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::FunctionPassManager::doInitialization */
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Executes all of the function passes scheduled in the function pass manager
|
|
|
|
on the provided function. Returns 1 if any of the passes modified the
|
|
|
|
function, false otherwise.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::FunctionPassManager::run(Function&) */
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Finalizes all of the function passes scheduled in in the function pass
|
|
|
|
manager. Returns 1 if any of the passes modified the module, 0 otherwise.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::FunctionPassManager::doFinalization */
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/** Frees the memory of a pass pipeline. For function pipelines, does not free
|
|
|
|
the module provider.
|
2012-03-21 03:54:29 +00:00
|
|
|
@see llvm::PassManagerBase::~PassManagerBase. */
|
2008-03-16 04:20:44 +00:00
|
|
|
void LLVMDisposePassManager(LLVMPassManagerRef PM);
|
|
|
|
|
2013-02-17 16:35:51 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup LLVMCCoreThreading Threading
|
|
|
|
*
|
|
|
|
* Handle the structures needed to make LLVM safe for multithreading.
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** Allocate and initialize structures needed to make LLVM safe for
|
|
|
|
multithreading. The return value indicates whether multithreaded
|
|
|
|
initialization succeeded. Must be executed in isolation from all
|
|
|
|
other LLVM api calls.
|
|
|
|
@see llvm::llvm_start_multithreaded */
|
2013-10-23 16:57:34 +00:00
|
|
|
LLVMBool LLVMStartMultithreaded(void);
|
2013-02-17 16:35:51 +00:00
|
|
|
|
|
|
|
/** Deallocate structures necessary to make LLVM safe for multithreading.
|
|
|
|
Must be executed in isolation from all other LLVM api calls.
|
|
|
|
@see llvm::llvm_stop_multithreaded */
|
2013-10-23 16:57:34 +00:00
|
|
|
void LLVMStopMultithreaded(void);
|
2013-02-17 16:35:51 +00:00
|
|
|
|
|
|
|
/** Check whether LLVM is executing in thread-safe mode or not.
|
|
|
|
@see llvm::llvm_is_multithreaded */
|
2013-10-23 16:57:34 +00:00
|
|
|
LLVMBool LLVMIsMultithreaded(void);
|
2013-02-17 16:35:51 +00:00
|
|
|
|
2012-03-21 03:54:29 +00:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
2008-03-16 04:20:44 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2013-04-04 17:40:53 +00:00
|
|
|
#endif /* !defined(__cplusplus) */
|
2007-10-05 23:59:36 +00:00
|
|
|
|
2013-04-04 17:40:53 +00:00
|
|
|
#endif /* !defined(LLVM_C_CORE_H) */
|