1 /*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
5 |* See https://llvm.org/LICENSE.txt for license information. *|
6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
8 |*===----------------------------------------------------------------------===*|
10 |* This header declares the C interface to libLLVMCore.a, which implements *|
11 |* the LLVM intermediate representation. *|
13 \*===----------------------------------------------------------------------===*/
18 #include "llvm-c/Deprecated.h"
19 #include "llvm-c/ErrorHandling.h"
20 #include "llvm-c/ExternC.h"
22 #include "llvm-c/Types.h"
27 * @defgroup LLVMC LLVM-C: C interface to LLVM
29 * This module exposes parts of the LLVM library as a C API.
35 * @defgroup LLVMCTransforms Transforms
39 * @defgroup LLVMCCore Core
41 * This modules provide an interface to libLLVMCore, which implements
42 * the LLVM intermediate representation as well as other related types
45 * Many exotic languages can interoperate with C code but have a harder time
46 * with C++ due to name mangling. So in addition to C, this interface enables
47 * tools written in such languages.
53 * @defgroup LLVMCCoreTypes Types and Enumerations
58 /// External users depend on the following values being stable. It is not safe
61 /* Terminator Instructions */
67 /* removed 6 due to API changes */
71 /* Standard Unary Operators */
74 /* Standard Binary Operators */
88 /* Logical Operators */
96 /* Memory Operators */
100 LLVMGetElementPtr
= 29,
115 LLVMAddrSpaceCast
= 60,
117 /* Other Operators */
126 LLVMExtractElement
= 50,
127 LLVMInsertElement
= 51,
128 LLVMShuffleVector
= 52,
129 LLVMExtractValue
= 53,
130 LLVMInsertValue
= 54,
133 /* Atomic operators */
135 LLVMAtomicCmpXchg
= 56,
138 /* Exception Handling Operators */
149 LLVMVoidTypeKind
, /**< type with no size */
150 LLVMHalfTypeKind
, /**< 16 bit floating point type */
151 LLVMFloatTypeKind
, /**< 32 bit floating point type */
152 LLVMDoubleTypeKind
, /**< 64 bit floating point type */
153 LLVMX86_FP80TypeKind
, /**< 80 bit floating point type (X87) */
154 LLVMFP128TypeKind
, /**< 128 bit floating point type (112-bit mantissa)*/
155 LLVMPPC_FP128TypeKind
, /**< 128 bit floating point type (two 64-bits) */
156 LLVMLabelTypeKind
, /**< Labels */
157 LLVMIntegerTypeKind
, /**< Arbitrary bit width integers */
158 LLVMFunctionTypeKind
, /**< Functions */
159 LLVMStructTypeKind
, /**< Structures */
160 LLVMArrayTypeKind
, /**< Arrays */
161 LLVMPointerTypeKind
, /**< Pointers */
162 LLVMVectorTypeKind
, /**< Fixed width SIMD vector type */
163 LLVMMetadataTypeKind
, /**< Metadata */
164 LLVMX86_MMXTypeKind
, /**< X86 MMX */
165 LLVMTokenTypeKind
, /**< Tokens */
166 LLVMScalableVectorTypeKind
, /**< Scalable SIMD vector type */
167 LLVMBFloatTypeKind
, /**< 16 bit brain floating point type */
168 LLVMX86_AMXTypeKind
, /**< X86 AMX */
169 LLVMTargetExtTypeKind
, /**< Target extension type */
173 LLVMExternalLinkage
, /**< Externally visible function */
174 LLVMAvailableExternallyLinkage
,
175 LLVMLinkOnceAnyLinkage
, /**< Keep one copy of function when linking (inline)*/
176 LLVMLinkOnceODRLinkage
, /**< Same, but only replaced by something
178 LLVMLinkOnceODRAutoHideLinkage
, /**< Obsolete */
179 LLVMWeakAnyLinkage
, /**< Keep one copy of function when linking (weak) */
180 LLVMWeakODRLinkage
, /**< Same, but only replaced by something
182 LLVMAppendingLinkage
, /**< Special purpose, only applies to global arrays */
183 LLVMInternalLinkage
, /**< Rename collisions when linking (static
185 LLVMPrivateLinkage
, /**< Like Internal, but omit from symbol table */
186 LLVMDLLImportLinkage
, /**< Obsolete */
187 LLVMDLLExportLinkage
, /**< Obsolete */
188 LLVMExternalWeakLinkage
,/**< ExternalWeak linkage description */
189 LLVMGhostLinkage
, /**< Obsolete */
190 LLVMCommonLinkage
, /**< Tentative definitions */
191 LLVMLinkerPrivateLinkage
, /**< Like Private, but linker removes. */
192 LLVMLinkerPrivateWeakLinkage
/**< Like LinkerPrivate, but is weak. */
196 LLVMDefaultVisibility
, /**< The GV is visible */
197 LLVMHiddenVisibility
, /**< The GV is hidden */
198 LLVMProtectedVisibility
/**< The GV is protected */
202 LLVMNoUnnamedAddr
, /**< Address of the GV is significant. */
203 LLVMLocalUnnamedAddr
, /**< Address of the GV is locally insignificant. */
204 LLVMGlobalUnnamedAddr
/**< Address of the GV is globally insignificant. */
208 LLVMDefaultStorageClass
= 0,
209 LLVMDLLImportStorageClass
= 1, /**< Function to be imported from DLL. */
210 LLVMDLLExportStorageClass
= 2 /**< Function to be accessible from DLL. */
211 } LLVMDLLStorageClass
;
215 LLVMFastCallConv
= 8,
216 LLVMColdCallConv
= 9,
217 LLVMGHCCallConv
= 10,
218 LLVMHiPECallConv
= 11,
219 LLVMWebKitJSCallConv
= 12,
220 LLVMAnyRegCallConv
= 13,
221 LLVMPreserveMostCallConv
= 14,
222 LLVMPreserveAllCallConv
= 15,
223 LLVMSwiftCallConv
= 16,
224 LLVMCXXFASTTLSCallConv
= 17,
225 LLVMX86StdcallCallConv
= 64,
226 LLVMX86FastcallCallConv
= 65,
227 LLVMARMAPCSCallConv
= 66,
228 LLVMARMAAPCSCallConv
= 67,
229 LLVMARMAAPCSVFPCallConv
= 68,
230 LLVMMSP430INTRCallConv
= 69,
231 LLVMX86ThisCallCallConv
= 70,
232 LLVMPTXKernelCallConv
= 71,
233 LLVMPTXDeviceCallConv
= 72,
234 LLVMSPIRFUNCCallConv
= 75,
235 LLVMSPIRKERNELCallConv
= 76,
236 LLVMIntelOCLBICallConv
= 77,
237 LLVMX8664SysVCallConv
= 78,
238 LLVMWin64CallConv
= 79,
239 LLVMX86VectorCallCallConv
= 80,
240 LLVMHHVMCallConv
= 81,
241 LLVMHHVMCCallConv
= 82,
242 LLVMX86INTRCallConv
= 83,
243 LLVMAVRINTRCallConv
= 84,
244 LLVMAVRSIGNALCallConv
= 85,
245 LLVMAVRBUILTINCallConv
= 86,
246 LLVMAMDGPUVSCallConv
= 87,
247 LLVMAMDGPUGSCallConv
= 88,
248 LLVMAMDGPUPSCallConv
= 89,
249 LLVMAMDGPUCSCallConv
= 90,
250 LLVMAMDGPUKERNELCallConv
= 91,
251 LLVMX86RegCallCallConv
= 92,
252 LLVMAMDGPUHSCallConv
= 93,
253 LLVMMSP430BUILTINCallConv
= 94,
254 LLVMAMDGPULSCallConv
= 95,
255 LLVMAMDGPUESCallConv
= 96
259 LLVMArgumentValueKind
,
260 LLVMBasicBlockValueKind
,
261 LLVMMemoryUseValueKind
,
262 LLVMMemoryDefValueKind
,
263 LLVMMemoryPhiValueKind
,
265 LLVMFunctionValueKind
,
266 LLVMGlobalAliasValueKind
,
267 LLVMGlobalIFuncValueKind
,
268 LLVMGlobalVariableValueKind
,
269 LLVMBlockAddressValueKind
,
270 LLVMConstantExprValueKind
,
271 LLVMConstantArrayValueKind
,
272 LLVMConstantStructValueKind
,
273 LLVMConstantVectorValueKind
,
275 LLVMUndefValueValueKind
,
276 LLVMConstantAggregateZeroValueKind
,
277 LLVMConstantDataArrayValueKind
,
278 LLVMConstantDataVectorValueKind
,
279 LLVMConstantIntValueKind
,
280 LLVMConstantFPValueKind
,
281 LLVMConstantPointerNullValueKind
,
282 LLVMConstantTokenNoneValueKind
,
284 LLVMMetadataAsValueValueKind
,
285 LLVMInlineAsmValueKind
,
287 LLVMInstructionValueKind
,
288 LLVMPoisonValueValueKind
,
289 LLVMConstantTargetNoneValueKind
,
293 LLVMIntEQ
= 32, /**< equal */
294 LLVMIntNE
, /**< not equal */
295 LLVMIntUGT
, /**< unsigned greater than */
296 LLVMIntUGE
, /**< unsigned greater or equal */
297 LLVMIntULT
, /**< unsigned less than */
298 LLVMIntULE
, /**< unsigned less or equal */
299 LLVMIntSGT
, /**< signed greater than */
300 LLVMIntSGE
, /**< signed greater or equal */
301 LLVMIntSLT
, /**< signed less than */
302 LLVMIntSLE
/**< signed less or equal */
306 LLVMRealPredicateFalse
, /**< Always false (always folded) */
307 LLVMRealOEQ
, /**< True if ordered and equal */
308 LLVMRealOGT
, /**< True if ordered and greater than */
309 LLVMRealOGE
, /**< True if ordered and greater than or equal */
310 LLVMRealOLT
, /**< True if ordered and less than */
311 LLVMRealOLE
, /**< True if ordered and less than or equal */
312 LLVMRealONE
, /**< True if ordered and operands are unequal */
313 LLVMRealORD
, /**< True if ordered (no nans) */
314 LLVMRealUNO
, /**< True if unordered: isnan(X) | isnan(Y) */
315 LLVMRealUEQ
, /**< True if unordered or equal */
316 LLVMRealUGT
, /**< True if unordered or greater than */
317 LLVMRealUGE
, /**< True if unordered, greater than, or equal */
318 LLVMRealULT
, /**< True if unordered or less than */
319 LLVMRealULE
, /**< True if unordered, less than, or equal */
320 LLVMRealUNE
, /**< True if unordered or not equal */
321 LLVMRealPredicateTrue
/**< Always true (always folded) */
325 LLVMLandingPadCatch
, /**< A catch clause */
326 LLVMLandingPadFilter
/**< A filter clause */
327 } LLVMLandingPadClauseTy
;
330 LLVMNotThreadLocal
= 0,
331 LLVMGeneralDynamicTLSModel
,
332 LLVMLocalDynamicTLSModel
,
333 LLVMInitialExecTLSModel
,
334 LLVMLocalExecTLSModel
335 } LLVMThreadLocalMode
;
338 LLVMAtomicOrderingNotAtomic
= 0, /**< A load or store which is not atomic */
339 LLVMAtomicOrderingUnordered
= 1, /**< Lowest level of atomicity, guarantees
340 somewhat sane results, lock free. */
341 LLVMAtomicOrderingMonotonic
= 2, /**< guarantees that if you take all the
342 operations affecting a specific address,
343 a consistent ordering exists */
344 LLVMAtomicOrderingAcquire
= 4, /**< Acquire provides a barrier of the sort
345 necessary to acquire a lock to access other
346 memory with normal loads and stores. */
347 LLVMAtomicOrderingRelease
= 5, /**< Release is similar to Acquire, but with
348 a barrier of the sort necessary to release
350 LLVMAtomicOrderingAcquireRelease
= 6, /**< provides both an Acquire and a
351 Release barrier (for fences and
352 operations which both read and write
354 LLVMAtomicOrderingSequentiallyConsistent
= 7 /**< provides Acquire semantics
355 for loads and Release
356 semantics for stores.
357 Additionally, it guarantees
358 that a total ordering exists
360 SequentiallyConsistent
362 } LLVMAtomicOrdering
;
365 LLVMAtomicRMWBinOpXchg
, /**< Set the new value and return the one old */
366 LLVMAtomicRMWBinOpAdd
, /**< Add a value and return the old one */
367 LLVMAtomicRMWBinOpSub
, /**< Subtract a value and return the old one */
368 LLVMAtomicRMWBinOpAnd
, /**< And a value and return the old one */
369 LLVMAtomicRMWBinOpNand
, /**< Not-And a value and return the old one */
370 LLVMAtomicRMWBinOpOr
, /**< OR a value and return the old one */
371 LLVMAtomicRMWBinOpXor
, /**< Xor a value and return the old one */
372 LLVMAtomicRMWBinOpMax
, /**< Sets the value if it's greater than the
373 original using a signed comparison and return
375 LLVMAtomicRMWBinOpMin
, /**< Sets the value if it's Smaller than the
376 original using a signed comparison and return
378 LLVMAtomicRMWBinOpUMax
, /**< Sets the value if it's greater than the
379 original using an unsigned comparison and return
381 LLVMAtomicRMWBinOpUMin
, /**< Sets the value if it's greater than the
382 original using an unsigned comparison and return
384 LLVMAtomicRMWBinOpFAdd
, /**< Add a floating point value and return the
386 LLVMAtomicRMWBinOpFSub
, /**< Subtract a floating point value and return the
388 LLVMAtomicRMWBinOpFMax
, /**< Sets the value if it's greater than the
389 original using an floating point comparison and
390 return the old one */
391 LLVMAtomicRMWBinOpFMin
, /**< Sets the value if it's smaller than the
392 original using an floating point comparison and
393 return the old one */
394 } LLVMAtomicRMWBinOp
;
401 } LLVMDiagnosticSeverity
;
404 LLVMInlineAsmDialectATT
,
405 LLVMInlineAsmDialectIntel
406 } LLVMInlineAsmDialect
;
410 * Emits an error if two values disagree, otherwise the resulting value is
411 * that of the operands.
413 * @see Module::ModFlagBehavior::Error
415 LLVMModuleFlagBehaviorError
,
417 * Emits a warning if two values disagree. The result value will be the
418 * operand for the flag from the first module being linked.
420 * @see Module::ModFlagBehavior::Warning
422 LLVMModuleFlagBehaviorWarning
,
424 * Adds a requirement that another module flag be present and have a
425 * specified value after linking is performed. The value must be a metadata
426 * pair, where the first element of the pair is the ID of the module flag
427 * to be restricted, and the second element of the pair is the value the
428 * module flag should be restricted to. This behavior can be used to
429 * restrict the allowable results (via triggering of an error) of linking
430 * IDs with the **Override** behavior.
432 * @see Module::ModFlagBehavior::Require
434 LLVMModuleFlagBehaviorRequire
,
436 * Uses the specified value, regardless of the behavior or value of the
437 * other module. If both modules specify **Override**, but the values
438 * differ, an error will be emitted.
440 * @see Module::ModFlagBehavior::Override
442 LLVMModuleFlagBehaviorOverride
,
444 * Appends the two values, which are required to be metadata nodes.
446 * @see Module::ModFlagBehavior::Append
448 LLVMModuleFlagBehaviorAppend
,
450 * Appends the two values, which are required to be metadata
451 * nodes. However, duplicate entries in the second list are dropped
452 * during the append operation.
454 * @see Module::ModFlagBehavior::AppendUnique
456 LLVMModuleFlagBehaviorAppendUnique
,
457 } LLVMModuleFlagBehavior
;
460 * Attribute index are either LLVMAttributeReturnIndex,
461 * LLVMAttributeFunctionIndex or a parameter number from 1 to N.
464 LLVMAttributeReturnIndex
= 0U,
465 // ISO C restricts enumerator values to range of 'int'
466 // (4294967295 is too large)
467 // LLVMAttributeFunctionIndex = ~0U,
468 LLVMAttributeFunctionIndex
= -1,
472 * Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
474 * Note that 'musttail' implies 'tail'.
476 * @see CallInst::TailCallKind
479 LLVMTailCallKindNone
= 0,
480 LLVMTailCallKindTail
= 1,
481 LLVMTailCallKindMustTail
= 2,
482 LLVMTailCallKindNoTail
= 3,
485 typedef unsigned LLVMAttributeIndex
;
491 /** Deallocate and destroy all ManagedStatic variables.
492 @see llvm::llvm_shutdown
493 @see ManagedStatic */
494 void LLVMShutdown(void);
496 /*===-- Version query -----------------------------------------------------===*/
499 * Return the major, minor, and patch version of LLVM
501 * The version components are returned via the function's three output
502 * parameters or skipped if a NULL pointer was supplied.
504 void LLVMGetVersion(unsigned *Major
, unsigned *Minor
, unsigned *Patch
);
506 /*===-- Error handling ----------------------------------------------------===*/
508 char *LLVMCreateMessage(const char *Message
);
509 void LLVMDisposeMessage(char *Message
);
512 * @defgroup LLVMCCoreContext Contexts
514 * Contexts are execution states for the core LLVM IR system.
516 * Most types are tied to a context instance. Multiple contexts can
517 * exist simultaneously. A single context is not thread safe. However,
518 * different contexts can execute on different threads simultaneously.
523 typedef void (*LLVMDiagnosticHandler
)(LLVMDiagnosticInfoRef
, void *);
524 typedef void (*LLVMYieldCallback
)(LLVMContextRef
, void *);
527 * Create a new context.
529 * Every call to this function should be paired with a call to
530 * LLVMContextDispose() or the context will leak memory.
532 LLVMContextRef
LLVMContextCreate(void);
535 * Obtain the global context instance.
537 LLVMContextRef
LLVMGetGlobalContext(void);
540 * Set the diagnostic handler for this context.
542 void LLVMContextSetDiagnosticHandler(LLVMContextRef C
,
543 LLVMDiagnosticHandler Handler
,
544 void *DiagnosticContext
);
547 * Get the diagnostic handler of this context.
549 LLVMDiagnosticHandler
LLVMContextGetDiagnosticHandler(LLVMContextRef C
);
552 * Get the diagnostic context of this context.
554 void *LLVMContextGetDiagnosticContext(LLVMContextRef C
);
557 * Set the yield callback function for this context.
559 * @see LLVMContext::setYieldCallback()
561 void LLVMContextSetYieldCallback(LLVMContextRef C
, LLVMYieldCallback Callback
,
565 * Retrieve whether the given context is set to discard all value names.
567 * @see LLVMContext::shouldDiscardValueNames()
569 LLVMBool
LLVMContextShouldDiscardValueNames(LLVMContextRef C
);
572 * Set whether the given context discards all value names.
574 * If true, only the names of GlobalValue objects will be available in the IR.
575 * This can be used to save memory and runtime, especially in release mode.
577 * @see LLVMContext::setDiscardValueNames()
579 void LLVMContextSetDiscardValueNames(LLVMContextRef C
, LLVMBool Discard
);
582 * Destroy a context instance.
584 * This should be called for every call to LLVMContextCreate() or memory
587 void LLVMContextDispose(LLVMContextRef C
);
590 * Return a string representation of the DiagnosticInfo. Use
591 * LLVMDisposeMessage to free the string.
593 * @see DiagnosticInfo::print()
595 char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI
);
598 * Return an enum LLVMDiagnosticSeverity.
600 * @see DiagnosticInfo::getSeverity()
602 LLVMDiagnosticSeverity
LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI
);
604 unsigned LLVMGetMDKindIDInContext(LLVMContextRef C
, const char *Name
,
606 unsigned LLVMGetMDKindID(const char *Name
, unsigned SLen
);
609 * Return an unique id given the name of a enum attribute,
610 * or 0 if no attribute by that name exists.
612 * See http://llvm.org/docs/LangRef.html#parameter-attributes
613 * and http://llvm.org/docs/LangRef.html#function-attributes
614 * for the list of available attributes.
616 * NB: Attribute names and/or id are subject to change without
617 * going through the C API deprecation cycle.
619 unsigned LLVMGetEnumAttributeKindForName(const char *Name
, size_t SLen
);
620 unsigned LLVMGetLastEnumAttributeKind(void);
623 * Create an enum attribute.
625 LLVMAttributeRef
LLVMCreateEnumAttribute(LLVMContextRef C
, unsigned KindID
,
629 * Get the unique id corresponding to the enum attribute
630 * passed as argument.
632 unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A
);
635 * Get the enum attribute's value. 0 is returned if none exists.
637 uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A
);
640 * Create a type attribute
642 LLVMAttributeRef
LLVMCreateTypeAttribute(LLVMContextRef C
, unsigned KindID
,
643 LLVMTypeRef type_ref
);
646 * Get the type attribute's value.
648 LLVMTypeRef
LLVMGetTypeAttributeValue(LLVMAttributeRef A
);
651 * Create a string attribute.
653 LLVMAttributeRef
LLVMCreateStringAttribute(LLVMContextRef C
,
654 const char *K
, unsigned KLength
,
655 const char *V
, unsigned VLength
);
658 * Get the string attribute's kind.
660 const char *LLVMGetStringAttributeKind(LLVMAttributeRef A
, unsigned *Length
);
663 * Get the string attribute's value.
665 const char *LLVMGetStringAttributeValue(LLVMAttributeRef A
, unsigned *Length
);
668 * Check for the different types of attributes.
670 LLVMBool
LLVMIsEnumAttribute(LLVMAttributeRef A
);
671 LLVMBool
LLVMIsStringAttribute(LLVMAttributeRef A
);
672 LLVMBool
LLVMIsTypeAttribute(LLVMAttributeRef A
);
675 * Obtain a Type from a context by its registered name.
677 LLVMTypeRef
LLVMGetTypeByName2(LLVMContextRef C
, const char *Name
);
684 * @defgroup LLVMCCoreModule Modules
686 * Modules represent the top-level structure in an LLVM program. An LLVM
687 * module is effectively a translation unit or a collection of
688 * translation units merged together.
694 * Create a new, empty module in the global context.
696 * This is equivalent to calling LLVMModuleCreateWithNameInContext with
697 * LLVMGetGlobalContext() as the context parameter.
699 * Every invocation should be paired with LLVMDisposeModule() or memory
702 LLVMModuleRef
LLVMModuleCreateWithName(const char *ModuleID
);
705 * Create a new, empty module in a specific context.
707 * Every invocation should be paired with LLVMDisposeModule() or memory
710 LLVMModuleRef
LLVMModuleCreateWithNameInContext(const char *ModuleID
,
713 * Return an exact copy of the specified module.
715 LLVMModuleRef
LLVMCloneModule(LLVMModuleRef M
);
718 * Destroy a module instance.
720 * This must be called for every created module or memory will be
723 void LLVMDisposeModule(LLVMModuleRef M
);
726 * Obtain the identifier of a module.
728 * @param M Module to obtain identifier of
729 * @param Len Out parameter which holds the length of the returned string.
730 * @return The identifier of M.
731 * @see Module::getModuleIdentifier()
733 const char *LLVMGetModuleIdentifier(LLVMModuleRef M
, size_t *Len
);
736 * Set the identifier of a module to a string Ident with length Len.
738 * @param M The module to set identifier
739 * @param Ident The string to set M's identifier to
740 * @param Len Length of Ident
741 * @see Module::setModuleIdentifier()
743 void LLVMSetModuleIdentifier(LLVMModuleRef M
, const char *Ident
, size_t Len
);
746 * Obtain the module's original source file name.
748 * @param M Module to obtain the name of
749 * @param Len Out parameter which holds the length of the returned string
750 * @return The original source file name of M
751 * @see Module::getSourceFileName()
753 const char *LLVMGetSourceFileName(LLVMModuleRef M
, size_t *Len
);
756 * Set the original source file name of a module to a string Name with length
759 * @param M The module to set the source file name of
760 * @param Name The string to set M's source file name to
761 * @param Len Length of Name
762 * @see Module::setSourceFileName()
764 void LLVMSetSourceFileName(LLVMModuleRef M
, const char *Name
, size_t Len
);
767 * Obtain the data layout for a module.
769 * @see Module::getDataLayoutStr()
771 * LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect,
772 * but match the name of another method on the module. Prefer the use
773 * of LLVMGetDataLayoutStr, which is not ambiguous.
775 const char *LLVMGetDataLayoutStr(LLVMModuleRef M
);
776 const char *LLVMGetDataLayout(LLVMModuleRef M
);
779 * Set the data layout for a module.
781 * @see Module::setDataLayout()
783 void LLVMSetDataLayout(LLVMModuleRef M
, const char *DataLayoutStr
);
786 * Obtain the target triple for a module.
788 * @see Module::getTargetTriple()
790 const char *LLVMGetTarget(LLVMModuleRef M
);
793 * Set the target triple for a module.
795 * @see Module::setTargetTriple()
797 void LLVMSetTarget(LLVMModuleRef M
, const char *Triple
);
800 * Returns the module flags as an array of flag-key-value triples. The caller
801 * is responsible for freeing this array by calling
802 * \c LLVMDisposeModuleFlagsMetadata.
804 * @see Module::getModuleFlagsMetadata()
806 LLVMModuleFlagEntry
*LLVMCopyModuleFlagsMetadata(LLVMModuleRef M
, size_t *Len
);
809 * Destroys module flags metadata entries.
811 void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry
*Entries
);
814 * Returns the flag behavior for a module flag entry at a specific index.
816 * @see Module::ModuleFlagEntry::Behavior
818 LLVMModuleFlagBehavior
819 LLVMModuleFlagEntriesGetFlagBehavior(LLVMModuleFlagEntry
*Entries
,
823 * Returns the key for a module flag entry at a specific index.
825 * @see Module::ModuleFlagEntry::Key
827 const char *LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry
*Entries
,
828 unsigned Index
, size_t *Len
);
831 * Returns the metadata for a module flag entry at a specific index.
833 * @see Module::ModuleFlagEntry::Val
835 LLVMMetadataRef
LLVMModuleFlagEntriesGetMetadata(LLVMModuleFlagEntry
*Entries
,
839 * Add a module-level flag to the module-level flags metadata if it doesn't
842 * @see Module::getModuleFlag()
844 LLVMMetadataRef
LLVMGetModuleFlag(LLVMModuleRef M
,
845 const char *Key
, size_t KeyLen
);
848 * Add a module-level flag to the module-level flags metadata if it doesn't
851 * @see Module::addModuleFlag()
853 void LLVMAddModuleFlag(LLVMModuleRef M
, LLVMModuleFlagBehavior Behavior
,
854 const char *Key
, size_t KeyLen
,
855 LLVMMetadataRef Val
);
858 * Dump a representation of a module to stderr.
860 * @see Module::dump()
862 void LLVMDumpModule(LLVMModuleRef M
);
865 * Print a representation of a module to a file. The ErrorMessage needs to be
866 * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
868 * @see Module::print()
870 LLVMBool
LLVMPrintModuleToFile(LLVMModuleRef M
, const char *Filename
,
871 char **ErrorMessage
);
874 * Return a string representation of the module. Use
875 * LLVMDisposeMessage to free the string.
877 * @see Module::print()
879 char *LLVMPrintModuleToString(LLVMModuleRef M
);
882 * Get inline assembly for a module.
884 * @see Module::getModuleInlineAsm()
886 const char *LLVMGetModuleInlineAsm(LLVMModuleRef M
, size_t *Len
);
889 * Set inline assembly for a module.
891 * @see Module::setModuleInlineAsm()
893 void LLVMSetModuleInlineAsm2(LLVMModuleRef M
, const char *Asm
, size_t Len
);
896 * Append inline assembly to a module.
898 * @see Module::appendModuleInlineAsm()
900 void LLVMAppendModuleInlineAsm(LLVMModuleRef M
, const char *Asm
, size_t Len
);
903 * Create the specified uniqued inline asm string.
905 * @see InlineAsm::get()
907 LLVMValueRef
LLVMGetInlineAsm(LLVMTypeRef Ty
, const char *AsmString
,
908 size_t AsmStringSize
, const char *Constraints
,
909 size_t ConstraintsSize
, LLVMBool HasSideEffects
,
910 LLVMBool IsAlignStack
,
911 LLVMInlineAsmDialect Dialect
, LLVMBool CanThrow
);
914 * Get the template string used for an inline assembly snippet
917 const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal
, size_t *Len
);
920 * Get the raw constraint string for an inline assembly snippet
923 const char *LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal
,
927 * Get the dialect used by the inline asm snippet
930 LLVMInlineAsmDialect
LLVMGetInlineAsmDialect(LLVMValueRef InlineAsmVal
);
933 * Get the function type of the inline assembly snippet. The same type that
934 * was passed into LLVMGetInlineAsm originally
936 * @see LLVMGetInlineAsm
939 LLVMTypeRef
LLVMGetInlineAsmFunctionType(LLVMValueRef InlineAsmVal
);
942 * Get if the inline asm snippet has side effects
945 LLVMBool
LLVMGetInlineAsmHasSideEffects(LLVMValueRef InlineAsmVal
);
948 * Get if the inline asm snippet needs an aligned stack
951 LLVMBool
LLVMGetInlineAsmNeedsAlignedStack(LLVMValueRef InlineAsmVal
);
954 * Get if the inline asm snippet may unwind the stack
957 LLVMBool
LLVMGetInlineAsmCanUnwind(LLVMValueRef InlineAsmVal
);
960 * Obtain the context to which this module is associated.
962 * @see Module::getContext()
964 LLVMContextRef
LLVMGetModuleContext(LLVMModuleRef M
);
966 /** Deprecated: Use LLVMGetTypeByName2 instead. */
967 LLVMTypeRef
LLVMGetTypeByName(LLVMModuleRef M
, const char *Name
);
970 * Obtain an iterator to the first NamedMDNode in a Module.
972 * @see llvm::Module::named_metadata_begin()
974 LLVMNamedMDNodeRef
LLVMGetFirstNamedMetadata(LLVMModuleRef M
);
977 * Obtain an iterator to the last NamedMDNode in a Module.
979 * @see llvm::Module::named_metadata_end()
981 LLVMNamedMDNodeRef
LLVMGetLastNamedMetadata(LLVMModuleRef M
);
984 * Advance a NamedMDNode iterator to the next NamedMDNode.
986 * Returns NULL if the iterator was already at the end and there are no more
987 * named metadata nodes.
989 LLVMNamedMDNodeRef
LLVMGetNextNamedMetadata(LLVMNamedMDNodeRef NamedMDNode
);
992 * Decrement a NamedMDNode iterator to the previous NamedMDNode.
994 * Returns NULL if the iterator was already at the beginning and there are
995 * no previous named metadata nodes.
997 LLVMNamedMDNodeRef
LLVMGetPreviousNamedMetadata(LLVMNamedMDNodeRef NamedMDNode
);
1000 * Retrieve a NamedMDNode with the given name, returning NULL if no such
1003 * @see llvm::Module::getNamedMetadata()
1005 LLVMNamedMDNodeRef
LLVMGetNamedMetadata(LLVMModuleRef M
,
1006 const char *Name
, size_t NameLen
);
1009 * Retrieve a NamedMDNode with the given name, creating a new node if no such
1012 * @see llvm::Module::getOrInsertNamedMetadata()
1014 LLVMNamedMDNodeRef
LLVMGetOrInsertNamedMetadata(LLVMModuleRef M
,
1019 * Retrieve the name of a NamedMDNode.
1021 * @see llvm::NamedMDNode::getName()
1023 const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NamedMD
,
1027 * Obtain the number of operands for named metadata in a module.
1029 * @see llvm::Module::getNamedMetadata()
1031 unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M
, const char *Name
);
1034 * Obtain the named metadata operands for a module.
1036 * The passed LLVMValueRef pointer should refer to an array of
1037 * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
1038 * array will be populated with the LLVMValueRef instances. Each
1039 * instance corresponds to a llvm::MDNode.
1041 * @see llvm::Module::getNamedMetadata()
1042 * @see llvm::MDNode::getOperand()
1044 void LLVMGetNamedMetadataOperands(LLVMModuleRef M
, const char *Name
,
1045 LLVMValueRef
*Dest
);
1048 * Add an operand to named metadata.
1050 * @see llvm::Module::getNamedMetadata()
1051 * @see llvm::MDNode::addOperand()
1053 void LLVMAddNamedMetadataOperand(LLVMModuleRef M
, const char *Name
,
1057 * Return the directory of the debug location for this value, which must be
1058 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1060 * @see llvm::Instruction::getDebugLoc()
1061 * @see llvm::GlobalVariable::getDebugInfo()
1062 * @see llvm::Function::getSubprogram()
1064 const char *LLVMGetDebugLocDirectory(LLVMValueRef Val
, unsigned *Length
);
1067 * Return the filename of the debug location for this value, which must be
1068 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1070 * @see llvm::Instruction::getDebugLoc()
1071 * @see llvm::GlobalVariable::getDebugInfo()
1072 * @see llvm::Function::getSubprogram()
1074 const char *LLVMGetDebugLocFilename(LLVMValueRef Val
, unsigned *Length
);
1077 * Return the line number of the debug location for this value, which must be
1078 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1080 * @see llvm::Instruction::getDebugLoc()
1081 * @see llvm::GlobalVariable::getDebugInfo()
1082 * @see llvm::Function::getSubprogram()
1084 unsigned LLVMGetDebugLocLine(LLVMValueRef Val
);
1087 * Return the column number of the debug location for this value, which must be
1088 * an llvm::Instruction.
1090 * @see llvm::Instruction::getDebugLoc()
1092 unsigned LLVMGetDebugLocColumn(LLVMValueRef Val
);
1095 * Add a function to a module under a specified name.
1097 * @see llvm::Function::Create()
1099 LLVMValueRef
LLVMAddFunction(LLVMModuleRef M
, const char *Name
,
1100 LLVMTypeRef FunctionTy
);
1103 * Obtain a Function value from a Module by its name.
1105 * The returned value corresponds to a llvm::Function value.
1107 * @see llvm::Module::getFunction()
1109 LLVMValueRef
LLVMGetNamedFunction(LLVMModuleRef M
, const char *Name
);
1112 * Obtain an iterator to the first Function in a Module.
1114 * @see llvm::Module::begin()
1116 LLVMValueRef
LLVMGetFirstFunction(LLVMModuleRef M
);
1119 * Obtain an iterator to the last Function in a Module.
1121 * @see llvm::Module::end()
1123 LLVMValueRef
LLVMGetLastFunction(LLVMModuleRef M
);
1126 * Advance a Function iterator to the next Function.
1128 * Returns NULL if the iterator was already at the end and there are no more
1131 LLVMValueRef
LLVMGetNextFunction(LLVMValueRef Fn
);
1134 * Decrement a Function iterator to the previous Function.
1136 * Returns NULL if the iterator was already at the beginning and there are
1137 * no previous functions.
1139 LLVMValueRef
LLVMGetPreviousFunction(LLVMValueRef Fn
);
1141 /** Deprecated: Use LLVMSetModuleInlineAsm2 instead. */
1142 void LLVMSetModuleInlineAsm(LLVMModuleRef M
, const char *Asm
);
1149 * @defgroup LLVMCCoreType Types
1151 * Types represent the type of a value.
1153 * Types are associated with a context instance. The context internally
1154 * deduplicates types so there is only 1 instance of a specific type
1155 * alive at a time. In other words, a unique type is shared among all
1156 * consumers within a context.
1158 * A Type in the C API corresponds to llvm::Type.
1160 * Types have the following hierarchy:
1178 * Obtain the enumerated type of a Type instance.
1180 * @see llvm::Type:getTypeID()
1182 LLVMTypeKind
LLVMGetTypeKind(LLVMTypeRef Ty
);
1185 * Whether the type has a known size.
1187 * Things that don't have a size are abstract types, labels, and void.a
1189 * @see llvm::Type::isSized()
1191 LLVMBool
LLVMTypeIsSized(LLVMTypeRef Ty
);
1194 * Obtain the context to which this type instance is associated.
1196 * @see llvm::Type::getContext()
1198 LLVMContextRef
LLVMGetTypeContext(LLVMTypeRef Ty
);
1201 * Dump a representation of a type to stderr.
1203 * @see llvm::Type::dump()
1205 void LLVMDumpType(LLVMTypeRef Val
);
1208 * Return a string representation of the type. Use
1209 * LLVMDisposeMessage to free the string.
1211 * @see llvm::Type::print()
1213 char *LLVMPrintTypeToString(LLVMTypeRef Val
);
1216 * @defgroup LLVMCCoreTypeInt Integer Types
1218 * Functions in this section operate on integer types.
1224 * Obtain an integer type from a context with specified bit width.
1226 LLVMTypeRef
LLVMInt1TypeInContext(LLVMContextRef C
);
1227 LLVMTypeRef
LLVMInt8TypeInContext(LLVMContextRef C
);
1228 LLVMTypeRef
LLVMInt16TypeInContext(LLVMContextRef C
);
1229 LLVMTypeRef
LLVMInt32TypeInContext(LLVMContextRef C
);
1230 LLVMTypeRef
LLVMInt64TypeInContext(LLVMContextRef C
);
1231 LLVMTypeRef
LLVMInt128TypeInContext(LLVMContextRef C
);
1232 LLVMTypeRef
LLVMIntTypeInContext(LLVMContextRef C
, unsigned NumBits
);
1235 * Obtain an integer type from the global context with a specified bit
1238 LLVMTypeRef
LLVMInt1Type(void);
1239 LLVMTypeRef
LLVMInt8Type(void);
1240 LLVMTypeRef
LLVMInt16Type(void);
1241 LLVMTypeRef
LLVMInt32Type(void);
1242 LLVMTypeRef
LLVMInt64Type(void);
1243 LLVMTypeRef
LLVMInt128Type(void);
1244 LLVMTypeRef
LLVMIntType(unsigned NumBits
);
1245 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy
);
1252 * @defgroup LLVMCCoreTypeFloat Floating Point Types
1258 * Obtain a 16-bit floating point type from a context.
1260 LLVMTypeRef
LLVMHalfTypeInContext(LLVMContextRef C
);
1263 * Obtain a 16-bit brain floating point type from a context.
1265 LLVMTypeRef
LLVMBFloatTypeInContext(LLVMContextRef C
);
1268 * Obtain a 32-bit floating point type from a context.
1270 LLVMTypeRef
LLVMFloatTypeInContext(LLVMContextRef C
);
1273 * Obtain a 64-bit floating point type from a context.
1275 LLVMTypeRef
LLVMDoubleTypeInContext(LLVMContextRef C
);
1278 * Obtain a 80-bit floating point type (X87) from a context.
1280 LLVMTypeRef
LLVMX86FP80TypeInContext(LLVMContextRef C
);
1283 * Obtain a 128-bit floating point type (112-bit mantissa) from a
1286 LLVMTypeRef
LLVMFP128TypeInContext(LLVMContextRef C
);
1289 * Obtain a 128-bit floating point type (two 64-bits) from a context.
1291 LLVMTypeRef
LLVMPPCFP128TypeInContext(LLVMContextRef C
);
1294 * Obtain a floating point type from the global context.
1296 * These map to the functions in this group of the same name.
1298 LLVMTypeRef
LLVMHalfType(void);
1299 LLVMTypeRef
LLVMBFloatType(void);
1300 LLVMTypeRef
LLVMFloatType(void);
1301 LLVMTypeRef
LLVMDoubleType(void);
1302 LLVMTypeRef
LLVMX86FP80Type(void);
1303 LLVMTypeRef
LLVMFP128Type(void);
1304 LLVMTypeRef
LLVMPPCFP128Type(void);
1311 * @defgroup LLVMCCoreTypeFunction Function Types
1317 * Obtain a function type consisting of a specified signature.
1319 * The function is defined as a tuple of a return Type, a list of
1320 * parameter types, and whether the function is variadic.
1322 LLVMTypeRef
LLVMFunctionType(LLVMTypeRef ReturnType
,
1323 LLVMTypeRef
*ParamTypes
, unsigned ParamCount
,
1327 * Returns whether a function type is variadic.
1329 LLVMBool
LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy
);
1332 * Obtain the Type this function Type returns.
1334 LLVMTypeRef
LLVMGetReturnType(LLVMTypeRef FunctionTy
);
1337 * Obtain the number of parameters this function accepts.
1339 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy
);
1342 * Obtain the types of a function's parameters.
1344 * The Dest parameter should point to a pre-allocated array of
1345 * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
1346 * first LLVMCountParamTypes() entries in the array will be populated
1347 * with LLVMTypeRef instances.
1349 * @param FunctionTy The function type to operate on.
1350 * @param Dest Memory address of an array to be filled with result.
1352 void LLVMGetParamTypes(LLVMTypeRef FunctionTy
, LLVMTypeRef
*Dest
);
1359 * @defgroup LLVMCCoreTypeStruct Structure Types
1361 * These functions relate to LLVMTypeRef instances.
1363 * @see llvm::StructType
1369 * Create a new structure type in a context.
1371 * A structure is specified by a list of inner elements/types and
1372 * whether these can be packed together.
1374 * @see llvm::StructType::create()
1376 LLVMTypeRef
LLVMStructTypeInContext(LLVMContextRef C
, LLVMTypeRef
*ElementTypes
,
1377 unsigned ElementCount
, LLVMBool Packed
);
1380 * Create a new structure type in the global context.
1382 * @see llvm::StructType::create()
1384 LLVMTypeRef
LLVMStructType(LLVMTypeRef
*ElementTypes
, unsigned ElementCount
,
1388 * Create an empty structure in a context having a specified name.
1390 * @see llvm::StructType::create()
1392 LLVMTypeRef
LLVMStructCreateNamed(LLVMContextRef C
, const char *Name
);
1395 * Obtain the name of a structure.
1397 * @see llvm::StructType::getName()
1399 const char *LLVMGetStructName(LLVMTypeRef Ty
);
1402 * Set the contents of a structure type.
1404 * @see llvm::StructType::setBody()
1406 void LLVMStructSetBody(LLVMTypeRef StructTy
, LLVMTypeRef
*ElementTypes
,
1407 unsigned ElementCount
, LLVMBool Packed
);
1410 * Get the number of elements defined inside the structure.
1412 * @see llvm::StructType::getNumElements()
1414 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy
);
1417 * Get the elements within a structure.
1419 * The function is passed the address of a pre-allocated array of
1420 * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
1421 * invocation, this array will be populated with the structure's
1422 * elements. The objects in the destination array will have a lifetime
1423 * of the structure type itself, which is the lifetime of the context it
1426 void LLVMGetStructElementTypes(LLVMTypeRef StructTy
, LLVMTypeRef
*Dest
);
1429 * Get the type of the element at a given index in the structure.
1431 * @see llvm::StructType::getTypeAtIndex()
1433 LLVMTypeRef
LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy
, unsigned i
);
1436 * Determine whether a structure is packed.
1438 * @see llvm::StructType::isPacked()
1440 LLVMBool
LLVMIsPackedStruct(LLVMTypeRef StructTy
);
1443 * Determine whether a structure is opaque.
1445 * @see llvm::StructType::isOpaque()
1447 LLVMBool
LLVMIsOpaqueStruct(LLVMTypeRef StructTy
);
1450 * Determine whether a structure is literal.
1452 * @see llvm::StructType::isLiteral()
1454 LLVMBool
LLVMIsLiteralStruct(LLVMTypeRef StructTy
);
1461 * @defgroup LLVMCCoreTypeSequential Sequential Types
1463 * Sequential types represents "arrays" of types. This is a super class
1464 * for array, vector, and pointer types.
1470 * Obtain the element type of an array or vector type.
1472 * @see llvm::SequentialType::getElementType()
1474 LLVMTypeRef
LLVMGetElementType(LLVMTypeRef Ty
);
1477 * Returns type's subtypes
1479 * @see llvm::Type::subtypes()
1481 void LLVMGetSubtypes(LLVMTypeRef Tp
, LLVMTypeRef
*Arr
);
1484 * Return the number of types in the derived type.
1486 * @see llvm::Type::getNumContainedTypes()
1488 unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp
);
1491 * Create a fixed size array type that refers to a specific type.
1493 * The created type will exist in the context that its element type
1496 * @deprecated LLVMArrayType is deprecated in favor of the API accurate
1498 * @see llvm::ArrayType::get()
1500 LLVMTypeRef
LLVMArrayType(LLVMTypeRef ElementType
, unsigned ElementCount
);
1503 * Create a fixed size array type that refers to a specific type.
1505 * The created type will exist in the context that its element type
1508 * @see llvm::ArrayType::get()
1510 LLVMTypeRef
LLVMArrayType2(LLVMTypeRef ElementType
, uint64_t ElementCount
);
1513 * Obtain the length of an array type.
1515 * This only works on types that represent arrays.
1517 * @deprecated LLVMGetArrayLength is deprecated in favor of the API accurate
1518 * LLVMGetArrayLength2
1519 * @see llvm::ArrayType::getNumElements()
1521 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy
);
1524 * Obtain the length of an array type.
1526 * This only works on types that represent arrays.
1528 * @see llvm::ArrayType::getNumElements()
1530 uint64_t LLVMGetArrayLength2(LLVMTypeRef ArrayTy
);
1533 * Create a pointer type that points to a defined type.
1535 * The created type will exist in the context that its pointee type
1538 * @see llvm::PointerType::get()
1540 LLVMTypeRef
LLVMPointerType(LLVMTypeRef ElementType
, unsigned AddressSpace
);
1543 * Determine whether a pointer is opaque.
1545 * True if this is an instance of an opaque PointerType.
1547 * @see llvm::Type::isOpaquePointerTy()
1549 LLVMBool
LLVMPointerTypeIsOpaque(LLVMTypeRef Ty
);
1552 * Create an opaque pointer type in a context.
1554 * @see llvm::PointerType::get()
1556 LLVMTypeRef
LLVMPointerTypeInContext(LLVMContextRef C
, unsigned AddressSpace
);
1559 * Obtain the address space of a pointer type.
1561 * This only works on types that represent pointers.
1563 * @see llvm::PointerType::getAddressSpace()
1565 unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy
);
1568 * Create a vector type that contains a defined type and has a specific
1569 * number of elements.
1571 * The created type will exist in the context thats its element type
1574 * @see llvm::VectorType::get()
1576 LLVMTypeRef
LLVMVectorType(LLVMTypeRef ElementType
, unsigned ElementCount
);
1579 * Create a vector type that contains a defined type and has a scalable
1580 * number of elements.
1582 * The created type will exist in the context thats its element type
1585 * @see llvm::ScalableVectorType::get()
1587 LLVMTypeRef
LLVMScalableVectorType(LLVMTypeRef ElementType
,
1588 unsigned ElementCount
);
1591 * Obtain the (possibly scalable) number of elements in a vector type.
1593 * This only works on types that represent vectors (fixed or scalable).
1595 * @see llvm::VectorType::getNumElements()
1597 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy
);
1604 * @defgroup LLVMCCoreTypeOther Other Types
1610 * Create a void type in a context.
1612 LLVMTypeRef
LLVMVoidTypeInContext(LLVMContextRef C
);
1615 * Create a label type in a context.
1617 LLVMTypeRef
LLVMLabelTypeInContext(LLVMContextRef C
);
1620 * Create a X86 MMX type in a context.
1622 LLVMTypeRef
LLVMX86MMXTypeInContext(LLVMContextRef C
);
1625 * Create a X86 AMX type in a context.
1627 LLVMTypeRef
LLVMX86AMXTypeInContext(LLVMContextRef C
);
1630 * Create a token type in a context.
1632 LLVMTypeRef
LLVMTokenTypeInContext(LLVMContextRef C
);
1635 * Create a metadata type in a context.
1637 LLVMTypeRef
LLVMMetadataTypeInContext(LLVMContextRef C
);
1640 * These are similar to the above functions except they operate on the
1643 LLVMTypeRef
LLVMVoidType(void);
1644 LLVMTypeRef
LLVMLabelType(void);
1645 LLVMTypeRef
LLVMX86MMXType(void);
1646 LLVMTypeRef
LLVMX86AMXType(void);
1649 * Create a target extension type in LLVM context.
1651 LLVMTypeRef
LLVMTargetExtTypeInContext(LLVMContextRef C
, const char *Name
,
1652 LLVMTypeRef
*TypeParams
,
1653 unsigned TypeParamCount
,
1654 unsigned *IntParams
,
1655 unsigned IntParamCount
);
1666 * @defgroup LLVMCCoreValues Values
1668 * The bulk of LLVM's object model consists of values, which comprise a very
1669 * rich type hierarchy.
1671 * LLVMValueRef essentially represents llvm::Value. There is a rich
1672 * hierarchy of classes within this type. Depending on the instance
1673 * obtained, not all APIs are available.
1675 * Callers can determine the type of an LLVMValueRef by calling the
1676 * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1677 * functions are defined by a macro, so it isn't obvious which are
1678 * available by looking at the Doxygen source code. Instead, look at the
1679 * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1680 * of value names given. These value names also correspond to classes in
1681 * the llvm::Value hierarchy.
1686 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1692 macro(BlockAddress) \
1693 macro(ConstantAggregateZero) \
1694 macro(ConstantArray) \
1695 macro(ConstantDataSequential) \
1696 macro(ConstantDataArray) \
1697 macro(ConstantDataVector) \
1698 macro(ConstantExpr) \
1700 macro(ConstantInt) \
1701 macro(ConstantPointerNull) \
1702 macro(ConstantStruct) \
1703 macro(ConstantTokenNone) \
1704 macro(ConstantVector) \
1705 macro(GlobalValue) \
1706 macro(GlobalAlias) \
1707 macro(GlobalObject) \
1709 macro(GlobalVariable) \
1710 macro(GlobalIFunc) \
1712 macro(PoisonValue) \
1713 macro(Instruction) \
1714 macro(UnaryOperator) \
1715 macro(BinaryOperator) \
1717 macro(IntrinsicInst) \
1718 macro(DbgInfoIntrinsic) \
1719 macro(DbgVariableIntrinsic) \
1720 macro(DbgDeclareInst) \
1721 macro(DbgLabelInst) \
1722 macro(MemIntrinsic) \
1724 macro(MemMoveInst) \
1729 macro(ExtractElementInst) \
1730 macro(GetElementPtrInst) \
1731 macro(InsertElementInst) \
1732 macro(InsertValueInst) \
1733 macro(LandingPadInst) \
1736 macro(ShuffleVectorInst) \
1739 macro(IndirectBrInst) \
1743 macro(UnreachableInst) \
1745 macro(CleanupReturnInst) \
1746 macro(CatchReturnInst) \
1747 macro(CatchSwitchInst) \
1749 macro(FuncletPadInst) \
1750 macro(CatchPadInst) \
1751 macro(CleanupPadInst) \
1752 macro(UnaryInstruction) \
1755 macro(AddrSpaceCastInst) \
1756 macro(BitCastInst) \
1760 macro(FPTruncInst) \
1761 macro(IntToPtrInst) \
1762 macro(PtrToIntInst) \
1768 macro(ExtractValueInst) \
1772 macro(AtomicCmpXchgInst) \
1773 macro(AtomicRMWInst) \
1777 * @defgroup LLVMCCoreValueGeneral General APIs
1779 * Functions in this section work on all LLVMValueRef instances,
1780 * regardless of their sub-type. They correspond to functions available
1787 * Obtain the type of a value.
1789 * @see llvm::Value::getType()
1791 LLVMTypeRef
LLVMTypeOf(LLVMValueRef Val
);
1794 * Obtain the enumerated type of a Value instance.
1796 * @see llvm::Value::getValueID()
1798 LLVMValueKind
LLVMGetValueKind(LLVMValueRef Val
);
1801 * Obtain the string name of a value.
1803 * @see llvm::Value::getName()
1805 const char *LLVMGetValueName2(LLVMValueRef Val
, size_t *Length
);
1808 * Set the string name of a value.
1810 * @see llvm::Value::setName()
1812 void LLVMSetValueName2(LLVMValueRef Val
, const char *Name
, size_t NameLen
);
1815 * Dump a representation of a value to stderr.
1817 * @see llvm::Value::dump()
1819 void LLVMDumpValue(LLVMValueRef Val
);
1822 * Return a string representation of the value. Use
1823 * LLVMDisposeMessage to free the string.
1825 * @see llvm::Value::print()
1827 char *LLVMPrintValueToString(LLVMValueRef Val
);
1830 * Replace all uses of a value with another one.
1832 * @see llvm::Value::replaceAllUsesWith()
1834 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal
, LLVMValueRef NewVal
);
1837 * Determine whether the specified value instance is constant.
1839 LLVMBool
LLVMIsConstant(LLVMValueRef Val
);
1842 * Determine whether a value instance is undefined.
1844 LLVMBool
LLVMIsUndef(LLVMValueRef Val
);
1847 * Determine whether a value instance is poisonous.
1849 LLVMBool
LLVMIsPoison(LLVMValueRef Val
);
1852 * Convert value instances between types.
1854 * Internally, an LLVMValueRef is "pinned" to a specific type. This
1855 * series of functions allows you to cast an instance to a specific
1858 * If the cast is not valid for the specified type, NULL is returned.
1860 * @see llvm::dyn_cast_or_null<>
1862 #define LLVM_DECLARE_VALUE_CAST(name) \
1863 LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1864 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST
)
1866 LLVMValueRef
LLVMIsAMDNode(LLVMValueRef Val
);
1867 LLVMValueRef
LLVMIsAValueAsMetadata(LLVMValueRef Val
);
1868 LLVMValueRef
LLVMIsAMDString(LLVMValueRef Val
);
1870 /** Deprecated: Use LLVMGetValueName2 instead. */
1871 const char *LLVMGetValueName(LLVMValueRef Val
);
1872 /** Deprecated: Use LLVMSetValueName2 instead. */
1873 void LLVMSetValueName(LLVMValueRef Val
, const char *Name
);
1880 * @defgroup LLVMCCoreValueUses Usage
1882 * This module defines functions that allow you to inspect the uses of a
1885 * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1886 * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1887 * llvm::User and llvm::Value.
1893 * Obtain the first use of a value.
1895 * Uses are obtained in an iterator fashion. First, call this function
1896 * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1897 * on that instance and all subsequently obtained instances until
1898 * LLVMGetNextUse() returns NULL.
1900 * @see llvm::Value::use_begin()
1902 LLVMUseRef
LLVMGetFirstUse(LLVMValueRef Val
);
1905 * Obtain the next use of a value.
1907 * This effectively advances the iterator. It returns NULL if you are on
1908 * the final use and no more are available.
1910 LLVMUseRef
LLVMGetNextUse(LLVMUseRef U
);
1913 * Obtain the user value for a user.
1915 * The returned value corresponds to a llvm::User type.
1917 * @see llvm::Use::getUser()
1919 LLVMValueRef
LLVMGetUser(LLVMUseRef U
);
1922 * Obtain the value this use corresponds to.
1924 * @see llvm::Use::get().
1926 LLVMValueRef
LLVMGetUsedValue(LLVMUseRef U
);
1933 * @defgroup LLVMCCoreValueUser User value
1935 * Function in this group pertain to LLVMValueRef instances that descent
1936 * from llvm::User. This includes constants, instructions, and
1943 * Obtain an operand at a specific index in a llvm::User value.
1945 * @see llvm::User::getOperand()
1947 LLVMValueRef
LLVMGetOperand(LLVMValueRef Val
, unsigned Index
);
1950 * Obtain the use of an operand at a specific index in a llvm::User value.
1952 * @see llvm::User::getOperandUse()
1954 LLVMUseRef
LLVMGetOperandUse(LLVMValueRef Val
, unsigned Index
);
1957 * Set an operand at a specific index in a llvm::User value.
1959 * @see llvm::User::setOperand()
1961 void LLVMSetOperand(LLVMValueRef User
, unsigned Index
, LLVMValueRef Val
);
1964 * Obtain the number of operands in a llvm::User value.
1966 * @see llvm::User::getNumOperands()
1968 int LLVMGetNumOperands(LLVMValueRef Val
);
1975 * @defgroup LLVMCCoreValueConstant Constants
1977 * This section contains APIs for interacting with LLVMValueRef that
1978 * correspond to llvm::Constant instances.
1980 * These functions will work for any LLVMValueRef in the llvm::Constant
1987 * Obtain a constant value referring to the null instance of a type.
1989 * @see llvm::Constant::getNullValue()
1991 LLVMValueRef
LLVMConstNull(LLVMTypeRef Ty
); /* all zeroes */
1994 * Obtain a constant value referring to the instance of a type
1995 * consisting of all ones.
1997 * This is only valid for integer types.
1999 * @see llvm::Constant::getAllOnesValue()
2001 LLVMValueRef
LLVMConstAllOnes(LLVMTypeRef Ty
);
2004 * Obtain a constant value referring to an undefined value of a type.
2006 * @see llvm::UndefValue::get()
2008 LLVMValueRef
LLVMGetUndef(LLVMTypeRef Ty
);
2011 * Obtain a constant value referring to a poison value of a type.
2013 * @see llvm::PoisonValue::get()
2015 LLVMValueRef
LLVMGetPoison(LLVMTypeRef Ty
);
2018 * Determine whether a value instance is null.
2020 * @see llvm::Constant::isNullValue()
2022 LLVMBool
LLVMIsNull(LLVMValueRef Val
);
2025 * Obtain a constant that is a constant pointer pointing to NULL for a
2028 LLVMValueRef
LLVMConstPointerNull(LLVMTypeRef Ty
);
2031 * @defgroup LLVMCCoreValueConstantScalar Scalar constants
2033 * Functions in this group model LLVMValueRef instances that correspond
2034 * to constants referring to scalar types.
2036 * For integer types, the LLVMTypeRef parameter should correspond to a
2037 * llvm::IntegerType instance and the returned LLVMValueRef will
2038 * correspond to a llvm::ConstantInt.
2040 * For floating point types, the LLVMTypeRef returned corresponds to a
2047 * Obtain a constant value for an integer type.
2049 * The returned value corresponds to a llvm::ConstantInt.
2051 * @see llvm::ConstantInt::get()
2053 * @param IntTy Integer type to obtain value of.
2054 * @param N The value the returned instance should refer to.
2055 * @param SignExtend Whether to sign extend the produced value.
2057 LLVMValueRef
LLVMConstInt(LLVMTypeRef IntTy
, unsigned long long N
,
2058 LLVMBool SignExtend
);
2061 * Obtain a constant value for an integer of arbitrary precision.
2063 * @see llvm::ConstantInt::get()
2065 LLVMValueRef
LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy
,
2067 const uint64_t Words
[]);
2070 * Obtain a constant value for an integer parsed from a string.
2072 * A similar API, LLVMConstIntOfStringAndSize is also available. If the
2073 * string's length is available, it is preferred to call that function
2076 * @see llvm::ConstantInt::get()
2078 LLVMValueRef
LLVMConstIntOfString(LLVMTypeRef IntTy
, const char *Text
,
2082 * Obtain a constant value for an integer parsed from a string with
2085 * @see llvm::ConstantInt::get()
2087 LLVMValueRef
LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy
, const char *Text
,
2088 unsigned SLen
, uint8_t Radix
);
2091 * Obtain a constant value referring to a double floating point value.
2093 LLVMValueRef
LLVMConstReal(LLVMTypeRef RealTy
, double N
);
2096 * Obtain a constant for a floating point value parsed from a string.
2098 * A similar API, LLVMConstRealOfStringAndSize is also available. It
2099 * should be used if the input string's length is known.
2101 LLVMValueRef
LLVMConstRealOfString(LLVMTypeRef RealTy
, const char *Text
);
2104 * Obtain a constant for a floating point value parsed from a string.
2106 LLVMValueRef
LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy
, const char *Text
,
2110 * Obtain the zero extended value for an integer constant value.
2112 * @see llvm::ConstantInt::getZExtValue()
2114 unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal
);
2117 * Obtain the sign extended value for an integer constant value.
2119 * @see llvm::ConstantInt::getSExtValue()
2121 long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal
);
2124 * Obtain the double value for an floating point constant value.
2125 * losesInfo indicates if some precision was lost in the conversion.
2127 * @see llvm::ConstantFP::getDoubleValue
2129 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal
, LLVMBool
*losesInfo
);
2136 * @defgroup LLVMCCoreValueConstantComposite Composite Constants
2138 * Functions in this group operate on composite constants.
2144 * Create a ConstantDataSequential and initialize it with a string.
2146 * @see llvm::ConstantDataArray::getString()
2148 LLVMValueRef
LLVMConstStringInContext(LLVMContextRef C
, const char *Str
,
2149 unsigned Length
, LLVMBool DontNullTerminate
);
2152 * Create a ConstantDataSequential with string content in the global context.
2154 * This is the same as LLVMConstStringInContext except it operates on the
2157 * @see LLVMConstStringInContext()
2158 * @see llvm::ConstantDataArray::getString()
2160 LLVMValueRef
LLVMConstString(const char *Str
, unsigned Length
,
2161 LLVMBool DontNullTerminate
);
2164 * Returns true if the specified constant is an array of i8.
2166 * @see ConstantDataSequential::getAsString()
2168 LLVMBool
LLVMIsConstantString(LLVMValueRef c
);
2171 * Get the given constant data sequential as a string.
2173 * @see ConstantDataSequential::getAsString()
2175 const char *LLVMGetAsString(LLVMValueRef c
, size_t *Length
);
2178 * Create an anonymous ConstantStruct with the specified values.
2180 * @see llvm::ConstantStruct::getAnon()
2182 LLVMValueRef
LLVMConstStructInContext(LLVMContextRef C
,
2183 LLVMValueRef
*ConstantVals
,
2184 unsigned Count
, LLVMBool Packed
);
2187 * Create a ConstantStruct in the global Context.
2189 * This is the same as LLVMConstStructInContext except it operates on the
2192 * @see LLVMConstStructInContext()
2194 LLVMValueRef
LLVMConstStruct(LLVMValueRef
*ConstantVals
, unsigned Count
,
2198 * Create a ConstantArray from values.
2200 * @deprecated LLVMConstArray is deprecated in favor of the API accurate
2202 * @see llvm::ConstantArray::get()
2204 LLVMValueRef
LLVMConstArray(LLVMTypeRef ElementTy
,
2205 LLVMValueRef
*ConstantVals
, unsigned Length
);
2208 * Create a ConstantArray from values.
2210 * @see llvm::ConstantArray::get()
2212 LLVMValueRef
LLVMConstArray2(LLVMTypeRef ElementTy
, LLVMValueRef
*ConstantVals
,
2216 * Create a non-anonymous ConstantStruct from values.
2218 * @see llvm::ConstantStruct::get()
2220 LLVMValueRef
LLVMConstNamedStruct(LLVMTypeRef StructTy
,
2221 LLVMValueRef
*ConstantVals
,
2225 * Get element of a constant aggregate (struct, array or vector) at the
2226 * specified index. Returns null if the index is out of range, or it's not
2227 * possible to determine the element (e.g., because the constant is a
2228 * constant expression.)
2230 * @see llvm::Constant::getAggregateElement()
2232 LLVMValueRef
LLVMGetAggregateElement(LLVMValueRef C
, unsigned Idx
);
2235 * Get an element at specified index as a constant.
2237 * @see ConstantDataSequential::getElementAsConstant()
2239 LLVM_ATTRIBUTE_C_DEPRECATED(
2240 LLVMValueRef
LLVMGetElementAsConstant(LLVMValueRef C
, unsigned idx
),
2241 "Use LLVMGetAggregateElement instead");
2244 * Create a ConstantVector from values.
2246 * @see llvm::ConstantVector::get()
2248 LLVMValueRef
LLVMConstVector(LLVMValueRef
*ScalarConstantVals
, unsigned Size
);
2255 * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
2257 * Functions in this group correspond to APIs on llvm::ConstantExpr.
2259 * @see llvm::ConstantExpr.
2263 LLVMOpcode
LLVMGetConstOpcode(LLVMValueRef ConstantVal
);
2264 LLVMValueRef
LLVMAlignOf(LLVMTypeRef Ty
);
2265 LLVMValueRef
LLVMSizeOf(LLVMTypeRef Ty
);
2266 LLVMValueRef
LLVMConstNeg(LLVMValueRef ConstantVal
);
2267 LLVMValueRef
LLVMConstNSWNeg(LLVMValueRef ConstantVal
);
2268 LLVMValueRef
LLVMConstNUWNeg(LLVMValueRef ConstantVal
);
2269 LLVMValueRef
LLVMConstNot(LLVMValueRef ConstantVal
);
2270 LLVMValueRef
LLVMConstAdd(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2271 LLVMValueRef
LLVMConstNSWAdd(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2272 LLVMValueRef
LLVMConstNUWAdd(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2273 LLVMValueRef
LLVMConstSub(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2274 LLVMValueRef
LLVMConstNSWSub(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2275 LLVMValueRef
LLVMConstNUWSub(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2276 LLVMValueRef
LLVMConstMul(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2277 LLVMValueRef
LLVMConstNSWMul(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2278 LLVMValueRef
LLVMConstNUWMul(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2279 LLVMValueRef
LLVMConstXor(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2280 LLVMValueRef
LLVMConstICmp(LLVMIntPredicate Predicate
,
2281 LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2282 LLVMValueRef
LLVMConstFCmp(LLVMRealPredicate Predicate
,
2283 LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2284 LLVMValueRef
LLVMConstShl(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2285 LLVMValueRef
LLVMConstLShr(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2286 LLVMValueRef
LLVMConstAShr(LLVMValueRef LHSConstant
, LLVMValueRef RHSConstant
);
2287 LLVMValueRef
LLVMConstGEP2(LLVMTypeRef Ty
, LLVMValueRef ConstantVal
,
2288 LLVMValueRef
*ConstantIndices
, unsigned NumIndices
);
2289 LLVMValueRef
LLVMConstInBoundsGEP2(LLVMTypeRef Ty
, LLVMValueRef ConstantVal
,
2290 LLVMValueRef
*ConstantIndices
,
2291 unsigned NumIndices
);
2292 LLVMValueRef
LLVMConstTrunc(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2293 LLVMValueRef
LLVMConstSExt(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2294 LLVMValueRef
LLVMConstZExt(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2295 LLVMValueRef
LLVMConstFPTrunc(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2296 LLVMValueRef
LLVMConstFPExt(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2297 LLVMValueRef
LLVMConstUIToFP(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2298 LLVMValueRef
LLVMConstSIToFP(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2299 LLVMValueRef
LLVMConstFPToUI(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2300 LLVMValueRef
LLVMConstFPToSI(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2301 LLVMValueRef
LLVMConstPtrToInt(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2302 LLVMValueRef
LLVMConstIntToPtr(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2303 LLVMValueRef
LLVMConstBitCast(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2304 LLVMValueRef
LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2305 LLVMValueRef
LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal
,
2306 LLVMTypeRef ToType
);
2307 LLVMValueRef
LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal
,
2308 LLVMTypeRef ToType
);
2309 LLVMValueRef
LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal
,
2310 LLVMTypeRef ToType
);
2311 LLVMValueRef
LLVMConstPointerCast(LLVMValueRef ConstantVal
,
2312 LLVMTypeRef ToType
);
2313 LLVMValueRef
LLVMConstIntCast(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
,
2315 LLVMValueRef
LLVMConstFPCast(LLVMValueRef ConstantVal
, LLVMTypeRef ToType
);
2316 LLVMValueRef
LLVMConstExtractElement(LLVMValueRef VectorConstant
,
2317 LLVMValueRef IndexConstant
);
2318 LLVMValueRef
LLVMConstInsertElement(LLVMValueRef VectorConstant
,
2319 LLVMValueRef ElementValueConstant
,
2320 LLVMValueRef IndexConstant
);
2321 LLVMValueRef
LLVMConstShuffleVector(LLVMValueRef VectorAConstant
,
2322 LLVMValueRef VectorBConstant
,
2323 LLVMValueRef MaskConstant
);
2324 LLVMValueRef
LLVMBlockAddress(LLVMValueRef F
, LLVMBasicBlockRef BB
);
2326 /** Deprecated: Use LLVMGetInlineAsm instead. */
2327 LLVMValueRef
LLVMConstInlineAsm(LLVMTypeRef Ty
,
2328 const char *AsmString
, const char *Constraints
,
2329 LLVMBool HasSideEffects
, LLVMBool IsAlignStack
);
2336 * @defgroup LLVMCCoreValueConstantGlobals Global Values
2338 * This group contains functions that operate on global values. Functions in
2339 * this group relate to functions in the llvm::GlobalValue class tree.
2341 * @see llvm::GlobalValue
2346 LLVMModuleRef
LLVMGetGlobalParent(LLVMValueRef Global
);
2347 LLVMBool
LLVMIsDeclaration(LLVMValueRef Global
);
2348 LLVMLinkage
LLVMGetLinkage(LLVMValueRef Global
);
2349 void LLVMSetLinkage(LLVMValueRef Global
, LLVMLinkage Linkage
);
2350 const char *LLVMGetSection(LLVMValueRef Global
);
2351 void LLVMSetSection(LLVMValueRef Global
, const char *Section
);
2352 LLVMVisibility
LLVMGetVisibility(LLVMValueRef Global
);
2353 void LLVMSetVisibility(LLVMValueRef Global
, LLVMVisibility Viz
);
2354 LLVMDLLStorageClass
LLVMGetDLLStorageClass(LLVMValueRef Global
);
2355 void LLVMSetDLLStorageClass(LLVMValueRef Global
, LLVMDLLStorageClass Class
);
2356 LLVMUnnamedAddr
LLVMGetUnnamedAddress(LLVMValueRef Global
);
2357 void LLVMSetUnnamedAddress(LLVMValueRef Global
, LLVMUnnamedAddr UnnamedAddr
);
2360 * Returns the "value type" of a global value. This differs from the formal
2361 * type of a global value which is always a pointer type.
2363 * @see llvm::GlobalValue::getValueType()
2365 LLVMTypeRef
LLVMGlobalGetValueType(LLVMValueRef Global
);
2367 /** Deprecated: Use LLVMGetUnnamedAddress instead. */
2368 LLVMBool
LLVMHasUnnamedAddr(LLVMValueRef Global
);
2369 /** Deprecated: Use LLVMSetUnnamedAddress instead. */
2370 void LLVMSetUnnamedAddr(LLVMValueRef Global
, LLVMBool HasUnnamedAddr
);
2373 * @defgroup LLVMCCoreValueWithAlignment Values with alignment
2375 * Functions in this group only apply to values with alignment, i.e.
2376 * global variables, load and store instructions.
2380 * Obtain the preferred alignment of the value.
2381 * @see llvm::AllocaInst::getAlignment()
2382 * @see llvm::LoadInst::getAlignment()
2383 * @see llvm::StoreInst::getAlignment()
2384 * @see llvm::AtomicRMWInst::setAlignment()
2385 * @see llvm::AtomicCmpXchgInst::setAlignment()
2386 * @see llvm::GlobalValue::getAlignment()
2388 unsigned LLVMGetAlignment(LLVMValueRef V
);
2391 * Set the preferred alignment of the value.
2392 * @see llvm::AllocaInst::setAlignment()
2393 * @see llvm::LoadInst::setAlignment()
2394 * @see llvm::StoreInst::setAlignment()
2395 * @see llvm::AtomicRMWInst::setAlignment()
2396 * @see llvm::AtomicCmpXchgInst::setAlignment()
2397 * @see llvm::GlobalValue::setAlignment()
2399 void LLVMSetAlignment(LLVMValueRef V
, unsigned Bytes
);
2402 * Sets a metadata attachment, erasing the existing metadata attachment if
2403 * it already exists for the given kind.
2405 * @see llvm::GlobalObject::setMetadata()
2407 void LLVMGlobalSetMetadata(LLVMValueRef Global
, unsigned Kind
,
2408 LLVMMetadataRef MD
);
2411 * Erases a metadata attachment of the given kind if it exists.
2413 * @see llvm::GlobalObject::eraseMetadata()
2415 void LLVMGlobalEraseMetadata(LLVMValueRef Global
, unsigned Kind
);
2418 * Removes all metadata attachments from this value.
2420 * @see llvm::GlobalObject::clearMetadata()
2422 void LLVMGlobalClearMetadata(LLVMValueRef Global
);
2425 * Retrieves an array of metadata entries representing the metadata attached to
2426 * this value. The caller is responsible for freeing this array by calling
2427 * \c LLVMDisposeValueMetadataEntries.
2429 * @see llvm::GlobalObject::getAllMetadata()
2431 LLVMValueMetadataEntry
*LLVMGlobalCopyAllMetadata(LLVMValueRef Value
,
2432 size_t *NumEntries
);
2435 * Destroys value metadata entries.
2437 void LLVMDisposeValueMetadataEntries(LLVMValueMetadataEntry
*Entries
);
2440 * Returns the kind of a value metadata entry at a specific index.
2442 unsigned LLVMValueMetadataEntriesGetKind(LLVMValueMetadataEntry
*Entries
,
2446 * Returns the underlying metadata node of a value metadata entry at a
2450 LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry
*Entries
,
2458 * @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
2460 * This group contains functions that operate on global variable values.
2462 * @see llvm::GlobalVariable
2466 LLVMValueRef
LLVMAddGlobal(LLVMModuleRef M
, LLVMTypeRef Ty
, const char *Name
);
2467 LLVMValueRef
LLVMAddGlobalInAddressSpace(LLVMModuleRef M
, LLVMTypeRef Ty
,
2469 unsigned AddressSpace
);
2470 LLVMValueRef
LLVMGetNamedGlobal(LLVMModuleRef M
, const char *Name
);
2471 LLVMValueRef
LLVMGetFirstGlobal(LLVMModuleRef M
);
2472 LLVMValueRef
LLVMGetLastGlobal(LLVMModuleRef M
);
2473 LLVMValueRef
LLVMGetNextGlobal(LLVMValueRef GlobalVar
);
2474 LLVMValueRef
LLVMGetPreviousGlobal(LLVMValueRef GlobalVar
);
2475 void LLVMDeleteGlobal(LLVMValueRef GlobalVar
);
2476 LLVMValueRef
LLVMGetInitializer(LLVMValueRef GlobalVar
);
2477 void LLVMSetInitializer(LLVMValueRef GlobalVar
, LLVMValueRef ConstantVal
);
2478 LLVMBool
LLVMIsThreadLocal(LLVMValueRef GlobalVar
);
2479 void LLVMSetThreadLocal(LLVMValueRef GlobalVar
, LLVMBool IsThreadLocal
);
2480 LLVMBool
LLVMIsGlobalConstant(LLVMValueRef GlobalVar
);
2481 void LLVMSetGlobalConstant(LLVMValueRef GlobalVar
, LLVMBool IsConstant
);
2482 LLVMThreadLocalMode
LLVMGetThreadLocalMode(LLVMValueRef GlobalVar
);
2483 void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar
, LLVMThreadLocalMode Mode
);
2484 LLVMBool
LLVMIsExternallyInitialized(LLVMValueRef GlobalVar
);
2485 void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar
, LLVMBool IsExtInit
);
2492 * @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
2494 * This group contains function that operate on global alias values.
2496 * @see llvm::GlobalAlias
2502 * Add a GlobalAlias with the given value type, address space and aliasee.
2504 * @see llvm::GlobalAlias::create()
2506 LLVMValueRef
LLVMAddAlias2(LLVMModuleRef M
, LLVMTypeRef ValueTy
,
2507 unsigned AddrSpace
, LLVMValueRef Aliasee
,
2511 * Obtain a GlobalAlias value from a Module by its name.
2513 * The returned value corresponds to a llvm::GlobalAlias value.
2515 * @see llvm::Module::getNamedAlias()
2517 LLVMValueRef
LLVMGetNamedGlobalAlias(LLVMModuleRef M
,
2518 const char *Name
, size_t NameLen
);
2521 * Obtain an iterator to the first GlobalAlias in a Module.
2523 * @see llvm::Module::alias_begin()
2525 LLVMValueRef
LLVMGetFirstGlobalAlias(LLVMModuleRef M
);
2528 * Obtain an iterator to the last GlobalAlias in a Module.
2530 * @see llvm::Module::alias_end()
2532 LLVMValueRef
LLVMGetLastGlobalAlias(LLVMModuleRef M
);
2535 * Advance a GlobalAlias iterator to the next GlobalAlias.
2537 * Returns NULL if the iterator was already at the end and there are no more
2540 LLVMValueRef
LLVMGetNextGlobalAlias(LLVMValueRef GA
);
2543 * Decrement a GlobalAlias iterator to the previous GlobalAlias.
2545 * Returns NULL if the iterator was already at the beginning and there are
2546 * no previous global aliases.
2548 LLVMValueRef
LLVMGetPreviousGlobalAlias(LLVMValueRef GA
);
2551 * Retrieve the target value of an alias.
2553 LLVMValueRef
LLVMAliasGetAliasee(LLVMValueRef Alias
);
2556 * Set the target value of an alias.
2558 void LLVMAliasSetAliasee(LLVMValueRef Alias
, LLVMValueRef Aliasee
);
2565 * @defgroup LLVMCCoreValueFunction Function values
2567 * Functions in this group operate on LLVMValueRef instances that
2568 * correspond to llvm::Function instances.
2570 * @see llvm::Function
2576 * Remove a function from its containing module and deletes it.
2578 * @see llvm::Function::eraseFromParent()
2580 void LLVMDeleteFunction(LLVMValueRef Fn
);
2583 * Check whether the given function has a personality function.
2585 * @see llvm::Function::hasPersonalityFn()
2587 LLVMBool
LLVMHasPersonalityFn(LLVMValueRef Fn
);
2590 * Obtain the personality function attached to the function.
2592 * @see llvm::Function::getPersonalityFn()
2594 LLVMValueRef
LLVMGetPersonalityFn(LLVMValueRef Fn
);
2597 * Set the personality function attached to the function.
2599 * @see llvm::Function::setPersonalityFn()
2601 void LLVMSetPersonalityFn(LLVMValueRef Fn
, LLVMValueRef PersonalityFn
);
2604 * Obtain the intrinsic ID number which matches the given function name.
2606 * @see llvm::Function::lookupIntrinsicID()
2608 unsigned LLVMLookupIntrinsicID(const char *Name
, size_t NameLen
);
2611 * Obtain the ID number from a function instance.
2613 * @see llvm::Function::getIntrinsicID()
2615 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn
);
2618 * Create or insert the declaration of an intrinsic. For overloaded intrinsics,
2619 * parameter types must be provided to uniquely identify an overload.
2621 * @see llvm::Intrinsic::getDeclaration()
2623 LLVMValueRef
LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod
,
2625 LLVMTypeRef
*ParamTypes
,
2629 * Retrieves the type of an intrinsic. For overloaded intrinsics, parameter
2630 * types must be provided to uniquely identify an overload.
2632 * @see llvm::Intrinsic::getType()
2634 LLVMTypeRef
LLVMIntrinsicGetType(LLVMContextRef Ctx
, unsigned ID
,
2635 LLVMTypeRef
*ParamTypes
, size_t ParamCount
);
2638 * Retrieves the name of an intrinsic.
2640 * @see llvm::Intrinsic::getName()
2642 const char *LLVMIntrinsicGetName(unsigned ID
, size_t *NameLength
);
2644 /** Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead. */
2645 const char *LLVMIntrinsicCopyOverloadedName(unsigned ID
,
2646 LLVMTypeRef
*ParamTypes
,
2648 size_t *NameLength
);
2651 * Copies the name of an overloaded intrinsic identified by a given list of
2654 * Unlike LLVMIntrinsicGetName, the caller is responsible for freeing the
2657 * This version also supports unnamed types.
2659 * @see llvm::Intrinsic::getName()
2661 const char *LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod
, unsigned ID
,
2662 LLVMTypeRef
*ParamTypes
,
2664 size_t *NameLength
);
2667 * Obtain if the intrinsic identified by the given ID is overloaded.
2669 * @see llvm::Intrinsic::isOverloaded()
2671 LLVMBool
LLVMIntrinsicIsOverloaded(unsigned ID
);
2674 * Obtain the calling function of a function.
2676 * The returned value corresponds to the LLVMCallConv enumeration.
2678 * @see llvm::Function::getCallingConv()
2680 unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn
);
2683 * Set the calling convention of a function.
2685 * @see llvm::Function::setCallingConv()
2687 * @param Fn Function to operate on
2688 * @param CC LLVMCallConv to set calling convention to
2690 void LLVMSetFunctionCallConv(LLVMValueRef Fn
, unsigned CC
);
2693 * Obtain the name of the garbage collector to use during code
2696 * @see llvm::Function::getGC()
2698 const char *LLVMGetGC(LLVMValueRef Fn
);
2701 * Define the garbage collector to use during code generation.
2703 * @see llvm::Function::setGC()
2705 void LLVMSetGC(LLVMValueRef Fn
, const char *Name
);
2708 * Add an attribute to a function.
2710 * @see llvm::Function::addAttribute()
2712 void LLVMAddAttributeAtIndex(LLVMValueRef F
, LLVMAttributeIndex Idx
,
2713 LLVMAttributeRef A
);
2714 unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F
, LLVMAttributeIndex Idx
);
2715 void LLVMGetAttributesAtIndex(LLVMValueRef F
, LLVMAttributeIndex Idx
,
2716 LLVMAttributeRef
*Attrs
);
2717 LLVMAttributeRef
LLVMGetEnumAttributeAtIndex(LLVMValueRef F
,
2718 LLVMAttributeIndex Idx
,
2720 LLVMAttributeRef
LLVMGetStringAttributeAtIndex(LLVMValueRef F
,
2721 LLVMAttributeIndex Idx
,
2722 const char *K
, unsigned KLen
);
2723 void LLVMRemoveEnumAttributeAtIndex(LLVMValueRef F
, LLVMAttributeIndex Idx
,
2725 void LLVMRemoveStringAttributeAtIndex(LLVMValueRef F
, LLVMAttributeIndex Idx
,
2726 const char *K
, unsigned KLen
);
2729 * Add a target-dependent attribute to a function
2730 * @see llvm::AttrBuilder::addAttribute()
2732 void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn
, const char *A
,
2736 * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
2738 * Functions in this group relate to arguments/parameters on functions.
2740 * Functions in this group expect LLVMValueRef instances that correspond
2741 * to llvm::Function instances.
2747 * Obtain the number of parameters in a function.
2749 * @see llvm::Function::arg_size()
2751 unsigned LLVMCountParams(LLVMValueRef Fn
);
2754 * Obtain the parameters in a function.
2756 * The takes a pointer to a pre-allocated array of LLVMValueRef that is
2757 * at least LLVMCountParams() long. This array will be filled with
2758 * LLVMValueRef instances which correspond to the parameters the
2759 * function receives. Each LLVMValueRef corresponds to a llvm::Argument
2762 * @see llvm::Function::arg_begin()
2764 void LLVMGetParams(LLVMValueRef Fn
, LLVMValueRef
*Params
);
2767 * Obtain the parameter at the specified index.
2769 * Parameters are indexed from 0.
2771 * @see llvm::Function::arg_begin()
2773 LLVMValueRef
LLVMGetParam(LLVMValueRef Fn
, unsigned Index
);
2776 * Obtain the function to which this argument belongs.
2778 * Unlike other functions in this group, this one takes an LLVMValueRef
2779 * that corresponds to a llvm::Attribute.
2781 * The returned LLVMValueRef is the llvm::Function to which this
2784 LLVMValueRef
LLVMGetParamParent(LLVMValueRef Inst
);
2787 * Obtain the first parameter to a function.
2789 * @see llvm::Function::arg_begin()
2791 LLVMValueRef
LLVMGetFirstParam(LLVMValueRef Fn
);
2794 * Obtain the last parameter to a function.
2796 * @see llvm::Function::arg_end()
2798 LLVMValueRef
LLVMGetLastParam(LLVMValueRef Fn
);
2801 * Obtain the next parameter to a function.
2803 * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
2804 * actually a wrapped iterator) and obtains the next parameter from the
2805 * underlying iterator.
2807 LLVMValueRef
LLVMGetNextParam(LLVMValueRef Arg
);
2810 * Obtain the previous parameter to a function.
2812 * This is the opposite of LLVMGetNextParam().
2814 LLVMValueRef
LLVMGetPreviousParam(LLVMValueRef Arg
);
2817 * Set the alignment for a function parameter.
2819 * @see llvm::Argument::addAttr()
2820 * @see llvm::AttrBuilder::addAlignmentAttr()
2822 void LLVMSetParamAlignment(LLVMValueRef Arg
, unsigned Align
);
2829 * @defgroup LLVMCCoreValueGlobalIFunc IFuncs
2831 * Functions in this group relate to indirect functions.
2833 * Functions in this group expect LLVMValueRef instances that correspond
2834 * to llvm::GlobalIFunc instances.
2840 * Add a global indirect function to a module under a specified name.
2842 * @see llvm::GlobalIFunc::create()
2844 LLVMValueRef
LLVMAddGlobalIFunc(LLVMModuleRef M
,
2845 const char *Name
, size_t NameLen
,
2846 LLVMTypeRef Ty
, unsigned AddrSpace
,
2847 LLVMValueRef Resolver
);
2850 * Obtain a GlobalIFunc value from a Module by its name.
2852 * The returned value corresponds to a llvm::GlobalIFunc value.
2854 * @see llvm::Module::getNamedIFunc()
2856 LLVMValueRef
LLVMGetNamedGlobalIFunc(LLVMModuleRef M
,
2857 const char *Name
, size_t NameLen
);
2860 * Obtain an iterator to the first GlobalIFunc in a Module.
2862 * @see llvm::Module::ifunc_begin()
2864 LLVMValueRef
LLVMGetFirstGlobalIFunc(LLVMModuleRef M
);
2867 * Obtain an iterator to the last GlobalIFunc in a Module.
2869 * @see llvm::Module::ifunc_end()
2871 LLVMValueRef
LLVMGetLastGlobalIFunc(LLVMModuleRef M
);
2874 * Advance a GlobalIFunc iterator to the next GlobalIFunc.
2876 * Returns NULL if the iterator was already at the end and there are no more
2879 LLVMValueRef
LLVMGetNextGlobalIFunc(LLVMValueRef IFunc
);
2882 * Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
2884 * Returns NULL if the iterator was already at the beginning and there are
2885 * no previous global aliases.
2887 LLVMValueRef
LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc
);
2890 * Retrieves the resolver function associated with this indirect function, or
2891 * NULL if it doesn't not exist.
2893 * @see llvm::GlobalIFunc::getResolver()
2895 LLVMValueRef
LLVMGetGlobalIFuncResolver(LLVMValueRef IFunc
);
2898 * Sets the resolver function associated with this indirect function.
2900 * @see llvm::GlobalIFunc::setResolver()
2902 void LLVMSetGlobalIFuncResolver(LLVMValueRef IFunc
, LLVMValueRef Resolver
);
2905 * Remove a global indirect function from its parent module and delete it.
2907 * @see llvm::GlobalIFunc::eraseFromParent()
2909 void LLVMEraseGlobalIFunc(LLVMValueRef IFunc
);
2912 * Remove a global indirect function from its parent module.
2914 * This unlinks the global indirect function from its containing module but
2917 * @see llvm::GlobalIFunc::removeFromParent()
2919 void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc
);
2938 * @defgroup LLVMCCoreValueMetadata Metadata
2944 * Create an MDString value from a given string value.
2946 * The MDString value does not take ownership of the given string, it remains
2947 * the responsibility of the caller to free it.
2949 * @see llvm::MDString::get()
2951 LLVMMetadataRef
LLVMMDStringInContext2(LLVMContextRef C
, const char *Str
,
2955 * Create an MDNode value with the given array of operands.
2957 * @see llvm::MDNode::get()
2959 LLVMMetadataRef
LLVMMDNodeInContext2(LLVMContextRef C
, LLVMMetadataRef
*MDs
,
2963 * Obtain a Metadata as a Value.
2965 LLVMValueRef
LLVMMetadataAsValue(LLVMContextRef C
, LLVMMetadataRef MD
);
2968 * Obtain a Value as a Metadata.
2970 LLVMMetadataRef
LLVMValueAsMetadata(LLVMValueRef Val
);
2973 * Obtain the underlying string from a MDString value.
2975 * @param V Instance to obtain string from.
2976 * @param Length Memory address which will hold length of returned string.
2977 * @return String data in MDString.
2979 const char *LLVMGetMDString(LLVMValueRef V
, unsigned *Length
);
2982 * Obtain the number of operands from an MDNode value.
2984 * @param V MDNode to get number of operands from.
2985 * @return Number of operands of the MDNode.
2987 unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V
);
2990 * Obtain the given MDNode's operands.
2992 * The passed LLVMValueRef pointer should point to enough memory to hold all of
2993 * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
2994 * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
2995 * MDNode's operands.
2997 * @param V MDNode to get the operands from.
2998 * @param Dest Destination array for operands.
3000 void LLVMGetMDNodeOperands(LLVMValueRef V
, LLVMValueRef
*Dest
);
3003 * Replace an operand at a specific index in a llvm::MDNode value.
3005 * @see llvm::MDNode::replaceOperandWith()
3007 void LLVMReplaceMDNodeOperandWith(LLVMValueRef V
, unsigned Index
,
3008 LLVMMetadataRef Replacement
);
3010 /** Deprecated: Use LLVMMDStringInContext2 instead. */
3011 LLVMValueRef
LLVMMDStringInContext(LLVMContextRef C
, const char *Str
,
3013 /** Deprecated: Use LLVMMDStringInContext2 instead. */
3014 LLVMValueRef
LLVMMDString(const char *Str
, unsigned SLen
);
3015 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
3016 LLVMValueRef
LLVMMDNodeInContext(LLVMContextRef C
, LLVMValueRef
*Vals
,
3018 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
3019 LLVMValueRef
LLVMMDNode(LLVMValueRef
*Vals
, unsigned Count
);
3026 * @defgroup LLVMCCoreValueBasicBlock Basic Block
3028 * A basic block represents a single entry single exit section of code.
3029 * Basic blocks contain a list of instructions which form the body of
3032 * Basic blocks belong to functions. They have the type of label.
3034 * Basic blocks are themselves values. However, the C API models them as
3035 * LLVMBasicBlockRef.
3037 * @see llvm::BasicBlock
3043 * Convert a basic block instance to a value type.
3045 LLVMValueRef
LLVMBasicBlockAsValue(LLVMBasicBlockRef BB
);
3048 * Determine whether an LLVMValueRef is itself a basic block.
3050 LLVMBool
LLVMValueIsBasicBlock(LLVMValueRef Val
);
3053 * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
3055 LLVMBasicBlockRef
LLVMValueAsBasicBlock(LLVMValueRef Val
);
3058 * Obtain the string name of a basic block.
3060 const char *LLVMGetBasicBlockName(LLVMBasicBlockRef BB
);
3063 * Obtain the function to which a basic block belongs.
3065 * @see llvm::BasicBlock::getParent()
3067 LLVMValueRef
LLVMGetBasicBlockParent(LLVMBasicBlockRef BB
);
3070 * Obtain the terminator instruction for a basic block.
3072 * If the basic block does not have a terminator (it is not well-formed
3073 * if it doesn't), then NULL is returned.
3075 * The returned LLVMValueRef corresponds to an llvm::Instruction.
3077 * @see llvm::BasicBlock::getTerminator()
3079 LLVMValueRef
LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB
);
3082 * Obtain the number of basic blocks in a function.
3084 * @param Fn Function value to operate on.
3086 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn
);
3089 * Obtain all of the basic blocks in a function.
3091 * This operates on a function value. The BasicBlocks parameter is a
3092 * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
3093 * LLVMCountBasicBlocks() in length. This array is populated with
3094 * LLVMBasicBlockRef instances.
3096 void LLVMGetBasicBlocks(LLVMValueRef Fn
, LLVMBasicBlockRef
*BasicBlocks
);
3099 * Obtain the first basic block in a function.
3101 * The returned basic block can be used as an iterator. You will likely
3102 * eventually call into LLVMGetNextBasicBlock() with it.
3104 * @see llvm::Function::begin()
3106 LLVMBasicBlockRef
LLVMGetFirstBasicBlock(LLVMValueRef Fn
);
3109 * Obtain the last basic block in a function.
3111 * @see llvm::Function::end()
3113 LLVMBasicBlockRef
LLVMGetLastBasicBlock(LLVMValueRef Fn
);
3116 * Advance a basic block iterator.
3118 LLVMBasicBlockRef
LLVMGetNextBasicBlock(LLVMBasicBlockRef BB
);
3121 * Go backwards in a basic block iterator.
3123 LLVMBasicBlockRef
LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB
);
3126 * Obtain the basic block that corresponds to the entry point of a
3129 * @see llvm::Function::getEntryBlock()
3131 LLVMBasicBlockRef
LLVMGetEntryBasicBlock(LLVMValueRef Fn
);
3134 * Insert the given basic block after the insertion point of the given builder.
3136 * The insertion point must be valid.
3138 * @see llvm::Function::BasicBlockListType::insertAfter()
3140 void LLVMInsertExistingBasicBlockAfterInsertBlock(LLVMBuilderRef Builder
,
3141 LLVMBasicBlockRef BB
);
3144 * Append the given basic block to the basic block list of the given function.
3146 * @see llvm::Function::BasicBlockListType::push_back()
3148 void LLVMAppendExistingBasicBlock(LLVMValueRef Fn
,
3149 LLVMBasicBlockRef BB
);
3152 * Create a new basic block without inserting it into a function.
3154 * @see llvm::BasicBlock::Create()
3156 LLVMBasicBlockRef
LLVMCreateBasicBlockInContext(LLVMContextRef C
,
3160 * Append a basic block to the end of a function.
3162 * @see llvm::BasicBlock::Create()
3164 LLVMBasicBlockRef
LLVMAppendBasicBlockInContext(LLVMContextRef C
,
3169 * Append a basic block to the end of a function using the global
3172 * @see llvm::BasicBlock::Create()
3174 LLVMBasicBlockRef
LLVMAppendBasicBlock(LLVMValueRef Fn
, const char *Name
);
3177 * Insert a basic block in a function before another basic block.
3179 * The function to add to is determined by the function of the
3180 * passed basic block.
3182 * @see llvm::BasicBlock::Create()
3184 LLVMBasicBlockRef
LLVMInsertBasicBlockInContext(LLVMContextRef C
,
3185 LLVMBasicBlockRef BB
,
3189 * Insert a basic block in a function using the global context.
3191 * @see llvm::BasicBlock::Create()
3193 LLVMBasicBlockRef
LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB
,
3197 * Remove a basic block from a function and delete it.
3199 * This deletes the basic block from its containing function and deletes
3200 * the basic block itself.
3202 * @see llvm::BasicBlock::eraseFromParent()
3204 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB
);
3207 * Remove a basic block from a function.
3209 * This deletes the basic block from its containing function but keep
3210 * the basic block alive.
3212 * @see llvm::BasicBlock::removeFromParent()
3214 void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB
);
3217 * Move a basic block to before another one.
3219 * @see llvm::BasicBlock::moveBefore()
3221 void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB
, LLVMBasicBlockRef MovePos
);
3224 * Move a basic block to after another one.
3226 * @see llvm::BasicBlock::moveAfter()
3228 void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB
, LLVMBasicBlockRef MovePos
);
3231 * Obtain the first instruction in a basic block.
3233 * The returned LLVMValueRef corresponds to a llvm::Instruction
3236 LLVMValueRef
LLVMGetFirstInstruction(LLVMBasicBlockRef BB
);
3239 * Obtain the last instruction in a basic block.
3241 * The returned LLVMValueRef corresponds to an LLVM:Instruction.
3243 LLVMValueRef
LLVMGetLastInstruction(LLVMBasicBlockRef BB
);
3250 * @defgroup LLVMCCoreValueInstruction Instructions
3252 * Functions in this group relate to the inspection and manipulation of
3253 * individual instructions.
3255 * In the C++ API, an instruction is modeled by llvm::Instruction. This
3256 * class has a large number of descendents. llvm::Instruction is a
3257 * llvm::Value and in the C API, instructions are modeled by
3260 * This group also contains sub-groups which operate on specific
3261 * llvm::Instruction types, e.g. llvm::CallInst.
3267 * Determine whether an instruction has any metadata attached.
3269 int LLVMHasMetadata(LLVMValueRef Val
);
3272 * Return metadata associated with an instruction value.
3274 LLVMValueRef
LLVMGetMetadata(LLVMValueRef Val
, unsigned KindID
);
3277 * Set metadata associated with an instruction value.
3279 void LLVMSetMetadata(LLVMValueRef Val
, unsigned KindID
, LLVMValueRef Node
);
3282 * Returns the metadata associated with an instruction value, but filters out
3283 * all the debug locations.
3285 * @see llvm::Instruction::getAllMetadataOtherThanDebugLoc()
3287 LLVMValueMetadataEntry
*
3288 LLVMInstructionGetAllMetadataOtherThanDebugLoc(LLVMValueRef Instr
,
3289 size_t *NumEntries
);
3292 * Obtain the basic block to which an instruction belongs.
3294 * @see llvm::Instruction::getParent()
3296 LLVMBasicBlockRef
LLVMGetInstructionParent(LLVMValueRef Inst
);
3299 * Obtain the instruction that occurs after the one specified.
3301 * The next instruction will be from the same basic block.
3303 * If this is the last instruction in a basic block, NULL will be
3306 LLVMValueRef
LLVMGetNextInstruction(LLVMValueRef Inst
);
3309 * Obtain the instruction that occurred before this one.
3311 * If the instruction is the first instruction in a basic block, NULL
3314 LLVMValueRef
LLVMGetPreviousInstruction(LLVMValueRef Inst
);
3317 * Remove an instruction.
3319 * The instruction specified is removed from its containing building
3320 * block but is kept alive.
3322 * @see llvm::Instruction::removeFromParent()
3324 void LLVMInstructionRemoveFromParent(LLVMValueRef Inst
);
3327 * Remove and delete an instruction.
3329 * The instruction specified is removed from its containing building
3330 * block and then deleted.
3332 * @see llvm::Instruction::eraseFromParent()
3334 void LLVMInstructionEraseFromParent(LLVMValueRef Inst
);
3337 * Delete an instruction.
3339 * The instruction specified is deleted. It must have previously been
3340 * removed from its containing building block.
3342 * @see llvm::Value::deleteValue()
3344 void LLVMDeleteInstruction(LLVMValueRef Inst
);
3347 * Obtain the code opcode for an individual instruction.
3349 * @see llvm::Instruction::getOpCode()
3351 LLVMOpcode
LLVMGetInstructionOpcode(LLVMValueRef Inst
);
3354 * Obtain the predicate of an instruction.
3356 * This is only valid for instructions that correspond to llvm::ICmpInst
3357 * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
3359 * @see llvm::ICmpInst::getPredicate()
3361 LLVMIntPredicate
LLVMGetICmpPredicate(LLVMValueRef Inst
);
3364 * Obtain the float predicate of an instruction.
3366 * This is only valid for instructions that correspond to llvm::FCmpInst
3367 * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
3369 * @see llvm::FCmpInst::getPredicate()
3371 LLVMRealPredicate
LLVMGetFCmpPredicate(LLVMValueRef Inst
);
3374 * Create a copy of 'this' instruction that is identical in all ways
3375 * except the following:
3376 * * The instruction has no parent
3377 * * The instruction has no name
3379 * @see llvm::Instruction::clone()
3381 LLVMValueRef
LLVMInstructionClone(LLVMValueRef Inst
);
3384 * Determine whether an instruction is a terminator. This routine is named to
3385 * be compatible with historical functions that did this by querying the
3386 * underlying C++ type.
3388 * @see llvm::Instruction::isTerminator()
3390 LLVMValueRef
LLVMIsATerminatorInst(LLVMValueRef Inst
);
3393 * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
3395 * Functions in this group apply to instructions that refer to call
3396 * sites and invocations. These correspond to C++ types in the
3397 * llvm::CallInst class tree.
3403 * Obtain the argument count for a call instruction.
3405 * This expects an LLVMValueRef that corresponds to a llvm::CallInst,
3406 * llvm::InvokeInst, or llvm:FuncletPadInst.
3408 * @see llvm::CallInst::getNumArgOperands()
3409 * @see llvm::InvokeInst::getNumArgOperands()
3410 * @see llvm::FuncletPadInst::getNumArgOperands()
3412 unsigned LLVMGetNumArgOperands(LLVMValueRef Instr
);
3415 * Set the calling convention for a call instruction.
3417 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3420 * @see llvm::CallInst::setCallingConv()
3421 * @see llvm::InvokeInst::setCallingConv()
3423 void LLVMSetInstructionCallConv(LLVMValueRef Instr
, unsigned CC
);
3426 * Obtain the calling convention for a call instruction.
3428 * This is the opposite of LLVMSetInstructionCallConv(). Reads its
3431 * @see LLVMSetInstructionCallConv()
3433 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr
);
3435 void LLVMSetInstrParamAlignment(LLVMValueRef Instr
, LLVMAttributeIndex Idx
,
3438 void LLVMAddCallSiteAttribute(LLVMValueRef C
, LLVMAttributeIndex Idx
,
3439 LLVMAttributeRef A
);
3440 unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C
, LLVMAttributeIndex Idx
);
3441 void LLVMGetCallSiteAttributes(LLVMValueRef C
, LLVMAttributeIndex Idx
,
3442 LLVMAttributeRef
*Attrs
);
3443 LLVMAttributeRef
LLVMGetCallSiteEnumAttribute(LLVMValueRef C
,
3444 LLVMAttributeIndex Idx
,
3446 LLVMAttributeRef
LLVMGetCallSiteStringAttribute(LLVMValueRef C
,
3447 LLVMAttributeIndex Idx
,
3448 const char *K
, unsigned KLen
);
3449 void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C
, LLVMAttributeIndex Idx
,
3451 void LLVMRemoveCallSiteStringAttribute(LLVMValueRef C
, LLVMAttributeIndex Idx
,
3452 const char *K
, unsigned KLen
);
3455 * Obtain the function type called by this instruction.
3457 * @see llvm::CallBase::getFunctionType()
3459 LLVMTypeRef
LLVMGetCalledFunctionType(LLVMValueRef C
);
3462 * Obtain the pointer to the function invoked by this instruction.
3464 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3467 * @see llvm::CallInst::getCalledOperand()
3468 * @see llvm::InvokeInst::getCalledOperand()
3470 LLVMValueRef
LLVMGetCalledValue(LLVMValueRef Instr
);
3473 * Obtain whether a call instruction is a tail call.
3475 * This only works on llvm::CallInst instructions.
3477 * @see llvm::CallInst::isTailCall()
3479 LLVMBool
LLVMIsTailCall(LLVMValueRef CallInst
);
3482 * Set whether a call instruction is a tail call.
3484 * This only works on llvm::CallInst instructions.
3486 * @see llvm::CallInst::setTailCall()
3488 void LLVMSetTailCall(LLVMValueRef CallInst
, LLVMBool IsTailCall
);
3491 * Obtain a tail call kind of the call instruction.
3493 * @see llvm::CallInst::setTailCallKind()
3495 LLVMTailCallKind
LLVMGetTailCallKind(LLVMValueRef CallInst
);
3498 * Set the call kind of the call instruction.
3500 * @see llvm::CallInst::getTailCallKind()
3502 void LLVMSetTailCallKind(LLVMValueRef CallInst
, LLVMTailCallKind kind
);
3505 * Return the normal destination basic block.
3507 * This only works on llvm::InvokeInst instructions.
3509 * @see llvm::InvokeInst::getNormalDest()
3511 LLVMBasicBlockRef
LLVMGetNormalDest(LLVMValueRef InvokeInst
);
3514 * Return the unwind destination basic block.
3516 * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3517 * llvm::CatchSwitchInst instructions.
3519 * @see llvm::InvokeInst::getUnwindDest()
3520 * @see llvm::CleanupReturnInst::getUnwindDest()
3521 * @see llvm::CatchSwitchInst::getUnwindDest()
3523 LLVMBasicBlockRef
LLVMGetUnwindDest(LLVMValueRef InvokeInst
);
3526 * Set the normal destination basic block.
3528 * This only works on llvm::InvokeInst instructions.
3530 * @see llvm::InvokeInst::setNormalDest()
3532 void LLVMSetNormalDest(LLVMValueRef InvokeInst
, LLVMBasicBlockRef B
);
3535 * Set the unwind destination basic block.
3537 * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3538 * llvm::CatchSwitchInst instructions.
3540 * @see llvm::InvokeInst::setUnwindDest()
3541 * @see llvm::CleanupReturnInst::setUnwindDest()
3542 * @see llvm::CatchSwitchInst::setUnwindDest()
3544 void LLVMSetUnwindDest(LLVMValueRef InvokeInst
, LLVMBasicBlockRef B
);
3551 * @defgroup LLVMCCoreValueInstructionTerminator Terminators
3553 * Functions in this group only apply to instructions for which
3554 * LLVMIsATerminatorInst returns true.
3560 * Return the number of successors that this terminator has.
3562 * @see llvm::Instruction::getNumSuccessors
3564 unsigned LLVMGetNumSuccessors(LLVMValueRef Term
);
3567 * Return the specified successor.
3569 * @see llvm::Instruction::getSuccessor
3571 LLVMBasicBlockRef
LLVMGetSuccessor(LLVMValueRef Term
, unsigned i
);
3574 * Update the specified successor to point at the provided block.
3576 * @see llvm::Instruction::setSuccessor
3578 void LLVMSetSuccessor(LLVMValueRef Term
, unsigned i
, LLVMBasicBlockRef block
);
3581 * Return if a branch is conditional.
3583 * This only works on llvm::BranchInst instructions.
3585 * @see llvm::BranchInst::isConditional
3587 LLVMBool
LLVMIsConditional(LLVMValueRef Branch
);
3590 * Return the condition of a branch instruction.
3592 * This only works on llvm::BranchInst instructions.
3594 * @see llvm::BranchInst::getCondition
3596 LLVMValueRef
LLVMGetCondition(LLVMValueRef Branch
);
3599 * Set the condition of a branch instruction.
3601 * This only works on llvm::BranchInst instructions.
3603 * @see llvm::BranchInst::setCondition
3605 void LLVMSetCondition(LLVMValueRef Branch
, LLVMValueRef Cond
);
3608 * Obtain the default destination basic block of a switch instruction.
3610 * This only works on llvm::SwitchInst instructions.
3612 * @see llvm::SwitchInst::getDefaultDest()
3614 LLVMBasicBlockRef
LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr
);
3621 * @defgroup LLVMCCoreValueInstructionAlloca Allocas
3623 * Functions in this group only apply to instructions that map to
3624 * llvm::AllocaInst instances.
3630 * Obtain the type that is being allocated by the alloca instruction.
3632 LLVMTypeRef
LLVMGetAllocatedType(LLVMValueRef Alloca
);
3639 * @defgroup LLVMCCoreValueInstructionGetElementPointer GEPs
3641 * Functions in this group only apply to instructions that map to
3642 * llvm::GetElementPtrInst instances.
3648 * Check whether the given GEP operator is inbounds.
3650 LLVMBool
LLVMIsInBounds(LLVMValueRef GEP
);
3653 * Set the given GEP instruction to be inbounds or not.
3655 void LLVMSetIsInBounds(LLVMValueRef GEP
, LLVMBool InBounds
);
3658 * Get the source element type of the given GEP operator.
3660 LLVMTypeRef
LLVMGetGEPSourceElementType(LLVMValueRef GEP
);
3667 * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
3669 * Functions in this group only apply to instructions that map to
3670 * llvm::PHINode instances.
3676 * Add an incoming value to the end of a PHI list.
3678 void LLVMAddIncoming(LLVMValueRef PhiNode
, LLVMValueRef
*IncomingValues
,
3679 LLVMBasicBlockRef
*IncomingBlocks
, unsigned Count
);
3682 * Obtain the number of incoming basic blocks to a PHI node.
3684 unsigned LLVMCountIncoming(LLVMValueRef PhiNode
);
3687 * Obtain an incoming value to a PHI node as an LLVMValueRef.
3689 LLVMValueRef
LLVMGetIncomingValue(LLVMValueRef PhiNode
, unsigned Index
);
3692 * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
3694 LLVMBasicBlockRef
LLVMGetIncomingBlock(LLVMValueRef PhiNode
, unsigned Index
);
3701 * @defgroup LLVMCCoreValueInstructionExtractValue ExtractValue
3702 * @defgroup LLVMCCoreValueInstructionInsertValue InsertValue
3704 * Functions in this group only apply to instructions that map to
3705 * llvm::ExtractValue and llvm::InsertValue instances.
3711 * Obtain the number of indices.
3712 * NB: This also works on GEP operators.
3714 unsigned LLVMGetNumIndices(LLVMValueRef Inst
);
3717 * Obtain the indices as an array.
3719 const unsigned *LLVMGetIndices(LLVMValueRef Inst
);
3734 * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
3736 * An instruction builder represents a point within a basic block and is
3737 * the exclusive means of building instructions using the C interface.
3742 LLVMBuilderRef
LLVMCreateBuilderInContext(LLVMContextRef C
);
3743 LLVMBuilderRef
LLVMCreateBuilder(void);
3744 void LLVMPositionBuilder(LLVMBuilderRef Builder
, LLVMBasicBlockRef Block
,
3745 LLVMValueRef Instr
);
3746 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder
, LLVMValueRef Instr
);
3747 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder
, LLVMBasicBlockRef Block
);
3748 LLVMBasicBlockRef
LLVMGetInsertBlock(LLVMBuilderRef Builder
);
3749 void LLVMClearInsertionPosition(LLVMBuilderRef Builder
);
3750 void LLVMInsertIntoBuilder(LLVMBuilderRef Builder
, LLVMValueRef Instr
);
3751 void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder
, LLVMValueRef Instr
,
3753 void LLVMDisposeBuilder(LLVMBuilderRef Builder
);
3758 * Get location information used by debugging information.
3760 * @see llvm::IRBuilder::getCurrentDebugLocation()
3762 LLVMMetadataRef
LLVMGetCurrentDebugLocation2(LLVMBuilderRef Builder
);
3765 * Set location information used by debugging information.
3767 * To clear the location metadata of the given instruction, pass NULL to \p Loc.
3769 * @see llvm::IRBuilder::SetCurrentDebugLocation()
3771 void LLVMSetCurrentDebugLocation2(LLVMBuilderRef Builder
, LLVMMetadataRef Loc
);
3774 * Attempts to set the debug location for the given instruction using the
3775 * current debug location for the given builder. If the builder has no current
3776 * debug location, this function is a no-op.
3778 * @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general
3779 * LLVMAddMetadataToInst.
3781 * @see llvm::IRBuilder::SetInstDebugLocation()
3783 void LLVMSetInstDebugLocation(LLVMBuilderRef Builder
, LLVMValueRef Inst
);
3786 * Adds the metadata registered with the given builder to the given instruction.
3788 * @see llvm::IRBuilder::AddMetadataToInst()
3790 void LLVMAddMetadataToInst(LLVMBuilderRef Builder
, LLVMValueRef Inst
);
3793 * Get the dafult floating-point math metadata for a given builder.
3795 * @see llvm::IRBuilder::getDefaultFPMathTag()
3797 LLVMMetadataRef
LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder
);
3800 * Set the default floating-point math metadata for the given builder.
3802 * To clear the metadata, pass NULL to \p FPMathTag.
3804 * @see llvm::IRBuilder::setDefaultFPMathTag()
3806 void LLVMBuilderSetDefaultFPMathTag(LLVMBuilderRef Builder
,
3807 LLVMMetadataRef FPMathTag
);
3810 * Deprecated: Passing the NULL location will crash.
3811 * Use LLVMGetCurrentDebugLocation2 instead.
3813 void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder
, LLVMValueRef L
);
3815 * Deprecated: Returning the NULL location will crash.
3816 * Use LLVMGetCurrentDebugLocation2 instead.
3818 LLVMValueRef
LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder
);
3821 LLVMValueRef
LLVMBuildRetVoid(LLVMBuilderRef
);
3822 LLVMValueRef
LLVMBuildRet(LLVMBuilderRef
, LLVMValueRef V
);
3823 LLVMValueRef
LLVMBuildAggregateRet(LLVMBuilderRef
, LLVMValueRef
*RetVals
,
3825 LLVMValueRef
LLVMBuildBr(LLVMBuilderRef
, LLVMBasicBlockRef Dest
);
3826 LLVMValueRef
LLVMBuildCondBr(LLVMBuilderRef
, LLVMValueRef If
,
3827 LLVMBasicBlockRef Then
, LLVMBasicBlockRef Else
);
3828 LLVMValueRef
LLVMBuildSwitch(LLVMBuilderRef
, LLVMValueRef V
,
3829 LLVMBasicBlockRef Else
, unsigned NumCases
);
3830 LLVMValueRef
LLVMBuildIndirectBr(LLVMBuilderRef B
, LLVMValueRef Addr
,
3832 LLVMValueRef
LLVMBuildInvoke2(LLVMBuilderRef
, LLVMTypeRef Ty
, LLVMValueRef Fn
,
3833 LLVMValueRef
*Args
, unsigned NumArgs
,
3834 LLVMBasicBlockRef Then
, LLVMBasicBlockRef Catch
,
3836 LLVMValueRef
LLVMBuildUnreachable(LLVMBuilderRef
);
3838 /* Exception Handling */
3839 LLVMValueRef
LLVMBuildResume(LLVMBuilderRef B
, LLVMValueRef Exn
);
3840 LLVMValueRef
LLVMBuildLandingPad(LLVMBuilderRef B
, LLVMTypeRef Ty
,
3841 LLVMValueRef PersFn
, unsigned NumClauses
,
3843 LLVMValueRef
LLVMBuildCleanupRet(LLVMBuilderRef B
, LLVMValueRef CatchPad
,
3844 LLVMBasicBlockRef BB
);
3845 LLVMValueRef
LLVMBuildCatchRet(LLVMBuilderRef B
, LLVMValueRef CatchPad
,
3846 LLVMBasicBlockRef BB
);
3847 LLVMValueRef
LLVMBuildCatchPad(LLVMBuilderRef B
, LLVMValueRef ParentPad
,
3848 LLVMValueRef
*Args
, unsigned NumArgs
,
3850 LLVMValueRef
LLVMBuildCleanupPad(LLVMBuilderRef B
, LLVMValueRef ParentPad
,
3851 LLVMValueRef
*Args
, unsigned NumArgs
,
3853 LLVMValueRef
LLVMBuildCatchSwitch(LLVMBuilderRef B
, LLVMValueRef ParentPad
,
3854 LLVMBasicBlockRef UnwindBB
,
3855 unsigned NumHandlers
, const char *Name
);
3857 /* Add a case to the switch instruction */
3858 void LLVMAddCase(LLVMValueRef Switch
, LLVMValueRef OnVal
,
3859 LLVMBasicBlockRef Dest
);
3861 /* Add a destination to the indirectbr instruction */
3862 void LLVMAddDestination(LLVMValueRef IndirectBr
, LLVMBasicBlockRef Dest
);
3864 /* Get the number of clauses on the landingpad instruction */
3865 unsigned LLVMGetNumClauses(LLVMValueRef LandingPad
);
3867 /* Get the value of the clause at index Idx on the landingpad instruction */
3868 LLVMValueRef
LLVMGetClause(LLVMValueRef LandingPad
, unsigned Idx
);
3870 /* Add a catch or filter clause to the landingpad instruction */
3871 void LLVMAddClause(LLVMValueRef LandingPad
, LLVMValueRef ClauseVal
);
3873 /* Get the 'cleanup' flag in the landingpad instruction */
3874 LLVMBool
LLVMIsCleanup(LLVMValueRef LandingPad
);
3876 /* Set the 'cleanup' flag in the landingpad instruction */
3877 void LLVMSetCleanup(LLVMValueRef LandingPad
, LLVMBool Val
);
3879 /* Add a destination to the catchswitch instruction */
3880 void LLVMAddHandler(LLVMValueRef CatchSwitch
, LLVMBasicBlockRef Dest
);
3882 /* Get the number of handlers on the catchswitch instruction */
3883 unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch
);
3886 * Obtain the basic blocks acting as handlers for a catchswitch instruction.
3888 * The Handlers parameter should point to a pre-allocated array of
3889 * LLVMBasicBlockRefs at least LLVMGetNumHandlers() large. On return, the
3890 * first LLVMGetNumHandlers() entries in the array will be populated
3891 * with LLVMBasicBlockRef instances.
3893 * @param CatchSwitch The catchswitch instruction to operate on.
3894 * @param Handlers Memory address of an array to be filled with basic blocks.
3896 void LLVMGetHandlers(LLVMValueRef CatchSwitch
, LLVMBasicBlockRef
*Handlers
);
3900 /* Get the number of funcletpad arguments. */
3901 LLVMValueRef
LLVMGetArgOperand(LLVMValueRef Funclet
, unsigned i
);
3903 /* Set a funcletpad argument at the given index. */
3904 void LLVMSetArgOperand(LLVMValueRef Funclet
, unsigned i
, LLVMValueRef value
);
3907 * Get the parent catchswitch instruction of a catchpad instruction.
3909 * This only works on llvm::CatchPadInst instructions.
3911 * @see llvm::CatchPadInst::getCatchSwitch()
3913 LLVMValueRef
LLVMGetParentCatchSwitch(LLVMValueRef CatchPad
);
3916 * Set the parent catchswitch instruction of a catchpad instruction.
3918 * This only works on llvm::CatchPadInst instructions.
3920 * @see llvm::CatchPadInst::setCatchSwitch()
3922 void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad
, LLVMValueRef CatchSwitch
);
3925 LLVMValueRef
LLVMBuildAdd(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3927 LLVMValueRef
LLVMBuildNSWAdd(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3929 LLVMValueRef
LLVMBuildNUWAdd(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3931 LLVMValueRef
LLVMBuildFAdd(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3933 LLVMValueRef
LLVMBuildSub(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3935 LLVMValueRef
LLVMBuildNSWSub(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3937 LLVMValueRef
LLVMBuildNUWSub(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3939 LLVMValueRef
LLVMBuildFSub(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3941 LLVMValueRef
LLVMBuildMul(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3943 LLVMValueRef
LLVMBuildNSWMul(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3945 LLVMValueRef
LLVMBuildNUWMul(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3947 LLVMValueRef
LLVMBuildFMul(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3949 LLVMValueRef
LLVMBuildUDiv(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3951 LLVMValueRef
LLVMBuildExactUDiv(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3953 LLVMValueRef
LLVMBuildSDiv(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3955 LLVMValueRef
LLVMBuildExactSDiv(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3957 LLVMValueRef
LLVMBuildFDiv(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3959 LLVMValueRef
LLVMBuildURem(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3961 LLVMValueRef
LLVMBuildSRem(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3963 LLVMValueRef
LLVMBuildFRem(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3965 LLVMValueRef
LLVMBuildShl(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3967 LLVMValueRef
LLVMBuildLShr(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3969 LLVMValueRef
LLVMBuildAShr(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3971 LLVMValueRef
LLVMBuildAnd(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3973 LLVMValueRef
LLVMBuildOr(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3975 LLVMValueRef
LLVMBuildXor(LLVMBuilderRef
, LLVMValueRef LHS
, LLVMValueRef RHS
,
3977 LLVMValueRef
LLVMBuildBinOp(LLVMBuilderRef B
, LLVMOpcode Op
,
3978 LLVMValueRef LHS
, LLVMValueRef RHS
,
3980 LLVMValueRef
LLVMBuildNeg(LLVMBuilderRef
, LLVMValueRef V
, const char *Name
);
3981 LLVMValueRef
LLVMBuildNSWNeg(LLVMBuilderRef B
, LLVMValueRef V
,
3983 LLVMValueRef
LLVMBuildNUWNeg(LLVMBuilderRef B
, LLVMValueRef V
,
3985 LLVMValueRef
LLVMBuildFNeg(LLVMBuilderRef
, LLVMValueRef V
, const char *Name
);
3986 LLVMValueRef
LLVMBuildNot(LLVMBuilderRef
, LLVMValueRef V
, const char *Name
);
3988 LLVMBool
LLVMGetNUW(LLVMValueRef ArithInst
);
3989 void LLVMSetNUW(LLVMValueRef ArithInst
, LLVMBool HasNUW
);
3990 LLVMBool
LLVMGetNSW(LLVMValueRef ArithInst
);
3991 void LLVMSetNSW(LLVMValueRef ArithInst
, LLVMBool HasNSW
);
3992 LLVMBool
LLVMGetExact(LLVMValueRef DivOrShrInst
);
3993 void LLVMSetExact(LLVMValueRef DivOrShrInst
, LLVMBool IsExact
);
3996 LLVMValueRef
LLVMBuildMalloc(LLVMBuilderRef
, LLVMTypeRef Ty
, const char *Name
);
3997 LLVMValueRef
LLVMBuildArrayMalloc(LLVMBuilderRef
, LLVMTypeRef Ty
,
3998 LLVMValueRef Val
, const char *Name
);
4001 * Creates and inserts a memset to the specified pointer and the
4004 * @see llvm::IRRBuilder::CreateMemSet()
4006 LLVMValueRef
LLVMBuildMemSet(LLVMBuilderRef B
, LLVMValueRef Ptr
,
4007 LLVMValueRef Val
, LLVMValueRef Len
,
4010 * Creates and inserts a memcpy between the specified pointers.
4012 * @see llvm::IRRBuilder::CreateMemCpy()
4014 LLVMValueRef
LLVMBuildMemCpy(LLVMBuilderRef B
,
4015 LLVMValueRef Dst
, unsigned DstAlign
,
4016 LLVMValueRef Src
, unsigned SrcAlign
,
4019 * Creates and inserts a memmove between the specified pointers.
4021 * @see llvm::IRRBuilder::CreateMemMove()
4023 LLVMValueRef
LLVMBuildMemMove(LLVMBuilderRef B
,
4024 LLVMValueRef Dst
, unsigned DstAlign
,
4025 LLVMValueRef Src
, unsigned SrcAlign
,
4028 LLVMValueRef
LLVMBuildAlloca(LLVMBuilderRef
, LLVMTypeRef Ty
, const char *Name
);
4029 LLVMValueRef
LLVMBuildArrayAlloca(LLVMBuilderRef
, LLVMTypeRef Ty
,
4030 LLVMValueRef Val
, const char *Name
);
4031 LLVMValueRef
LLVMBuildFree(LLVMBuilderRef
, LLVMValueRef PointerVal
);
4032 LLVMValueRef
LLVMBuildLoad2(LLVMBuilderRef
, LLVMTypeRef Ty
,
4033 LLVMValueRef PointerVal
, const char *Name
);
4034 LLVMValueRef
LLVMBuildStore(LLVMBuilderRef
, LLVMValueRef Val
, LLVMValueRef Ptr
);
4035 LLVMValueRef
LLVMBuildGEP2(LLVMBuilderRef B
, LLVMTypeRef Ty
,
4036 LLVMValueRef Pointer
, LLVMValueRef
*Indices
,
4037 unsigned NumIndices
, const char *Name
);
4038 LLVMValueRef
LLVMBuildInBoundsGEP2(LLVMBuilderRef B
, LLVMTypeRef Ty
,
4039 LLVMValueRef Pointer
, LLVMValueRef
*Indices
,
4040 unsigned NumIndices
, const char *Name
);
4041 LLVMValueRef
LLVMBuildStructGEP2(LLVMBuilderRef B
, LLVMTypeRef Ty
,
4042 LLVMValueRef Pointer
, unsigned Idx
,
4044 LLVMValueRef
LLVMBuildGlobalString(LLVMBuilderRef B
, const char *Str
,
4046 LLVMValueRef
LLVMBuildGlobalStringPtr(LLVMBuilderRef B
, const char *Str
,
4048 LLVMBool
LLVMGetVolatile(LLVMValueRef MemoryAccessInst
);
4049 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst
, LLVMBool IsVolatile
);
4050 LLVMBool
LLVMGetWeak(LLVMValueRef CmpXchgInst
);
4051 void LLVMSetWeak(LLVMValueRef CmpXchgInst
, LLVMBool IsWeak
);
4052 LLVMAtomicOrdering
LLVMGetOrdering(LLVMValueRef MemoryAccessInst
);
4053 void LLVMSetOrdering(LLVMValueRef MemoryAccessInst
, LLVMAtomicOrdering Ordering
);
4054 LLVMAtomicRMWBinOp
LLVMGetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst
);
4055 void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst
, LLVMAtomicRMWBinOp BinOp
);
4058 LLVMValueRef
LLVMBuildTrunc(LLVMBuilderRef
, LLVMValueRef Val
,
4059 LLVMTypeRef DestTy
, const char *Name
);
4060 LLVMValueRef
LLVMBuildZExt(LLVMBuilderRef
, LLVMValueRef Val
,
4061 LLVMTypeRef DestTy
, const char *Name
);
4062 LLVMValueRef
LLVMBuildSExt(LLVMBuilderRef
, LLVMValueRef Val
,
4063 LLVMTypeRef DestTy
, const char *Name
);
4064 LLVMValueRef
LLVMBuildFPToUI(LLVMBuilderRef
, LLVMValueRef Val
,
4065 LLVMTypeRef DestTy
, const char *Name
);
4066 LLVMValueRef
LLVMBuildFPToSI(LLVMBuilderRef
, LLVMValueRef Val
,
4067 LLVMTypeRef DestTy
, const char *Name
);
4068 LLVMValueRef
LLVMBuildUIToFP(LLVMBuilderRef
, LLVMValueRef Val
,
4069 LLVMTypeRef DestTy
, const char *Name
);
4070 LLVMValueRef
LLVMBuildSIToFP(LLVMBuilderRef
, LLVMValueRef Val
,
4071 LLVMTypeRef DestTy
, const char *Name
);
4072 LLVMValueRef
LLVMBuildFPTrunc(LLVMBuilderRef
, LLVMValueRef Val
,
4073 LLVMTypeRef DestTy
, const char *Name
);
4074 LLVMValueRef
LLVMBuildFPExt(LLVMBuilderRef
, LLVMValueRef Val
,
4075 LLVMTypeRef DestTy
, const char *Name
);
4076 LLVMValueRef
LLVMBuildPtrToInt(LLVMBuilderRef
, LLVMValueRef Val
,
4077 LLVMTypeRef DestTy
, const char *Name
);
4078 LLVMValueRef
LLVMBuildIntToPtr(LLVMBuilderRef
, LLVMValueRef Val
,
4079 LLVMTypeRef DestTy
, const char *Name
);
4080 LLVMValueRef
LLVMBuildBitCast(LLVMBuilderRef
, LLVMValueRef Val
,
4081 LLVMTypeRef DestTy
, const char *Name
);
4082 LLVMValueRef
LLVMBuildAddrSpaceCast(LLVMBuilderRef
, LLVMValueRef Val
,
4083 LLVMTypeRef DestTy
, const char *Name
);
4084 LLVMValueRef
LLVMBuildZExtOrBitCast(LLVMBuilderRef
, LLVMValueRef Val
,
4085 LLVMTypeRef DestTy
, const char *Name
);
4086 LLVMValueRef
LLVMBuildSExtOrBitCast(LLVMBuilderRef
, LLVMValueRef Val
,
4087 LLVMTypeRef DestTy
, const char *Name
);
4088 LLVMValueRef
LLVMBuildTruncOrBitCast(LLVMBuilderRef
, LLVMValueRef Val
,
4089 LLVMTypeRef DestTy
, const char *Name
);
4090 LLVMValueRef
LLVMBuildCast(LLVMBuilderRef B
, LLVMOpcode Op
, LLVMValueRef Val
,
4091 LLVMTypeRef DestTy
, const char *Name
);
4092 LLVMValueRef
LLVMBuildPointerCast(LLVMBuilderRef
, LLVMValueRef Val
,
4093 LLVMTypeRef DestTy
, const char *Name
);
4094 LLVMValueRef
LLVMBuildIntCast2(LLVMBuilderRef
, LLVMValueRef Val
,
4095 LLVMTypeRef DestTy
, LLVMBool IsSigned
,
4097 LLVMValueRef
LLVMBuildFPCast(LLVMBuilderRef
, LLVMValueRef Val
,
4098 LLVMTypeRef DestTy
, const char *Name
);
4100 /** Deprecated: This cast is always signed. Use LLVMBuildIntCast2 instead. */
4101 LLVMValueRef
LLVMBuildIntCast(LLVMBuilderRef
, LLVMValueRef Val
, /*Signed cast!*/
4102 LLVMTypeRef DestTy
, const char *Name
);
4104 LLVMOpcode
LLVMGetCastOpcode(LLVMValueRef Src
, LLVMBool SrcIsSigned
,
4105 LLVMTypeRef DestTy
, LLVMBool DestIsSigned
);
4108 LLVMValueRef
LLVMBuildICmp(LLVMBuilderRef
, LLVMIntPredicate Op
,
4109 LLVMValueRef LHS
, LLVMValueRef RHS
,
4111 LLVMValueRef
LLVMBuildFCmp(LLVMBuilderRef
, LLVMRealPredicate Op
,
4112 LLVMValueRef LHS
, LLVMValueRef RHS
,
4115 /* Miscellaneous instructions */
4116 LLVMValueRef
LLVMBuildPhi(LLVMBuilderRef
, LLVMTypeRef Ty
, const char *Name
);
4117 LLVMValueRef
LLVMBuildCall2(LLVMBuilderRef
, LLVMTypeRef
, LLVMValueRef Fn
,
4118 LLVMValueRef
*Args
, unsigned NumArgs
,
4120 LLVMValueRef
LLVMBuildSelect(LLVMBuilderRef
, LLVMValueRef If
,
4121 LLVMValueRef Then
, LLVMValueRef Else
,
4123 LLVMValueRef
LLVMBuildVAArg(LLVMBuilderRef
, LLVMValueRef List
, LLVMTypeRef Ty
,
4125 LLVMValueRef
LLVMBuildExtractElement(LLVMBuilderRef
, LLVMValueRef VecVal
,
4126 LLVMValueRef Index
, const char *Name
);
4127 LLVMValueRef
LLVMBuildInsertElement(LLVMBuilderRef
, LLVMValueRef VecVal
,
4128 LLVMValueRef EltVal
, LLVMValueRef Index
,
4130 LLVMValueRef
LLVMBuildShuffleVector(LLVMBuilderRef
, LLVMValueRef V1
,
4131 LLVMValueRef V2
, LLVMValueRef Mask
,
4133 LLVMValueRef
LLVMBuildExtractValue(LLVMBuilderRef
, LLVMValueRef AggVal
,
4134 unsigned Index
, const char *Name
);
4135 LLVMValueRef
LLVMBuildInsertValue(LLVMBuilderRef
, LLVMValueRef AggVal
,
4136 LLVMValueRef EltVal
, unsigned Index
,
4138 LLVMValueRef
LLVMBuildFreeze(LLVMBuilderRef
, LLVMValueRef Val
,
4141 LLVMValueRef
LLVMBuildIsNull(LLVMBuilderRef
, LLVMValueRef Val
,
4143 LLVMValueRef
LLVMBuildIsNotNull(LLVMBuilderRef
, LLVMValueRef Val
,
4145 LLVMValueRef
LLVMBuildPtrDiff2(LLVMBuilderRef
, LLVMTypeRef ElemTy
,
4146 LLVMValueRef LHS
, LLVMValueRef RHS
,
4148 LLVMValueRef
LLVMBuildFence(LLVMBuilderRef B
, LLVMAtomicOrdering ordering
,
4149 LLVMBool singleThread
, const char *Name
);
4150 LLVMValueRef
LLVMBuildAtomicRMW(LLVMBuilderRef B
, LLVMAtomicRMWBinOp op
,
4151 LLVMValueRef PTR
, LLVMValueRef Val
,
4152 LLVMAtomicOrdering ordering
,
4153 LLVMBool singleThread
);
4154 LLVMValueRef
LLVMBuildAtomicCmpXchg(LLVMBuilderRef B
, LLVMValueRef Ptr
,
4155 LLVMValueRef Cmp
, LLVMValueRef New
,
4156 LLVMAtomicOrdering SuccessOrdering
,
4157 LLVMAtomicOrdering FailureOrdering
,
4158 LLVMBool SingleThread
);
4161 * Get the number of elements in the mask of a ShuffleVector instruction.
4163 unsigned LLVMGetNumMaskElements(LLVMValueRef ShuffleVectorInst
);
4166 * \returns a constant that specifies that the result of a \c ShuffleVectorInst
4169 int LLVMGetUndefMaskElem(void);
4172 * Get the mask value at position Elt in the mask of a ShuffleVector
4175 * \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is
4176 * poison at that position.
4178 int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst
, unsigned Elt
);
4180 LLVMBool
LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst
);
4181 void LLVMSetAtomicSingleThread(LLVMValueRef AtomicInst
, LLVMBool SingleThread
);
4183 LLVMAtomicOrdering
LLVMGetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst
);
4184 void LLVMSetCmpXchgSuccessOrdering(LLVMValueRef CmpXchgInst
,
4185 LLVMAtomicOrdering Ordering
);
4186 LLVMAtomicOrdering
LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst
);
4187 void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst
,
4188 LLVMAtomicOrdering Ordering
);
4195 * @defgroup LLVMCCoreModuleProvider Module Providers
4201 * Changes the type of M so it can be passed to FunctionPassManagers and the
4202 * JIT. They take ModuleProviders for historical reasons.
4204 LLVMModuleProviderRef
4205 LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M
);
4208 * Destroys the module M.
4210 void LLVMDisposeModuleProvider(LLVMModuleProviderRef M
);
4217 * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
4222 LLVMBool
LLVMCreateMemoryBufferWithContentsOfFile(const char *Path
,
4223 LLVMMemoryBufferRef
*OutMemBuf
,
4225 LLVMBool
LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef
*OutMemBuf
,
4227 LLVMMemoryBufferRef
LLVMCreateMemoryBufferWithMemoryRange(const char *InputData
,
4228 size_t InputDataLength
,
4229 const char *BufferName
,
4230 LLVMBool RequiresNullTerminator
);
4231 LLVMMemoryBufferRef
LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData
,
4232 size_t InputDataLength
,
4233 const char *BufferName
);
4234 const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf
);
4235 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf
);
4236 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf
);
4243 * @defgroup LLVMCCorePassManagers Pass Managers
4244 * @ingroup LLVMCCore
4249 /** Constructs a new whole-module pass pipeline. This type of pipeline is
4250 suitable for link-time optimization and whole-module transformations.
4251 @see llvm::PassManager::PassManager */
4252 LLVMPassManagerRef
LLVMCreatePassManager(void);
4254 /** Constructs a new function-by-function pass pipeline over the module
4255 provider. It does not take ownership of the module provider. This type of
4256 pipeline is suitable for code generation and JIT compilation tasks.
4257 @see llvm::FunctionPassManager::FunctionPassManager */
4258 LLVMPassManagerRef
LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M
);
4260 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
4261 LLVMPassManagerRef
LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP
);
4263 /** Initializes, executes on the provided module, and finalizes all of the
4264 passes scheduled in the pass manager. Returns 1 if any of the passes
4265 modified the module, 0 otherwise.
4266 @see llvm::PassManager::run(Module&) */
4267 LLVMBool
LLVMRunPassManager(LLVMPassManagerRef PM
, LLVMModuleRef M
);
4269 /** Initializes all of the function passes scheduled in the function pass
4270 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4271 @see llvm::FunctionPassManager::doInitialization */
4272 LLVMBool
LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM
);
4274 /** Executes all of the function passes scheduled in the function pass manager
4275 on the provided function. Returns 1 if any of the passes modified the
4276 function, false otherwise.
4277 @see llvm::FunctionPassManager::run(Function&) */
4278 LLVMBool
LLVMRunFunctionPassManager(LLVMPassManagerRef FPM
, LLVMValueRef F
);
4280 /** Finalizes all of the function passes scheduled in the function pass
4281 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4282 @see llvm::FunctionPassManager::doFinalization */
4283 LLVMBool
LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM
);
4285 /** Frees the memory of a pass pipeline. For function pipelines, does not free
4286 the module provider.
4287 @see llvm::PassManagerBase::~PassManagerBase. */
4288 void LLVMDisposePassManager(LLVMPassManagerRef PM
);
4295 * @defgroup LLVMCCoreThreading Threading
4297 * Handle the structures needed to make LLVM safe for multithreading.
4302 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4303 time define LLVM_ENABLE_THREADS. This function always returns
4304 LLVMIsMultithreaded(). */
4305 LLVMBool
LLVMStartMultithreaded(void);
4307 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4308 time define LLVM_ENABLE_THREADS. */
4309 void LLVMStopMultithreaded(void);
4311 /** Check whether LLVM is executing in thread-safe mode or not.
4312 @see llvm::llvm_is_multithreaded */
4313 LLVMBool
LLVMIsMultithreaded(void);
4329 #endif /* LLVM_C_CORE_H */