1 /*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* This header declares the C interface to libLLVMCore.a, which implements *|
11 |* the LLVM intermediate representation. *|
13 \*===----------------------------------------------------------------------===*/
18 #include "llvm-c/ErrorHandling.h"
19 #include "llvm-c/Types.h"
26 * @defgroup LLVMC LLVM-C: C interface to LLVM
28 * This module exposes parts of the LLVM library as a C API.
34 * @defgroup LLVMCTransforms Transforms
38 * @defgroup LLVMCCore Core
40 * This modules provide an interface to libLLVMCore, which implements
41 * the LLVM intermediate representation as well as other related types
44 * Many exotic languages can interoperate with C code but have a harder time
45 * with C++ due to name mangling. So in addition to C, this interface enables
46 * tools written in such languages.
52 * @defgroup LLVMCCoreTypes Types and Enumerations
58 LLVMZExtAttribute = 1<<0,
59 LLVMSExtAttribute = 1<<1,
60 LLVMNoReturnAttribute = 1<<2,
61 LLVMInRegAttribute = 1<<3,
62 LLVMStructRetAttribute = 1<<4,
63 LLVMNoUnwindAttribute = 1<<5,
64 LLVMNoAliasAttribute = 1<<6,
65 LLVMByValAttribute = 1<<7,
66 LLVMNestAttribute = 1<<8,
67 LLVMReadNoneAttribute = 1<<9,
68 LLVMReadOnlyAttribute = 1<<10,
69 LLVMNoInlineAttribute = 1<<11,
70 LLVMAlwaysInlineAttribute = 1<<12,
71 LLVMOptimizeForSizeAttribute = 1<<13,
72 LLVMStackProtectAttribute = 1<<14,
73 LLVMStackProtectReqAttribute = 1<<15,
74 LLVMAlignment = 31<<16,
75 LLVMNoCaptureAttribute = 1<<21,
76 LLVMNoRedZoneAttribute = 1<<22,
77 LLVMNoImplicitFloatAttribute = 1<<23,
78 LLVMNakedAttribute = 1<<24,
79 LLVMInlineHintAttribute = 1<<25,
80 LLVMStackAlignment = 7<<26,
81 LLVMReturnsTwice = 1 << 29,
82 LLVMUWTable = 1 << 30,
83 LLVMNonLazyBind = 1 << 31
85 /* FIXME: These attributes are currently not included in the C API as
86 a temporary measure until the API/ABI impact to the C API is understood
87 and the path forward agreed upon.
88 LLVMSanitizeAddressAttribute = 1ULL << 32,
89 LLVMStackProtectStrongAttribute = 1ULL<<35,
90 LLVMColdAttribute = 1ULL << 40,
91 LLVMOptimizeNoneAttribute = 1ULL << 42,
92 LLVMInAllocaAttribute = 1ULL << 43,
93 LLVMNonNullAttribute = 1ULL << 44,
94 LLVMJumpTableAttribute = 1ULL << 45,
95 LLVMConvergentAttribute = 1ULL << 46,
96 LLVMSafeStackAttribute = 1ULL << 47,
101 /* Terminator Instructions */
107 /* removed 6 due to API changes */
110 /* Standard Binary Operators */
124 /* Logical Operators */
132 /* Memory Operators */
136 LLVMGetElementPtr = 29,
151 LLVMAddrSpaceCast = 60,
153 /* Other Operators */
162 LLVMExtractElement = 50,
163 LLVMInsertElement = 51,
164 LLVMShuffleVector = 52,
165 LLVMExtractValue = 53,
166 LLVMInsertValue = 54,
168 /* Atomic operators */
170 LLVMAtomicCmpXchg = 56,
173 /* Exception Handling Operators */
184 LLVMVoidTypeKind, /**< type with no size */
185 LLVMHalfTypeKind, /**< 16 bit floating point type */
186 LLVMFloatTypeKind, /**< 32 bit floating point type */
187 LLVMDoubleTypeKind, /**< 64 bit floating point type */
188 LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */
189 LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/
190 LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */
191 LLVMLabelTypeKind, /**< Labels */
192 LLVMIntegerTypeKind, /**< Arbitrary bit width integers */
193 LLVMFunctionTypeKind, /**< Functions */
194 LLVMStructTypeKind, /**< Structures */
195 LLVMArrayTypeKind, /**< Arrays */
196 LLVMPointerTypeKind, /**< Pointers */
197 LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
198 LLVMMetadataTypeKind, /**< Metadata */
199 LLVMX86_MMXTypeKind, /**< X86 MMX */
200 LLVMTokenTypeKind /**< Tokens */
204 LLVMExternalLinkage, /**< Externally visible function */
205 LLVMAvailableExternallyLinkage,
206 LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
207 LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
209 LLVMLinkOnceODRAutoHideLinkage, /**< Obsolete */
210 LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
211 LLVMWeakODRLinkage, /**< Same, but only replaced by something
213 LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
214 LLVMInternalLinkage, /**< Rename collisions when linking (static
216 LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
217 LLVMDLLImportLinkage, /**< Obsolete */
218 LLVMDLLExportLinkage, /**< Obsolete */
219 LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
220 LLVMGhostLinkage, /**< Obsolete */
221 LLVMCommonLinkage, /**< Tentative definitions */
222 LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
223 LLVMLinkerPrivateWeakLinkage /**< Like LinkerPrivate, but is weak. */
227 LLVMDefaultVisibility, /**< The GV is visible */
228 LLVMHiddenVisibility, /**< The GV is hidden */
229 LLVMProtectedVisibility /**< The GV is protected */
233 LLVMDefaultStorageClass = 0,
234 LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
235 LLVMDLLExportStorageClass = 2 /**< Function to be accessible from DLL. */
236 } LLVMDLLStorageClass;
240 LLVMFastCallConv = 8,
241 LLVMColdCallConv = 9,
242 LLVMWebKitJSCallConv = 12,
243 LLVMAnyRegCallConv = 13,
244 LLVMX86StdcallCallConv = 64,
245 LLVMX86FastcallCallConv = 65
249 LLVMIntEQ = 32, /**< equal */
250 LLVMIntNE, /**< not equal */
251 LLVMIntUGT, /**< unsigned greater than */
252 LLVMIntUGE, /**< unsigned greater or equal */
253 LLVMIntULT, /**< unsigned less than */
254 LLVMIntULE, /**< unsigned less or equal */
255 LLVMIntSGT, /**< signed greater than */
256 LLVMIntSGE, /**< signed greater or equal */
257 LLVMIntSLT, /**< signed less than */
258 LLVMIntSLE /**< signed less or equal */
262 LLVMRealPredicateFalse, /**< Always false (always folded) */
263 LLVMRealOEQ, /**< True if ordered and equal */
264 LLVMRealOGT, /**< True if ordered and greater than */
265 LLVMRealOGE, /**< True if ordered and greater than or equal */
266 LLVMRealOLT, /**< True if ordered and less than */
267 LLVMRealOLE, /**< True if ordered and less than or equal */
268 LLVMRealONE, /**< True if ordered and operands are unequal */
269 LLVMRealORD, /**< True if ordered (no nans) */
270 LLVMRealUNO, /**< True if unordered: isnan(X) | isnan(Y) */
271 LLVMRealUEQ, /**< True if unordered or equal */
272 LLVMRealUGT, /**< True if unordered or greater than */
273 LLVMRealUGE, /**< True if unordered, greater than, or equal */
274 LLVMRealULT, /**< True if unordered or less than */
275 LLVMRealULE, /**< True if unordered, less than, or equal */
276 LLVMRealUNE, /**< True if unordered or not equal */
277 LLVMRealPredicateTrue /**< Always true (always folded) */
281 LLVMLandingPadCatch, /**< A catch clause */
282 LLVMLandingPadFilter /**< A filter clause */
283 } LLVMLandingPadClauseTy;
286 LLVMNotThreadLocal = 0,
287 LLVMGeneralDynamicTLSModel,
288 LLVMLocalDynamicTLSModel,
289 LLVMInitialExecTLSModel,
290 LLVMLocalExecTLSModel
291 } LLVMThreadLocalMode;
294 LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */
295 LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees
296 somewhat sane results, lock free. */
297 LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the
298 operations affecting a specific address,
299 a consistent ordering exists */
300 LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort
301 necessary to acquire a lock to access other
302 memory with normal loads and stores. */
303 LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with
304 a barrier of the sort necessary to release
306 LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a
307 Release barrier (for fences and
308 operations which both read and write
310 LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics
311 for loads and Release
312 semantics for stores.
313 Additionally, it guarantees
314 that a total ordering exists
316 SequentiallyConsistent
318 } LLVMAtomicOrdering;
321 LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
322 LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
323 LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
324 LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
325 LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
326 LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
327 LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
328 LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
329 original using a signed comparison and return
331 LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
332 original using a signed comparison and return
334 LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
335 original using an unsigned comparison and return
337 LLVMAtomicRMWBinOpUMin /**< Sets the value if it's greater than the
338 original using an unsigned comparison and return
340 } LLVMAtomicRMWBinOp;
347 } LLVMDiagnosticSeverity;
353 void LLVMInitializeCore(LLVMPassRegistryRef R);
355 /** Deallocate and destroy all ManagedStatic variables.
356 @see llvm::llvm_shutdown
357 @see ManagedStatic */
358 void LLVMShutdown(void);
360 /*===-- Error handling ----------------------------------------------------===*/
362 char *LLVMCreateMessage(const char *Message);
363 void LLVMDisposeMessage(char *Message);
366 * @defgroup LLVMCCoreContext Contexts
368 * Contexts are execution states for the core LLVM IR system.
370 * Most types are tied to a context instance. Multiple contexts can
371 * exist simultaneously. A single context is not thread safe. However,
372 * different contexts can execute on different threads simultaneously.
377 typedef void (*LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *);
378 typedef void (*LLVMYieldCallback)(LLVMContextRef, void *);
381 * Create a new context.
383 * Every call to this function should be paired with a call to
384 * LLVMContextDispose() or the context will leak memory.
386 LLVMContextRef LLVMContextCreate(void);
389 * Obtain the global context instance.
391 LLVMContextRef LLVMGetGlobalContext(void);
394 * Set the diagnostic handler for this context.
396 void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
397 LLVMDiagnosticHandler Handler,
398 void *DiagnosticContext);
401 * Set the yield callback function for this context.
403 * @see LLVMContext::setYieldCallback()
405 void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback,
409 * Destroy a context instance.
411 * This should be called for every call to LLVMContextCreate() or memory
414 void LLVMContextDispose(LLVMContextRef C);
417 * Return a string representation of the DiagnosticInfo. Use
418 * LLVMDisposeMessage to free the string.
420 * @see DiagnosticInfo::print()
422 char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI);
425 * Return an enum LLVMDiagnosticSeverity.
427 * @see DiagnosticInfo::getSeverity()
429 LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI);
431 unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
433 unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);
440 * @defgroup LLVMCCoreModule Modules
442 * Modules represent the top-level structure in an LLVM program. An LLVM
443 * module is effectively a translation unit or a collection of
444 * translation units merged together.
450 * Create a new, empty module in the global context.
452 * This is equivalent to calling LLVMModuleCreateWithNameInContext with
453 * LLVMGetGlobalContext() as the context parameter.
455 * Every invocation should be paired with LLVMDisposeModule() or memory
458 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
461 * Create a new, empty module in a specific context.
463 * Every invocation should be paired with LLVMDisposeModule() or memory
466 LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
469 * Return an exact copy of the specified module.
471 LLVMModuleRef LLVMCloneModule(LLVMModuleRef M);
474 * Destroy a module instance.
476 * This must be called for every created module or memory will be
479 void LLVMDisposeModule(LLVMModuleRef M);
482 * Obtain the data layout for a module.
484 * @see Module::getDataLayout()
486 const char *LLVMGetDataLayout(LLVMModuleRef M);
489 * Set the data layout for a module.
491 * @see Module::setDataLayout()
493 void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple);
496 * Obtain the target triple for a module.
498 * @see Module::getTargetTriple()
500 const char *LLVMGetTarget(LLVMModuleRef M);
503 * Set the target triple for a module.
505 * @see Module::setTargetTriple()
507 void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
510 * Dump a representation of a module to stderr.
512 * @see Module::dump()
514 void LLVMDumpModule(LLVMModuleRef M);
517 * Print a representation of a module to a file. The ErrorMessage needs to be
518 * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
520 * @see Module::print()
522 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
523 char **ErrorMessage);
526 * Return a string representation of the module. Use
527 * LLVMDisposeMessage to free the string.
529 * @see Module::print()
531 char *LLVMPrintModuleToString(LLVMModuleRef M);
534 * Set inline assembly for a module.
536 * @see Module::setModuleInlineAsm()
538 void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
541 * Obtain the context to which this module is associated.
543 * @see Module::getContext()
545 LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M);
548 * Obtain a Type from a module by its registered name.
550 LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name);
553 * Obtain the number of operands for named metadata in a module.
555 * @see llvm::Module::getNamedMetadata()
557 unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char* name);
560 * Obtain the named metadata operands for a module.
562 * The passed LLVMValueRef pointer should refer to an array of
563 * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
564 * array will be populated with the LLVMValueRef instances. Each
565 * instance corresponds to a llvm::MDNode.
567 * @see llvm::Module::getNamedMetadata()
568 * @see llvm::MDNode::getOperand()
570 void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char* name, LLVMValueRef *Dest);
573 * Add an operand to named metadata.
575 * @see llvm::Module::getNamedMetadata()
576 * @see llvm::MDNode::addOperand()
578 void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char* name,
582 * Add a function to a module under a specified name.
584 * @see llvm::Function::Create()
586 LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
587 LLVMTypeRef FunctionTy);
590 * Obtain a Function value from a Module by its name.
592 * The returned value corresponds to a llvm::Function value.
594 * @see llvm::Module::getFunction()
596 LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
599 * Obtain an iterator to the first Function in a Module.
601 * @see llvm::Module::begin()
603 LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M);
606 * Obtain an iterator to the last Function in a Module.
608 * @see llvm::Module::end()
610 LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M);
613 * Advance a Function iterator to the next Function.
615 * Returns NULL if the iterator was already at the end and there are no more
618 LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn);
621 * Decrement a Function iterator to the previous Function.
623 * Returns NULL if the iterator was already at the beginning and there are
624 * no previous functions.
626 LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn);
633 * @defgroup LLVMCCoreType Types
635 * Types represent the type of a value.
637 * Types are associated with a context instance. The context internally
638 * deduplicates types so there is only 1 instance of a specific type
639 * alive at a time. In other words, a unique type is shared among all
640 * consumers within a context.
642 * A Type in the C API corresponds to llvm::Type.
644 * Types have the following hierarchy:
662 * Obtain the enumerated type of a Type instance.
664 * @see llvm::Type:getTypeID()
666 LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
669 * Whether the type has a known size.
671 * Things that don't have a size are abstract types, labels, and void.a
673 * @see llvm::Type::isSized()
675 LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty);
678 * Obtain the context to which this type instance is associated.
680 * @see llvm::Type::getContext()
682 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
685 * Dump a representation of a type to stderr.
687 * @see llvm::Type::dump()
689 void LLVMDumpType(LLVMTypeRef Val);
692 * Return a string representation of the type. Use
693 * LLVMDisposeMessage to free the string.
695 * @see llvm::Type::print()
697 char *LLVMPrintTypeToString(LLVMTypeRef Val);
700 * @defgroup LLVMCCoreTypeInt Integer Types
702 * Functions in this section operate on integer types.
708 * Obtain an integer type from a context with specified bit width.
710 LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C);
711 LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C);
712 LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
713 LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
714 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
715 LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C);
716 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
719 * Obtain an integer type from the global context with a specified bit
722 LLVMTypeRef LLVMInt1Type(void);
723 LLVMTypeRef LLVMInt8Type(void);
724 LLVMTypeRef LLVMInt16Type(void);
725 LLVMTypeRef LLVMInt32Type(void);
726 LLVMTypeRef LLVMInt64Type(void);
727 LLVMTypeRef LLVMInt128Type(void);
728 LLVMTypeRef LLVMIntType(unsigned NumBits);
729 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
736 * @defgroup LLVMCCoreTypeFloat Floating Point Types
742 * Obtain a 16-bit floating point type from a context.
744 LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C);
747 * Obtain a 32-bit floating point type from a context.
749 LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C);
752 * Obtain a 64-bit floating point type from a context.
754 LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C);
757 * Obtain a 80-bit floating point type (X87) from a context.
759 LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C);
762 * Obtain a 128-bit floating point type (112-bit mantissa) from a
765 LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C);
768 * Obtain a 128-bit floating point type (two 64-bits) from a context.
770 LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C);
773 * Obtain a floating point type from the global context.
775 * These map to the functions in this group of the same name.
777 LLVMTypeRef LLVMHalfType(void);
778 LLVMTypeRef LLVMFloatType(void);
779 LLVMTypeRef LLVMDoubleType(void);
780 LLVMTypeRef LLVMX86FP80Type(void);
781 LLVMTypeRef LLVMFP128Type(void);
782 LLVMTypeRef LLVMPPCFP128Type(void);
789 * @defgroup LLVMCCoreTypeFunction Function Types
795 * Obtain a function type consisting of a specified signature.
797 * The function is defined as a tuple of a return Type, a list of
798 * parameter types, and whether the function is variadic.
800 LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
801 LLVMTypeRef *ParamTypes, unsigned ParamCount,
805 * Returns whether a function type is variadic.
807 LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
810 * Obtain the Type this function Type returns.
812 LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
815 * Obtain the number of parameters this function accepts.
817 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
820 * Obtain the types of a function's parameters.
822 * The Dest parameter should point to a pre-allocated array of
823 * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
824 * first LLVMCountParamTypes() entries in the array will be populated
825 * with LLVMTypeRef instances.
827 * @param FunctionTy The function type to operate on.
828 * @param Dest Memory address of an array to be filled with result.
830 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
837 * @defgroup LLVMCCoreTypeStruct Structure Types
839 * These functions relate to LLVMTypeRef instances.
841 * @see llvm::StructType
847 * Create a new structure type in a context.
849 * A structure is specified by a list of inner elements/types and
850 * whether these can be packed together.
852 * @see llvm::StructType::create()
854 LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
855 unsigned ElementCount, LLVMBool Packed);
858 * Create a new structure type in the global context.
860 * @see llvm::StructType::create()
862 LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
866 * Create an empty structure in a context having a specified name.
868 * @see llvm::StructType::create()
870 LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
873 * Obtain the name of a structure.
875 * @see llvm::StructType::getName()
877 const char *LLVMGetStructName(LLVMTypeRef Ty);
880 * Set the contents of a structure type.
882 * @see llvm::StructType::setBody()
884 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
885 unsigned ElementCount, LLVMBool Packed);
888 * Get the number of elements defined inside the structure.
890 * @see llvm::StructType::getNumElements()
892 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
895 * Get the elements within a structure.
897 * The function is passed the address of a pre-allocated array of
898 * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
899 * invocation, this array will be populated with the structure's
900 * elements. The objects in the destination array will have a lifetime
901 * of the structure type itself, which is the lifetime of the context it
904 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
907 * Get the type of the element at a given index in the structure.
909 * @see llvm::StructType::getTypeAtIndex()
911 LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i);
914 * Determine whether a structure is packed.
916 * @see llvm::StructType::isPacked()
918 LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
921 * Determine whether a structure is opaque.
923 * @see llvm::StructType::isOpaque()
925 LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
932 * @defgroup LLVMCCoreTypeSequential Sequential Types
934 * Sequential types represents "arrays" of types. This is a super class
935 * for array, vector, and pointer types.
941 * Obtain the type of elements within a sequential type.
943 * This works on array, vector, and pointer types.
945 * @see llvm::SequentialType::getElementType()
947 LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty);
950 * Create a fixed size array type that refers to a specific type.
952 * The created type will exist in the context that its element type
955 * @see llvm::ArrayType::get()
957 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
960 * Obtain the length of an array type.
962 * This only works on types that represent arrays.
964 * @see llvm::ArrayType::getNumElements()
966 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
969 * Create a pointer type that points to a defined type.
971 * The created type will exist in the context that its pointee type
974 * @see llvm::PointerType::get()
976 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
979 * Obtain the address space of a pointer type.
981 * This only works on types that represent pointers.
983 * @see llvm::PointerType::getAddressSpace()
985 unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
988 * Create a vector type that contains a defined type and has a specific
989 * number of elements.
991 * The created type will exist in the context thats its element type
994 * @see llvm::VectorType::get()
996 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
999 * Obtain the number of elements in a vector type.
1001 * This only works on types that represent vectors.
1003 * @see llvm::VectorType::getNumElements()
1005 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
1012 * @defgroup LLVMCCoreTypeOther Other Types
1018 * Create a void type in a context.
1020 LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C);
1023 * Create a label type in a context.
1025 LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C);
1028 * Create a X86 MMX type in a context.
1030 LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
1033 * These are similar to the above functions except they operate on the
1036 LLVMTypeRef LLVMVoidType(void);
1037 LLVMTypeRef LLVMLabelType(void);
1038 LLVMTypeRef LLVMX86MMXType(void);
1049 * @defgroup LLVMCCoreValues Values
1051 * The bulk of LLVM's object model consists of values, which comprise a very
1052 * rich type hierarchy.
1054 * LLVMValueRef essentially represents llvm::Value. There is a rich
1055 * hierarchy of classes within this type. Depending on the instance
1056 * obtained, not all APIs are available.
1058 * Callers can determine the type of an LLVMValueRef by calling the
1059 * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1060 * functions are defined by a macro, so it isn't obvious which are
1061 * available by looking at the Doxygen source code. Instead, look at the
1062 * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1063 * of value names given. These value names also correspond to classes in
1064 * the llvm::Value hierarchy.
1069 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1075 macro(BlockAddress) \
1076 macro(ConstantAggregateZero) \
1077 macro(ConstantArray) \
1078 macro(ConstantDataSequential) \
1079 macro(ConstantDataArray) \
1080 macro(ConstantDataVector) \
1081 macro(ConstantExpr) \
1083 macro(ConstantInt) \
1084 macro(ConstantPointerNull) \
1085 macro(ConstantStruct) \
1086 macro(ConstantTokenNone) \
1087 macro(ConstantVector) \
1088 macro(GlobalValue) \
1089 macro(GlobalAlias) \
1090 macro(GlobalObject) \
1092 macro(GlobalVariable) \
1094 macro(Instruction) \
1095 macro(BinaryOperator) \
1097 macro(IntrinsicInst) \
1098 macro(DbgInfoIntrinsic) \
1099 macro(DbgDeclareInst) \
1100 macro(MemIntrinsic) \
1102 macro(MemMoveInst) \
1107 macro(ExtractElementInst) \
1108 macro(GetElementPtrInst) \
1109 macro(InsertElementInst) \
1110 macro(InsertValueInst) \
1111 macro(LandingPadInst) \
1114 macro(ShuffleVectorInst) \
1116 macro(TerminatorInst) \
1118 macro(IndirectBrInst) \
1122 macro(UnreachableInst) \
1124 macro(CleanupReturnInst) \
1125 macro(CatchReturnInst) \
1126 macro(FuncletPadInst) \
1127 macro(CatchPadInst) \
1128 macro(CleanupPadInst) \
1129 macro(UnaryInstruction) \
1132 macro(AddrSpaceCastInst) \
1133 macro(BitCastInst) \
1137 macro(FPTruncInst) \
1138 macro(IntToPtrInst) \
1139 macro(PtrToIntInst) \
1145 macro(ExtractValueInst) \
1150 * @defgroup LLVMCCoreValueGeneral General APIs
1152 * Functions in this section work on all LLVMValueRef instances,
1153 * regardless of their sub-type. They correspond to functions available
1160 * Obtain the type of a value.
1162 * @see llvm::Value::getType()
1164 LLVMTypeRef LLVMTypeOf(LLVMValueRef Val);
1167 * Obtain the string name of a value.
1169 * @see llvm::Value::getName()
1171 const char *LLVMGetValueName(LLVMValueRef Val);
1174 * Set the string name of a value.
1176 * @see llvm::Value::setName()
1178 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
1181 * Dump a representation of a value to stderr.
1183 * @see llvm::Value::dump()
1185 void LLVMDumpValue(LLVMValueRef Val);
1188 * Return a string representation of the value. Use
1189 * LLVMDisposeMessage to free the string.
1191 * @see llvm::Value::print()
1193 char *LLVMPrintValueToString(LLVMValueRef Val);
1196 * Replace all uses of a value with another one.
1198 * @see llvm::Value::replaceAllUsesWith()
1200 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
1203 * Determine whether the specified value instance is constant.
1205 LLVMBool LLVMIsConstant(LLVMValueRef Val);
1208 * Determine whether a value instance is undefined.
1210 LLVMBool LLVMIsUndef(LLVMValueRef Val);
1213 * Convert value instances between types.
1215 * Internally, an LLVMValueRef is "pinned" to a specific type. This
1216 * series of functions allows you to cast an instance to a specific
1219 * If the cast is not valid for the specified type, NULL is returned.
1221 * @see llvm::dyn_cast_or_null<>
1223 #define LLVM_DECLARE_VALUE_CAST(name) \
1224 LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1225 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
1227 LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val);
1228 LLVMValueRef LLVMIsAMDString(LLVMValueRef Val);
1235 * @defgroup LLVMCCoreValueUses Usage
1237 * This module defines functions that allow you to inspect the uses of a
1240 * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1241 * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1242 * llvm::User and llvm::Value.
1248 * Obtain the first use of a value.
1250 * Uses are obtained in an iterator fashion. First, call this function
1251 * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1252 * on that instance and all subsequently obtained instances until
1253 * LLVMGetNextUse() returns NULL.
1255 * @see llvm::Value::use_begin()
1257 LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val);
1260 * Obtain the next use of a value.
1262 * This effectively advances the iterator. It returns NULL if you are on
1263 * the final use and no more are available.
1265 LLVMUseRef LLVMGetNextUse(LLVMUseRef U);
1268 * Obtain the user value for a user.
1270 * The returned value corresponds to a llvm::User type.
1272 * @see llvm::Use::getUser()
1274 LLVMValueRef LLVMGetUser(LLVMUseRef U);
1277 * Obtain the value this use corresponds to.
1279 * @see llvm::Use::get().
1281 LLVMValueRef LLVMGetUsedValue(LLVMUseRef U);
1288 * @defgroup LLVMCCoreValueUser User value
1290 * Function in this group pertain to LLVMValueRef instances that descent
1291 * from llvm::User. This includes constants, instructions, and
1298 * Obtain an operand at a specific index in a llvm::User value.
1300 * @see llvm::User::getOperand()
1302 LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
1305 * Obtain the use of an operand at a specific index in a llvm::User value.
1307 * @see llvm::User::getOperandUse()
1309 LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index);
1312 * Set an operand at a specific index in a llvm::User value.
1314 * @see llvm::User::setOperand()
1316 void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
1319 * Obtain the number of operands in a llvm::User value.
1321 * @see llvm::User::getNumOperands()
1323 int LLVMGetNumOperands(LLVMValueRef Val);
1330 * @defgroup LLVMCCoreValueConstant Constants
1332 * This section contains APIs for interacting with LLVMValueRef that
1333 * correspond to llvm::Constant instances.
1335 * These functions will work for any LLVMValueRef in the llvm::Constant
1342 * Obtain a constant value referring to the null instance of a type.
1344 * @see llvm::Constant::getNullValue()
1346 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
1349 * Obtain a constant value referring to the instance of a type
1350 * consisting of all ones.
1352 * This is only valid for integer types.
1354 * @see llvm::Constant::getAllOnesValue()
1356 LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty);
1359 * Obtain a constant value referring to an undefined value of a type.
1361 * @see llvm::UndefValue::get()
1363 LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
1366 * Determine whether a value instance is null.
1368 * @see llvm::Constant::isNullValue()
1370 LLVMBool LLVMIsNull(LLVMValueRef Val);
1373 * Obtain a constant that is a constant pointer pointing to NULL for a
1376 LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
1379 * @defgroup LLVMCCoreValueConstantScalar Scalar constants
1381 * Functions in this group model LLVMValueRef instances that correspond
1382 * to constants referring to scalar types.
1384 * For integer types, the LLVMTypeRef parameter should correspond to a
1385 * llvm::IntegerType instance and the returned LLVMValueRef will
1386 * correspond to a llvm::ConstantInt.
1388 * For floating point types, the LLVMTypeRef returned corresponds to a
1395 * Obtain a constant value for an integer type.
1397 * The returned value corresponds to a llvm::ConstantInt.
1399 * @see llvm::ConstantInt::get()
1401 * @param IntTy Integer type to obtain value of.
1402 * @param N The value the returned instance should refer to.
1403 * @param SignExtend Whether to sign extend the produced value.
1405 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1406 LLVMBool SignExtend);
1409 * Obtain a constant value for an integer of arbitrary precision.
1411 * @see llvm::ConstantInt::get()
1413 LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
1415 const uint64_t Words[]);
1418 * Obtain a constant value for an integer parsed from a string.
1420 * A similar API, LLVMConstIntOfStringAndSize is also available. If the
1421 * string's length is available, it is preferred to call that function
1424 * @see llvm::ConstantInt::get()
1426 LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
1430 * Obtain a constant value for an integer parsed from a string with
1433 * @see llvm::ConstantInt::get()
1435 LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
1436 unsigned SLen, uint8_t Radix);
1439 * Obtain a constant value referring to a double floating point value.
1441 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
1444 * Obtain a constant for a floating point value parsed from a string.
1446 * A similar API, LLVMConstRealOfStringAndSize is also available. It
1447 * should be used if the input string's length is known.
1449 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
1452 * Obtain a constant for a floating point value parsed from a string.
1454 LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
1458 * Obtain the zero extended value for an integer constant value.
1460 * @see llvm::ConstantInt::getZExtValue()
1462 unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
1465 * Obtain the sign extended value for an integer constant value.
1467 * @see llvm::ConstantInt::getSExtValue()
1469 long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
1472 * Obtain the double value for an floating point constant value.
1473 * losesInfo indicates if some precision was lost in the conversion.
1475 * @see llvm::ConstantFP::getDoubleValue
1477 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
1484 * @defgroup LLVMCCoreValueConstantComposite Composite Constants
1486 * Functions in this group operate on composite constants.
1492 * Create a ConstantDataSequential and initialize it with a string.
1494 * @see llvm::ConstantDataArray::getString()
1496 LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
1497 unsigned Length, LLVMBool DontNullTerminate);
1500 * Create a ConstantDataSequential with string content in the global context.
1502 * This is the same as LLVMConstStringInContext except it operates on the
1505 * @see LLVMConstStringInContext()
1506 * @see llvm::ConstantDataArray::getString()
1508 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1509 LLVMBool DontNullTerminate);
1512 * Returns true if the specified constant is an array of i8.
1514 * @see ConstantDataSequential::getAsString()
1516 LLVMBool LLVMIsConstantString(LLVMValueRef c);
1519 * Get the given constant data sequential as a string.
1521 * @see ConstantDataSequential::getAsString()
1523 const char *LLVMGetAsString(LLVMValueRef c, size_t* out);
1526 * Create an anonymous ConstantStruct with the specified values.
1528 * @see llvm::ConstantStruct::getAnon()
1530 LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
1531 LLVMValueRef *ConstantVals,
1532 unsigned Count, LLVMBool Packed);
1535 * Create a ConstantStruct in the global Context.
1537 * This is the same as LLVMConstStructInContext except it operates on the
1540 * @see LLVMConstStructInContext()
1542 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
1546 * Create a ConstantArray from values.
1548 * @see llvm::ConstantArray::get()
1550 LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
1551 LLVMValueRef *ConstantVals, unsigned Length);
1554 * Create a non-anonymous ConstantStruct from values.
1556 * @see llvm::ConstantStruct::get()
1558 LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
1559 LLVMValueRef *ConstantVals,
1563 * Get an element at specified index as a constant.
1565 * @see ConstantDataSequential::getElementAsConstant()
1567 LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx);
1570 * Create a ConstantVector from values.
1572 * @see llvm::ConstantVector::get()
1574 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
1581 * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
1583 * Functions in this group correspond to APIs on llvm::ConstantExpr.
1585 * @see llvm::ConstantExpr.
1589 LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal);
1590 LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty);
1591 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
1592 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
1593 LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
1594 LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
1595 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
1596 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
1597 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1598 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1599 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1600 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1601 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1602 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1603 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1604 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1605 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1606 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1607 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1608 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1609 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1610 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1611 LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1612 LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1613 LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1614 LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1615 LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1616 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1617 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1618 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1619 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
1620 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1621 LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,
1622 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1623 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1624 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1625 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1626 LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal,
1627 LLVMValueRef *ConstantIndices, unsigned NumIndices);
1628 LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal,
1629 LLVMValueRef *ConstantIndices,
1630 unsigned NumIndices);
1631 LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1632 LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1633 LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1634 LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1635 LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1636 LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1637 LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1638 LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1639 LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1640 LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1641 LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1642 LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1643 LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1644 LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal,
1645 LLVMTypeRef ToType);
1646 LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal,
1647 LLVMTypeRef ToType);
1648 LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal,
1649 LLVMTypeRef ToType);
1650 LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
1651 LLVMTypeRef ToType);
1652 LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
1654 LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1655 LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
1656 LLVMValueRef ConstantIfTrue,
1657 LLVMValueRef ConstantIfFalse);
1658 LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant,
1659 LLVMValueRef IndexConstant);
1660 LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
1661 LLVMValueRef ElementValueConstant,
1662 LLVMValueRef IndexConstant);
1663 LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
1664 LLVMValueRef VectorBConstant,
1665 LLVMValueRef MaskConstant);
1666 LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
1668 LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
1669 LLVMValueRef ElementValueConstant,
1670 unsigned *IdxList, unsigned NumIdx);
1671 LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
1672 const char *AsmString, const char *Constraints,
1673 LLVMBool HasSideEffects, LLVMBool IsAlignStack);
1674 LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB);
1681 * @defgroup LLVMCCoreValueConstantGlobals Global Values
1683 * This group contains functions that operate on global values. Functions in
1684 * this group relate to functions in the llvm::GlobalValue class tree.
1686 * @see llvm::GlobalValue
1691 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
1692 LLVMBool LLVMIsDeclaration(LLVMValueRef Global);
1693 LLVMLinkage LLVMGetLinkage(LLVMValueRef Global);
1694 void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
1695 const char *LLVMGetSection(LLVMValueRef Global);
1696 void LLVMSetSection(LLVMValueRef Global, const char *Section);
1697 LLVMVisibility LLVMGetVisibility(LLVMValueRef Global);
1698 void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
1699 LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global);
1700 void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class);
1701 LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global);
1702 void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
1705 * @defgroup LLVMCCoreValueWithAlignment Values with alignment
1707 * Functions in this group only apply to values with alignment, i.e.
1708 * global variables, load and store instructions.
1712 * Obtain the preferred alignment of the value.
1713 * @see llvm::AllocaInst::getAlignment()
1714 * @see llvm::LoadInst::getAlignment()
1715 * @see llvm::StoreInst::getAlignment()
1716 * @see llvm::GlobalValue::getAlignment()
1718 unsigned LLVMGetAlignment(LLVMValueRef V);
1721 * Set the preferred alignment of the value.
1722 * @see llvm::AllocaInst::setAlignment()
1723 * @see llvm::LoadInst::setAlignment()
1724 * @see llvm::StoreInst::setAlignment()
1725 * @see llvm::GlobalValue::setAlignment()
1727 void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
1734 * @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
1736 * This group contains functions that operate on global variable values.
1738 * @see llvm::GlobalVariable
1742 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name);
1743 LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
1745 unsigned AddressSpace);
1746 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
1747 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
1748 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
1749 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
1750 LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
1751 void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
1752 LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
1753 void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
1754 LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar);
1755 void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
1756 LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
1757 void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant);
1758 LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar);
1759 void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode);
1760 LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar);
1761 void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit);
1768 * @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
1770 * This group contains function that operate on global alias values.
1772 * @see llvm::GlobalAlias
1776 LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
1784 * @defgroup LLVMCCoreValueFunction Function values
1786 * Functions in this group operate on LLVMValueRef instances that
1787 * correspond to llvm::Function instances.
1789 * @see llvm::Function
1795 * Remove a function from its containing module and deletes it.
1797 * @see llvm::Function::eraseFromParent()
1799 void LLVMDeleteFunction(LLVMValueRef Fn);
1802 * Obtain the personality function attached to the function.
1804 * @see llvm::Function::getPersonalityFn()
1806 LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
1809 * Set the personality function attached to the function.
1811 * @see llvm::Function::setPersonalityFn()
1813 void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
1816 * Obtain the ID number from a function instance.
1818 * @see llvm::Function::getIntrinsicID()
1820 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
1823 * Obtain the calling function of a function.
1825 * The returned value corresponds to the LLVMCallConv enumeration.
1827 * @see llvm::Function::getCallingConv()
1829 unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
1832 * Set the calling convention of a function.
1834 * @see llvm::Function::setCallingConv()
1836 * @param Fn Function to operate on
1837 * @param CC LLVMCallConv to set calling convention to
1839 void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
1842 * Obtain the name of the garbage collector to use during code
1845 * @see llvm::Function::getGC()
1847 const char *LLVMGetGC(LLVMValueRef Fn);
1850 * Define the garbage collector to use during code generation.
1852 * @see llvm::Function::setGC()
1854 void LLVMSetGC(LLVMValueRef Fn, const char *Name);
1857 * Add an attribute to a function.
1859 * @see llvm::Function::addAttribute()
1861 void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
1864 * Add a target-dependent attribute to a function
1865 * @see llvm::AttrBuilder::addAttribute()
1867 void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
1871 * Obtain an attribute from a function.
1873 * @see llvm::Function::getAttributes()
1875 LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn);
1878 * Remove an attribute from a function.
1880 void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
1883 * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
1885 * Functions in this group relate to arguments/parameters on functions.
1887 * Functions in this group expect LLVMValueRef instances that correspond
1888 * to llvm::Function instances.
1894 * Obtain the number of parameters in a function.
1896 * @see llvm::Function::arg_size()
1898 unsigned LLVMCountParams(LLVMValueRef Fn);
1901 * Obtain the parameters in a function.
1903 * The takes a pointer to a pre-allocated array of LLVMValueRef that is
1904 * at least LLVMCountParams() long. This array will be filled with
1905 * LLVMValueRef instances which correspond to the parameters the
1906 * function receives. Each LLVMValueRef corresponds to a llvm::Argument
1909 * @see llvm::Function::arg_begin()
1911 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
1914 * Obtain the parameter at the specified index.
1916 * Parameters are indexed from 0.
1918 * @see llvm::Function::arg_begin()
1920 LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
1923 * Obtain the function to which this argument belongs.
1925 * Unlike other functions in this group, this one takes an LLVMValueRef
1926 * that corresponds to a llvm::Attribute.
1928 * The returned LLVMValueRef is the llvm::Function to which this
1931 LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst);
1934 * Obtain the first parameter to a function.
1936 * @see llvm::Function::arg_begin()
1938 LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn);
1941 * Obtain the last parameter to a function.
1943 * @see llvm::Function::arg_end()
1945 LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
1948 * Obtain the next parameter to a function.
1950 * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
1951 * actually a wrapped iterator) and obtains the next parameter from the
1952 * underlying iterator.
1954 LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
1957 * Obtain the previous parameter to a function.
1959 * This is the opposite of LLVMGetNextParam().
1961 LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
1964 * Add an attribute to a function argument.
1966 * @see llvm::Argument::addAttr()
1968 void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA);
1971 * Remove an attribute from a function argument.
1973 * @see llvm::Argument::removeAttr()
1975 void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA);
1978 * Get an attribute from a function argument.
1980 LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg);
1983 * Set the alignment for a function parameter.
1985 * @see llvm::Argument::addAttr()
1986 * @see llvm::AttrBuilder::addAlignmentAttr()
1988 void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
2007 * @defgroup LLVMCCoreValueMetadata Metadata
2013 * Obtain a MDString value from a context.
2015 * The returned instance corresponds to the llvm::MDString class.
2017 * The instance is specified by string data of a specified length. The
2018 * string content is copied, so the backing memory can be freed after
2019 * this function returns.
2021 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
2025 * Obtain a MDString value from the global context.
2027 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2030 * Obtain a MDNode value from a context.
2032 * The returned value corresponds to the llvm::MDNode class.
2034 LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
2038 * Obtain a MDNode value from the global context.
2040 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
2043 * Obtain the underlying string from a MDString value.
2045 * @param V Instance to obtain string from.
2046 * @param Len Memory address which will hold length of returned string.
2047 * @return String data in MDString.
2049 const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len);
2052 * Obtain the number of operands from an MDNode value.
2054 * @param V MDNode to get number of operands from.
2055 * @return Number of operands of the MDNode.
2057 unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V);
2060 * Obtain the given MDNode's operands.
2062 * The passed LLVMValueRef pointer should point to enough memory to hold all of
2063 * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
2064 * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
2065 * MDNode's operands.
2067 * @param V MDNode to get the operands from.
2068 * @param Dest Destination array for operands.
2070 void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
2077 * @defgroup LLVMCCoreValueBasicBlock Basic Block
2079 * A basic block represents a single entry single exit section of code.
2080 * Basic blocks contain a list of instructions which form the body of
2083 * Basic blocks belong to functions. They have the type of label.
2085 * Basic blocks are themselves values. However, the C API models them as
2086 * LLVMBasicBlockRef.
2088 * @see llvm::BasicBlock
2094 * Convert a basic block instance to a value type.
2096 LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
2099 * Determine whether an LLVMValueRef is itself a basic block.
2101 LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val);
2104 * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
2106 LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
2109 * Obtain the string name of a basic block.
2111 const char *LLVMGetBasicBlockName(LLVMBasicBlockRef BB);
2114 * Obtain the function to which a basic block belongs.
2116 * @see llvm::BasicBlock::getParent()
2118 LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
2121 * Obtain the terminator instruction for a basic block.
2123 * If the basic block does not have a terminator (it is not well-formed
2124 * if it doesn't), then NULL is returned.
2126 * The returned LLVMValueRef corresponds to a llvm::TerminatorInst.
2128 * @see llvm::BasicBlock::getTerminator()
2130 LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB);
2133 * Obtain the number of basic blocks in a function.
2135 * @param Fn Function value to operate on.
2137 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
2140 * Obtain all of the basic blocks in a function.
2142 * This operates on a function value. The BasicBlocks parameter is a
2143 * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
2144 * LLVMCountBasicBlocks() in length. This array is populated with
2145 * LLVMBasicBlockRef instances.
2147 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
2150 * Obtain the first basic block in a function.
2152 * The returned basic block can be used as an iterator. You will likely
2153 * eventually call into LLVMGetNextBasicBlock() with it.
2155 * @see llvm::Function::begin()
2157 LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn);
2160 * Obtain the last basic block in a function.
2162 * @see llvm::Function::end()
2164 LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn);
2167 * Advance a basic block iterator.
2169 LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB);
2172 * Go backwards in a basic block iterator.
2174 LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
2177 * Obtain the basic block that corresponds to the entry point of a
2180 * @see llvm::Function::getEntryBlock()
2182 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
2185 * Append a basic block to the end of a function.
2187 * @see llvm::BasicBlock::Create()
2189 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
2194 * Append a basic block to the end of a function using the global
2197 * @see llvm::BasicBlock::Create()
2199 LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);
2202 * Insert a basic block in a function before another basic block.
2204 * The function to add to is determined by the function of the
2205 * passed basic block.
2207 * @see llvm::BasicBlock::Create()
2209 LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C,
2210 LLVMBasicBlockRef BB,
2214 * Insert a basic block in a function using the global context.
2216 * @see llvm::BasicBlock::Create()
2218 LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB,
2222 * Remove a basic block from a function and delete it.
2224 * This deletes the basic block from its containing function and deletes
2225 * the basic block itself.
2227 * @see llvm::BasicBlock::eraseFromParent()
2229 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
2232 * Remove a basic block from a function.
2234 * This deletes the basic block from its containing function but keep
2235 * the basic block alive.
2237 * @see llvm::BasicBlock::removeFromParent()
2239 void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB);
2242 * Move a basic block to before another one.
2244 * @see llvm::BasicBlock::moveBefore()
2246 void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
2249 * Move a basic block to after another one.
2251 * @see llvm::BasicBlock::moveAfter()
2253 void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
2256 * Obtain the first instruction in a basic block.
2258 * The returned LLVMValueRef corresponds to a llvm::Instruction
2261 LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB);
2264 * Obtain the last instruction in a basic block.
2266 * The returned LLVMValueRef corresponds to an LLVM:Instruction.
2268 LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB);
2275 * @defgroup LLVMCCoreValueInstruction Instructions
2277 * Functions in this group relate to the inspection and manipulation of
2278 * individual instructions.
2280 * In the C++ API, an instruction is modeled by llvm::Instruction. This
2281 * class has a large number of descendents. llvm::Instruction is a
2282 * llvm::Value and in the C API, instructions are modeled by
2285 * This group also contains sub-groups which operate on specific
2286 * llvm::Instruction types, e.g. llvm::CallInst.
2292 * Determine whether an instruction has any metadata attached.
2294 int LLVMHasMetadata(LLVMValueRef Val);
2297 * Return metadata associated with an instruction value.
2299 LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
2302 * Set metadata associated with an instruction value.
2304 void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
2307 * Obtain the basic block to which an instruction belongs.
2309 * @see llvm::Instruction::getParent()
2311 LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
2314 * Obtain the instruction that occurs after the one specified.
2316 * The next instruction will be from the same basic block.
2318 * If this is the last instruction in a basic block, NULL will be
2321 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
2324 * Obtain the instruction that occurred before this one.
2326 * If the instruction is the first instruction in a basic block, NULL
2329 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
2332 * Remove and delete an instruction.
2334 * The instruction specified is removed from its containing building
2335 * block and then deleted.
2337 * @see llvm::Instruction::eraseFromParent()
2339 void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
2342 * Obtain the code opcode for an individual instruction.
2344 * @see llvm::Instruction::getOpCode()
2346 LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
2349 * Obtain the predicate of an instruction.
2351 * This is only valid for instructions that correspond to llvm::ICmpInst
2352 * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
2354 * @see llvm::ICmpInst::getPredicate()
2356 LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
2359 * Obtain the float predicate of an instruction.
2361 * This is only valid for instructions that correspond to llvm::FCmpInst
2362 * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
2364 * @see llvm::FCmpInst::getPredicate()
2366 LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst);
2369 * Create a copy of 'this' instruction that is identical in all ways
2370 * except the following:
2371 * * The instruction has no parent
2372 * * The instruction has no name
2374 * @see llvm::Instruction::clone()
2376 LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst);
2379 * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
2381 * Functions in this group apply to instructions that refer to call
2382 * sites and invocations. These correspond to C++ types in the
2383 * llvm::CallInst class tree.
2389 * Obtain the argument count for a call instruction.
2391 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
2394 * @see llvm::CallInst::getNumArgOperands()
2395 * @see llvm::InvokeInst::getNumArgOperands()
2397 unsigned LLVMGetNumArgOperands(LLVMValueRef Instr);
2400 * Set the calling convention for a call instruction.
2402 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
2405 * @see llvm::CallInst::setCallingConv()
2406 * @see llvm::InvokeInst::setCallingConv()
2408 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
2411 * Obtain the calling convention for a call instruction.
2413 * This is the opposite of LLVMSetInstructionCallConv(). Reads its
2416 * @see LLVMSetInstructionCallConv()
2418 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
2421 void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute);
2422 void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
2424 void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
2428 * Obtain the pointer to the function invoked by this instruction.
2430 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
2433 * @see llvm::CallInst::getCalledValue()
2434 * @see llvm::InvokeInst::getCalledValue()
2436 LLVMValueRef LLVMGetCalledValue(LLVMValueRef Instr);
2439 * Obtain whether a call instruction is a tail call.
2441 * This only works on llvm::CallInst instructions.
2443 * @see llvm::CallInst::isTailCall()
2445 LLVMBool LLVMIsTailCall(LLVMValueRef CallInst);
2448 * Set whether a call instruction is a tail call.
2450 * This only works on llvm::CallInst instructions.
2452 * @see llvm::CallInst::setTailCall()
2454 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
2461 * @defgroup LLVMCCoreValueInstructionTerminator Terminators
2463 * Functions in this group only apply to instructions that map to
2464 * llvm::TerminatorInst instances.
2470 * Return the number of successors that this terminator has.
2472 * @see llvm::TerminatorInst::getNumSuccessors
2474 unsigned LLVMGetNumSuccessors(LLVMValueRef Term);
2477 * Return the specified successor.
2479 * @see llvm::TerminatorInst::getSuccessor
2481 LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i);
2484 * Update the specified successor to point at the provided block.
2486 * @see llvm::TerminatorInst::setSuccessor
2488 void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block);
2491 * Return if a branch is conditional.
2493 * This only works on llvm::BranchInst instructions.
2495 * @see llvm::BranchInst::isConditional
2497 LLVMBool LLVMIsConditional(LLVMValueRef Branch);
2500 * Return the condition of a branch instruction.
2502 * This only works on llvm::BranchInst instructions.
2504 * @see llvm::BranchInst::getCondition
2506 LLVMValueRef LLVMGetCondition(LLVMValueRef Branch);
2509 * Set the condition of a branch instruction.
2511 * This only works on llvm::BranchInst instructions.
2513 * @see llvm::BranchInst::setCondition
2515 void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond);
2518 * Obtain the default destination basic block of a switch instruction.
2520 * This only works on llvm::SwitchInst instructions.
2522 * @see llvm::SwitchInst::getDefaultDest()
2524 LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr);
2531 * @defgroup LLVMCCoreValueInstructionAlloca Allocas
2533 * Functions in this group only apply to instructions that map to
2534 * llvm::AllocaInst instances.
2540 * Obtain the type that is being allocated by the alloca instruction.
2542 LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca);
2549 * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
2551 * Functions in this group only apply to instructions that map to
2552 * llvm::PHINode instances.
2558 * Add an incoming value to the end of a PHI list.
2560 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
2561 LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
2564 * Obtain the number of incoming basic blocks to a PHI node.
2566 unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
2569 * Obtain an incoming value to a PHI node as an LLVMValueRef.
2571 LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index);
2574 * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
2576 LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
2591 * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
2593 * An instruction builder represents a point within a basic block and is
2594 * the exclusive means of building instructions using the C interface.
2599 LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C);
2600 LLVMBuilderRef LLVMCreateBuilder(void);
2601 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
2602 LLVMValueRef Instr);
2603 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
2604 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block);
2605 LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder);
2606 void LLVMClearInsertionPosition(LLVMBuilderRef Builder);
2607 void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr);
2608 void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr,
2610 void LLVMDisposeBuilder(LLVMBuilderRef Builder);
2613 void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
2614 LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
2615 void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
2618 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
2619 LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
2620 LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef *RetVals,
2622 LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest);
2623 LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If,
2624 LLVMBasicBlockRef Then, LLVMBasicBlockRef Else);
2625 LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
2626 LLVMBasicBlockRef Else, unsigned NumCases);
2627 LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
2629 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
2630 LLVMValueRef *Args, unsigned NumArgs,
2631 LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
2633 LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
2634 LLVMValueRef PersFn, unsigned NumClauses,
2636 LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);
2637 LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
2639 /* Add a case to the switch instruction */
2640 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
2641 LLVMBasicBlockRef Dest);
2643 /* Add a destination to the indirectbr instruction */
2644 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
2646 /* Add a catch or filter clause to the landingpad instruction */
2647 void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
2649 /* Set the 'cleanup' flag in the landingpad instruction */
2650 void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
2653 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2655 LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2657 LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2659 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2661 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2663 LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2665 LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2667 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2669 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2671 LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2673 LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2675 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2677 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2679 LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2681 LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2683 LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2685 LLVMValueRef LLVMBuildURem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2687 LLVMValueRef LLVMBuildSRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2689 LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2691 LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2693 LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2695 LLVMValueRef LLVMBuildAShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2697 LLVMValueRef LLVMBuildAnd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2699 LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2701 LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2703 LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op,
2704 LLVMValueRef LHS, LLVMValueRef RHS,
2706 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2707 LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
2709 LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
2711 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2712 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2715 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2716 LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
2717 LLVMValueRef Val, const char *Name);
2718 LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2719 LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
2720 LLVMValueRef Val, const char *Name);
2721 LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
2722 LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
2724 LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr);
2725 LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2726 LLVMValueRef *Indices, unsigned NumIndices,
2728 LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2729 LLVMValueRef *Indices, unsigned NumIndices,
2731 LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2732 unsigned Idx, const char *Name);
2733 LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str,
2735 LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str,
2737 LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
2738 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
2739 LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemoryAccessInst);
2740 void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering);
2743 LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val,
2744 LLVMTypeRef DestTy, const char *Name);
2745 LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val,
2746 LLVMTypeRef DestTy, const char *Name);
2747 LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val,
2748 LLVMTypeRef DestTy, const char *Name);
2749 LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val,
2750 LLVMTypeRef DestTy, const char *Name);
2751 LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val,
2752 LLVMTypeRef DestTy, const char *Name);
2753 LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef, LLVMValueRef Val,
2754 LLVMTypeRef DestTy, const char *Name);
2755 LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef, LLVMValueRef Val,
2756 LLVMTypeRef DestTy, const char *Name);
2757 LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef, LLVMValueRef Val,
2758 LLVMTypeRef DestTy, const char *Name);
2759 LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef, LLVMValueRef Val,
2760 LLVMTypeRef DestTy, const char *Name);
2761 LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val,
2762 LLVMTypeRef DestTy, const char *Name);
2763 LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef, LLVMValueRef Val,
2764 LLVMTypeRef DestTy, const char *Name);
2765 LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef, LLVMValueRef Val,
2766 LLVMTypeRef DestTy, const char *Name);
2767 LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef, LLVMValueRef Val,
2768 LLVMTypeRef DestTy, const char *Name);
2769 LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2770 LLVMTypeRef DestTy, const char *Name);
2771 LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2772 LLVMTypeRef DestTy, const char *Name);
2773 LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2774 LLVMTypeRef DestTy, const char *Name);
2775 LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val,
2776 LLVMTypeRef DestTy, const char *Name);
2777 LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val,
2778 LLVMTypeRef DestTy, const char *Name);
2779 LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, /*Signed cast!*/
2780 LLVMTypeRef DestTy, const char *Name);
2781 LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val,
2782 LLVMTypeRef DestTy, const char *Name);
2785 LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op,
2786 LLVMValueRef LHS, LLVMValueRef RHS,
2788 LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
2789 LLVMValueRef LHS, LLVMValueRef RHS,
2792 /* Miscellaneous instructions */
2793 LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2794 LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn,
2795 LLVMValueRef *Args, unsigned NumArgs,
2797 LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If,
2798 LLVMValueRef Then, LLVMValueRef Else,
2800 LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef, LLVMValueRef List, LLVMTypeRef Ty,
2802 LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal,
2803 LLVMValueRef Index, const char *Name);
2804 LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal,
2805 LLVMValueRef EltVal, LLVMValueRef Index,
2807 LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1,
2808 LLVMValueRef V2, LLVMValueRef Mask,
2810 LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef, LLVMValueRef AggVal,
2811 unsigned Index, const char *Name);
2812 LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef, LLVMValueRef AggVal,
2813 LLVMValueRef EltVal, unsigned Index,
2816 LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef, LLVMValueRef Val,
2818 LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val,
2820 LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS,
2821 LLVMValueRef RHS, const char *Name);
2822 LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering,
2823 LLVMBool singleThread, const char *Name);
2824 LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
2825 LLVMValueRef PTR, LLVMValueRef Val,
2826 LLVMAtomicOrdering ordering,
2827 LLVMBool singleThread);
2834 * @defgroup LLVMCCoreModuleProvider Module Providers
2840 * Changes the type of M so it can be passed to FunctionPassManagers and the
2841 * JIT. They take ModuleProviders for historical reasons.
2843 LLVMModuleProviderRef
2844 LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
2847 * Destroys the module M.
2849 void LLVMDisposeModuleProvider(LLVMModuleProviderRef M);
2856 * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
2861 LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
2862 LLVMMemoryBufferRef *OutMemBuf,
2864 LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
2866 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData,
2867 size_t InputDataLength,
2868 const char *BufferName,
2869 LLVMBool RequiresNullTerminator);
2870 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData,
2871 size_t InputDataLength,
2872 const char *BufferName);
2873 const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
2874 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
2875 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
2882 * @defgroup LLVMCCorePassRegistry Pass Registry
2887 /** Return the global pass registry, for use with initialization functions.
2888 @see llvm::PassRegistry::getPassRegistry */
2889 LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void);
2896 * @defgroup LLVMCCorePassManagers Pass Managers
2901 /** Constructs a new whole-module pass pipeline. This type of pipeline is
2902 suitable for link-time optimization and whole-module transformations.
2903 @see llvm::PassManager::PassManager */
2904 LLVMPassManagerRef LLVMCreatePassManager(void);
2906 /** Constructs a new function-by-function pass pipeline over the module
2907 provider. It does not take ownership of the module provider. This type of
2908 pipeline is suitable for code generation and JIT compilation tasks.
2909 @see llvm::FunctionPassManager::FunctionPassManager */
2910 LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M);
2912 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
2913 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
2915 /** Initializes, executes on the provided module, and finalizes all of the
2916 passes scheduled in the pass manager. Returns 1 if any of the passes
2917 modified the module, 0 otherwise.
2918 @see llvm::PassManager::run(Module&) */
2919 LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M);
2921 /** Initializes all of the function passes scheduled in the function pass
2922 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
2923 @see llvm::FunctionPassManager::doInitialization */
2924 LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM);
2926 /** Executes all of the function passes scheduled in the function pass manager
2927 on the provided function. Returns 1 if any of the passes modified the
2928 function, false otherwise.
2929 @see llvm::FunctionPassManager::run(Function&) */
2930 LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F);
2932 /** Finalizes all of the function passes scheduled in in the function pass
2933 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
2934 @see llvm::FunctionPassManager::doFinalization */
2935 LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM);
2937 /** Frees the memory of a pass pipeline. For function pipelines, does not free
2938 the module provider.
2939 @see llvm::PassManagerBase::~PassManagerBase. */
2940 void LLVMDisposePassManager(LLVMPassManagerRef PM);
2947 * @defgroup LLVMCCoreThreading Threading
2949 * Handle the structures needed to make LLVM safe for multithreading.
2954 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
2955 time define LLVM_ENABLE_THREADS. This function always returns
2956 LLVMIsMultithreaded(). */
2957 LLVMBool LLVMStartMultithreaded(void);
2959 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
2960 time define LLVM_ENABLE_THREADS. */
2961 void LLVMStopMultithreaded(void);
2963 /** Check whether LLVM is executing in thread-safe mode or not.
2964 @see llvm::llvm_is_multithreaded */
2965 LLVMBool LLVMIsMultithreaded(void);
2983 #endif /* LLVM_C_CORE_H */