mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 22:13:17 +00:00
Update to LLVM-17
This commit is contained in:
BIN
LLVM-C.dll
BIN
LLVM-C.dll
Binary file not shown.
Binary file not shown.
@@ -61,8 +61,13 @@ LLVMBool LLVMGetBitcodeModuleInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutM, char **OutMessage);
|
||||
|
||||
/** Reads a module from the specified path, returning via the OutMP parameter a
|
||||
* module provider which performs lazy deserialization. Returns 0 on success. */
|
||||
/** Reads a module from the given memory buffer, returning via the OutMP
|
||||
* parameter a module provider which performs lazy deserialization.
|
||||
*
|
||||
* Returns 0 on success.
|
||||
*
|
||||
* Takes ownership of \p MemBuf if (and only if) the module was read
|
||||
* successfully. */
|
||||
LLVMBool LLVMGetBitcodeModuleInContext2(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf,
|
||||
LLVMModuleRef *OutM);
|
||||
|
||||
@@ -19,14 +19,20 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreComdat Comdats
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
LLVMAnyComdatSelectionKind, ///< The linker may choose any COMDAT.
|
||||
LLVMExactMatchComdatSelectionKind, ///< The data referenced by the COMDAT must
|
||||
///< be the same.
|
||||
LLVMLargestComdatSelectionKind, ///< The linker will choose the largest
|
||||
///< COMDAT.
|
||||
LLVMNoDuplicatesComdatSelectionKind, ///< No other Module may specify this
|
||||
///< COMDAT.
|
||||
LLVMNoDeduplicateComdatSelectionKind, ///< No deduplication is performed.
|
||||
LLVMSameSizeComdatSelectionKind ///< The data referenced by the COMDAT must be
|
||||
///< the same size.
|
||||
} LLVMComdatSelectionKind;
|
||||
@@ -67,6 +73,10 @@ LLVMComdatSelectionKind LLVMGetComdatSelectionKind(LLVMComdatRef C);
|
||||
*/
|
||||
void LLVMSetComdatSelectionKind(LLVMComdatRef C, LLVMComdatSelectionKind Kind);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*===------- llvm/Config/abi-breaking.h - llvm configuration -------*- C -*-===*/
|
||||
/*===------- llvm-c/Config//abi-breaking.h - llvm configuration -------*- C -*-===*/
|
||||
/* */
|
||||
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||
/* Exceptions. */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*===------- llvm/Config/llvm-config.h - llvm configuration -------*- C -*-===*/
|
||||
/*===------- llvm-c/Config//llvm-config.h - llvm configuration -------*- C -*-===*/
|
||||
/* */
|
||||
/* Part of the LLVM Project, under the Apache License v2.0 with LLVM */
|
||||
/* Exceptions. */
|
||||
@@ -66,7 +66,7 @@
|
||||
#define LLVM_USE_PERF 0
|
||||
|
||||
/* Major version of the LLVM API */
|
||||
#define LLVM_VERSION_MAJOR 12
|
||||
#define LLVM_VERSION_MAJOR 17
|
||||
|
||||
/* Minor version of the LLVM API */
|
||||
#define LLVM_VERSION_MINOR 0
|
||||
@@ -75,7 +75,7 @@
|
||||
#define LLVM_VERSION_PATCH 1
|
||||
|
||||
/* LLVM version string */
|
||||
#define LLVM_VERSION_STRING "12.0.1"
|
||||
#define LLVM_VERSION_STRING "17.0.1"
|
||||
|
||||
/* Whether LLVM records statistics for use with GetStatistics(),
|
||||
* PrintStatistics() or PrintStatisticsJSON()
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
#ifndef LLVM_C_CORE_H
|
||||
#define LLVM_C_CORE_H
|
||||
|
||||
#include "llvm-c/Deprecated.h"
|
||||
#include "llvm-c/ErrorHandling.h"
|
||||
#include "llvm-c/ExternC.h"
|
||||
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
@@ -163,7 +165,8 @@ typedef enum {
|
||||
LLVMTokenTypeKind, /**< Tokens */
|
||||
LLVMScalableVectorTypeKind, /**< Scalable SIMD vector type */
|
||||
LLVMBFloatTypeKind, /**< 16 bit brain floating point type */
|
||||
LLVMX86_AMXTypeKind /**< X86 AMX */
|
||||
LLVMX86_AMXTypeKind, /**< X86 AMX */
|
||||
LLVMTargetExtTypeKind, /**< Target extension type */
|
||||
} LLVMTypeKind;
|
||||
|
||||
typedef enum {
|
||||
@@ -282,7 +285,8 @@ typedef enum {
|
||||
LLVMInlineAsmValueKind,
|
||||
|
||||
LLVMInstructionValueKind,
|
||||
LLVMPoisonValueValueKind
|
||||
LLVMPoisonValueValueKind,
|
||||
LLVMConstantTargetNoneValueKind,
|
||||
} LLVMValueKind;
|
||||
|
||||
typedef enum {
|
||||
@@ -379,8 +383,14 @@ typedef enum {
|
||||
the old one */
|
||||
LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the
|
||||
old one */
|
||||
LLVMAtomicRMWBinOpFSub /**< Subtract a floating point value and return the
|
||||
old one */
|
||||
LLVMAtomicRMWBinOpFSub, /**< Subtract a floating point value and return the
|
||||
old one */
|
||||
LLVMAtomicRMWBinOpFMax, /**< Sets the value if it's greater than the
|
||||
original using an floating point comparison and
|
||||
return the old one */
|
||||
LLVMAtomicRMWBinOpFMin, /**< Sets the value if it's smaller than the
|
||||
original using an floating point comparison and
|
||||
return the old one */
|
||||
} LLVMAtomicRMWBinOp;
|
||||
|
||||
typedef enum {
|
||||
@@ -464,13 +474,21 @@ typedef unsigned LLVMAttributeIndex;
|
||||
* @}
|
||||
*/
|
||||
|
||||
void LLVMInitializeCore(LLVMPassRegistryRef R);
|
||||
|
||||
/** Deallocate and destroy all ManagedStatic variables.
|
||||
@see llvm::llvm_shutdown
|
||||
@see ManagedStatic */
|
||||
void LLVMShutdown(void);
|
||||
|
||||
/*===-- Version query -----------------------------------------------------===*/
|
||||
|
||||
/**
|
||||
* Return the major, minor, and patch version of LLVM
|
||||
*
|
||||
* The version components are returned via the function's three output
|
||||
* parameters or skipped if a NULL pointer was supplied.
|
||||
*/
|
||||
void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch);
|
||||
|
||||
/*===-- Error handling ----------------------------------------------------===*/
|
||||
|
||||
char *LLVMCreateMessage(const char *Message);
|
||||
@@ -872,11 +890,11 @@ void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len);
|
||||
*
|
||||
* @see InlineAsm::get()
|
||||
*/
|
||||
LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty,
|
||||
char *AsmString, size_t AsmStringSize,
|
||||
char *Constraints, size_t ConstraintsSize,
|
||||
LLVMBool HasSideEffects, LLVMBool IsAlignStack,
|
||||
LLVMInlineAsmDialect Dialect);
|
||||
LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, char *AsmString,
|
||||
size_t AsmStringSize, char *Constraints,
|
||||
size_t ConstraintsSize, LLVMBool HasSideEffects,
|
||||
LLVMBool IsAlignStack,
|
||||
LLVMInlineAsmDialect Dialect, LLVMBool CanThrow);
|
||||
|
||||
/**
|
||||
* Obtain the context to which this module is associated.
|
||||
@@ -1389,9 +1407,7 @@ LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Obtain the type of elements within a sequential type.
|
||||
*
|
||||
* This works on array, vector, and pointer types.
|
||||
* Obtain the element type of an array or vector type.
|
||||
*
|
||||
* @see llvm::SequentialType::getElementType()
|
||||
*/
|
||||
@@ -1417,10 +1433,33 @@ unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp);
|
||||
* The created type will exist in the context that its element type
|
||||
* exists in.
|
||||
*
|
||||
* @deprecated LLVMArrayType is deprecated in favor of the API accurate
|
||||
* LLVMArrayType2
|
||||
* @see llvm::ArrayType::get()
|
||||
*/
|
||||
LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
|
||||
|
||||
/**
|
||||
* 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 LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount);
|
||||
|
||||
/**
|
||||
* Obtain the length of an array type.
|
||||
*
|
||||
* This only works on types that represent arrays.
|
||||
*
|
||||
* @deprecated LLVMGetArrayLength is deprecated in favor of the API accurate
|
||||
* LLVMGetArrayLength2
|
||||
* @see llvm::ArrayType::getNumElements()
|
||||
*/
|
||||
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
|
||||
|
||||
/**
|
||||
* Obtain the length of an array type.
|
||||
*
|
||||
@@ -1428,7 +1467,7 @@ LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
|
||||
*
|
||||
* @see llvm::ArrayType::getNumElements()
|
||||
*/
|
||||
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
|
||||
uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy);
|
||||
|
||||
/**
|
||||
* Create a pointer type that points to a defined type.
|
||||
@@ -1440,6 +1479,22 @@ unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
|
||||
*/
|
||||
LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
|
||||
|
||||
/**
|
||||
* Determine whether a pointer is opaque.
|
||||
*
|
||||
* True if this is an instance of an opaque PointerType.
|
||||
*
|
||||
* @see llvm::Type::isOpaquePointerTy()
|
||||
*/
|
||||
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty);
|
||||
|
||||
/**
|
||||
* Create an opaque pointer type in a context.
|
||||
*
|
||||
* @see llvm::PointerType::get()
|
||||
*/
|
||||
LLVMTypeRef LLVMPointerTypeInContext(LLVMContextRef C, unsigned AddressSpace);
|
||||
|
||||
/**
|
||||
* Obtain the address space of a pointer type.
|
||||
*
|
||||
@@ -1530,6 +1585,15 @@ LLVMTypeRef LLVMLabelType(void);
|
||||
LLVMTypeRef LLVMX86MMXType(void);
|
||||
LLVMTypeRef LLVMX86AMXType(void);
|
||||
|
||||
/**
|
||||
* Create a target extension type in LLVM context.
|
||||
*/
|
||||
LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name,
|
||||
LLVMTypeRef *TypeParams,
|
||||
unsigned TypeParamCount,
|
||||
unsigned *IntParams,
|
||||
unsigned IntParamCount);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -1580,10 +1644,10 @@ LLVMTypeRef LLVMX86AMXType(void);
|
||||
macro(ConstantVector) \
|
||||
macro(GlobalValue) \
|
||||
macro(GlobalAlias) \
|
||||
macro(GlobalIFunc) \
|
||||
macro(GlobalObject) \
|
||||
macro(Function) \
|
||||
macro(GlobalVariable) \
|
||||
macro(GlobalIFunc) \
|
||||
macro(UndefValue) \
|
||||
macro(PoisonValue) \
|
||||
macro(Instruction) \
|
||||
@@ -1740,6 +1804,7 @@ LLVMBool LLVMIsPoison(LLVMValueRef Val);
|
||||
LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
|
||||
|
||||
LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val);
|
||||
LLVMValueRef LLVMIsAValueAsMetadata(LLVMValueRef Val);
|
||||
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val);
|
||||
|
||||
/** Deprecated: Use LLVMGetValueName2 instead. */
|
||||
@@ -2072,11 +2137,21 @@ LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
|
||||
/**
|
||||
* Create a ConstantArray from values.
|
||||
*
|
||||
* @deprecated LLVMConstArray is deprecated in favor of the API accurate
|
||||
* LLVMConstArray2
|
||||
* @see llvm::ConstantArray::get()
|
||||
*/
|
||||
LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
|
||||
LLVMValueRef *ConstantVals, unsigned Length);
|
||||
|
||||
/**
|
||||
* Create a ConstantArray from values.
|
||||
*
|
||||
* @see llvm::ConstantArray::get()
|
||||
*/
|
||||
LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals,
|
||||
uint64_t Length);
|
||||
|
||||
/**
|
||||
* Create a non-anonymous ConstantStruct from values.
|
||||
*
|
||||
@@ -2086,12 +2161,24 @@ LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
|
||||
LLVMValueRef *ConstantVals,
|
||||
unsigned Count);
|
||||
|
||||
/**
|
||||
* Get element of a constant aggregate (struct, array or vector) at the
|
||||
* specified index. Returns null if the index is out of range, or it's not
|
||||
* possible to determine the element (e.g., because the constant is a
|
||||
* constant expression.)
|
||||
*
|
||||
* @see llvm::Constant::getAggregateElement()
|
||||
*/
|
||||
LLVMValueRef LLVMGetAggregateElement(LLVMValueRef C, unsigned Idx);
|
||||
|
||||
/**
|
||||
* Get an element at specified index as a constant.
|
||||
*
|
||||
* @see ConstantDataSequential::getElementAsConstant()
|
||||
*/
|
||||
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx);
|
||||
LLVM_ATTRIBUTE_C_DEPRECATED(
|
||||
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx),
|
||||
"Use LLVMGetAggregateElement instead");
|
||||
|
||||
/**
|
||||
* Create a ConstantVector from values.
|
||||
@@ -2119,28 +2206,16 @@ LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
|
||||
LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
|
||||
LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
|
||||
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
|
||||
LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
|
||||
LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
|
||||
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstExactUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
|
||||
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);
|
||||
@@ -2151,13 +2226,8 @@ LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,
|
||||
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);
|
||||
LLVMValueRef LLVMConstGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal,
|
||||
LLVMValueRef *ConstantIndices, unsigned NumIndices);
|
||||
LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal,
|
||||
LLVMValueRef *ConstantIndices,
|
||||
unsigned NumIndices);
|
||||
LLVMValueRef LLVMConstInBoundsGEP2(LLVMTypeRef Ty, LLVMValueRef ConstantVal,
|
||||
LLVMValueRef *ConstantIndices,
|
||||
unsigned NumIndices);
|
||||
@@ -2185,9 +2255,6 @@ LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
|
||||
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
|
||||
LLVMBool isSigned);
|
||||
LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
|
||||
LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
|
||||
LLVMValueRef ConstantIfTrue,
|
||||
LLVMValueRef ConstantIfFalse);
|
||||
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant,
|
||||
LLVMValueRef IndexConstant);
|
||||
LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
|
||||
@@ -2196,11 +2263,6 @@ LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
|
||||
LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
|
||||
LLVMValueRef VectorBConstant,
|
||||
LLVMValueRef MaskConstant);
|
||||
LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
|
||||
unsigned NumIdx);
|
||||
LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
|
||||
LLVMValueRef ElementValueConstant,
|
||||
unsigned *IdxList, unsigned NumIdx);
|
||||
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB);
|
||||
|
||||
/** Deprecated: Use LLVMGetInlineAsm instead. */
|
||||
@@ -2261,6 +2323,8 @@ void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
|
||||
* @see llvm::AllocaInst::getAlignment()
|
||||
* @see llvm::LoadInst::getAlignment()
|
||||
* @see llvm::StoreInst::getAlignment()
|
||||
* @see llvm::AtomicRMWInst::setAlignment()
|
||||
* @see llvm::AtomicCmpXchgInst::setAlignment()
|
||||
* @see llvm::GlobalValue::getAlignment()
|
||||
*/
|
||||
unsigned LLVMGetAlignment(LLVMValueRef V);
|
||||
@@ -2270,6 +2334,8 @@ unsigned LLVMGetAlignment(LLVMValueRef V);
|
||||
* @see llvm::AllocaInst::setAlignment()
|
||||
* @see llvm::LoadInst::setAlignment()
|
||||
* @see llvm::StoreInst::setAlignment()
|
||||
* @see llvm::AtomicRMWInst::setAlignment()
|
||||
* @see llvm::AtomicCmpXchgInst::setAlignment()
|
||||
* @see llvm::GlobalValue::setAlignment()
|
||||
*/
|
||||
void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
|
||||
@@ -2373,8 +2439,15 @@ void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit);
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
|
||||
const char *Name);
|
||||
|
||||
/**
|
||||
* Add a GlobalAlias with the given value type, address space and aliasee.
|
||||
*
|
||||
* @see llvm::GlobalAlias::create()
|
||||
*/
|
||||
LLVMValueRef LLVMAddAlias2(LLVMModuleRef M, LLVMTypeRef ValueTy,
|
||||
unsigned AddrSpace, LLVMValueRef Aliasee,
|
||||
const char *Name);
|
||||
|
||||
/**
|
||||
* Obtain a GlobalAlias value from a Module by its name.
|
||||
@@ -2510,6 +2583,12 @@ LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID,
|
||||
*/
|
||||
const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength);
|
||||
|
||||
/** Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead. */
|
||||
const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
|
||||
LLVMTypeRef *ParamTypes,
|
||||
size_t ParamCount,
|
||||
size_t *NameLength);
|
||||
|
||||
/**
|
||||
* Copies the name of an overloaded intrinsic identified by a given list of
|
||||
* parameter types.
|
||||
@@ -2517,12 +2596,14 @@ const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength);
|
||||
* Unlike LLVMIntrinsicGetName, the caller is responsible for freeing the
|
||||
* returned string.
|
||||
*
|
||||
* This version also supports unnamed types.
|
||||
*
|
||||
* @see llvm::Intrinsic::getName()
|
||||
*/
|
||||
const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
|
||||
LLVMTypeRef *ParamTypes,
|
||||
size_t ParamCount,
|
||||
size_t *NameLength);
|
||||
const char *LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID,
|
||||
LLVMTypeRef *ParamTypes,
|
||||
size_t ParamCount,
|
||||
size_t *NameLength);
|
||||
|
||||
/**
|
||||
* Obtain if the intrinsic identified by the given ID is overloaded.
|
||||
@@ -2860,6 +2941,14 @@ unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V);
|
||||
*/
|
||||
void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
|
||||
|
||||
/**
|
||||
* Replace an operand at a specific index in a llvm::MDNode value.
|
||||
*
|
||||
* @see llvm::MDNode::replaceOperandWith()
|
||||
*/
|
||||
void LLVMReplaceMDNodeOperandWith(LLVMValueRef V, unsigned Index,
|
||||
LLVMMetadataRef Replacement);
|
||||
|
||||
/** Deprecated: Use LLVMMDStringInContext2 instead. */
|
||||
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
|
||||
unsigned SLen);
|
||||
@@ -3167,7 +3256,7 @@ LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
|
||||
LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Remove and delete an instruction.
|
||||
* Remove an instruction.
|
||||
*
|
||||
* The instruction specified is removed from its containing building
|
||||
* block but is kept alive.
|
||||
@@ -3186,6 +3275,16 @@ void LLVMInstructionRemoveFromParent(LLVMValueRef Inst);
|
||||
*/
|
||||
void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Delete an instruction.
|
||||
*
|
||||
* The instruction specified is deleted. It must have previously been
|
||||
* removed from its containing building block.
|
||||
*
|
||||
* @see llvm::Value::deleteValue()
|
||||
*/
|
||||
void LLVMDeleteInstruction(LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Obtain the code opcode for an individual instruction.
|
||||
*
|
||||
@@ -3275,7 +3374,7 @@ void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
|
||||
*/
|
||||
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
|
||||
|
||||
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
|
||||
void LLVMSetInstrParamAlignment(LLVMValueRef Instr, LLVMAttributeIndex Idx,
|
||||
unsigned Align);
|
||||
|
||||
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx,
|
||||
@@ -3474,7 +3573,7 @@ LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca);
|
||||
*/
|
||||
|
||||
/**
|
||||
* Check whether the given GEP instruction is inbounds.
|
||||
* Check whether the given GEP operator is inbounds.
|
||||
*/
|
||||
LLVMBool LLVMIsInBounds(LLVMValueRef GEP);
|
||||
|
||||
@@ -3483,6 +3582,11 @@ LLVMBool LLVMIsInBounds(LLVMValueRef GEP);
|
||||
*/
|
||||
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds);
|
||||
|
||||
/**
|
||||
* Get the source element type of the given GEP operator.
|
||||
*/
|
||||
LLVMTypeRef LLVMGetGEPSourceElementType(LLVMValueRef GEP);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
@@ -3533,7 +3637,7 @@ LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
|
||||
|
||||
/**
|
||||
* Obtain the number of indices.
|
||||
* NB: This also works on GEP.
|
||||
* NB: This also works on GEP operators.
|
||||
*/
|
||||
unsigned LLVMGetNumIndices(LLVMValueRef Inst);
|
||||
|
||||
@@ -3599,10 +3703,20 @@ void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder, LLVMMetadataRef Loc);
|
||||
* current debug location for the given builder. If the builder has no current
|
||||
* debug location, this function is a no-op.
|
||||
*
|
||||
* @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general
|
||||
* LLVMAddMetadataToInst.
|
||||
*
|
||||
* @see llvm::IRBuilder::SetInstDebugLocation()
|
||||
*/
|
||||
void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Adds the metadata registered with the given builder to the given instruction.
|
||||
*
|
||||
* @see llvm::IRBuilder::AddMetadataToInst()
|
||||
*/
|
||||
void LLVMAddMetadataToInst(LLVMBuilderRef Builder, LLVMValueRef Inst);
|
||||
|
||||
/**
|
||||
* Get the dafult floating-point math metadata for a given builder.
|
||||
*
|
||||
@@ -3643,12 +3757,6 @@ LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
|
||||
LLVMBasicBlockRef Else, unsigned NumCases);
|
||||
LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
|
||||
unsigned NumDests);
|
||||
// LLVMBuildInvoke is deprecated in favor of LLVMBuildInvoke2, in preparation
|
||||
// for opaque pointer types.
|
||||
LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildInvoke2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
|
||||
@@ -3805,6 +3913,13 @@ LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
|
||||
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
|
||||
LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
|
||||
|
||||
LLVMBool LLVMGetNUW(LLVMValueRef ArithInst);
|
||||
void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW);
|
||||
LLVMBool LLVMGetNSW(LLVMValueRef ArithInst);
|
||||
void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW);
|
||||
LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst);
|
||||
void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact);
|
||||
|
||||
/* Memory */
|
||||
LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
||||
LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
|
||||
@@ -3842,23 +3957,9 @@ LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
||||
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
|
||||
LLVMValueRef Val, const char *Name);
|
||||
LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
|
||||
// LLVMBuildLoad is deprecated in favor of LLVMBuildLoad2, in preparation for
|
||||
// opaque pointer types.
|
||||
LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty,
|
||||
LLVMValueRef PointerVal, const char *Name);
|
||||
LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr);
|
||||
// LLVMBuildGEP, LLVMBuildInBoundsGEP, and LLVMBuildStructGEP are deprecated in
|
||||
// favor of LLVMBuild*GEP2, in preparation for opaque pointer types.
|
||||
LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
|
||||
LLVMValueRef *Indices, unsigned NumIndices,
|
||||
const char *Name);
|
||||
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 LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty,
|
||||
LLVMValueRef Pointer, LLVMValueRef *Indices,
|
||||
unsigned NumIndices, const char *Name);
|
||||
@@ -3928,6 +4029,9 @@ LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val,
|
||||
LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, /*Signed cast!*/
|
||||
LLVMTypeRef DestTy, const char *Name);
|
||||
|
||||
LLVMOpcode LLVMGetCastOpcode(LLVMValueRef Src, LLVMBool SrcIsSigned,
|
||||
LLVMTypeRef DestTy, LLVMBool DestIsSigned);
|
||||
|
||||
/* Comparisons */
|
||||
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op,
|
||||
LLVMValueRef LHS, LLVMValueRef RHS,
|
||||
@@ -3938,11 +4042,6 @@ LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
|
||||
|
||||
/* Miscellaneous instructions */
|
||||
LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
|
||||
// LLVMBuildCall is deprecated in favor of LLVMBuildCall2, in preparation for
|
||||
// opaque pointer types.
|
||||
LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn,
|
||||
LLVMValueRef *Args, unsigned NumArgs,
|
||||
const char *Name);
|
||||
@@ -3971,8 +4070,9 @@ 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);
|
||||
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef, LLVMTypeRef ElemTy,
|
||||
LLVMValueRef LHS, LLVMValueRef RHS,
|
||||
const char *Name);
|
||||
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering,
|
||||
LLVMBool singleThread, const char *Name);
|
||||
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
|
||||
@@ -4000,8 +4100,8 @@ int LLVMGetUndefMaskElem(void);
|
||||
* Get the mask value at position Elt in the mask of a ShuffleVector
|
||||
* instruction.
|
||||
*
|
||||
* \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is undef
|
||||
* at that position.
|
||||
* \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is
|
||||
* poison at that position.
|
||||
*/
|
||||
int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt);
|
||||
|
||||
@@ -4063,26 +4163,13 @@ const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
|
||||
size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
|
||||
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCorePassRegistry Pass Registry
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** Return the global pass registry, for use with initialization functions.
|
||||
@see llvm::PassRegistry::getPassRegistry */
|
||||
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCorePassManagers Pass Managers
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
@@ -16,11 +16,18 @@
|
||||
#ifndef LLVM_C_DEBUGINFO_H
|
||||
#define LLVM_C_DEBUGINFO_H
|
||||
|
||||
#include "llvm-c/Core.h"
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreDebugInfo Debug Information
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debug info flags.
|
||||
*/
|
||||
@@ -109,6 +116,16 @@ typedef enum {
|
||||
LLVMDWARFSourceLanguageFortran08,
|
||||
LLVMDWARFSourceLanguageRenderScript,
|
||||
LLVMDWARFSourceLanguageBLISS,
|
||||
LLVMDWARFSourceLanguageKotlin,
|
||||
LLVMDWARFSourceLanguageZig,
|
||||
LLVMDWARFSourceLanguageCrystal,
|
||||
LLVMDWARFSourceLanguageC_plus_plus_17,
|
||||
LLVMDWARFSourceLanguageC_plus_plus_20,
|
||||
LLVMDWARFSourceLanguageC17,
|
||||
LLVMDWARFSourceLanguageFortran18,
|
||||
LLVMDWARFSourceLanguageAda2005,
|
||||
LLVMDWARFSourceLanguageAda2012,
|
||||
LLVMDWARFSourceLanguageMojo,
|
||||
// Vendor extensions:
|
||||
LLVMDWARFSourceLanguageMips_Assembler,
|
||||
LLVMDWARFSourceLanguageGOOGLE_RenderScript,
|
||||
@@ -161,7 +178,9 @@ enum {
|
||||
LLVMDIMacroFileMetadataKind,
|
||||
LLVMDICommonBlockMetadataKind,
|
||||
LLVMDIStringTypeMetadataKind,
|
||||
LLVMDIGenericSubrangeMetadataKind
|
||||
LLVMDIGenericSubrangeMetadataKind,
|
||||
LLVMDIArgListMetadataKind,
|
||||
LLVMDIAssignIDMetadataKind,
|
||||
};
|
||||
typedef unsigned LLVMMetadataKind;
|
||||
|
||||
@@ -225,6 +244,13 @@ void LLVMDisposeDIBuilder(LLVMDIBuilderRef Builder);
|
||||
*/
|
||||
void LLVMDIBuilderFinalize(LLVMDIBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Finalize a specific subprogram.
|
||||
* No new variables may be added to this subprogram afterwards.
|
||||
*/
|
||||
void LLVMDIBuilderFinalizeSubprogram(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Subprogram);
|
||||
|
||||
/**
|
||||
* A CompileUnit provides an anchor for all debugging
|
||||
* information generated during this instance of compilation.
|
||||
@@ -388,48 +414,48 @@ LLVMDIBuilderCreateImportedModuleFromNamespace(LLVMDIBuilderRef Builder,
|
||||
* \param ImportedEntity Previous imported entity to alias.
|
||||
* \param File File where the declaration is located.
|
||||
* \param Line Line number of the declaration.
|
||||
* \param Elements Renamed elements.
|
||||
* \param NumElements Number of renamed elements.
|
||||
*/
|
||||
LLVMMetadataRef
|
||||
LLVMDIBuilderCreateImportedModuleFromAlias(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef ImportedEntity,
|
||||
LLVMMetadataRef File,
|
||||
unsigned Line);
|
||||
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromAlias(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef ImportedEntity, LLVMMetadataRef File, unsigned Line,
|
||||
LLVMMetadataRef *Elements, unsigned NumElements);
|
||||
|
||||
/**
|
||||
* Create a descriptor for an imported module.
|
||||
* \param Builder The \c DIBuilder.
|
||||
* \param Scope The scope this module is imported into
|
||||
* \param M The module being imported here
|
||||
* \param File File where the declaration is located.
|
||||
* \param Line Line number of the declaration.
|
||||
* \param Builder The \c DIBuilder.
|
||||
* \param Scope The scope this module is imported into
|
||||
* \param M The module being imported here
|
||||
* \param File File where the declaration is located.
|
||||
* \param Line Line number of the declaration.
|
||||
* \param Elements Renamed elements.
|
||||
* \param NumElements Number of renamed elements.
|
||||
*/
|
||||
LLVMMetadataRef
|
||||
LLVMDIBuilderCreateImportedModuleFromModule(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef M,
|
||||
LLVMMetadataRef File,
|
||||
unsigned Line);
|
||||
LLVMMetadataRef LLVMDIBuilderCreateImportedModuleFromModule(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef M,
|
||||
LLVMMetadataRef File, unsigned Line, LLVMMetadataRef *Elements,
|
||||
unsigned NumElements);
|
||||
|
||||
/**
|
||||
* Create a descriptor for an imported function, type, or variable. Suitable
|
||||
* for e.g. FORTRAN-style USE declarations.
|
||||
* \param Builder The DIBuilder.
|
||||
* \param Scope The scope this module is imported into.
|
||||
* \param Decl The declaration (or definition) of a function, type,
|
||||
or variable.
|
||||
* \param File File where the declaration is located.
|
||||
* \param Line Line number of the declaration.
|
||||
* \param Name A name that uniquely identifies this imported declaration.
|
||||
* \param NameLen The length of the C string passed to \c Name.
|
||||
* \param Builder The DIBuilder.
|
||||
* \param Scope The scope this module is imported into.
|
||||
* \param Decl The declaration (or definition) of a function, type,
|
||||
or variable.
|
||||
* \param File File where the declaration is located.
|
||||
* \param Line Line number of the declaration.
|
||||
* \param Name A name that uniquely identifies this imported
|
||||
declaration.
|
||||
* \param NameLen The length of the C string passed to \c Name.
|
||||
* \param Elements Renamed elements.
|
||||
* \param NumElements Number of renamed elements.
|
||||
*/
|
||||
LLVMMetadataRef
|
||||
LLVMDIBuilderCreateImportedDeclaration(LLVMDIBuilderRef Builder,
|
||||
LLVMMetadataRef Scope,
|
||||
LLVMMetadataRef Decl,
|
||||
LLVMMetadataRef File,
|
||||
unsigned Line,
|
||||
const char *Name, size_t NameLen);
|
||||
LLVMMetadataRef LLVMDIBuilderCreateImportedDeclaration(
|
||||
LLVMDIBuilderRef Builder, LLVMMetadataRef Scope, LLVMMetadataRef Decl,
|
||||
LLVMMetadataRef File, unsigned Line, const char *Name, size_t NameLen,
|
||||
LLVMMetadataRef *Elements, unsigned NumElements);
|
||||
|
||||
/**
|
||||
* Creates a new DebugLocation that describes a source location.
|
||||
@@ -1087,7 +1113,7 @@ LLVMMetadataRef LLVMDIBuilderGetOrCreateArray(LLVMDIBuilderRef Builder,
|
||||
* \param Length Length of the address operation array.
|
||||
*/
|
||||
LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
|
||||
int64_t *Addr, size_t Length);
|
||||
uint64_t *Addr, size_t Length);
|
||||
|
||||
/**
|
||||
* Create a new descriptor for the specified variable that does not have an
|
||||
@@ -1097,7 +1123,7 @@ LLVMMetadataRef LLVMDIBuilderCreateExpression(LLVMDIBuilderRef Builder,
|
||||
*/
|
||||
LLVMMetadataRef
|
||||
LLVMDIBuilderCreateConstantValueExpression(LLVMDIBuilderRef Builder,
|
||||
int64_t Value);
|
||||
uint64_t Value);
|
||||
|
||||
/**
|
||||
* Create a new descriptor for the specified variable.
|
||||
@@ -1124,6 +1150,12 @@ LLVMMetadataRef LLVMDIBuilderCreateGlobalVariableExpression(
|
||||
unsigned LineNo, LLVMMetadataRef Ty, LLVMBool LocalToUnit,
|
||||
LLVMMetadataRef Expr, LLVMMetadataRef Decl, uint32_t AlignInBits);
|
||||
|
||||
|
||||
/**
|
||||
* Get the dwarf::Tag of a DINode
|
||||
*/
|
||||
uint16_t LLVMGetDINodeTag(LLVMMetadataRef MD);
|
||||
|
||||
/**
|
||||
* Retrieves the \c DIVariable associated with this global variable expression.
|
||||
* \param GVE The global variable expression.
|
||||
@@ -1359,6 +1391,10 @@ void LLVMInstructionSetDebugLoc(LLVMValueRef Inst, LLVMMetadataRef Loc);
|
||||
*/
|
||||
LLVMMetadataKind LLVMGetMetadataKind(LLVMMetadataRef Metadata);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
38
src/llvm-c/Deprecated.h
Normal file
38
src/llvm-c/Deprecated.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*===-- llvm-c/Deprecated.h - Deprecation macro -------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares LLVM_ATTRIBUTE_C_DEPRECATED() macro, which can be *|
|
||||
|* used to deprecate functions in the C interface. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_DEPRECATED_H
|
||||
#define LLVM_C_DEPRECATED_H
|
||||
|
||||
#ifndef __has_feature
|
||||
# define __has_feature(x) 0
|
||||
#endif
|
||||
|
||||
// This is a variant of LLVM_ATTRIBUTE_DEPRECATED() that is compatible with
|
||||
// C compilers.
|
||||
#if __has_feature(attribute_deprecated_with_message)
|
||||
# define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
|
||||
decl __attribute__((deprecated(message)))
|
||||
#elif defined(__GNUC__)
|
||||
# define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
|
||||
decl __attribute__((deprecated))
|
||||
#elif defined(_MSC_VER)
|
||||
# define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
|
||||
__declspec(deprecated(message)) decl
|
||||
#else
|
||||
# define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message) \
|
||||
decl
|
||||
#endif
|
||||
|
||||
#endif /* LLVM_C_DEPRECATED_H */
|
||||
@@ -7,8 +7,8 @@
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_DISASSEMBLER_TYPES_H
|
||||
#define LLVM_DISASSEMBLER_TYPES_H
|
||||
#ifndef LLVM_C_DISASSEMBLERTYPES_H
|
||||
#define LLVM_C_DISASSEMBLERTYPES_H
|
||||
|
||||
#include "llvm-c/DataTypes.h"
|
||||
#ifdef __cplusplus
|
||||
@@ -17,6 +17,12 @@
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup LLVMCDisassembler
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* An opaque reference to a disassembler context.
|
||||
*/
|
||||
@@ -32,15 +38,15 @@ typedef void *LLVMDisasmContextRef;
|
||||
* one operand with symbolic information. To determine the symbolic operand
|
||||
* information for each operand, the bytes for the specific operand in the
|
||||
* instruction are specified by the Offset parameter and its byte widith is the
|
||||
* size parameter. For instructions sets with fixed widths and one symbolic
|
||||
* operand per instruction, the Offset parameter will be zero and Size parameter
|
||||
* will be the instruction width. The information is returned in TagBuf and is
|
||||
* Triple specific with its specific information defined by the value of
|
||||
* TagType for that Triple. If symbolic information is returned the function
|
||||
* returns 1, otherwise it returns 0.
|
||||
* OpSize parameter. For instructions sets with fixed widths and one symbolic
|
||||
* operand per instruction, the Offset parameter will be zero and InstSize
|
||||
* parameter will be the instruction width. The information is returned in
|
||||
* TagBuf and is Triple specific with its specific information defined by the
|
||||
* value of TagType for that Triple. If symbolic information is returned the
|
||||
* function * returns 1, otherwise it returns 0.
|
||||
*/
|
||||
typedef int (*LLVMOpInfoCallback)(void *DisInfo, uint64_t PC,
|
||||
uint64_t Offset, uint64_t Size,
|
||||
typedef int (*LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, uint64_t Offset,
|
||||
uint64_t OpSize, uint64_t InstSize,
|
||||
int TagType, void *TagBuf);
|
||||
|
||||
/**
|
||||
@@ -157,4 +163,8 @@ typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo,
|
||||
/* The output reference is to a C++ symbol name. */
|
||||
#define LLVMDisassembler_ReferenceType_DeMangled_Name 9
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCError Error Handling
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LLVMErrorSuccess 0
|
||||
|
||||
/**
|
||||
@@ -67,6 +74,10 @@ LLVMErrorTypeId LLVMGetStringErrorTypeId(void);
|
||||
*/
|
||||
LLVMErrorRef LLVMCreateStringError(const char *ErrMsg);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,13 +11,19 @@
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_ERROR_HANDLING_H
|
||||
#define LLVM_C_ERROR_HANDLING_H
|
||||
#ifndef LLVM_C_ERRORHANDLING_H
|
||||
#define LLVM_C_ERRORHANDLING_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup LLVMCError
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef void (*LLVMFatalErrorHandler)(const char *Reason);
|
||||
|
||||
/**
|
||||
@@ -42,6 +48,10 @@ void LLVMResetFatalErrorHandler(void);
|
||||
*/
|
||||
void LLVMEnablePrettyStackTrace(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_EXTERN_C_H
|
||||
#define LLVM_C_EXTERN_C_H
|
||||
#ifndef LLVM_C_EXTERNC_H
|
||||
#define LLVM_C_EXTERNC_H
|
||||
|
||||
#ifdef __clang__
|
||||
#define LLVM_C_STRICT_PROTOTYPES_BEGIN \
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreIRReader IR Reader
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Read LLVM IR from a memory buffer and convert it into an in-memory Module
|
||||
* object. Returns 0 on success.
|
||||
@@ -32,6 +39,10 @@ LLVMBool LLVMParseIRInContext(LLVMContextRef ContextRef,
|
||||
LLVMMemoryBufferRef MemBuf, LLVMModuleRef *OutM,
|
||||
char **OutMessage);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
/*===-- llvm-c/Initialization.h - Initialization C Interface ------*- C -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to LLVM initialization routines, *|
|
||||
|* which must be called before you can use the functionality provided by *|
|
||||
|* the corresponding LLVM library. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_INITIALIZATION_H
|
||||
#define LLVM_C_INITIALIZATION_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCInitialization Initialization Routines
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* This module contains routines used to initialize the LLVM system.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
void LLVMInitializeCore(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeTransformUtils(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeScalarOpts(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeVectorization(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeInstCombine(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeAggressiveInstCombiner(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeIPO(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeInstrumentation(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeAnalysis(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeIPA(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeCodeGen(LLVMPassRegistryRef R);
|
||||
void LLVMInitializeTarget(LLVMPassRegistryRef R);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
251
src/llvm-c/LLJIT.h
Normal file
251
src/llvm-c/LLJIT.h
Normal file
@@ -0,0 +1,251 @@
|
||||
/*===----------- llvm-c/LLJIT.h - OrcV2 LLJIT C bindings --------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to the LLJIT class in *|
|
||||
|* libLLVMOrcJIT.a, which provides a simple MCJIT-like ORC JIT. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
|* Note: This interface is experimental. It is *NOT* stable, and may be *|
|
||||
|* changed without warning. Only C API usage documentation is *|
|
||||
|* provided. See the C++ documentation for all higher level ORC API *|
|
||||
|* details. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_LLJIT_H
|
||||
#define LLVM_C_LLJIT_H
|
||||
|
||||
#include "llvm-c/Error.h"
|
||||
#include "llvm-c/Orc.h"
|
||||
#include "llvm-c/TargetMachine.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCExecutionEngineLLJIT LLJIT
|
||||
* @ingroup LLVMCExecutionEngine
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* A function for constructing an ObjectLinkingLayer instance to be used
|
||||
* by an LLJIT instance.
|
||||
*
|
||||
* Clients can call LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator to
|
||||
* set the creator function to use when constructing an LLJIT instance.
|
||||
* This can be used to override the default linking layer implementation
|
||||
* that would otherwise be chosen by LLJITBuilder.
|
||||
*
|
||||
* Object linking layers returned by this function will become owned by the
|
||||
* LLJIT instance. The client is not responsible for managing their lifetimes
|
||||
* after the function returns.
|
||||
*/
|
||||
typedef LLVMOrcObjectLayerRef (
|
||||
*LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction)(
|
||||
void *Ctx, LLVMOrcExecutionSessionRef ES, const char *Triple);
|
||||
|
||||
/**
|
||||
* A reference to an orc::LLJITBuilder instance.
|
||||
*/
|
||||
typedef struct LLVMOrcOpaqueLLJITBuilder *LLVMOrcLLJITBuilderRef;
|
||||
|
||||
/**
|
||||
* A reference to an orc::LLJIT instance.
|
||||
*/
|
||||
typedef struct LLVMOrcOpaqueLLJIT *LLVMOrcLLJITRef;
|
||||
|
||||
/**
|
||||
* Create an LLVMOrcLLJITBuilder.
|
||||
*
|
||||
* The client owns the resulting LLJITBuilder and should dispose of it using
|
||||
* LLVMOrcDisposeLLJITBuilder once they are done with it.
|
||||
*/
|
||||
LLVMOrcLLJITBuilderRef LLVMOrcCreateLLJITBuilder(void);
|
||||
|
||||
/**
|
||||
* Dispose of an LLVMOrcLLJITBuilderRef. This should only be called if ownership
|
||||
* has not been passed to LLVMOrcCreateLLJIT (e.g. because some error prevented
|
||||
* that function from being called).
|
||||
*/
|
||||
void LLVMOrcDisposeLLJITBuilder(LLVMOrcLLJITBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Set the JITTargetMachineBuilder to be used when constructing the LLJIT
|
||||
* instance. Calling this function is optional: if it is not called then the
|
||||
* LLJITBuilder will use JITTargeTMachineBuilder::detectHost to construct a
|
||||
* JITTargetMachineBuilder.
|
||||
*
|
||||
* This function takes ownership of the JTMB argument: clients should not
|
||||
* dispose of the JITTargetMachineBuilder after calling this function.
|
||||
*/
|
||||
void LLVMOrcLLJITBuilderSetJITTargetMachineBuilder(
|
||||
LLVMOrcLLJITBuilderRef Builder, LLVMOrcJITTargetMachineBuilderRef JTMB);
|
||||
|
||||
/**
|
||||
* Set an ObjectLinkingLayer creator function for this LLJIT instance.
|
||||
*/
|
||||
void LLVMOrcLLJITBuilderSetObjectLinkingLayerCreator(
|
||||
LLVMOrcLLJITBuilderRef Builder,
|
||||
LLVMOrcLLJITBuilderObjectLinkingLayerCreatorFunction F, void *Ctx);
|
||||
|
||||
/**
|
||||
* Create an LLJIT instance from an LLJITBuilder.
|
||||
*
|
||||
* This operation takes ownership of the Builder argument: clients should not
|
||||
* dispose of the builder after calling this function (even if the function
|
||||
* returns an error). If a null Builder argument is provided then a
|
||||
* default-constructed LLJITBuilder will be used.
|
||||
*
|
||||
* On success the resulting LLJIT instance is uniquely owned by the client and
|
||||
* automatically manages the memory of all JIT'd code and all modules that are
|
||||
* transferred to it (e.g. via LLVMOrcLLJITAddLLVMIRModule). Disposing of the
|
||||
* LLJIT instance will free all memory managed by the JIT, including JIT'd code
|
||||
* and not-yet compiled modules.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcCreateLLJIT(LLVMOrcLLJITRef *Result,
|
||||
LLVMOrcLLJITBuilderRef Builder);
|
||||
|
||||
/**
|
||||
* Dispose of an LLJIT instance.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcDisposeLLJIT(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Get a reference to the ExecutionSession for this LLJIT instance.
|
||||
*
|
||||
* The ExecutionSession is owned by the LLJIT instance. The client is not
|
||||
* responsible for managing its memory.
|
||||
*/
|
||||
LLVMOrcExecutionSessionRef LLVMOrcLLJITGetExecutionSession(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Return a reference to the Main JITDylib.
|
||||
*
|
||||
* The JITDylib is owned by the LLJIT instance. The client is not responsible
|
||||
* for managing its memory.
|
||||
*/
|
||||
LLVMOrcJITDylibRef LLVMOrcLLJITGetMainJITDylib(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Return the target triple for this LLJIT instance. This string is owned by
|
||||
* the LLJIT instance and should not be freed by the client.
|
||||
*/
|
||||
const char *LLVMOrcLLJITGetTripleString(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Returns the global prefix character according to the LLJIT's DataLayout.
|
||||
*/
|
||||
char LLVMOrcLLJITGetGlobalPrefix(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Mangles the given string according to the LLJIT instance's DataLayout, then
|
||||
* interns the result in the SymbolStringPool and returns a reference to the
|
||||
* pool entry. Clients should call LLVMOrcReleaseSymbolStringPoolEntry to
|
||||
* decrement the ref-count on the pool entry once they are finished with this
|
||||
* value.
|
||||
*/
|
||||
LLVMOrcSymbolStringPoolEntryRef
|
||||
LLVMOrcLLJITMangleAndIntern(LLVMOrcLLJITRef J, const char *UnmangledName);
|
||||
|
||||
/**
|
||||
* Add a buffer representing an object file to the given JITDylib in the given
|
||||
* LLJIT instance. This operation transfers ownership of the buffer to the
|
||||
* LLJIT instance. The buffer should not be disposed of or referenced once this
|
||||
* function returns.
|
||||
*
|
||||
* Resources associated with the given object will be tracked by the given
|
||||
* JITDylib's default resource tracker.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcLLJITAddObjectFile(LLVMOrcLLJITRef J, LLVMOrcJITDylibRef JD,
|
||||
LLVMMemoryBufferRef ObjBuffer);
|
||||
|
||||
/**
|
||||
* Add a buffer representing an object file to the given ResourceTracker's
|
||||
* JITDylib in the given LLJIT instance. This operation transfers ownership of
|
||||
* the buffer to the LLJIT instance. The buffer should not be disposed of or
|
||||
* referenced once this function returns.
|
||||
*
|
||||
* Resources associated with the given object will be tracked by ResourceTracker
|
||||
* RT.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcLLJITAddObjectFileWithRT(LLVMOrcLLJITRef J,
|
||||
LLVMOrcResourceTrackerRef RT,
|
||||
LLVMMemoryBufferRef ObjBuffer);
|
||||
|
||||
/**
|
||||
* Add an IR module to the given JITDylib in the given LLJIT instance. This
|
||||
* operation transfers ownership of the TSM argument to the LLJIT instance.
|
||||
* The TSM argument should not be disposed of or referenced once this
|
||||
* function returns.
|
||||
*
|
||||
* Resources associated with the given Module will be tracked by the given
|
||||
* JITDylib's default resource tracker.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModule(LLVMOrcLLJITRef J,
|
||||
LLVMOrcJITDylibRef JD,
|
||||
LLVMOrcThreadSafeModuleRef TSM);
|
||||
|
||||
/**
|
||||
* Add an IR module to the given ResourceTracker's JITDylib in the given LLJIT
|
||||
* instance. This operation transfers ownership of the TSM argument to the LLJIT
|
||||
* instance. The TSM argument should not be disposed of or referenced once this
|
||||
* function returns.
|
||||
*
|
||||
* Resources associated with the given Module will be tracked by ResourceTracker
|
||||
* RT.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcLLJITAddLLVMIRModuleWithRT(LLVMOrcLLJITRef J,
|
||||
LLVMOrcResourceTrackerRef JD,
|
||||
LLVMOrcThreadSafeModuleRef TSM);
|
||||
|
||||
/**
|
||||
* Look up the given symbol in the main JITDylib of the given LLJIT instance.
|
||||
*
|
||||
* This operation does not take ownership of the Name argument.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcLLJITLookup(LLVMOrcLLJITRef J,
|
||||
LLVMOrcExecutorAddress *Result,
|
||||
const char *Name);
|
||||
|
||||
/**
|
||||
* Returns a non-owning reference to the LLJIT instance's object linking layer.
|
||||
*/
|
||||
LLVMOrcObjectLayerRef LLVMOrcLLJITGetObjLinkingLayer(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Returns a non-owning reference to the LLJIT instance's object linking layer.
|
||||
*/
|
||||
LLVMOrcObjectTransformLayerRef
|
||||
LLVMOrcLLJITGetObjTransformLayer(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Returns a non-owning reference to the LLJIT instance's IR transform layer.
|
||||
*/
|
||||
LLVMOrcIRTransformLayerRef LLVMOrcLLJITGetIRTransformLayer(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* Get the LLJIT instance's default data layout string.
|
||||
*
|
||||
* This string is owned by the LLJIT instance and does not need to be freed
|
||||
* by the caller.
|
||||
*/
|
||||
const char *LLVMOrcLLJITGetDataLayoutStr(LLVMOrcLLJITRef J);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif /* LLVM_C_LLJIT_H */
|
||||
@@ -1,66 +0,0 @@
|
||||
//===-- llvm/LinkTimeOptimizer.h - LTO Public C Interface -------*- C++ -*-===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This header provides a C API to use the LLVM link time optimization
|
||||
// library. This is intended to be used by linkers which are C-only in
|
||||
// their implementation for performing LTO.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef LLVM_C_LINKTIMEOPTIMIZER_H
|
||||
#define LLVM_C_LINKTIMEOPTIMIZER_H
|
||||
|
||||
#include "ExternC.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCLinkTimeOptimizer Link Time Optimization
|
||||
* @ingroup LLVMC
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/// This provides a dummy type for pointers to the LTO object.
|
||||
typedef void* llvm_lto_t;
|
||||
|
||||
/// This provides a C-visible enumerator to manage status codes.
|
||||
/// This should map exactly onto the C++ enumerator LTOStatus.
|
||||
typedef enum llvm_lto_status {
|
||||
LLVM_LTO_UNKNOWN,
|
||||
LLVM_LTO_OPT_SUCCESS,
|
||||
LLVM_LTO_READ_SUCCESS,
|
||||
LLVM_LTO_READ_FAILURE,
|
||||
LLVM_LTO_WRITE_FAILURE,
|
||||
LLVM_LTO_NO_TARGET,
|
||||
LLVM_LTO_NO_WORK,
|
||||
LLVM_LTO_MODULE_MERGE_FAILURE,
|
||||
LLVM_LTO_ASM_FAILURE,
|
||||
|
||||
// Added C-specific error codes
|
||||
LLVM_LTO_NULL_OBJECT
|
||||
} llvm_lto_status_t;
|
||||
|
||||
/// This provides C interface to initialize link time optimizer. This allows
|
||||
/// linker to use dlopen() interface to dynamically load LinkTimeOptimizer.
|
||||
/// extern "C" helps, because dlopen() interface uses name to find the symbol.
|
||||
extern llvm_lto_t llvm_create_optimizer(void);
|
||||
extern void llvm_destroy_optimizer(llvm_lto_t lto);
|
||||
|
||||
extern llvm_lto_status_t llvm_read_object_file
|
||||
(llvm_lto_t lto, const char* input_filename);
|
||||
extern llvm_lto_status_t llvm_optimize_modules
|
||||
(llvm_lto_t lto, const char* output_filename);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -19,6 +19,13 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreLinker Linker
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/* This enum is provided for backwards-compatibility only. It has no effect. */
|
||||
typedef enum {
|
||||
LLVMLinkerDestroySource = 0, /* This is the default behavior. */
|
||||
@@ -35,4 +42,8 @@ LLVMBool LLVMLinkModules2(LLVMModuleRef Dest, LLVMModuleRef Src);
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
#include "llvm-c/Config/llvm-config.h"
|
||||
#include "llvm-c/Config//llvm-config.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
@@ -38,21 +38,23 @@ typedef struct LLVMOpaqueSymbolIterator *LLVMSymbolIteratorRef;
|
||||
typedef struct LLVMOpaqueRelocationIterator *LLVMRelocationIteratorRef;
|
||||
|
||||
typedef enum {
|
||||
LLVMBinaryTypeArchive, /**< Archive file. */
|
||||
LLVMBinaryTypeMachOUniversalBinary, /**< Mach-O Universal Binary file. */
|
||||
LLVMBinaryTypeCOFFImportFile, /**< COFF Import file. */
|
||||
LLVMBinaryTypeIR, /**< LLVM IR. */
|
||||
LLVMBinaryTypeWinRes, /**< Windows resource (.res) file. */
|
||||
LLVMBinaryTypeCOFF, /**< COFF Object file. */
|
||||
LLVMBinaryTypeELF32L, /**< ELF 32-bit, little endian. */
|
||||
LLVMBinaryTypeELF32B, /**< ELF 32-bit, big endian. */
|
||||
LLVMBinaryTypeELF64L, /**< ELF 64-bit, little endian. */
|
||||
LLVMBinaryTypeELF64B, /**< ELF 64-bit, big endian. */
|
||||
LLVMBinaryTypeMachO32L, /**< MachO 32-bit, little endian. */
|
||||
LLVMBinaryTypeMachO32B, /**< MachO 32-bit, big endian. */
|
||||
LLVMBinaryTypeMachO64L, /**< MachO 64-bit, little endian. */
|
||||
LLVMBinaryTypeMachO64B, /**< MachO 64-bit, big endian. */
|
||||
LLVMBinaryTypeWasm, /**< Web Assembly. */
|
||||
LLVMBinaryTypeArchive, /**< Archive file. */
|
||||
LLVMBinaryTypeMachOUniversalBinary, /**< Mach-O Universal Binary file. */
|
||||
LLVMBinaryTypeCOFFImportFile, /**< COFF Import file. */
|
||||
LLVMBinaryTypeIR, /**< LLVM IR. */
|
||||
LLVMBinaryTypeWinRes, /**< Windows resource (.res) file. */
|
||||
LLVMBinaryTypeCOFF, /**< COFF Object file. */
|
||||
LLVMBinaryTypeELF32L, /**< ELF 32-bit, little endian. */
|
||||
LLVMBinaryTypeELF32B, /**< ELF 32-bit, big endian. */
|
||||
LLVMBinaryTypeELF64L, /**< ELF 64-bit, little endian. */
|
||||
LLVMBinaryTypeELF64B, /**< ELF 64-bit, big endian. */
|
||||
LLVMBinaryTypeMachO32L, /**< MachO 32-bit, little endian. */
|
||||
LLVMBinaryTypeMachO32B, /**< MachO 32-bit, big endian. */
|
||||
LLVMBinaryTypeMachO64L, /**< MachO 64-bit, little endian. */
|
||||
LLVMBinaryTypeMachO64B, /**< MachO 64-bit, big endian. */
|
||||
LLVMBinaryTypeWasm, /**< Web Assembly. */
|
||||
LLVMBinaryTypeOffload, /**< Offloading fatbinary. */
|
||||
|
||||
} LLVMBinaryType;
|
||||
|
||||
/**
|
||||
|
||||
1292
src/llvm-c/Orc.h
Normal file
1292
src/llvm-c/Orc.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,169 +0,0 @@
|
||||
/*===----------- llvm-c/OrcBindings.h - Orc Lib C Iface ---------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMOrcJIT.a, which implements *|
|
||||
|* JIT compilation of LLVM IR. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
|* Note: This interface is experimental. It is *NOT* stable, and may be *|
|
||||
|* changed without warning. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_ORCBINDINGS_H
|
||||
#define LLVM_C_ORCBINDINGS_H
|
||||
|
||||
#include "Error.h"
|
||||
#include "ExternC.h"
|
||||
#include "Object.h"
|
||||
#include "TargetMachine.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
typedef struct LLVMOrcOpaqueJITStack *LLVMOrcJITStackRef;
|
||||
typedef uint64_t LLVMOrcModuleHandle;
|
||||
typedef uint64_t LLVMOrcTargetAddress;
|
||||
typedef uint64_t (*LLVMOrcSymbolResolverFn)(const char *Name, void *LookupCtx);
|
||||
typedef uint64_t (*LLVMOrcLazyCompileCallbackFn)(LLVMOrcJITStackRef JITStack,
|
||||
void *CallbackCtx);
|
||||
|
||||
/**
|
||||
* Create an ORC JIT stack.
|
||||
*
|
||||
* The client owns the resulting stack, and must call OrcDisposeInstance(...)
|
||||
* to destroy it and free its memory. The JIT stack will take ownership of the
|
||||
* TargetMachine, which will be destroyed when the stack is destroyed. The
|
||||
* client should not attempt to dispose of the Target Machine, or it will result
|
||||
* in a double-free.
|
||||
*/
|
||||
LLVMOrcJITStackRef LLVMOrcCreateInstance(LLVMTargetMachineRef TM);
|
||||
|
||||
/**
|
||||
* Get the error message for the most recent error (if any).
|
||||
*
|
||||
* This message is owned by the ORC JIT Stack and will be freed when the stack
|
||||
* is disposed of by LLVMOrcDisposeInstance.
|
||||
*/
|
||||
const char *LLVMOrcGetErrorMsg(LLVMOrcJITStackRef JITStack);
|
||||
|
||||
/**
|
||||
* Mangle the given symbol.
|
||||
* Memory will be allocated for MangledSymbol to hold the result. The client
|
||||
*/
|
||||
void LLVMOrcGetMangledSymbol(LLVMOrcJITStackRef JITStack, char **MangledSymbol,
|
||||
const char *Symbol);
|
||||
|
||||
/**
|
||||
* Dispose of a mangled symbol.
|
||||
*/
|
||||
void LLVMOrcDisposeMangledSymbol(char *MangledSymbol);
|
||||
|
||||
/**
|
||||
* Create a lazy compile callback.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcCreateLazyCompileCallback(
|
||||
LLVMOrcJITStackRef JITStack, LLVMOrcTargetAddress *RetAddr,
|
||||
LLVMOrcLazyCompileCallbackFn Callback, void *CallbackCtx);
|
||||
|
||||
/**
|
||||
* Create a named indirect call stub.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcCreateIndirectStub(LLVMOrcJITStackRef JITStack,
|
||||
const char *StubName,
|
||||
LLVMOrcTargetAddress InitAddr);
|
||||
|
||||
/**
|
||||
* Set the pointer for the given indirect stub.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcSetIndirectStubPointer(LLVMOrcJITStackRef JITStack,
|
||||
const char *StubName,
|
||||
LLVMOrcTargetAddress NewAddr);
|
||||
|
||||
/**
|
||||
* Add module to be eagerly compiled.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcAddEagerlyCompiledIR(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcModuleHandle *RetHandle,
|
||||
LLVMModuleRef Mod,
|
||||
LLVMOrcSymbolResolverFn SymbolResolver,
|
||||
void *SymbolResolverCtx);
|
||||
|
||||
/**
|
||||
* Add module to be lazily compiled one function at a time.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcAddLazilyCompiledIR(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcModuleHandle *RetHandle,
|
||||
LLVMModuleRef Mod,
|
||||
LLVMOrcSymbolResolverFn SymbolResolver,
|
||||
void *SymbolResolverCtx);
|
||||
|
||||
/**
|
||||
* Add an object file.
|
||||
*
|
||||
* This method takes ownership of the given memory buffer and attempts to add
|
||||
* it to the JIT as an object file.
|
||||
* Clients should *not* dispose of the 'Obj' argument: the JIT will manage it
|
||||
* from this call onwards.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcAddObjectFile(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcModuleHandle *RetHandle,
|
||||
LLVMMemoryBufferRef Obj,
|
||||
LLVMOrcSymbolResolverFn SymbolResolver,
|
||||
void *SymbolResolverCtx);
|
||||
|
||||
/**
|
||||
* Remove a module set from the JIT.
|
||||
*
|
||||
* This works for all modules that can be added via OrcAdd*, including object
|
||||
* files.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcRemoveModule(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcModuleHandle H);
|
||||
|
||||
/**
|
||||
* Get symbol address from JIT instance.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcGetSymbolAddress(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcTargetAddress *RetAddr,
|
||||
const char *SymbolName);
|
||||
|
||||
/**
|
||||
* Get symbol address from JIT instance, searching only the specified
|
||||
* handle.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcGetSymbolAddressIn(LLVMOrcJITStackRef JITStack,
|
||||
LLVMOrcTargetAddress *RetAddr,
|
||||
LLVMOrcModuleHandle H,
|
||||
const char *SymbolName);
|
||||
|
||||
/**
|
||||
* Dispose of an ORC JIT stack.
|
||||
*/
|
||||
LLVMErrorRef LLVMOrcDisposeInstance(LLVMOrcJITStackRef JITStack);
|
||||
|
||||
/**
|
||||
* Register a JIT Event Listener.
|
||||
*
|
||||
* A NULL listener is ignored.
|
||||
*/
|
||||
void LLVMOrcRegisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L);
|
||||
|
||||
/**
|
||||
* Unegister a JIT Event Listener.
|
||||
*
|
||||
* A NULL listener is ignored.
|
||||
*/
|
||||
void LLVMOrcUnregisterJITEventListener(LLVMOrcJITStackRef JITStack, LLVMJITEventListenerRef L);
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif /* LLVM_C_ORCBINDINGS_H */
|
||||
103
src/llvm-c/OrcEE.h
Normal file
103
src/llvm-c/OrcEE.h
Normal file
@@ -0,0 +1,103 @@
|
||||
/*===-- llvm-c/OrcEE.h - OrcV2 C bindings ExecutionEngine utils -*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to ExecutionEngine based utils, e.g. *|
|
||||
|* RTDyldObjectLinkingLayer (based on RuntimeDyld) in Orc. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
|* Note: This interface is experimental. It is *NOT* stable, and may be *|
|
||||
|* changed without warning. Only C API usage documentation is *|
|
||||
|* provided. See the C++ documentation for all higher level ORC API *|
|
||||
|* details. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_ORCEE_H
|
||||
#define LLVM_C_ORCEE_H
|
||||
|
||||
#include "llvm-c/Error.h"
|
||||
#include "llvm-c/ExecutionEngine.h"
|
||||
#include "llvm-c/Orc.h"
|
||||
#include "llvm-c/TargetMachine.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
typedef void *(*LLVMMemoryManagerCreateContextCallback)(void *CtxCtx);
|
||||
typedef void (*LLVMMemoryManagerNotifyTerminatingCallback)(void *CtxCtx);
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCExecutionEngineORCEE ExecutionEngine-based ORC Utils
|
||||
* @ingroup LLVMCExecutionEngine
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a RTDyldObjectLinkingLayer instance using the standard
|
||||
* SectionMemoryManager for memory management.
|
||||
*/
|
||||
LLVMOrcObjectLayerRef
|
||||
LLVMOrcCreateRTDyldObjectLinkingLayerWithSectionMemoryManager(
|
||||
LLVMOrcExecutionSessionRef ES);
|
||||
|
||||
/**
|
||||
* Create a RTDyldObjectLinkingLayer instance using MCJIT-memory-manager-like
|
||||
* callbacks.
|
||||
*
|
||||
* This is intended to simplify transitions for existing MCJIT clients. The
|
||||
* callbacks used are similar (but not identical) to the callbacks for
|
||||
* LLVMCreateSimpleMCJITMemoryManager: Unlike MCJIT, RTDyldObjectLinkingLayer
|
||||
* will create a new memory manager for each object linked by calling the given
|
||||
* CreateContext callback. This allows for code removal by destroying each
|
||||
* allocator individually. Every allocator will be destroyed (if it has not been
|
||||
* already) at RTDyldObjectLinkingLayer destruction time, and the
|
||||
* NotifyTerminating callback will be called to indicate that no further
|
||||
* allocation contexts will be created.
|
||||
*
|
||||
* To implement MCJIT-like behavior clients can implement CreateContext,
|
||||
* NotifyTerminating, and Destroy as:
|
||||
*
|
||||
* void *CreateContext(void *CtxCtx) { return CtxCtx; }
|
||||
* void NotifyTerminating(void *CtxCtx) { MyOriginalDestroy(CtxCtx); }
|
||||
* void Destroy(void *Ctx) { }
|
||||
*
|
||||
* This scheme simply reuses the CreateContextCtx pointer as the one-and-only
|
||||
* allocation context.
|
||||
*/
|
||||
LLVMOrcObjectLayerRef
|
||||
LLVMOrcCreateRTDyldObjectLinkingLayerWithMCJITMemoryManagerLikeCallbacks(
|
||||
LLVMOrcExecutionSessionRef ES, void *CreateContextCtx,
|
||||
LLVMMemoryManagerCreateContextCallback CreateContext,
|
||||
LLVMMemoryManagerNotifyTerminatingCallback NotifyTerminating,
|
||||
LLVMMemoryManagerAllocateCodeSectionCallback AllocateCodeSection,
|
||||
LLVMMemoryManagerAllocateDataSectionCallback AllocateDataSection,
|
||||
LLVMMemoryManagerFinalizeMemoryCallback FinalizeMemory,
|
||||
LLVMMemoryManagerDestroyCallback Destroy);
|
||||
|
||||
/**
|
||||
* Add the given listener to the given RTDyldObjectLinkingLayer.
|
||||
*
|
||||
* Note: Layer must be an RTDyldObjectLinkingLayer instance or
|
||||
* behavior is undefined.
|
||||
*/
|
||||
void LLVMOrcRTDyldObjectLinkingLayerRegisterJITEventListener(
|
||||
LLVMOrcObjectLayerRef RTDyldObjLinkingLayer,
|
||||
LLVMJITEventListenerRef Listener);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif /* LLVM_C_ORCEE_H */
|
||||
@@ -20,6 +20,12 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function permanently loads the dynamic library at the given path.
|
||||
* It is safe to call this function multiple times for the same library.
|
||||
@@ -57,6 +63,10 @@ void *LLVMSearchForAddressOfSymbol(const char *symbolName);
|
||||
*/
|
||||
void LLVMAddSymbol(const char *symbolName, void *symbolValue);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
#include "llvm-c/Config/llvm-config.h"
|
||||
#include "llvm-c/Config//llvm-config.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
@@ -40,34 +40,34 @@ typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
|
||||
/* Declare all of the target-initialization functions that are available. */
|
||||
#define LLVM_TARGET(TargetName) \
|
||||
void LLVMInitialize##TargetName##TargetInfo(void);
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
#define LLVM_TARGET(TargetName) void LLVMInitialize##TargetName##Target(void);
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
#define LLVM_TARGET(TargetName) \
|
||||
void LLVMInitialize##TargetName##TargetMC(void);
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available assembly printer initialization functions. */
|
||||
#define LLVM_ASM_PRINTER(TargetName) \
|
||||
void LLVMInitialize##TargetName##AsmPrinter(void);
|
||||
#include "llvm-c/Config/AsmPrinters.def"
|
||||
#include "llvm-c/Config//AsmPrinters.def"
|
||||
#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available assembly parser initialization functions. */
|
||||
#define LLVM_ASM_PARSER(TargetName) \
|
||||
void LLVMInitialize##TargetName##AsmParser(void);
|
||||
#include "llvm-c/Config/AsmParsers.def"
|
||||
#include "llvm-c/Config//AsmParsers.def"
|
||||
#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/* Declare all of the available disassembler initialization functions. */
|
||||
#define LLVM_DISASSEMBLER(TargetName) \
|
||||
void LLVMInitialize##TargetName##Disassembler(void);
|
||||
#include "llvm-c/Config/Disassemblers.def"
|
||||
#include "llvm-c/Config//Disassemblers.def"
|
||||
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
|
||||
|
||||
/** LLVMInitializeAllTargetInfos - The main program should call this function if
|
||||
@@ -75,7 +75,7 @@ typedef struct LLVMOpaqueTargetLibraryInfotData *LLVMTargetLibraryInfoRef;
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargetInfos(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetInfo();
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ static inline void LLVMInitializeAllTargetInfos(void) {
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargets(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##Target();
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ static inline void LLVMInitializeAllTargets(void) {
|
||||
support. */
|
||||
static inline void LLVMInitializeAllTargetMCs(void) {
|
||||
#define LLVM_TARGET(TargetName) LLVMInitialize##TargetName##TargetMC();
|
||||
#include "llvm-c/Config/Targets.def"
|
||||
#include "llvm-c/Config//Targets.def"
|
||||
#undef LLVM_TARGET /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ static inline void LLVMInitializeAllTargetMCs(void) {
|
||||
available via the TargetRegistry. */
|
||||
static inline void LLVMInitializeAllAsmPrinters(void) {
|
||||
#define LLVM_ASM_PRINTER(TargetName) LLVMInitialize##TargetName##AsmPrinter();
|
||||
#include "llvm-c/Config/AsmPrinters.def"
|
||||
#include "llvm-c/Config//AsmPrinters.def"
|
||||
#undef LLVM_ASM_PRINTER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ static inline void LLVMInitializeAllAsmPrinters(void) {
|
||||
available via the TargetRegistry. */
|
||||
static inline void LLVMInitializeAllAsmParsers(void) {
|
||||
#define LLVM_ASM_PARSER(TargetName) LLVMInitialize##TargetName##AsmParser();
|
||||
#include "llvm-c/Config/AsmParsers.def"
|
||||
#include "llvm-c/Config//AsmParsers.def"
|
||||
#undef LLVM_ASM_PARSER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ static inline void LLVMInitializeAllAsmParsers(void) {
|
||||
static inline void LLVMInitializeAllDisassemblers(void) {
|
||||
#define LLVM_DISASSEMBLER(TargetName) \
|
||||
LLVMInitialize##TargetName##Disassembler();
|
||||
#include "llvm-c/Config/Disassemblers.def"
|
||||
#include "llvm-c/Config//Disassemblers.def"
|
||||
#undef LLVM_DISASSEMBLER /* Explicit undef to make SWIG happier */
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @addtogroup LLVMCTarget
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
typedef struct LLVMOpaqueTargetMachine *LLVMTargetMachineRef;
|
||||
typedef struct LLVMTarget *LLVMTargetRef;
|
||||
|
||||
@@ -130,7 +136,9 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
|
||||
wraps several c++ only classes (among them a file stream). Returns any
|
||||
error in ErrorMessage. Use LLVMDisposeMessage to dispose the message. */
|
||||
LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
|
||||
char *Filename, LLVMCodeGenFileType codegen, char **ErrorMessage);
|
||||
const char *Filename,
|
||||
LLVMCodeGenFileType codegen,
|
||||
char **ErrorMessage);
|
||||
|
||||
/** Compile the LLVM IR stored in \p M and store the result in \p OutMemBuf. */
|
||||
LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T, LLVMModuleRef M,
|
||||
@@ -156,6 +164,10 @@ char* LLVMGetHostCPUFeatures(void);
|
||||
/** Adds the target-specific analysis passes to the pass manager. */
|
||||
void LLVMAddAnalysisPasses(LLVMTargetMachineRef T, LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/*===-- AggressiveInstCombine.h ---------------------------------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMAggressiveInstCombine.a, *|
|
||||
|* which combines instructions to form fewer, simple IR instructions. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_AGGRESSIVEINSTCOMBINE_H
|
||||
#define LLVM_C_TRANSFORMS_AGGRESSIVEINSTCOMBINE_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsAggressiveInstCombine Aggressive Instruction Combining transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createAggressiveInstCombinerPass function. */
|
||||
void LLVMAddAggressiveInstCombinerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*===-- Coroutines.h - Coroutines Library C Interface -----------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMCoroutines.a, which *|
|
||||
|* implements various scalar transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_COROUTINES_H
|
||||
#define LLVM_C_TRANSFORMS_COROUTINES_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
#include "llvm-c/Transforms/PassManagerBuilder.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsCoroutines Coroutine transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createCoroEarlyLegacyPass function. */
|
||||
void LLVMAddCoroEarlyPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCoroSplitLegacyPass function. */
|
||||
void LLVMAddCoroSplitPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCoroElideLegacyPass function. */
|
||||
void LLVMAddCoroElidePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCoroCleanupLegacyPass function. */
|
||||
void LLVMAddCoroCleanupPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::addCoroutinePassesToExtensionPoints. */
|
||||
void LLVMPassManagerBuilderAddCoroutinePassesToExtensionPoints(LLVMPassManagerBuilderRef PMB);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -1,96 +0,0 @@
|
||||
/*===-- IPO.h - Interprocedural Transformations C Interface -----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMIPO.a, which implements *|
|
||||
|* various interprocedural transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_IPO_H
|
||||
#define LLVM_C_TRANSFORMS_IPO_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsIPO Interprocedural transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createArgumentPromotionPass function. */
|
||||
void LLVMAddArgumentPromotionPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createConstantMergePass function. */
|
||||
void LLVMAddConstantMergePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createMergeFunctionsPass function. */
|
||||
void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCalledValuePropagationPass function. */
|
||||
void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createDeadArgEliminationPass function. */
|
||||
void LLVMAddDeadArgEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createFunctionAttrsPass function. */
|
||||
void LLVMAddFunctionAttrsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createFunctionInliningPass function. */
|
||||
void LLVMAddFunctionInliningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createAlwaysInlinerPass function. */
|
||||
void LLVMAddAlwaysInlinerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGlobalDCEPass function. */
|
||||
void LLVMAddGlobalDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGlobalOptimizerPass function. */
|
||||
void LLVMAddGlobalOptimizerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createPruneEHPass function. */
|
||||
void LLVMAddPruneEHPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createIPSCCPPass function. */
|
||||
void LLVMAddIPSCCPPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createInternalizePass function. */
|
||||
void LLVMAddInternalizePass(LLVMPassManagerRef, unsigned AllButMain);
|
||||
|
||||
/**
|
||||
* Create and add the internalize pass to the given pass manager with the
|
||||
* provided preservation callback.
|
||||
*
|
||||
* The context parameter is forwarded to the callback on each invocation.
|
||||
* As such, it is the responsibility of the caller to extend its lifetime
|
||||
* until execution of this pass has finished.
|
||||
*
|
||||
* @see llvm::createInternalizePass function.
|
||||
*/
|
||||
void LLVMAddInternalizePassWithMustPreservePredicate(
|
||||
LLVMPassManagerRef PM,
|
||||
void *Context,
|
||||
LLVMBool (*MustPreserve)(LLVMValueRef, void *));
|
||||
|
||||
/** See llvm::createStripDeadPrototypesPass function. */
|
||||
void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createStripSymbolsPass function. */
|
||||
void LLVMAddStripSymbolsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -1,40 +0,0 @@
|
||||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMInstCombine.a, which *|
|
||||
|* combines instructions to form fewer, simple IR instructions. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_INSTCOMBINE_H
|
||||
#define LLVM_C_TRANSFORMS_INSTCOMBINE_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsInstCombine Instruction Combining transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createInstructionCombiningPass function. */
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
116
src/llvm-c/Transforms/PassBuilder.h
Normal file
116
src/llvm-c/Transforms/PassBuilder.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*===-- llvm-c/Transform/PassBuilder.h - PassBuilder for LLVM C ---*- C -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header contains the LLVM-C interface into the new pass manager *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_PASSBUILDER_H
|
||||
#define LLVM_C_TRANSFORMS_PASSBUILDER_H
|
||||
|
||||
#include "llvm-c/Error.h"
|
||||
#include "llvm-c/TargetMachine.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCCoreNewPM New Pass Manager
|
||||
* @ingroup LLVMCCore
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* A set of options passed which are attached to the Pass Manager upon run.
|
||||
*
|
||||
* This corresponds to an llvm::LLVMPassBuilderOptions instance
|
||||
*
|
||||
* The details for how the different properties of this structure are used can
|
||||
* be found in the source for LLVMRunPasses
|
||||
*/
|
||||
typedef struct LLVMOpaquePassBuilderOptions *LLVMPassBuilderOptionsRef;
|
||||
|
||||
/**
|
||||
* Construct and run a set of passes over a module
|
||||
*
|
||||
* This function takes a string with the passes that should be used. The format
|
||||
* of this string is the same as opt's -passes argument for the new pass
|
||||
* manager. Individual passes may be specified, separated by commas. Full
|
||||
* pipelines may also be invoked using `default<O3>` and friends. See opt for
|
||||
* full reference of the Passes format.
|
||||
*/
|
||||
LLVMErrorRef LLVMRunPasses(LLVMModuleRef M, const char *Passes,
|
||||
LLVMTargetMachineRef TM,
|
||||
LLVMPassBuilderOptionsRef Options);
|
||||
|
||||
/**
|
||||
* Create a new set of options for a PassBuilder
|
||||
*
|
||||
* Ownership of the returned instance is given to the client, and they are
|
||||
* responsible for it. The client should call LLVMDisposePassBuilderOptions
|
||||
* to free the pass builder options.
|
||||
*/
|
||||
LLVMPassBuilderOptionsRef LLVMCreatePassBuilderOptions(void);
|
||||
|
||||
/**
|
||||
* Toggle adding the VerifierPass for the PassBuilder, ensuring all functions
|
||||
* inside the module is valid.
|
||||
*/
|
||||
void LLVMPassBuilderOptionsSetVerifyEach(LLVMPassBuilderOptionsRef Options,
|
||||
LLVMBool VerifyEach);
|
||||
|
||||
/**
|
||||
* Toggle debug logging when running the PassBuilder
|
||||
*/
|
||||
void LLVMPassBuilderOptionsSetDebugLogging(LLVMPassBuilderOptionsRef Options,
|
||||
LLVMBool DebugLogging);
|
||||
|
||||
void LLVMPassBuilderOptionsSetLoopInterleaving(
|
||||
LLVMPassBuilderOptionsRef Options, LLVMBool LoopInterleaving);
|
||||
|
||||
void LLVMPassBuilderOptionsSetLoopVectorization(
|
||||
LLVMPassBuilderOptionsRef Options, LLVMBool LoopVectorization);
|
||||
|
||||
void LLVMPassBuilderOptionsSetSLPVectorization(
|
||||
LLVMPassBuilderOptionsRef Options, LLVMBool SLPVectorization);
|
||||
|
||||
void LLVMPassBuilderOptionsSetLoopUnrolling(LLVMPassBuilderOptionsRef Options,
|
||||
LLVMBool LoopUnrolling);
|
||||
|
||||
void LLVMPassBuilderOptionsSetForgetAllSCEVInLoopUnroll(
|
||||
LLVMPassBuilderOptionsRef Options, LLVMBool ForgetAllSCEVInLoopUnroll);
|
||||
|
||||
void LLVMPassBuilderOptionsSetLicmMssaOptCap(LLVMPassBuilderOptionsRef Options,
|
||||
unsigned LicmMssaOptCap);
|
||||
|
||||
void LLVMPassBuilderOptionsSetLicmMssaNoAccForPromotionCap(
|
||||
LLVMPassBuilderOptionsRef Options, unsigned LicmMssaNoAccForPromotionCap);
|
||||
|
||||
void LLVMPassBuilderOptionsSetCallGraphProfile(
|
||||
LLVMPassBuilderOptionsRef Options, LLVMBool CallGraphProfile);
|
||||
|
||||
void LLVMPassBuilderOptionsSetMergeFunctions(LLVMPassBuilderOptionsRef Options,
|
||||
LLVMBool MergeFunctions);
|
||||
|
||||
void LLVMPassBuilderOptionsSetInlinerThreshold(
|
||||
LLVMPassBuilderOptionsRef Options, int Threshold);
|
||||
|
||||
/**
|
||||
* Dispose of a heap-allocated PassBuilderOptions instance
|
||||
*/
|
||||
void LLVMDisposePassBuilderOptions(LLVMPassBuilderOptionsRef Options);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif // LLVM_C_TRANSFORMS_PASSBUILDER_H
|
||||
@@ -1,87 +0,0 @@
|
||||
/*===-- llvm-c/Transform/PassManagerBuilder.h - PMB C Interface ---*- C -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to the PassManagerBuilder class. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
|
||||
#define LLVM_C_TRANSFORMS_PASSMANAGERBUILDER_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
typedef struct LLVMOpaquePassManagerBuilder *LLVMPassManagerBuilderRef;
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsPassManagerBuilder Pass manager builder
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::PassManagerBuilder. */
|
||||
LLVMPassManagerBuilderRef LLVMPassManagerBuilderCreate(void);
|
||||
void LLVMPassManagerBuilderDispose(LLVMPassManagerBuilderRef PMB);
|
||||
|
||||
/** See llvm::PassManagerBuilder::OptLevel. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetOptLevel(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned OptLevel);
|
||||
|
||||
/** See llvm::PassManagerBuilder::SizeLevel. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetSizeLevel(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned SizeLevel);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableUnitAtATime. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableUnitAtATime(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableUnrollLoops. */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableUnrollLoops(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::DisableSimplifyLibCalls */
|
||||
void
|
||||
LLVMPassManagerBuilderSetDisableSimplifyLibCalls(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMBool Value);
|
||||
|
||||
/** See llvm::PassManagerBuilder::Inliner. */
|
||||
void
|
||||
LLVMPassManagerBuilderUseInlinerWithThreshold(LLVMPassManagerBuilderRef PMB,
|
||||
unsigned Threshold);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateFunctionPassManager. */
|
||||
void
|
||||
LLVMPassManagerBuilderPopulateFunctionPassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateModulePassManager. */
|
||||
void
|
||||
LLVMPassManagerBuilderPopulateModulePassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::PassManagerBuilder::populateLTOPassManager. */
|
||||
void LLVMPassManagerBuilderPopulateLTOPassManager(LLVMPassManagerBuilderRef PMB,
|
||||
LLVMPassManagerRef PM,
|
||||
LLVMBool Internalize,
|
||||
LLVMBool RunInliner);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -1,170 +0,0 @@
|
||||
/*===-- Scalar.h - Scalar Transformation Library C Interface ----*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMScalarOpts.a, which *|
|
||||
|* implements various scalar transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_SCALAR_H
|
||||
#define LLVM_C_TRANSFORMS_SCALAR_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsScalar Scalar transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createAggressiveDCEPass function. */
|
||||
void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createDeadCodeEliminationPass function. */
|
||||
void LLVMAddDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createBitTrackingDCEPass function. */
|
||||
void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createAlignmentFromAssumptionsPass function. */
|
||||
void LLVMAddAlignmentFromAssumptionsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCFGSimplificationPass function. */
|
||||
void LLVMAddCFGSimplificationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createDeadStoreEliminationPass function. */
|
||||
void LLVMAddDeadStoreEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createScalarizerPass function. */
|
||||
void LLVMAddScalarizerPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createMergedLoadStoreMotionPass function. */
|
||||
void LLVMAddMergedLoadStoreMotionPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGVNPass function. */
|
||||
void LLVMAddGVNPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createGVNPass function. */
|
||||
void LLVMAddNewGVNPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createIndVarSimplifyPass function. */
|
||||
void LLVMAddIndVarSimplifyPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createInstructionCombiningPass function. */
|
||||
void LLVMAddInstructionCombiningPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createInstSimplifyLegacyPass function. */
|
||||
void LLVMAddInstructionSimplifyPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createJumpThreadingPass function. */
|
||||
void LLVMAddJumpThreadingPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLICMPass function. */
|
||||
void LLVMAddLICMPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopDeletionPass function. */
|
||||
void LLVMAddLoopDeletionPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopIdiomPass function */
|
||||
void LLVMAddLoopIdiomPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopRotatePass function. */
|
||||
void LLVMAddLoopRotatePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopRerollPass function. */
|
||||
void LLVMAddLoopRerollPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopUnrollPass function. */
|
||||
void LLVMAddLoopUnrollPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopUnrollAndJamPass function. */
|
||||
void LLVMAddLoopUnrollAndJamPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLoopUnswitchPass function. */
|
||||
void LLVMAddLoopUnswitchPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLowerAtomicPass function. */
|
||||
void LLVMAddLowerAtomicPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createMemCpyOptPass function. */
|
||||
void LLVMAddMemCpyOptPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createPartiallyInlineLibCallsPass function. */
|
||||
void LLVMAddPartiallyInlineLibCallsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createReassociatePass function. */
|
||||
void LLVMAddReassociatePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSCCPPass function. */
|
||||
void LLVMAddSCCPPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSROAPass function. */
|
||||
void LLVMAddScalarReplAggregatesPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSROAPass function. */
|
||||
void LLVMAddScalarReplAggregatesPassSSA(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSROAPass function. */
|
||||
void LLVMAddScalarReplAggregatesPassWithThreshold(LLVMPassManagerRef PM,
|
||||
int Threshold);
|
||||
|
||||
/** See llvm::createSimplifyLibCallsPass function. */
|
||||
void LLVMAddSimplifyLibCallsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createTailCallEliminationPass function. */
|
||||
void LLVMAddTailCallEliminationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::demotePromoteMemoryToRegisterPass function. */
|
||||
void LLVMAddDemoteMemoryToRegisterPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createVerifierPass function. */
|
||||
void LLVMAddVerifierPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createCorrelatedValuePropagationPass function */
|
||||
void LLVMAddCorrelatedValuePropagationPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createEarlyCSEPass function */
|
||||
void LLVMAddEarlyCSEPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createEarlyCSEPass function */
|
||||
void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLowerExpectIntrinsicPass function */
|
||||
void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createLowerConstantIntrinsicsPass function */
|
||||
void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createTypeBasedAliasAnalysisPass function */
|
||||
void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createScopedNoAliasAAPass function */
|
||||
void LLVMAddScopedNoAliasAAPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createBasicAliasAnalysisPass function */
|
||||
void LLVMAddBasicAliasAnalysisPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createUnifyFunctionExitNodesPass function */
|
||||
void LLVMAddUnifyFunctionExitNodesPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -1,50 +0,0 @@
|
||||
/*===-- Utils.h - Transformation Utils Library C Interface ------*- C++ -*-===*\
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMTransformUtils.a, which *|
|
||||
|* implements various transformation utilities of the LLVM IR. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_UTILS_H
|
||||
#define LLVM_C_TRANSFORMS_UTILS_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsUtils Transformation Utilities
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createLowerSwitchPass function. */
|
||||
void LLVMAddLowerSwitchPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createPromoteMemoryToRegisterPass function. */
|
||||
void LLVMAddPromoteMemoryToRegisterPass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createAddDiscriminatorsPass function. */
|
||||
void LLVMAddAddDiscriminatorsPass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*===---------------------------Vectorize.h --------------------- -*- C -*-===*\
|
||||
|*===----------- Vectorization Transformation Library C Interface ---------===*|
|
||||
|* *|
|
||||
|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
|
||||
|* Exceptions. *|
|
||||
|* See https://llvm.org/LICENSE.txt for license information. *|
|
||||
|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to libLLVMVectorize.a, which *|
|
||||
|* implements various vectorization transformations of the LLVM IR. *|
|
||||
|* *|
|
||||
|* 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. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_TRANSFORMS_VECTORIZE_H
|
||||
#define LLVM_C_TRANSFORMS_VECTORIZE_H
|
||||
|
||||
#include "llvm-c/ExternC.h"
|
||||
#include "llvm-c/Types.h"
|
||||
|
||||
LLVM_C_EXTERN_C_BEGIN
|
||||
|
||||
/**
|
||||
* @defgroup LLVMCTransformsVectorize Vectorization transformations
|
||||
* @ingroup LLVMCTransforms
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** See llvm::createLoopVectorizePass function. */
|
||||
void LLVMAddLoopVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/** See llvm::createSLPVectorizerPass function. */
|
||||
void LLVMAddSLPVectorizePass(LLVMPassManagerRef PM);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
LLVM_C_EXTERN_C_END
|
||||
|
||||
#endif
|
||||
@@ -126,9 +126,6 @@ typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
|
||||
/** @see llvm::PassManagerBase */
|
||||
typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
|
||||
|
||||
/** @see llvm::PassRegistry */
|
||||
typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
|
||||
|
||||
/**
|
||||
* Used to get the users and usees of a Value.
|
||||
*
|
||||
|
||||
79
src/llvm-c/blake3.h
Normal file
79
src/llvm-c/blake3.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/*===-- llvm-c/blake3.h - BLAKE3 C Interface ----------------------*- C -*-===*\
|
||||
|* *|
|
||||
|* Released into the public domain with CC0 1.0 *|
|
||||
|* See 'llvm/lib/Support/BLAKE3/LICENSE' for info. *|
|
||||
|* SPDX-License-Identifier: CC0-1.0 *|
|
||||
|* *|
|
||||
|*===----------------------------------------------------------------------===*|
|
||||
|* *|
|
||||
|* This header declares the C interface to LLVM's BLAKE3 implementation. *|
|
||||
|* Original BLAKE3 C API: https://github.com/BLAKE3-team/BLAKE3/tree/1.3.1/c *|
|
||||
|* *|
|
||||
|* Symbols are prefixed with 'llvm' to avoid a potential conflict with *|
|
||||
|* another BLAKE3 version within the same program. *|
|
||||
|* *|
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef LLVM_C_BLAKE3_H
|
||||
#define LLVM_C_BLAKE3_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define LLVM_BLAKE3_VERSION_STRING "1.3.1"
|
||||
#define LLVM_BLAKE3_KEY_LEN 32
|
||||
#define LLVM_BLAKE3_OUT_LEN 32
|
||||
#define LLVM_BLAKE3_BLOCK_LEN 64
|
||||
#define LLVM_BLAKE3_CHUNK_LEN 1024
|
||||
#define LLVM_BLAKE3_MAX_DEPTH 54
|
||||
|
||||
// This struct is a private implementation detail. It has to be here because
|
||||
// it's part of llvm_blake3_hasher below.
|
||||
typedef struct {
|
||||
uint32_t cv[8];
|
||||
uint64_t chunk_counter;
|
||||
uint8_t buf[LLVM_BLAKE3_BLOCK_LEN];
|
||||
uint8_t buf_len;
|
||||
uint8_t blocks_compressed;
|
||||
uint8_t flags;
|
||||
} llvm_blake3_chunk_state;
|
||||
|
||||
typedef struct {
|
||||
uint32_t key[8];
|
||||
llvm_blake3_chunk_state chunk;
|
||||
uint8_t cv_stack_len;
|
||||
// The stack size is MAX_DEPTH + 1 because we do lazy merging. For example,
|
||||
// with 7 chunks, we have 3 entries in the stack. Adding an 8th chunk
|
||||
// requires a 4th entry, rather than merging everything down to 1, because we
|
||||
// don't know whether more input is coming. This is different from how the
|
||||
// reference implementation does things.
|
||||
uint8_t cv_stack[(LLVM_BLAKE3_MAX_DEPTH + 1) * LLVM_BLAKE3_OUT_LEN];
|
||||
} llvm_blake3_hasher;
|
||||
|
||||
const char *llvm_blake3_version(void);
|
||||
void llvm_blake3_hasher_init(llvm_blake3_hasher *self);
|
||||
void llvm_blake3_hasher_init_keyed(llvm_blake3_hasher *self,
|
||||
const uint8_t key[LLVM_BLAKE3_KEY_LEN]);
|
||||
void llvm_blake3_hasher_init_derive_key(llvm_blake3_hasher *self,
|
||||
const char *context);
|
||||
void llvm_blake3_hasher_init_derive_key_raw(llvm_blake3_hasher *self,
|
||||
const void *context,
|
||||
size_t context_len);
|
||||
void llvm_blake3_hasher_update(llvm_blake3_hasher *self, const void *input,
|
||||
size_t input_len);
|
||||
void llvm_blake3_hasher_finalize(const llvm_blake3_hasher *self, uint8_t *out,
|
||||
size_t out_len);
|
||||
void llvm_blake3_hasher_finalize_seek(const llvm_blake3_hasher *self,
|
||||
uint64_t seek, uint8_t *out,
|
||||
size_t out_len);
|
||||
void llvm_blake3_hasher_reset(llvm_blake3_hasher *self);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LLVM_C_BLAKE3_H */
|
||||
@@ -46,7 +46,7 @@ typedef bool lto_bool_t;
|
||||
* @{
|
||||
*/
|
||||
|
||||
#define LTO_API_VERSION 27
|
||||
#define LTO_API_VERSION 29
|
||||
|
||||
/**
|
||||
* \since prior to LTO_API_VERSION=3
|
||||
@@ -312,6 +312,16 @@ extern lto_bool_t lto_module_get_macho_cputype(lto_module_t mod,
|
||||
unsigned int *out_cputype,
|
||||
unsigned int *out_cpusubtype);
|
||||
|
||||
/**
|
||||
* This function can be used by the linker to check if a given module has
|
||||
* any constructor or destructor functions.
|
||||
*
|
||||
* Returns true if the module has either the @llvm.global_ctors or the
|
||||
* @llvm.global_dtors symbol. Otherwise returns false.
|
||||
*
|
||||
* \since LTO_API_VERSION=29
|
||||
*/
|
||||
extern lto_bool_t lto_module_has_ctor_dtor(lto_module_t mod);
|
||||
/**
|
||||
* Diagnostic severity.
|
||||
*
|
||||
@@ -527,7 +537,23 @@ extern unsigned int
|
||||
lto_api_version(void);
|
||||
|
||||
/**
|
||||
* Sets options to help debug codegen bugs.
|
||||
* Parses options immediately, making them available as early as possible. For
|
||||
* example during executing codegen::InitTargetOptionsFromCodeGenFlags. Since
|
||||
* parsing shud only happen once, only one of lto_codegen_debug_options or
|
||||
* lto_set_debug_options should be called.
|
||||
*
|
||||
* This function takes one or more options separated by spaces.
|
||||
* Warning: passing file paths through this function may confuse the argument
|
||||
* parser if the paths contain spaces.
|
||||
*
|
||||
* \since LTO_API_VERSION=28
|
||||
*/
|
||||
extern void lto_set_debug_options(const char *const *options, int number);
|
||||
|
||||
/**
|
||||
* Sets options to help debug codegen bugs. Since parsing shud only happen once,
|
||||
* only one of lto_codegen_debug_options or lto_set_debug_options
|
||||
* should be called.
|
||||
*
|
||||
* This function takes one or more options separated by spaces.
|
||||
* Warning: passing file paths through this function may confuse the argument
|
||||
|
||||
@@ -168,7 +168,7 @@ gb_internal lbValue lb_equal_proc_for_type(lbModule *m, Type *type) {
|
||||
map_set(&m->equal_procs, type, p);
|
||||
lb_begin_procedure_body(p);
|
||||
|
||||
lb_add_attribute_to_proc(m, p->value, "readonly");
|
||||
// lb_add_attribute_to_proc(m, p->value, "readonly");
|
||||
lb_add_attribute_to_proc(m, p->value, "nounwind");
|
||||
|
||||
LLVMValueRef x = LLVMGetParam(p->value, 0);
|
||||
@@ -337,7 +337,7 @@ gb_internal lbValue lb_hasher_proc_for_type(lbModule *m, Type *type) {
|
||||
lb_begin_procedure_body(p);
|
||||
defer (lb_end_procedure_body(p));
|
||||
|
||||
lb_add_attribute_to_proc(m, p->value, "readonly");
|
||||
// lb_add_attribute_to_proc(m, p->value, "readonly");
|
||||
lb_add_attribute_to_proc(m, p->value, "nounwind");
|
||||
|
||||
LLVMValueRef x = LLVMGetParam(p->value, 0);
|
||||
@@ -346,7 +346,7 @@ gb_internal lbValue lb_hasher_proc_for_type(lbModule *m, Type *type) {
|
||||
lbValue seed = {y, t_uintptr};
|
||||
|
||||
lb_add_proc_attribute_at_index(p, 1+0, "nonnull");
|
||||
lb_add_proc_attribute_at_index(p, 1+0, "readonly");
|
||||
// lb_add_proc_attribute_at_index(p, 1+0, "readonly");
|
||||
|
||||
if (is_type_simple_compare(type)) {
|
||||
lbValue res = lb_simple_compare_hash(p, type, data, seed);
|
||||
|
||||
@@ -6,13 +6,7 @@
|
||||
#include "llvm-c/Object.h"
|
||||
#include "llvm-c/BitWriter.h"
|
||||
#include "llvm-c/DebugInfo.h"
|
||||
#include "llvm-c/Transforms/AggressiveInstCombine.h"
|
||||
#include "llvm-c/Transforms/InstCombine.h"
|
||||
#include "llvm-c/Transforms/IPO.h"
|
||||
#include "llvm-c/Transforms/PassManagerBuilder.h"
|
||||
#include "llvm-c/Transforms/Scalar.h"
|
||||
#include "llvm-c/Transforms/Utils.h"
|
||||
#include "llvm-c/Transforms/Vectorize.h"
|
||||
#include "llvm-c/Transforms/PassBuilder.h"
|
||||
#else
|
||||
#include <llvm-c/Core.h>
|
||||
#include <llvm-c/ExecutionEngine.h>
|
||||
@@ -170,6 +164,8 @@ struct lbModule {
|
||||
|
||||
lbProcedure *curr_procedure;
|
||||
|
||||
LLVMBuilderRef const_dummy_builder;
|
||||
|
||||
LLVMDIBuilderRef debug_builder;
|
||||
LLVMMetadataRef debug_compile_unit;
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ gb_internal String lb_get_const_string(lbModule *m, lbValue value) {
|
||||
|
||||
unsigned ptr_indices[1] = {0};
|
||||
unsigned len_indices[1] = {1};
|
||||
LLVMValueRef underlying_ptr = LLVMConstExtractValue(value.value, ptr_indices, gb_count_of(ptr_indices));
|
||||
LLVMValueRef underlying_len = LLVMConstExtractValue(value.value, len_indices, gb_count_of(len_indices));
|
||||
LLVMValueRef underlying_ptr = llvm_const_extract_value(m, value.value, ptr_indices, gb_count_of(ptr_indices));
|
||||
LLVMValueRef underlying_len = llvm_const_extract_value(m, value.value, len_indices, gb_count_of(len_indices));
|
||||
|
||||
GB_ASSERT(LLVMGetConstOpcode(underlying_ptr) == LLVMGetElementPtr);
|
||||
underlying_ptr = LLVMGetOperand(underlying_ptr, 0);
|
||||
@@ -1096,7 +1096,7 @@ gb_internal lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bo
|
||||
if (is_constant) {
|
||||
LLVMValueRef elem_value = lb_const_value(m, tav.type, tav.value, allow_local).value;
|
||||
if (LLVMIsConstant(elem_value)) {
|
||||
values[index] = LLVMConstInsertValue(values[index], elem_value, idx_list, idx_list_len);
|
||||
values[index] = llvm_const_insert_value(m, values[index], elem_value, idx_list, idx_list_len);
|
||||
} else {
|
||||
is_constant = false;
|
||||
}
|
||||
|
||||
@@ -4271,7 +4271,7 @@ gb_internal lbAddr lb_build_addr_compound_lit(lbProcedure *p, Ast *expr) {
|
||||
unsigned len_index = lb_convert_struct_index(p->module, type, 1);
|
||||
if (lb_is_const(slice)) {
|
||||
unsigned indices[1] = {len_index};
|
||||
count.value = LLVMConstExtractValue(slice.value, indices, gb_count_of(indices));
|
||||
count.value = llvm_const_extract_value(p->module, slice.value, indices, gb_count_of(indices));
|
||||
} else {
|
||||
count.value = LLVMBuildExtractValue(p->builder, slice.value, len_index, "");
|
||||
}
|
||||
|
||||
@@ -90,6 +90,8 @@ gb_internal void lb_init_module(lbModule *m, Checker *c) {
|
||||
map_init(&m->map_cell_info_map, 0);
|
||||
map_init(&m->exact_value_compound_literal_addr_map, 1024);
|
||||
|
||||
m->const_dummy_builder = LLVMCreateBuilderInContext(m->ctx);
|
||||
|
||||
}
|
||||
|
||||
gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
|
||||
@@ -277,10 +279,39 @@ gb_internal lbValue lb_zero(lbModule *m, Type *t) {
|
||||
return v;
|
||||
}
|
||||
|
||||
gb_internal LLVMValueRef llvm_const_extract_value(lbModule *m, LLVMValueRef agg, unsigned *indices, isize count) {
|
||||
// return LLVMConstExtractValue(value, indices, count);
|
||||
LLVMValueRef res = agg;
|
||||
GB_ASSERT(LLVMIsConstant(res));
|
||||
for (isize i = 0; i < count; i++) {
|
||||
res = LLVMBuildExtractValue(m->const_dummy_builder, res, indices[i], "");
|
||||
GB_ASSERT(LLVMIsConstant(res));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
gb_internal LLVMValueRef llvm_const_insert_value(lbModule *m, LLVMValueRef agg, LLVMValueRef val, unsigned *indices, isize count) {
|
||||
GB_ASSERT(LLVMIsConstant(agg));
|
||||
GB_ASSERT(LLVMIsConstant(val));
|
||||
GB_ASSERT(count > 0);
|
||||
|
||||
LLVMValueRef extracted_value = val;
|
||||
for (isize i = count-1; i >= 0; i--) {
|
||||
LLVMValueRef nested = llvm_const_extract_value(m, agg, indices, i);
|
||||
GB_ASSERT(LLVMIsConstant(nested));
|
||||
extracted_value = LLVMBuildInsertValue(m->const_dummy_builder, nested, extracted_value, indices[i], "");
|
||||
}
|
||||
GB_ASSERT(LLVMIsConstant(extracted_value));
|
||||
return extracted_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
gb_internal LLVMValueRef llvm_cstring(lbModule *m, String const &str) {
|
||||
lbValue v = lb_find_or_add_entity_string(m, str);
|
||||
unsigned indices[1] = {0};
|
||||
return LLVMConstExtractValue(v.value, indices, gb_count_of(indices));
|
||||
return llvm_const_extract_value(m, v.value, indices, gb_count_of(indices));
|
||||
}
|
||||
|
||||
gb_internal bool lb_is_instr_terminating(LLVMValueRef instr) {
|
||||
|
||||
@@ -65,6 +65,7 @@ gb_internal void lb_basic_populate_function_pass_manager(LLVMPassManagerRef fpm,
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (false && optimization_level <= 0 && build_context.ODIN_DEBUG) {
|
||||
LLVMAddMergedLoadStoreMotionPass(fpm);
|
||||
} else {
|
||||
@@ -75,6 +76,7 @@ gb_internal void lb_basic_populate_function_pass_manager(LLVMPassManagerRef fpm,
|
||||
LLVMAddEarlyCSEPass(fpm);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
gb_internal void lb_populate_function_pass_manager(lbModule *m, LLVMPassManagerRef fpm, bool ignore_memcpy_pass, i32 optimization_level) {
|
||||
@@ -82,6 +84,7 @@ gb_internal void lb_populate_function_pass_manager(lbModule *m, LLVMPassManagerR
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (ignore_memcpy_pass) {
|
||||
lb_basic_populate_function_pass_manager(fpm, optimization_level);
|
||||
return;
|
||||
@@ -109,6 +112,7 @@ gb_internal void lb_populate_function_pass_manager(lbModule *m, LLVMPassManagerR
|
||||
LLVMAddEarlyCSEPass(fpm);
|
||||
LLVMAddLowerExpectIntrinsicPass(fpm);
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
gb_internal void lb_populate_function_pass_manager_specific(lbModule *m, LLVMPassManagerRef fpm, i32 optimization_level) {
|
||||
@@ -116,6 +120,7 @@ gb_internal void lb_populate_function_pass_manager_specific(lbModule *m, LLVMPas
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
if (optimization_level <= 0) {
|
||||
LLVMAddMemCpyOptPass(fpm);
|
||||
lb_basic_populate_function_pass_manager(fpm, optimization_level);
|
||||
@@ -183,6 +188,7 @@ gb_internal void lb_add_function_simplifcation_passes(LLVMPassManagerRef mpm, i3
|
||||
LLVMAddLoopRerollPass(mpm);
|
||||
LLVMAddAggressiveDCEPass(mpm);
|
||||
LLVMAddCFGSimplificationPass(mpm);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@@ -193,7 +199,7 @@ gb_internal void lb_populate_module_pass_manager(LLVMTargetMachineRef target_mac
|
||||
if (optimization_level <= 0 && build_context.ODIN_DEBUG) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
LLVMAddAlwaysInlinerPass(mpm);
|
||||
LLVMAddStripDeadPrototypesPass(mpm);
|
||||
LLVMAddAnalysisPasses(target_machine, mpm);
|
||||
@@ -263,6 +269,7 @@ gb_internal void lb_populate_module_pass_manager(LLVMTargetMachineRef target_mac
|
||||
}
|
||||
|
||||
LLVMAddCFGSimplificationPass(mpm);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ gb_global Timings global_timings = {0};
|
||||
#include "llvm_backend.cpp"
|
||||
|
||||
#if defined(GB_SYSTEM_OSX)
|
||||
#include <llvm/Config/llvm-config.h>
|
||||
#include <llvm-c/Config/llvm-config.h>
|
||||
#if LLVM_VERSION_MAJOR < 11
|
||||
#error LLVM Version 11+ is required => "brew install llvm@11"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user