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. *|
|
|
|
|
|* *|
|
|
|
|
|* LLVM uses a polymorphic type hierarchy which C cannot represent, therefore *|
|
|
|
|
|* parameters must be passed as base types. Despite the declared types, most *|
|
|
|
|
|* of the functions provided operate only on branches of the type hierarchy. *|
|
|
|
|
|* The declared parameter names are descriptive and specify which type is *|
|
|
|
|
|* required. Additionally, each type hierarchy is documented along with the *|
|
|
|
|
|* functions that operate upon it. For more detail, refer to LLVM's C++ code. *|
|
|
|
|
|* If in doubt, refer to Core.cpp, which performs paramter downcasts in the *|
|
|
|
|
|* form unwrap<RequiredType>(Param). *|
|
|
|
|
|* *|
|
|
|
|
|* Many exotic languages can interoperate with C code but have a harder time *|
|
|
|
|
|* with C++ due to name mangling. So in addition to C, this interface enables *|
|
|
|
|
|* tools written in such languages. *|
|
|
|
|
|* *|
|
2007-10-05 23:59:36 +00:00
|
|
|
|* When included into a C++ source file, also declares 'wrap' and 'unwrap' *|
|
|
|
|
|* helpers to perform opaque reference<-->pointer conversions. These helpers *|
|
|
|
|
|* are shorter and more tightly typed than writing the casts by hand when *|
|
|
|
|
|* authoring bindings. In assert builds, they will do runtime type checking. *|
|
|
|
|
|* *|
|
2007-09-18 03:18:57 +00:00
|
|
|
\*===----------------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
#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
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
#ifdef __cplusplus
|
2007-10-05 23:59:36 +00:00
|
|
|
|
|
|
|
/* Need these includes to support the LLVM 'cast' template for the C++ 'wrap'
|
|
|
|
and 'unwrap' conversion functions. */
|
|
|
|
#include "llvm/Module.h"
|
2010-10-07 17:55:47 +00:00
|
|
|
#include "llvm/PassRegistry.h"
|
2008-04-13 06:22:09 +00:00
|
|
|
#include "llvm/Support/IRBuilder.h"
|
2007-10-05 23:59:36 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
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
|
|
|
/**
|
|
|
|
* The top-level container for all LLVM global data. See the LLVMContext class.
|
|
|
|
*/
|
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)
|
|
|
|
* objects. See the llvm::Module class.
|
|
|
|
*/
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef struct LLVMOpaqueModule *LLVMModuleRef;
|
2007-12-30 17:46:33 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-07 19:13:06 +00:00
|
|
|
* Each value in the LLVM IR has a type, an LLVMTypeRef. See the llvm::Type
|
|
|
|
* class.
|
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
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
typedef struct LLVMOpaqueValue *LLVMValueRef;
|
2007-09-26 20:56:12 +00:00
|
|
|
typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
|
|
|
|
typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2010-01-27 20:34:15 +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
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
/* Used to provide a module to JIT or interpreter.
|
|
|
|
* See the llvm::MemoryBuffer class.
|
|
|
|
*/
|
|
|
|
typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
|
|
|
|
|
2008-03-16 04:20:44 +00:00
|
|
|
/** See the llvm::PassManagerBase class. */
|
|
|
|
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
|
|
|
|
|
2010-10-07 17:55:47 +00:00
|
|
|
/** See the llvm::PassRegistry class. */
|
|
|
|
typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
|
|
|
|
|
2010-03-02 20:32:28 +00:00
|
|
|
/** Used to get the users and usees of a Value. See the llvm::Use class. */
|
|
|
|
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,
|
|
|
|
LLVMNonLazyBind = 1 << 31
|
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,
|
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,
|
2011-10-06 12:39:34 +00:00
|
|
|
LLVMLandingPad = 59,
|
|
|
|
LLVMUnwind = 60
|
|
|
|
|
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. */
|
|
|
|
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 */
|
2007-12-30 17:46:33 +00:00
|
|
|
LLVMDLLImportLinkage, /**< Function to be imported from DLL */
|
|
|
|
LLVMDLLExportLinkage, /**< Function to be accessible from DLL */
|
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. */
|
2010-08-20 22:05:50 +00:00
|
|
|
LLVMLinkerPrivateWeakLinkage, /**< Like LinkerPrivate, but is weak. */
|
|
|
|
LLVMLinkerPrivateWeakDefAutoLinkage /**< Like LinkerPrivateWeak, but possibly
|
|
|
|
hidden. */
|
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,
|
|
|
|
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;
|
|
|
|
|
2011-05-15 07:20:34 +00:00
|
|
|
void LLVMInitializeCore(LLVMPassRegistryRef R);
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
/*===-- Error handling ----------------------------------------------------===*/
|
|
|
|
|
|
|
|
void LLVMDisposeMessage(char *Message);
|
|
|
|
|
|
|
|
|
2010-02-28 09:45:59 +00:00
|
|
|
/*===-- Contexts ----------------------------------------------------------===*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2009-07-01 16:58:40 +00:00
|
|
|
/* Create and destroy contexts. */
|
2009-08-30 23:38:06 +00:00
|
|
|
LLVMContextRef LLVMContextCreate(void);
|
|
|
|
LLVMContextRef LLVMGetGlobalContext(void);
|
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);
|
|
|
|
|
|
|
|
/*===-- Modules -----------------------------------------------------------===*/
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Create and destroy modules. */
|
2008-03-07 19:13:06 +00:00
|
|
|
/** See llvm::Module::Module. */
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
|
2009-07-02 07:17:57 +00:00
|
|
|
LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
|
|
|
|
LLVMContextRef C);
|
2008-03-07 19:13:06 +00:00
|
|
|
|
|
|
|
/** See llvm::Module::~Module. */
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMDisposeModule(LLVMModuleRef M);
|
|
|
|
|
2008-03-07 19:13:06 +00:00
|
|
|
/** Data layout. See Module::getDataLayout. */
|
2007-12-27 20:13:47 +00:00
|
|
|
const char *LLVMGetDataLayout(LLVMModuleRef M);
|
|
|
|
void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple);
|
|
|
|
|
2008-03-07 19:13:06 +00:00
|
|
|
/** Target triple. See Module::getTargetTriple. */
|
2007-12-27 20:13:47 +00:00
|
|
|
const char *LLVMGetTarget(LLVMModuleRef M);
|
|
|
|
void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
|
|
|
|
|
2008-03-14 23:58:56 +00:00
|
|
|
/** See Module::dump. */
|
|
|
|
void LLVMDumpModule(LLVMModuleRef M);
|
|
|
|
|
2010-04-10 17:52:58 +00:00
|
|
|
/** See Module::setModuleInlineAsm. */
|
|
|
|
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2010-11-28 20:03:44 +00:00
|
|
|
/** See Module::getContext. */
|
|
|
|
LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
/*===-- Types -------------------------------------------------------------===*/
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
/* LLVM types conform to the following hierarchy:
|
|
|
|
*
|
|
|
|
* types:
|
|
|
|
* integer type
|
|
|
|
* real type
|
|
|
|
* function type
|
|
|
|
* sequence types:
|
|
|
|
* array type
|
|
|
|
* pointer type
|
|
|
|
* vector type
|
|
|
|
* void type
|
|
|
|
* label type
|
|
|
|
* opaque type
|
|
|
|
*/
|
|
|
|
|
2008-03-07 19:13:06 +00:00
|
|
|
/** See llvm::LLVMTypeKind::getTypeID. */
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
|
2011-10-06 12:13:28 +00:00
|
|
|
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty);
|
2008-03-07 19:13:06 +00:00
|
|
|
|
2009-08-14 00:01:31 +00:00
|
|
|
/** See llvm::LLVMType::getContext. */
|
|
|
|
LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Operations on integer types */
|
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);
|
|
|
|
|
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
|
|
|
|
|
|
|
/* Operations on real types */
|
2011-12-17 00:04:22 +00:00
|
|
|
LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C);
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C);
|
|
|
|
|
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
|
|
|
|
|
|
|
/* Operations on function types */
|
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);
|
|
|
|
LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
|
|
|
|
unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
|
|
|
|
void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
/* Operations on struct types */
|
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);
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool Packed);
|
2011-07-14 05:53:17 +00:00
|
|
|
LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
|
2011-10-06 12:12:50 +00:00
|
|
|
const char *LLVMGetStructName(LLVMTypeRef Ty);
|
2011-07-14 05:53:17 +00:00
|
|
|
void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
|
|
|
|
unsigned ElementCount, LLVMBool Packed);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
|
2007-09-18 03:18:57 +00:00
|
|
|
void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
|
2011-07-14 16:20:28 +00:00
|
|
|
LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
|
|
|
|
|
|
|
|
LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
/* Operations on array, pointer, and vector types (sequence types) */
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
|
2007-12-17 16:08:32 +00:00
|
|
|
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
|
2007-10-06 16:05:20 +00:00
|
|
|
LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty);
|
|
|
|
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
|
2007-12-17 16:08:32 +00:00
|
|
|
unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
|
2007-09-18 03:18:57 +00:00
|
|
|
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
|
|
|
|
|
|
|
|
/* Operations on other types */
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C);
|
|
|
|
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C);
|
2010-09-10 21:58:02 +00:00
|
|
|
LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
|
2009-08-14 00:01:31 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
/*===-- Values ------------------------------------------------------------===*/
|
|
|
|
|
|
|
|
/* The bulk of LLVM's object model consists of values, which comprise a very
|
|
|
|
* rich type hierarchy.
|
|
|
|
*/
|
|
|
|
|
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) \
|
|
|
|
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) \
|
2011-10-14 20:37:56 +00:00
|
|
|
macro(EHExceptionInst) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(EHSelectorInst) \
|
|
|
|
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) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(UnaryInstruction) \
|
2009-10-23 21:09:37 +00:00
|
|
|
macro(AllocaInst) \
|
2008-12-19 18:39:45 +00:00
|
|
|
macro(CastInst) \
|
2008-12-19 18:51:17 +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
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Operations on all values */
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMTypeRef LLVMTypeOf(LLVMValueRef Val);
|
2007-09-18 03:18:57 +00:00
|
|
|
const char *LLVMGetValueName(LLVMValueRef Val);
|
|
|
|
void LLVMSetValueName(LLVMValueRef Val, const char *Name);
|
2007-10-06 00:08:49 +00:00
|
|
|
void LLVMDumpValue(LLVMValueRef Val);
|
2009-10-12 04:01:02 +00:00
|
|
|
void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
|
2010-02-28 09:45:59 +00:00
|
|
|
int LLVMHasMetadata(LLVMValueRef Val);
|
|
|
|
LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
|
|
|
|
void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2008-12-19 18:39:45 +00:00
|
|
|
/* Conversion functions. Return the input value if it is an instance of the
|
|
|
|
specified class, otherwise NULL. See llvm::dyn_cast_or_null<>. */
|
|
|
|
#define LLVM_DECLARE_VALUE_CAST(name) \
|
|
|
|
LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
|
|
|
|
LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
|
|
|
|
|
2009-10-12 04:01:02 +00:00
|
|
|
/* Operations on Uses */
|
2010-03-02 20:32:28 +00:00
|
|
|
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val);
|
|
|
|
LLVMUseRef LLVMGetNextUse(LLVMUseRef U);
|
|
|
|
LLVMValueRef LLVMGetUser(LLVMUseRef U);
|
|
|
|
LLVMValueRef LLVMGetUsedValue(LLVMUseRef U);
|
2009-10-12 04:01:02 +00:00
|
|
|
|
2011-11-04 17:07:11 +00:00
|
|
|
/* Operations on Users and metadata */
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
|
2010-08-20 14:51:22 +00:00
|
|
|
void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
|
|
|
|
int LLVMGetNumOperands(LLVMValueRef Val);
|
2009-10-12 04:01:02 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Operations on constants of any type */
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
|
|
|
|
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); /* only for int/vector */
|
2007-09-18 03:18:57 +00:00
|
|
|
LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsConstant(LLVMValueRef Val);
|
|
|
|
LLVMBool LLVMIsNull(LLVMValueRef Val);
|
|
|
|
LLVMBool LLVMIsUndef(LLVMValueRef Val);
|
2009-07-06 17:29:59 +00:00
|
|
|
LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2010-02-28 09:45:59 +00:00
|
|
|
/* Operations on metadata */
|
|
|
|
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
|
|
|
|
unsigned SLen);
|
|
|
|
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
|
|
|
|
LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
|
|
|
|
unsigned Count);
|
|
|
|
LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
|
2011-10-06 12:13:11 +00:00
|
|
|
const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len);
|
|
|
|
unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char* name);
|
|
|
|
void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char* name, LLVMValueRef *Dest);
|
2010-02-28 09:45:59 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Operations on scalar constants */
|
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);
|
2010-11-23 02:47:22 +00:00
|
|
|
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
|
|
|
|
unsigned NumWords,
|
|
|
|
const uint64_t Words[]);
|
2009-08-16 23:36:46 +00:00
|
|
|
LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
|
|
|
|
uint8_t Radix);
|
|
|
|
LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
|
|
|
|
unsigned SLen, uint8_t Radix);
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
|
2008-02-02 01:07:50 +00:00
|
|
|
LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
|
2009-08-16 23:36:46 +00:00
|
|
|
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
|
|
|
|
unsigned SLen);
|
2009-10-12 04:01:02 +00:00
|
|
|
unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
|
|
|
|
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
|
2009-08-16 23:36:46 +00:00
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
|
|
|
|
/* Operations on composite constants */
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
|
2010-01-09 22:27:07 +00:00
|
|
|
unsigned Length, LLVMBool DontNullTerminate);
|
2009-08-14 00:01:31 +00:00
|
|
|
LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
|
|
|
|
LLVMValueRef *ConstantVals,
|
2010-01-09 22:27:07 +00:00
|
|
|
unsigned Count, LLVMBool Packed);
|
2009-08-14 00:01:31 +00:00
|
|
|
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool DontNullTerminate);
|
2008-04-25 03:21:19 +00:00
|
|
|
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef *ConstantVals, unsigned Length);
|
|
|
|
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool Packed);
|
2011-07-14 19:09:08 +00:00
|
|
|
LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
|
|
|
LLVMValueRef *ConstantVals,
|
|
|
|
unsigned Count);
|
2007-10-06 15:11:06 +00:00
|
|
|
LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2007-10-06 14:29:36 +00:00
|
|
|
/* Constant expressions */
|
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);
|
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
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
/* Operations on global variables, functions, and aliases (globals) */
|
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);
|
|
|
|
unsigned LLVMGetAlignment(LLVMValueRef Global);
|
|
|
|
void LLVMSetAlignment(LLVMValueRef Global, unsigned Bytes);
|
|
|
|
|
|
|
|
/* Operations on global variables */
|
|
|
|
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);
|
2007-09-18 03:18:57 +00:00
|
|
|
|
2008-12-17 21:39:50 +00:00
|
|
|
/* Operations on aliases */
|
|
|
|
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
|
|
|
|
const char *Name);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
/* Operations on functions */
|
|
|
|
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
|
|
|
|
LLVMTypeRef FunctionTy);
|
2007-10-08 03:45:09 +00:00
|
|
|
LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M);
|
|
|
|
LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M);
|
|
|
|
LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn);
|
|
|
|
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn);
|
2007-09-26 20:56:12 +00:00
|
|
|
void LLVMDeleteFunction(LLVMValueRef Fn);
|
|
|
|
unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
|
|
|
|
unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
|
|
|
|
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
|
2008-08-17 18:44:35 +00:00
|
|
|
const char *LLVMGetGC(LLVMValueRef Fn);
|
|
|
|
void LLVMSetGC(LLVMValueRef Fn, const char *Name);
|
2009-05-06 12:21:17 +00:00
|
|
|
void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn);
|
2009-05-06 12:21:17 +00:00
|
|
|
void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2008-03-19 01:11:35 +00:00
|
|
|
/* Operations on parameters */
|
|
|
|
unsigned LLVMCountParams(LLVMValueRef Fn);
|
|
|
|
void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
|
|
|
|
LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
|
|
|
|
LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst);
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn);
|
|
|
|
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
|
|
|
|
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
|
|
|
|
LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
|
2008-09-25 21:00:45 +00:00
|
|
|
void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA);
|
|
|
|
void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA);
|
2009-10-12 04:01:02 +00:00
|
|
|
LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg);
|
2008-04-28 17:37:06 +00:00
|
|
|
void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
|
2008-03-19 01:11:35 +00:00
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
/* Operations on basic blocks */
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
|
2008-03-23 22:21:29 +00:00
|
|
|
LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
|
2011-08-23 20:27:46 +00:00
|
|
|
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB);
|
2007-09-26 20:56:12 +00:00
|
|
|
unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
|
|
|
|
void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn);
|
|
|
|
LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn);
|
|
|
|
LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB);
|
|
|
|
LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
|
2009-08-14 00:01:31 +00:00
|
|
|
|
|
|
|
LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
|
|
|
|
LLVMValueRef Fn,
|
|
|
|
const char *Name);
|
|
|
|
LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C,
|
|
|
|
LLVMBasicBlockRef BB,
|
|
|
|
const char *Name);
|
|
|
|
|
2007-09-26 20:56:12 +00:00
|
|
|
LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);
|
|
|
|
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB,
|
|
|
|
const char *Name);
|
|
|
|
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
|
2011-08-23 20:27:46 +00:00
|
|
|
void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
2010-07-19 15:31:07 +00:00
|
|
|
void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
|
|
|
|
void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
|
|
|
|
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB);
|
|
|
|
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB);
|
2011-08-23 20:27:46 +00:00
|
|
|
|
|
|
|
/* Operations on instructions */
|
|
|
|
LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
|
2008-03-19 03:47:18 +00:00
|
|
|
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
|
|
|
|
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
|
2011-10-03 20:59:18 +00:00
|
|
|
void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
2011-10-14 20:37:49 +00:00
|
|
|
LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
|
2011-10-06 12:13:20 +00:00
|
|
|
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
|
2008-03-19 01:11:35 +00:00
|
|
|
|
2007-12-29 20:45:00 +00:00
|
|
|
/* Operations on call sites */
|
|
|
|
void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
|
|
|
|
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
|
2008-09-25 21:00:45 +00:00
|
|
|
void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute);
|
|
|
|
void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
|
|
|
|
LLVMAttribute);
|
2008-04-28 17:37:06 +00:00
|
|
|
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
|
|
|
|
unsigned align);
|
2007-12-29 20:45:00 +00:00
|
|
|
|
2008-08-30 16:34:54 +00:00
|
|
|
/* Operations on call instructions (only) */
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMIsTailCall(LLVMValueRef CallInst);
|
|
|
|
void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
|
2008-08-30 16:34:54 +00:00
|
|
|
|
2011-08-23 20:27:46 +00:00
|
|
|
/* Operations on switch instructions (only) */
|
|
|
|
LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr);
|
|
|
|
|
2007-10-08 18:14:39 +00:00
|
|
|
/* Operations on phi nodes */
|
|
|
|
void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
|
|
|
|
LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
|
|
|
|
unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
|
|
|
|
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index);
|
|
|
|
LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
|
2007-09-26 20:56:12 +00:00
|
|
|
|
|
|
|
/*===-- Instruction builders ----------------------------------------------===*/
|
|
|
|
|
|
|
|
/* An instruction builder represents a point within a basic block, and is the
|
|
|
|
* exclusive means of building instructions using the C interface.
|
|
|
|
*/
|
|
|
|
|
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);
|
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);
|
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);
|
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
|
2007-12-12 01:04:30 +00:00
|
|
|
/*===-- Module providers --------------------------------------------------===*/
|
|
|
|
|
2010-01-27 20:34:15 +00:00
|
|
|
/* Changes the type of M so it can be passed to FunctionPassManagers and the
|
|
|
|
* JIT. They take ModuleProviders for historical reasons.
|
2007-12-12 01:04:30 +00:00
|
|
|
*/
|
|
|
|
LLVMModuleProviderRef
|
|
|
|
LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
|
|
|
|
|
2010-01-27 20:34:15 +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
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
|
|
|
|
/*===-- Memory buffers ----------------------------------------------------===*/
|
|
|
|
|
2010-01-09 22:27:07 +00:00
|
|
|
LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
|
|
|
|
LLVMMemoryBufferRef *OutMemBuf,
|
|
|
|
char **OutMessage);
|
|
|
|
LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
|
|
|
|
char **OutMessage);
|
2007-12-19 22:30:40 +00:00
|
|
|
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
|
|
|
|
|
2010-10-07 17:55:47 +00:00
|
|
|
/*===-- Pass Registry -----------------------------------------------------===*/
|
|
|
|
|
|
|
|
/** Return the global pass registry, for use with initialization functions.
|
|
|
|
See llvm::PassRegistry::getPassRegistry. */
|
|
|
|
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void);
|
2008-03-16 04:20:44 +00:00
|
|
|
|
|
|
|
/*===-- Pass Managers -----------------------------------------------------===*/
|
|
|
|
|
|
|
|
/** Constructs a new whole-module pass pipeline. This type of pipeline is
|
|
|
|
suitable for link-time optimization and whole-module transformations.
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
See llvm::PassManagerBase::~PassManagerBase. */
|
|
|
|
void LLVMDisposePassManager(LLVMPassManagerRef PM);
|
|
|
|
|
|
|
|
|
2007-09-18 03:18:57 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
|
2007-10-05 23:59:36 +00:00
|
|
|
namespace llvm {
|
2007-12-19 22:30:40 +00:00
|
|
|
class MemoryBuffer;
|
2008-03-16 15:55:43 +00:00
|
|
|
class PassManagerBase;
|
2007-12-12 01:04:30 +00:00
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
|
|
|
|
inline ty *unwrap(ref P) { \
|
|
|
|
return reinterpret_cast<ty*>(P); \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
inline ref wrap(const ty *P) { \
|
|
|
|
return reinterpret_cast<ref>(const_cast<ty*>(P)); \
|
|
|
|
}
|
2007-10-05 23:59:36 +00:00
|
|
|
|
2008-03-16 04:20:44 +00:00
|
|
|
#define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref) \
|
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
|
|
|
|
\
|
|
|
|
template<typename T> \
|
|
|
|
inline T *unwrap(ref P) { \
|
|
|
|
return cast<T>(unwrap(P)); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref) \
|
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref) \
|
|
|
|
\
|
|
|
|
template<typename T> \
|
|
|
|
inline T *unwrap(ref P) { \
|
2010-01-22 06:49:46 +00:00
|
|
|
T *Q = (T*)unwrap(P); \
|
2008-03-16 04:20:44 +00:00
|
|
|
assert(Q && "Invalid cast!"); \
|
|
|
|
return Q; \
|
|
|
|
}
|
|
|
|
|
|
|
|
DEFINE_ISA_CONVERSION_FUNCTIONS (Type, LLVMTypeRef )
|
|
|
|
DEFINE_ISA_CONVERSION_FUNCTIONS (Value, LLVMValueRef )
|
2007-12-27 18:25:59 +00:00
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef )
|
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock, LLVMBasicBlockRef )
|
2008-08-08 19:39:37 +00:00
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>, LLVMBuilderRef )
|
2007-12-27 18:25:59 +00:00
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer, LLVMMemoryBufferRef )
|
2009-07-01 16:58:40 +00:00
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(LLVMContext, LLVMContextRef )
|
2010-03-02 20:32:28 +00:00
|
|
|
DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Use, LLVMUseRef )
|
2008-03-16 04:20:44 +00:00
|
|
|
DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase, LLVMPassManagerRef )
|
2010-10-07 17:55:47 +00:00
|
|
|
DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassRegistry, LLVMPassRegistryRef )
|
2010-01-27 20:34:15 +00:00
|
|
|
/* LLVMModuleProviderRef exists for historical reasons, but now just holds a
|
|
|
|
* Module.
|
|
|
|
*/
|
|
|
|
inline Module *unwrap(LLVMModuleProviderRef MP) {
|
|
|
|
return reinterpret_cast<Module*>(MP);
|
|
|
|
}
|
2007-10-05 23:59:36 +00:00
|
|
|
|
2008-03-16 04:20:44 +00:00
|
|
|
#undef DEFINE_STDCXX_CONVERSION_FUNCTIONS
|
|
|
|
#undef DEFINE_ISA_CONVERSION_FUNCTIONS
|
2007-12-19 22:30:40 +00:00
|
|
|
#undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
|
2009-08-14 00:01:31 +00:00
|
|
|
|
|
|
|
/* Specialized opaque context conversions.
|
|
|
|
*/
|
|
|
|
inline LLVMContext **unwrap(LLVMContextRef* Tys) {
|
|
|
|
return reinterpret_cast<LLVMContext**>(Tys);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline LLVMContextRef *wrap(const LLVMContext **Tys) {
|
|
|
|
return reinterpret_cast<LLVMContextRef*>(const_cast<LLVMContext**>(Tys));
|
|
|
|
}
|
2007-10-05 23:59:36 +00:00
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
/* Specialized opaque type conversions.
|
|
|
|
*/
|
2007-10-05 23:59:36 +00:00
|
|
|
inline Type **unwrap(LLVMTypeRef* Tys) {
|
|
|
|
return reinterpret_cast<Type**>(Tys);
|
|
|
|
}
|
|
|
|
|
2011-07-18 04:54:35 +00:00
|
|
|
inline LLVMTypeRef *wrap(Type **Tys) {
|
2007-10-05 23:59:36 +00:00
|
|
|
return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
|
|
|
|
}
|
|
|
|
|
2007-12-19 22:30:40 +00:00
|
|
|
/* Specialized opaque value conversions.
|
2007-10-05 23:59:36 +00:00
|
|
|
*/
|
|
|
|
inline Value **unwrap(LLVMValueRef *Vals) {
|
|
|
|
return reinterpret_cast<Value**>(Vals);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
|
|
|
|
#if DEBUG
|
2009-07-10 18:28:19 +00:00
|
|
|
for (LLVMValueRef *I = Vals, *E = Vals + Length; I != E; ++I)
|
2007-10-05 23:59:36 +00:00
|
|
|
cast<T>(*I);
|
|
|
|
#endif
|
2011-06-04 16:00:19 +00:00
|
|
|
(void)Length;
|
2007-10-05 23:59:36 +00:00
|
|
|
return reinterpret_cast<T**>(Vals);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline LLVMValueRef *wrap(const Value **Vals) {
|
|
|
|
return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !defined(__cplusplus) */
|
|
|
|
|
|
|
|
#endif /* !defined(LLVM_C_CORE_H) */
|