LLVM 19.0.0git
Core.h
Go to the documentation of this file.
1/*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
2|* *|
3|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *|
4|* Exceptions. *|
5|* See https://llvm.org/LICENSE.txt for license information. *|
6|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *|
7|* *|
8|*===----------------------------------------------------------------------===*|
9|* *|
10|* This header declares the C interface to libLLVMCore.a, which implements *|
11|* the LLVM intermediate representation. *|
12|* *|
13\*===----------------------------------------------------------------------===*/
14
15#ifndef LLVM_C_CORE_H
16#define LLVM_C_CORE_H
17
18#include "llvm-c/Deprecated.h"
20#include "llvm-c/ExternC.h"
21
22#include "llvm-c/Types.h"
23
25
26/**
27 * @defgroup LLVMC LLVM-C: C interface to LLVM
28 *
29 * This module exposes parts of the LLVM library as a C API.
30 *
31 * @{
32 */
33
34/**
35 * @defgroup LLVMCTransforms Transforms
36 */
37
38/**
39 * @defgroup LLVMCCore Core
40 *
41 * This modules provide an interface to libLLVMCore, which implements
42 * the LLVM intermediate representation as well as other related types
43 * and utilities.
44 *
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.
48 *
49 * @{
50 */
51
52/**
53 * @defgroup LLVMCCoreTypes Types and Enumerations
54 *
55 * @{
56 */
57
58/// External users depend on the following values being stable. It is not safe
59/// to reorder them.
60typedef enum {
61 /* Terminator Instructions */
63 LLVMBr = 2,
67 /* removed 6 due to API changes */
70
71 /* Standard Unary Operators */
73
74 /* Standard Binary Operators */
77 LLVMSub = 10,
79 LLVMMul = 12,
87
88 /* Logical Operators */
89 LLVMShl = 20,
92 LLVMAnd = 23,
93 LLVMOr = 24,
94 LLVMXor = 25,
95
96 /* Memory Operators */
101
102 /* Cast Operators */
116
117 /* Other Operators */
132
133 /* Atomic operators */
137
138 /* Exception Handling Operators */
145 LLVMCatchSwitch = 65
147
148typedef enum {
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 */
171
172typedef enum {
173 LLVMExternalLinkage, /**< Externally visible function */
175 LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
176 LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
177 equivalent. */
179 LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
180 LLVMWeakODRLinkage, /**< Same, but only replaced by something
181 equivalent. */
182 LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
183 LLVMInternalLinkage, /**< Rename collisions when linking (static
184 functions) */
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. */
194
195typedef enum {
196 LLVMDefaultVisibility, /**< The GV is visible */
197 LLVMHiddenVisibility, /**< The GV is hidden */
198 LLVMProtectedVisibility /**< The GV is protected */
200
201typedef enum {
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. */
206
207typedef enum {
209 LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
210 LLVMDLLExportStorageClass = 2 /**< Function to be accessible from DLL. */
212
213typedef enum {
256
257typedef enum {
263
273
282
285
290
291typedef enum {
292 LLVMIntEQ = 32, /**< equal */
293 LLVMIntNE, /**< not equal */
294 LLVMIntUGT, /**< unsigned greater than */
295 LLVMIntUGE, /**< unsigned greater or equal */
296 LLVMIntULT, /**< unsigned less than */
297 LLVMIntULE, /**< unsigned less or equal */
298 LLVMIntSGT, /**< signed greater than */
299 LLVMIntSGE, /**< signed greater or equal */
300 LLVMIntSLT, /**< signed less than */
301 LLVMIntSLE /**< signed less or equal */
303
304typedef enum {
305 LLVMRealPredicateFalse, /**< Always false (always folded) */
306 LLVMRealOEQ, /**< True if ordered and equal */
307 LLVMRealOGT, /**< True if ordered and greater than */
308 LLVMRealOGE, /**< True if ordered and greater than or equal */
309 LLVMRealOLT, /**< True if ordered and less than */
310 LLVMRealOLE, /**< True if ordered and less than or equal */
311 LLVMRealONE, /**< True if ordered and operands are unequal */
312 LLVMRealORD, /**< True if ordered (no nans) */
313 LLVMRealUNO, /**< True if unordered: isnan(X) | isnan(Y) */
314 LLVMRealUEQ, /**< True if unordered or equal */
315 LLVMRealUGT, /**< True if unordered or greater than */
316 LLVMRealUGE, /**< True if unordered, greater than, or equal */
317 LLVMRealULT, /**< True if unordered or less than */
318 LLVMRealULE, /**< True if unordered, less than, or equal */
319 LLVMRealUNE, /**< True if unordered or not equal */
320 LLVMRealPredicateTrue /**< Always true (always folded) */
322
323typedef enum {
324 LLVMLandingPadCatch, /**< A catch clause */
325 LLVMLandingPadFilter /**< A filter clause */
327
328typedef enum {
335
336typedef enum {
337 LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */
338 LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees
339 somewhat sane results, lock free. */
340 LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the
341 operations affecting a specific address,
342 a consistent ordering exists */
343 LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort
344 necessary to acquire a lock to access other
345 memory with normal loads and stores. */
346 LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with
347 a barrier of the sort necessary to release
348 a lock. */
349 LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a
350 Release barrier (for fences and
351 operations which both read and write
352 memory). */
353 LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics
354 for loads and Release
355 semantics for stores.
356 Additionally, it guarantees
357 that a total ordering exists
358 between all
359 SequentiallyConsistent
360 operations. */
362
363typedef enum {
364 LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
365 LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
366 LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
367 LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
368 LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
369 LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
370 LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
371 LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
372 original using a signed comparison and return
373 the old one */
374 LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
375 original using a signed comparison and return
376 the old one */
377 LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
378 original using an unsigned comparison and return
379 the old one */
380 LLVMAtomicRMWBinOpUMin, /**< Sets the value if it's greater than the
381 original using an unsigned comparison and return
382 the old one */
383 LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the
384 old one */
385 LLVMAtomicRMWBinOpFSub, /**< Subtract a floating point value and return the
386 old one */
387 LLVMAtomicRMWBinOpFMax, /**< Sets the value if it's greater than the
388 original using an floating point comparison and
389 return the old one */
390 LLVMAtomicRMWBinOpFMin, /**< Sets the value if it's smaller than the
391 original using an floating point comparison and
392 return the old one */
393 LLVMAtomicRMWBinOpUIncWrap, /**< Increments the value, wrapping back to zero
394 when incremented above input value */
395 LLVMAtomicRMWBinOpUDecWrap, /**< Decrements the value, wrapping back to
396 the input value when decremented below zero */
398
399typedef enum {
405
406typedef enum {
410
411typedef enum {
412 /**
413 * Emits an error if two values disagree, otherwise the resulting value is
414 * that of the operands.
415 *
416 * @see Module::ModFlagBehavior::Error
417 */
419 /**
420 * Emits a warning if two values disagree. The result value will be the
421 * operand for the flag from the first module being linked.
422 *
423 * @see Module::ModFlagBehavior::Warning
424 */
426 /**
427 * Adds a requirement that another module flag be present and have a
428 * specified value after linking is performed. The value must be a metadata
429 * pair, where the first element of the pair is the ID of the module flag
430 * to be restricted, and the second element of the pair is the value the
431 * module flag should be restricted to. This behavior can be used to
432 * restrict the allowable results (via triggering of an error) of linking
433 * IDs with the **Override** behavior.
434 *
435 * @see Module::ModFlagBehavior::Require
436 */
438 /**
439 * Uses the specified value, regardless of the behavior or value of the
440 * other module. If both modules specify **Override**, but the values
441 * differ, an error will be emitted.
442 *
443 * @see Module::ModFlagBehavior::Override
444 */
446 /**
447 * Appends the two values, which are required to be metadata nodes.
448 *
449 * @see Module::ModFlagBehavior::Append
450 */
452 /**
453 * Appends the two values, which are required to be metadata
454 * nodes. However, duplicate entries in the second list are dropped
455 * during the append operation.
456 *
457 * @see Module::ModFlagBehavior::AppendUnique
458 */
461
462/**
463 * Attribute index are either LLVMAttributeReturnIndex,
464 * LLVMAttributeFunctionIndex or a parameter number from 1 to N.
465 */
466enum {
468 // ISO C restricts enumerator values to range of 'int'
469 // (4294967295 is too large)
470 // LLVMAttributeFunctionIndex = ~0U,
472};
473
474/**
475 * Tail call kind for LLVMSetTailCallKind and LLVMGetTailCallKind.
476 *
477 * Note that 'musttail' implies 'tail'.
478 *
479 * @see CallInst::TailCallKind
480 */
481typedef enum {
487
488typedef unsigned LLVMAttributeIndex;
489
490enum {
503};
504
505/**
506 * Flags to indicate what fast-math-style optimizations are allowed
507 * on operations.
508 *
509 * See https://llvm.org/docs/LangRef.html#fast-math-flags
510 */
511typedef unsigned LLVMFastMathFlags;
512
513/**
514 * @}
515 */
516
517/** Deallocate and destroy all ManagedStatic variables.
518 @see llvm::llvm_shutdown
519 @see ManagedStatic */
520void LLVMShutdown(void);
521
522/*===-- Version query -----------------------------------------------------===*/
523
524/**
525 * Return the major, minor, and patch version of LLVM
526 *
527 * The version components are returned via the function's three output
528 * parameters or skipped if a NULL pointer was supplied.
529 */
530void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch);
531
532/*===-- Error handling ----------------------------------------------------===*/
533
534char *LLVMCreateMessage(const char *Message);
535void LLVMDisposeMessage(char *Message);
536
537/**
538 * @defgroup LLVMCCoreContext Contexts
539 *
540 * Contexts are execution states for the core LLVM IR system.
541 *
542 * Most types are tied to a context instance. Multiple contexts can
543 * exist simultaneously. A single context is not thread safe. However,
544 * different contexts can execute on different threads simultaneously.
545 *
546 * @{
547 */
548
550typedef void (*LLVMYieldCallback)(LLVMContextRef, void *);
551
552/**
553 * Create a new context.
554 *
555 * Every call to this function should be paired with a call to
556 * LLVMContextDispose() or the context will leak memory.
557 */
559
560/**
561 * Obtain the global context instance.
562 */
564
565/**
566 * Set the diagnostic handler for this context.
567 */
569 LLVMDiagnosticHandler Handler,
570 void *DiagnosticContext);
571
572/**
573 * Get the diagnostic handler of this context.
574 */
576
577/**
578 * Get the diagnostic context of this context.
579 */
581
582/**
583 * Set the yield callback function for this context.
584 *
585 * @see LLVMContext::setYieldCallback()
586 */
588 void *OpaqueHandle);
589
590/**
591 * Retrieve whether the given context is set to discard all value names.
592 *
593 * @see LLVMContext::shouldDiscardValueNames()
594 */
596
597/**
598 * Set whether the given context discards all value names.
599 *
600 * If true, only the names of GlobalValue objects will be available in the IR.
601 * This can be used to save memory and runtime, especially in release mode.
602 *
603 * @see LLVMContext::setDiscardValueNames()
604 */
606
607/**
608 * Destroy a context instance.
609 *
610 * This should be called for every call to LLVMContextCreate() or memory
611 * will be leaked.
612 */
614
615/**
616 * Return a string representation of the DiagnosticInfo. Use
617 * LLVMDisposeMessage to free the string.
618 *
619 * @see DiagnosticInfo::print()
620 */
622
623/**
624 * Return an enum LLVMDiagnosticSeverity.
625 *
626 * @see DiagnosticInfo::getSeverity()
627 */
629
630unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
631 unsigned SLen);
632unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
633
634/**
635 * Return an unique id given the name of a enum attribute,
636 * or 0 if no attribute by that name exists.
637 *
638 * See http://llvm.org/docs/LangRef.html#parameter-attributes
639 * and http://llvm.org/docs/LangRef.html#function-attributes
640 * for the list of available attributes.
641 *
642 * NB: Attribute names and/or id are subject to change without
643 * going through the C API deprecation cycle.
644 */
645unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen);
646unsigned LLVMGetLastEnumAttributeKind(void);
647
648/**
649 * Create an enum attribute.
650 */
652 uint64_t Val);
653
654/**
655 * Get the unique id corresponding to the enum attribute
656 * passed as argument.
657 */
659
660/**
661 * Get the enum attribute's value. 0 is returned if none exists.
662 */
664
665/**
666 * Create a type attribute
667 */
669 LLVMTypeRef type_ref);
670
671/**
672 * Get the type attribute's value.
673 */
675
676/**
677 * Create a ConstantRange attribute.
678 *
679 * LowerWords and UpperWords need to be NumBits divided by 64 rounded up
680 * elements long.
681 */
683 unsigned KindID,
684 unsigned NumBits,
685 const uint64_t LowerWords[],
686 const uint64_t UpperWords[]);
687
688/**
689 * Create a string attribute.
690 */
692 const char *K, unsigned KLength,
693 const char *V, unsigned VLength);
694
695/**
696 * Get the string attribute's kind.
697 */
698const char *LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length);
699
700/**
701 * Get the string attribute's value.
702 */
703const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
704
705/**
706 * Check for the different types of attributes.
707 */
711
712/**
713 * Obtain a Type from a context by its registered name.
714 */
716
717/**
718 * @}
719 */
720
721/**
722 * @defgroup LLVMCCoreModule Modules
723 *
724 * Modules represent the top-level structure in an LLVM program. An LLVM
725 * module is effectively a translation unit or a collection of
726 * translation units merged together.
727 *
728 * @{
729 */
730
731/**
732 * Create a new, empty module in the global context.
733 *
734 * This is equivalent to calling LLVMModuleCreateWithNameInContext with
735 * LLVMGetGlobalContext() as the context parameter.
736 *
737 * Every invocation should be paired with LLVMDisposeModule() or memory
738 * will be leaked.
739 */
740LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
741
742/**
743 * Create a new, empty module in a specific context.
744 *
745 * Every invocation should be paired with LLVMDisposeModule() or memory
746 * will be leaked.
747 */
750/**
751 * Return an exact copy of the specified module.
752 */
754
755/**
756 * Destroy a module instance.
757 *
758 * This must be called for every created module or memory will be
759 * leaked.
760 */
762
763/**
764 * Soon to be deprecated.
765 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
766 *
767 * Returns true if the module is in the new debug info mode which uses
768 * non-instruction debug records instead of debug intrinsics for variable
769 * location tracking.
770 */
772
773/**
774 * Soon to be deprecated.
775 * See https://llvm.org/docs/RemoveDIsDebugInfo.html#c-api-changes
776 *
777 * Convert module into desired debug info format.
778 */
780
781/**
782 * Obtain the identifier of a module.
783 *
784 * @param M Module to obtain identifier of
785 * @param Len Out parameter which holds the length of the returned string.
786 * @return The identifier of M.
787 * @see Module::getModuleIdentifier()
788 */
789const char *LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len);
790
791/**
792 * Set the identifier of a module to a string Ident with length Len.
793 *
794 * @param M The module to set identifier
795 * @param Ident The string to set M's identifier to
796 * @param Len Length of Ident
797 * @see Module::setModuleIdentifier()
798 */
799void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len);
800
801/**
802 * Obtain the module's original source file name.
803 *
804 * @param M Module to obtain the name of
805 * @param Len Out parameter which holds the length of the returned string
806 * @return The original source file name of M
807 * @see Module::getSourceFileName()
808 */
809const char *LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len);
810
811/**
812 * Set the original source file name of a module to a string Name with length
813 * Len.
814 *
815 * @param M The module to set the source file name of
816 * @param Name The string to set M's source file name to
817 * @param Len Length of Name
818 * @see Module::setSourceFileName()
819 */
820void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len);
821
822/**
823 * Obtain the data layout for a module.
824 *
825 * @see Module::getDataLayoutStr()
826 *
827 * LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect,
828 * but match the name of another method on the module. Prefer the use
829 * of LLVMGetDataLayoutStr, which is not ambiguous.
830 */
832const char *LLVMGetDataLayout(LLVMModuleRef M);
833
834/**
835 * Set the data layout for a module.
836 *
837 * @see Module::setDataLayout()
838 */
839void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr);
840
841/**
842 * Obtain the target triple for a module.
843 *
844 * @see Module::getTargetTriple()
845 */
846const char *LLVMGetTarget(LLVMModuleRef M);
847
848/**
849 * Set the target triple for a module.
850 *
851 * @see Module::setTargetTriple()
852 */
853void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
854
855/**
856 * Returns the module flags as an array of flag-key-value triples. The caller
857 * is responsible for freeing this array by calling
858 * \c LLVMDisposeModuleFlagsMetadata.
859 *
860 * @see Module::getModuleFlagsMetadata()
861 */
863
864/**
865 * Destroys module flags metadata entries.
866 */
868
869/**
870 * Returns the flag behavior for a module flag entry at a specific index.
871 *
872 * @see Module::ModuleFlagEntry::Behavior
873 */
876 unsigned Index);
877
878/**
879 * Returns the key for a module flag entry at a specific index.
880 *
881 * @see Module::ModuleFlagEntry::Key
882 */
884 unsigned Index, size_t *Len);
885
886/**
887 * Returns the metadata for a module flag entry at a specific index.
888 *
889 * @see Module::ModuleFlagEntry::Val
890 */
892 unsigned Index);
893
894/**
895 * Add a module-level flag to the module-level flags metadata if it doesn't
896 * already exist.
897 *
898 * @see Module::getModuleFlag()
899 */
901 const char *Key, size_t KeyLen);
902
903/**
904 * Add a module-level flag to the module-level flags metadata if it doesn't
905 * already exist.
906 *
907 * @see Module::addModuleFlag()
908 */
910 const char *Key, size_t KeyLen,
911 LLVMMetadataRef Val);
912
913/**
914 * Dump a representation of a module to stderr.
915 *
916 * @see Module::dump()
917 */
919
920/**
921 * Print a representation of a module to a file. The ErrorMessage needs to be
922 * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
923 *
924 * @see Module::print()
925 */
926LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
927 char **ErrorMessage);
928
929/**
930 * Return a string representation of the module. Use
931 * LLVMDisposeMessage to free the string.
932 *
933 * @see Module::print()
934 */
936
937/**
938 * Get inline assembly for a module.
939 *
940 * @see Module::getModuleInlineAsm()
941 */
942const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len);
943
944/**
945 * Set inline assembly for a module.
946 *
947 * @see Module::setModuleInlineAsm()
948 */
949void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len);
950
951/**
952 * Append inline assembly to a module.
953 *
954 * @see Module::appendModuleInlineAsm()
955 */
956void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len);
957
958/**
959 * Create the specified uniqued inline asm string.
960 *
961 * @see InlineAsm::get()
962 */
963LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, const char *AsmString,
964 size_t AsmStringSize, const char *Constraints,
965 size_t ConstraintsSize, LLVMBool HasSideEffects,
966 LLVMBool IsAlignStack,
967 LLVMInlineAsmDialect Dialect, LLVMBool CanThrow);
968
969/**
970 * Get the template string used for an inline assembly snippet
971 *
972 */
973const char *LLVMGetInlineAsmAsmString(LLVMValueRef InlineAsmVal, size_t *Len);
974
975/**
976 * Get the raw constraint string for an inline assembly snippet
977 *
978 */
979const char *LLVMGetInlineAsmConstraintString(LLVMValueRef InlineAsmVal,
980 size_t *Len);
981
982/**
983 * Get the dialect used by the inline asm snippet
984 *
985 */
987
988/**
989 * Get the function type of the inline assembly snippet. The same type that
990 * was passed into LLVMGetInlineAsm originally
991 *
992 * @see LLVMGetInlineAsm
993 *
994 */
996
997/**
998 * Get if the inline asm snippet has side effects
999 *
1000 */
1002
1003/**
1004 * Get if the inline asm snippet needs an aligned stack
1005 *
1006 */
1008
1009/**
1010 * Get if the inline asm snippet may unwind the stack
1011 *
1012 */
1014
1015/**
1016 * Obtain the context to which this module is associated.
1017 *
1018 * @see Module::getContext()
1019 */
1021
1022/** Deprecated: Use LLVMGetTypeByName2 instead. */
1024
1025/**
1026 * Obtain an iterator to the first NamedMDNode in a Module.
1027 *
1028 * @see llvm::Module::named_metadata_begin()
1029 */
1031
1032/**
1033 * Obtain an iterator to the last NamedMDNode in a Module.
1034 *
1035 * @see llvm::Module::named_metadata_end()
1036 */
1038
1039/**
1040 * Advance a NamedMDNode iterator to the next NamedMDNode.
1041 *
1042 * Returns NULL if the iterator was already at the end and there are no more
1043 * named metadata nodes.
1044 */
1046
1047/**
1048 * Decrement a NamedMDNode iterator to the previous NamedMDNode.
1049 *
1050 * Returns NULL if the iterator was already at the beginning and there are
1051 * no previous named metadata nodes.
1052 */
1054
1055/**
1056 * Retrieve a NamedMDNode with the given name, returning NULL if no such
1057 * node exists.
1058 *
1059 * @see llvm::Module::getNamedMetadata()
1060 */
1062 const char *Name, size_t NameLen);
1063
1064/**
1065 * Retrieve a NamedMDNode with the given name, creating a new node if no such
1066 * node exists.
1067 *
1068 * @see llvm::Module::getOrInsertNamedMetadata()
1069 */
1071 const char *Name,
1072 size_t NameLen);
1073
1074/**
1075 * Retrieve the name of a NamedMDNode.
1076 *
1077 * @see llvm::NamedMDNode::getName()
1078 */
1080 size_t *NameLen);
1081
1082/**
1083 * Obtain the number of operands for named metadata in a module.
1084 *
1085 * @see llvm::Module::getNamedMetadata()
1086 */
1087unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name);
1088
1089/**
1090 * Obtain the named metadata operands for a module.
1091 *
1092 * The passed LLVMValueRef pointer should refer to an array of
1093 * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
1094 * array will be populated with the LLVMValueRef instances. Each
1095 * instance corresponds to a llvm::MDNode.
1096 *
1097 * @see llvm::Module::getNamedMetadata()
1098 * @see llvm::MDNode::getOperand()
1099 */
1101 LLVMValueRef *Dest);
1102
1103/**
1104 * Add an operand to named metadata.
1105 *
1106 * @see llvm::Module::getNamedMetadata()
1107 * @see llvm::MDNode::addOperand()
1108 */
1110 LLVMValueRef Val);
1111
1112/**
1113 * Return the directory of the debug location for this value, which must be
1114 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1115 *
1116 * @see llvm::Instruction::getDebugLoc()
1117 * @see llvm::GlobalVariable::getDebugInfo()
1118 * @see llvm::Function::getSubprogram()
1119 */
1120const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length);
1121
1122/**
1123 * Return the filename of the debug location for this value, which must be
1124 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1125 *
1126 * @see llvm::Instruction::getDebugLoc()
1127 * @see llvm::GlobalVariable::getDebugInfo()
1128 * @see llvm::Function::getSubprogram()
1129 */
1130const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length);
1131
1132/**
1133 * Return the line number of the debug location for this value, which must be
1134 * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1135 *
1136 * @see llvm::Instruction::getDebugLoc()
1137 * @see llvm::GlobalVariable::getDebugInfo()
1138 * @see llvm::Function::getSubprogram()
1139 */
1140unsigned LLVMGetDebugLocLine(LLVMValueRef Val);
1141
1142/**
1143 * Return the column number of the debug location for this value, which must be
1144 * an llvm::Instruction.
1145 *
1146 * @see llvm::Instruction::getDebugLoc()
1147 */
1149
1150/**
1151 * Add a function to a module under a specified name.
1152 *
1153 * @see llvm::Function::Create()
1154 */
1156 LLVMTypeRef FunctionTy);
1157
1158/**
1159 * Obtain a Function value from a Module by its name.
1160 *
1161 * The returned value corresponds to a llvm::Function value.
1162 *
1163 * @see llvm::Module::getFunction()
1164 */
1166
1167/**
1168 * Obtain an iterator to the first Function in a Module.
1169 *
1170 * @see llvm::Module::begin()
1171 */
1173
1174/**
1175 * Obtain an iterator to the last Function in a Module.
1176 *
1177 * @see llvm::Module::end()
1178 */
1180
1181/**
1182 * Advance a Function iterator to the next Function.
1183 *
1184 * Returns NULL if the iterator was already at the end and there are no more
1185 * functions.
1186 */
1188
1189/**
1190 * Decrement a Function iterator to the previous Function.
1191 *
1192 * Returns NULL if the iterator was already at the beginning and there are
1193 * no previous functions.
1194 */
1196
1197/** Deprecated: Use LLVMSetModuleInlineAsm2 instead. */
1198void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
1199
1200/**
1201 * @}
1202 */
1203
1204/**
1205 * @defgroup LLVMCCoreType Types
1206 *
1207 * Types represent the type of a value.
1208 *
1209 * Types are associated with a context instance. The context internally
1210 * deduplicates types so there is only 1 instance of a specific type
1211 * alive at a time. In other words, a unique type is shared among all
1212 * consumers within a context.
1213 *
1214 * A Type in the C API corresponds to llvm::Type.
1215 *
1216 * Types have the following hierarchy:
1217 *
1218 * types:
1219 * integer type
1220 * real type
1221 * function type
1222 * sequence types:
1223 * array type
1224 * pointer type
1225 * vector type
1226 * void type
1227 * label type
1228 * opaque type
1229 *
1230 * @{
1231 */
1232
1233/**
1234 * Obtain the enumerated type of a Type instance.
1235 *
1236 * @see llvm::Type:getTypeID()
1237 */
1239
1240/**
1241 * Whether the type has a known size.
1242 *
1243 * Things that don't have a size are abstract types, labels, and void.a
1244 *
1245 * @see llvm::Type::isSized()
1246 */
1248
1249/**
1250 * Obtain the context to which this type instance is associated.
1251 *
1252 * @see llvm::Type::getContext()
1253 */
1255
1256/**
1257 * Dump a representation of a type to stderr.
1258 *
1259 * @see llvm::Type::dump()
1260 */
1261void LLVMDumpType(LLVMTypeRef Val);
1262
1263/**
1264 * Return a string representation of the type. Use
1265 * LLVMDisposeMessage to free the string.
1266 *
1267 * @see llvm::Type::print()
1268 */
1270
1271/**
1272 * @defgroup LLVMCCoreTypeInt Integer Types
1273 *
1274 * Functions in this section operate on integer types.
1275 *
1276 * @{
1277 */
1278
1279/**
1280 * Obtain an integer type from a context with specified bit width.
1281 */
1289
1290/**
1291 * Obtain an integer type from the global context with a specified bit
1292 * width.
1293 */
1300LLVMTypeRef LLVMIntType(unsigned NumBits);
1301unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
1302
1303/**
1304 * @}
1305 */
1306
1307/**
1308 * @defgroup LLVMCCoreTypeFloat Floating Point Types
1309 *
1310 * @{
1311 */
1312
1313/**
1314 * Obtain a 16-bit floating point type from a context.
1315 */
1317
1318/**
1319 * Obtain a 16-bit brain floating point type from a context.
1320 */
1322
1323/**
1324 * Obtain a 32-bit floating point type from a context.
1325 */
1327
1328/**
1329 * Obtain a 64-bit floating point type from a context.
1330 */
1332
1333/**
1334 * Obtain a 80-bit floating point type (X87) from a context.
1335 */
1337
1338/**
1339 * Obtain a 128-bit floating point type (112-bit mantissa) from a
1340 * context.
1341 */
1343
1344/**
1345 * Obtain a 128-bit floating point type (two 64-bits) from a context.
1346 */
1348
1349/**
1350 * Obtain a floating point type from the global context.
1351 *
1352 * These map to the functions in this group of the same name.
1353 */
1361
1362/**
1363 * @}
1364 */
1365
1366/**
1367 * @defgroup LLVMCCoreTypeFunction Function Types
1368 *
1369 * @{
1370 */
1371
1372/**
1373 * Obtain a function type consisting of a specified signature.
1374 *
1375 * The function is defined as a tuple of a return Type, a list of
1376 * parameter types, and whether the function is variadic.
1377 */
1379 LLVMTypeRef *ParamTypes, unsigned ParamCount,
1380 LLVMBool IsVarArg);
1381
1382/**
1383 * Returns whether a function type is variadic.
1384 */
1386
1387/**
1388 * Obtain the Type this function Type returns.
1389 */
1391
1392/**
1393 * Obtain the number of parameters this function accepts.
1394 */
1395unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
1396
1397/**
1398 * Obtain the types of a function's parameters.
1399 *
1400 * The Dest parameter should point to a pre-allocated array of
1401 * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
1402 * first LLVMCountParamTypes() entries in the array will be populated
1403 * with LLVMTypeRef instances.
1404 *
1405 * @param FunctionTy The function type to operate on.
1406 * @param Dest Memory address of an array to be filled with result.
1407 */
1408void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
1409
1410/**
1411 * @}
1412 */
1413
1414/**
1415 * @defgroup LLVMCCoreTypeStruct Structure Types
1416 *
1417 * These functions relate to LLVMTypeRef instances.
1418 *
1419 * @see llvm::StructType
1420 *
1421 * @{
1422 */
1423
1424/**
1425 * Create a new structure type in a context.
1426 *
1427 * A structure is specified by a list of inner elements/types and
1428 * whether these can be packed together.
1429 *
1430 * @see llvm::StructType::create()
1431 */
1433 unsigned ElementCount, LLVMBool Packed);
1434
1435/**
1436 * Create a new structure type in the global context.
1437 *
1438 * @see llvm::StructType::create()
1439 */
1440LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
1441 LLVMBool Packed);
1442
1443/**
1444 * Create an empty structure in a context having a specified name.
1445 *
1446 * @see llvm::StructType::create()
1447 */
1449
1450/**
1451 * Obtain the name of a structure.
1452 *
1453 * @see llvm::StructType::getName()
1454 */
1455const char *LLVMGetStructName(LLVMTypeRef Ty);
1456
1457/**
1458 * Set the contents of a structure type.
1459 *
1460 * @see llvm::StructType::setBody()
1461 */
1462void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
1463 unsigned ElementCount, LLVMBool Packed);
1464
1465/**
1466 * Get the number of elements defined inside the structure.
1467 *
1468 * @see llvm::StructType::getNumElements()
1469 */
1470unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
1471
1472/**
1473 * Get the elements within a structure.
1474 *
1475 * The function is passed the address of a pre-allocated array of
1476 * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
1477 * invocation, this array will be populated with the structure's
1478 * elements. The objects in the destination array will have a lifetime
1479 * of the structure type itself, which is the lifetime of the context it
1480 * is contained in.
1481 */
1483
1484/**
1485 * Get the type of the element at a given index in the structure.
1486 *
1487 * @see llvm::StructType::getTypeAtIndex()
1488 */
1490
1491/**
1492 * Determine whether a structure is packed.
1493 *
1494 * @see llvm::StructType::isPacked()
1495 */
1497
1498/**
1499 * Determine whether a structure is opaque.
1500 *
1501 * @see llvm::StructType::isOpaque()
1502 */
1504
1505/**
1506 * Determine whether a structure is literal.
1507 *
1508 * @see llvm::StructType::isLiteral()
1509 */
1511
1512/**
1513 * @}
1514 */
1515
1516/**
1517 * @defgroup LLVMCCoreTypeSequential Sequential Types
1518 *
1519 * Sequential types represents "arrays" of types. This is a super class
1520 * for array, vector, and pointer types.
1521 *
1522 * @{
1523 */
1524
1525/**
1526 * Obtain the element type of an array or vector type.
1527 *
1528 * @see llvm::SequentialType::getElementType()
1529 */
1531
1532/**
1533 * Returns type's subtypes
1534 *
1535 * @see llvm::Type::subtypes()
1536 */
1538
1539/**
1540 * Return the number of types in the derived type.
1541 *
1542 * @see llvm::Type::getNumContainedTypes()
1543 */
1545
1546/**
1547 * Create a fixed size array type that refers to a specific type.
1548 *
1549 * The created type will exist in the context that its element type
1550 * exists in.
1551 *
1552 * @deprecated LLVMArrayType is deprecated in favor of the API accurate
1553 * LLVMArrayType2
1554 * @see llvm::ArrayType::get()
1555 */
1556LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
1557
1558/**
1559 * Create a fixed size array type that refers to a specific type.
1560 *
1561 * The created type will exist in the context that its element type
1562 * exists in.
1563 *
1564 * @see llvm::ArrayType::get()
1565 */
1566LLVMTypeRef LLVMArrayType2(LLVMTypeRef ElementType, uint64_t ElementCount);
1567
1568/**
1569 * Obtain the length of an array type.
1570 *
1571 * This only works on types that represent arrays.
1572 *
1573 * @deprecated LLVMGetArrayLength is deprecated in favor of the API accurate
1574 * LLVMGetArrayLength2
1575 * @see llvm::ArrayType::getNumElements()
1576 */
1577unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
1578
1579/**
1580 * Obtain the length of an array type.
1581 *
1582 * This only works on types that represent arrays.
1583 *
1584 * @see llvm::ArrayType::getNumElements()
1585 */
1587
1588/**
1589 * Create a pointer type that points to a defined type.
1590 *
1591 * The created type will exist in the context that its pointee type
1592 * exists in.
1593 *
1594 * @see llvm::PointerType::get()
1595 */
1596LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
1597
1598/**
1599 * Determine whether a pointer is opaque.
1600 *
1601 * True if this is an instance of an opaque PointerType.
1602 *
1603 * @see llvm::Type::isOpaquePointerTy()
1604 */
1606
1607/**
1608 * Create an opaque pointer type in a context.
1609 *
1610 * @see llvm::PointerType::get()
1611 */
1613
1614/**
1615 * Obtain the address space of a pointer type.
1616 *
1617 * This only works on types that represent pointers.
1618 *
1619 * @see llvm::PointerType::getAddressSpace()
1620 */
1621unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
1622
1623/**
1624 * Create a vector type that contains a defined type and has a specific
1625 * number of elements.
1626 *
1627 * The created type will exist in the context thats its element type
1628 * exists in.
1629 *
1630 * @see llvm::VectorType::get()
1631 */
1632LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
1633
1634/**
1635 * Create a vector type that contains a defined type and has a scalable
1636 * number of elements.
1637 *
1638 * The created type will exist in the context thats its element type
1639 * exists in.
1640 *
1641 * @see llvm::ScalableVectorType::get()
1642 */
1644 unsigned ElementCount);
1645
1646/**
1647 * Obtain the (possibly scalable) number of elements in a vector type.
1648 *
1649 * This only works on types that represent vectors (fixed or scalable).
1650 *
1651 * @see llvm::VectorType::getNumElements()
1652 */
1653unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
1654
1655/**
1656 * @}
1657 */
1658
1659/**
1660 * @defgroup LLVMCCoreTypeOther Other Types
1661 *
1662 * @{
1663 */
1664
1665/**
1666 * Create a void type in a context.
1667 */
1669
1670/**
1671 * Create a label type in a context.
1672 */
1674
1675/**
1676 * Create a X86 MMX type in a context.
1677 */
1679
1680/**
1681 * Create a X86 AMX type in a context.
1682 */
1684
1685/**
1686 * Create a token type in a context.
1687 */
1689
1690/**
1691 * Create a metadata type in a context.
1692 */
1694
1695/**
1696 * These are similar to the above functions except they operate on the
1697 * global context.
1698 */
1703
1704/**
1705 * Create a target extension type in LLVM context.
1706 */
1708 LLVMTypeRef *TypeParams,
1709 unsigned TypeParamCount,
1710 unsigned *IntParams,
1711 unsigned IntParamCount);
1712
1713/**
1714 * @}
1715 */
1716
1717/**
1718 * @}
1719 */
1720
1721/**
1722 * @defgroup LLVMCCoreValues Values
1723 *
1724 * The bulk of LLVM's object model consists of values, which comprise a very
1725 * rich type hierarchy.
1726 *
1727 * LLVMValueRef essentially represents llvm::Value. There is a rich
1728 * hierarchy of classes within this type. Depending on the instance
1729 * obtained, not all APIs are available.
1730 *
1731 * Callers can determine the type of an LLVMValueRef by calling the
1732 * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1733 * functions are defined by a macro, so it isn't obvious which are
1734 * available by looking at the Doxygen source code. Instead, look at the
1735 * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1736 * of value names given. These value names also correspond to classes in
1737 * the llvm::Value hierarchy.
1738 *
1739 * @{
1740 */
1741
1742#define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1743 macro(Argument) \
1744 macro(BasicBlock) \
1745 macro(InlineAsm) \
1746 macro(User) \
1747 macro(Constant) \
1748 macro(BlockAddress) \
1749 macro(ConstantAggregateZero) \
1750 macro(ConstantArray) \
1751 macro(ConstantDataSequential) \
1752 macro(ConstantDataArray) \
1753 macro(ConstantDataVector) \
1754 macro(ConstantExpr) \
1755 macro(ConstantFP) \
1756 macro(ConstantInt) \
1757 macro(ConstantPointerNull) \
1758 macro(ConstantStruct) \
1759 macro(ConstantTokenNone) \
1760 macro(ConstantVector) \
1761 macro(GlobalValue) \
1762 macro(GlobalAlias) \
1763 macro(GlobalObject) \
1764 macro(Function) \
1765 macro(GlobalVariable) \
1766 macro(GlobalIFunc) \
1767 macro(UndefValue) \
1768 macro(PoisonValue) \
1769 macro(Instruction) \
1770 macro(UnaryOperator) \
1771 macro(BinaryOperator) \
1772 macro(CallInst) \
1773 macro(IntrinsicInst) \
1774 macro(DbgInfoIntrinsic) \
1775 macro(DbgVariableIntrinsic) \
1776 macro(DbgDeclareInst) \
1777 macro(DbgLabelInst) \
1778 macro(MemIntrinsic) \
1779 macro(MemCpyInst) \
1780 macro(MemMoveInst) \
1781 macro(MemSetInst) \
1782 macro(CmpInst) \
1783 macro(FCmpInst) \
1784 macro(ICmpInst) \
1785 macro(ExtractElementInst) \
1786 macro(GetElementPtrInst) \
1787 macro(InsertElementInst) \
1788 macro(InsertValueInst) \
1789 macro(LandingPadInst) \
1790 macro(PHINode) \
1791 macro(SelectInst) \
1792 macro(ShuffleVectorInst) \
1793 macro(StoreInst) \
1794 macro(BranchInst) \
1795 macro(IndirectBrInst) \
1796 macro(InvokeInst) \
1797 macro(ReturnInst) \
1798 macro(SwitchInst) \
1799 macro(UnreachableInst) \
1800 macro(ResumeInst) \
1801 macro(CleanupReturnInst) \
1802 macro(CatchReturnInst) \
1803 macro(CatchSwitchInst) \
1804 macro(CallBrInst) \
1805 macro(FuncletPadInst) \
1806 macro(CatchPadInst) \
1807 macro(CleanupPadInst) \
1808 macro(UnaryInstruction) \
1809 macro(AllocaInst) \
1810 macro(CastInst) \
1811 macro(AddrSpaceCastInst) \
1812 macro(BitCastInst) \
1813 macro(FPExtInst) \
1814 macro(FPToSIInst) \
1815 macro(FPToUIInst) \
1816 macro(FPTruncInst) \
1817 macro(IntToPtrInst) \
1818 macro(PtrToIntInst) \
1819 macro(SExtInst) \
1820 macro(SIToFPInst) \
1821 macro(TruncInst) \
1822 macro(UIToFPInst) \
1823 macro(ZExtInst) \
1824 macro(ExtractValueInst) \
1825 macro(LoadInst) \
1826 macro(VAArgInst) \
1827 macro(FreezeInst) \
1828 macro(AtomicCmpXchgInst) \
1829 macro(AtomicRMWInst) \
1830 macro(FenceInst)
1831
1832/**
1833 * @defgroup LLVMCCoreValueGeneral General APIs
1834 *
1835 * Functions in this section work on all LLVMValueRef instances,
1836 * regardless of their sub-type. They correspond to functions available
1837 * on llvm::Value.
1838 *
1839 * @{
1840 */
1841
1842/**
1843 * Obtain the type of a value.
1844 *
1845 * @see llvm::Value::getType()
1846 */
1848
1849/**
1850 * Obtain the enumerated type of a Value instance.
1851 *
1852 * @see llvm::Value::getValueID()
1853 */
1855
1856/**
1857 * Obtain the string name of a value.
1858 *
1859 * @see llvm::Value::getName()
1860 */
1861const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length);
1862
1863/**
1864 * Set the string name of a value.
1865 *
1866 * @see llvm::Value::setName()
1867 */
1868void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen);
1869
1870/**
1871 * Dump a representation of a value to stderr.
1872 *
1873 * @see llvm::Value::dump()
1874 */
1875void LLVMDumpValue(LLVMValueRef Val);
1876
1877/**
1878 * Return a string representation of the value. Use
1879 * LLVMDisposeMessage to free the string.
1880 *
1881 * @see llvm::Value::print()
1882 */
1884
1885/**
1886 * Return a string representation of the DbgRecord. Use
1887 * LLVMDisposeMessage to free the string.
1888 *
1889 * @see llvm::DbgRecord::print()
1890 */
1892
1893/**
1894 * Replace all uses of a value with another one.
1895 *
1896 * @see llvm::Value::replaceAllUsesWith()
1897 */
1899
1900/**
1901 * Determine whether the specified value instance is constant.
1902 */
1904
1905/**
1906 * Determine whether a value instance is undefined.
1907 */
1909
1910/**
1911 * Determine whether a value instance is poisonous.
1912 */
1914
1915/**
1916 * Convert value instances between types.
1917 *
1918 * Internally, an LLVMValueRef is "pinned" to a specific type. This
1919 * series of functions allows you to cast an instance to a specific
1920 * type.
1921 *
1922 * If the cast is not valid for the specified type, NULL is returned.
1923 *
1924 * @see llvm::dyn_cast_or_null<>
1925 */
1926#define LLVM_DECLARE_VALUE_CAST(name) \
1927 LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1929
1933
1934/** Deprecated: Use LLVMGetValueName2 instead. */
1935const char *LLVMGetValueName(LLVMValueRef Val);
1936/** Deprecated: Use LLVMSetValueName2 instead. */
1937void LLVMSetValueName(LLVMValueRef Val, const char *Name);
1938
1939/**
1940 * @}
1941 */
1942
1943/**
1944 * @defgroup LLVMCCoreValueUses Usage
1945 *
1946 * This module defines functions that allow you to inspect the uses of a
1947 * LLVMValueRef.
1948 *
1949 * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1950 * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1951 * llvm::User and llvm::Value.
1952 *
1953 * @{
1954 */
1955
1956/**
1957 * Obtain the first use of a value.
1958 *
1959 * Uses are obtained in an iterator fashion. First, call this function
1960 * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1961 * on that instance and all subsequently obtained instances until
1962 * LLVMGetNextUse() returns NULL.
1963 *
1964 * @see llvm::Value::use_begin()
1965 */
1967
1968/**
1969 * Obtain the next use of a value.
1970 *
1971 * This effectively advances the iterator. It returns NULL if you are on
1972 * the final use and no more are available.
1973 */
1975
1976/**
1977 * Obtain the user value for a user.
1978 *
1979 * The returned value corresponds to a llvm::User type.
1980 *
1981 * @see llvm::Use::getUser()
1982 */
1984
1985/**
1986 * Obtain the value this use corresponds to.
1987 *
1988 * @see llvm::Use::get().
1989 */
1991
1992/**
1993 * @}
1994 */
1995
1996/**
1997 * @defgroup LLVMCCoreValueUser User value
1998 *
1999 * Function in this group pertain to LLVMValueRef instances that descent
2000 * from llvm::User. This includes constants, instructions, and
2001 * operators.
2002 *
2003 * @{
2004 */
2005
2006/**
2007 * Obtain an operand at a specific index in a llvm::User value.
2008 *
2009 * @see llvm::User::getOperand()
2010 */
2012
2013/**
2014 * Obtain the use of an operand at a specific index in a llvm::User value.
2015 *
2016 * @see llvm::User::getOperandUse()
2017 */
2019
2020/**
2021 * Set an operand at a specific index in a llvm::User value.
2022 *
2023 * @see llvm::User::setOperand()
2024 */
2025void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
2026
2027/**
2028 * Obtain the number of operands in a llvm::User value.
2029 *
2030 * @see llvm::User::getNumOperands()
2031 */
2033
2034/**
2035 * @}
2036 */
2037
2038/**
2039 * @defgroup LLVMCCoreValueConstant Constants
2040 *
2041 * This section contains APIs for interacting with LLVMValueRef that
2042 * correspond to llvm::Constant instances.
2043 *
2044 * These functions will work for any LLVMValueRef in the llvm::Constant
2045 * class hierarchy.
2046 *
2047 * @{
2048 */
2049
2050/**
2051 * Obtain a constant value referring to the null instance of a type.
2052 *
2053 * @see llvm::Constant::getNullValue()
2054 */
2055LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
2056
2057/**
2058 * Obtain a constant value referring to the instance of a type
2059 * consisting of all ones.
2060 *
2061 * This is only valid for integer types.
2062 *
2063 * @see llvm::Constant::getAllOnesValue()
2064 */
2066
2067/**
2068 * Obtain a constant value referring to an undefined value of a type.
2069 *
2070 * @see llvm::UndefValue::get()
2071 */
2073
2074/**
2075 * Obtain a constant value referring to a poison value of a type.
2076 *
2077 * @see llvm::PoisonValue::get()
2078 */
2080
2081/**
2082 * Determine whether a value instance is null.
2083 *
2084 * @see llvm::Constant::isNullValue()
2085 */
2087
2088/**
2089 * Obtain a constant that is a constant pointer pointing to NULL for a
2090 * specified type.
2091 */
2093
2094/**
2095 * @defgroup LLVMCCoreValueConstantScalar Scalar constants
2096 *
2097 * Functions in this group model LLVMValueRef instances that correspond
2098 * to constants referring to scalar types.
2099 *
2100 * For integer types, the LLVMTypeRef parameter should correspond to a
2101 * llvm::IntegerType instance and the returned LLVMValueRef will
2102 * correspond to a llvm::ConstantInt.
2103 *
2104 * For floating point types, the LLVMTypeRef returned corresponds to a
2105 * llvm::ConstantFP.
2106 *
2107 * @{
2108 */
2109
2110/**
2111 * Obtain a constant value for an integer type.
2112 *
2113 * The returned value corresponds to a llvm::ConstantInt.
2114 *
2115 * @see llvm::ConstantInt::get()
2116 *
2117 * @param IntTy Integer type to obtain value of.
2118 * @param N The value the returned instance should refer to.
2119 * @param SignExtend Whether to sign extend the produced value.
2120 */
2121LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
2122 LLVMBool SignExtend);
2123
2124/**
2125 * Obtain a constant value for an integer of arbitrary precision.
2126 *
2127 * @see llvm::ConstantInt::get()
2128 */
2130 unsigned NumWords,
2131 const uint64_t Words[]);
2132
2133/**
2134 * Obtain a constant value for an integer parsed from a string.
2135 *
2136 * A similar API, LLVMConstIntOfStringAndSize is also available. If the
2137 * string's length is available, it is preferred to call that function
2138 * instead.
2139 *
2140 * @see llvm::ConstantInt::get()
2141 */
2143 uint8_t Radix);
2144
2145/**
2146 * Obtain a constant value for an integer parsed from a string with
2147 * specified length.
2148 *
2149 * @see llvm::ConstantInt::get()
2150 */
2152 unsigned SLen, uint8_t Radix);
2153
2154/**
2155 * Obtain a constant value referring to a double floating point value.
2156 */
2157LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
2158
2159/**
2160 * Obtain a constant for a floating point value parsed from a string.
2161 *
2162 * A similar API, LLVMConstRealOfStringAndSize is also available. It
2163 * should be used if the input string's length is known.
2164 */
2165LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
2166
2167/**
2168 * Obtain a constant for a floating point value parsed from a string.
2169 */
2171 unsigned SLen);
2172
2173/**
2174 * Obtain the zero extended value for an integer constant value.
2175 *
2176 * @see llvm::ConstantInt::getZExtValue()
2177 */
2178unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
2179
2180/**
2181 * Obtain the sign extended value for an integer constant value.
2182 *
2183 * @see llvm::ConstantInt::getSExtValue()
2184 */
2185long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
2186
2187/**
2188 * Obtain the double value for an floating point constant value.
2189 * losesInfo indicates if some precision was lost in the conversion.
2190 *
2191 * @see llvm::ConstantFP::getDoubleValue
2192 */
2193double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
2194
2195/**
2196 * @}
2197 */
2198
2199/**
2200 * @defgroup LLVMCCoreValueConstantComposite Composite Constants
2201 *
2202 * Functions in this group operate on composite constants.
2203 *
2204 * @{
2205 */
2206
2207/**
2208 * Create a ConstantDataSequential and initialize it with a string.
2209 *
2210 * @deprecated LLVMConstStringInContext is deprecated in favor of the API
2211 * accurate LLVMConstStringInContext2
2212 * @see llvm::ConstantDataArray::getString()
2213 */
2215 unsigned Length, LLVMBool DontNullTerminate);
2216
2217/**
2218 * Create a ConstantDataSequential and initialize it with a string.
2219 *
2220 * @see llvm::ConstantDataArray::getString()
2221 */
2223 size_t Length,
2224 LLVMBool DontNullTerminate);
2225
2226/**
2227 * Create a ConstantDataSequential with string content in the global context.
2228 *
2229 * This is the same as LLVMConstStringInContext except it operates on the
2230 * global context.
2231 *
2232 * @see LLVMConstStringInContext()
2233 * @see llvm::ConstantDataArray::getString()
2234 */
2235LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
2236 LLVMBool DontNullTerminate);
2237
2238/**
2239 * Returns true if the specified constant is an array of i8.
2240 *
2241 * @see ConstantDataSequential::getAsString()
2242 */
2244
2245/**
2246 * Get the given constant data sequential as a string.
2247 *
2248 * @see ConstantDataSequential::getAsString()
2249 */
2250const char *LLVMGetAsString(LLVMValueRef c, size_t *Length);
2251
2252/**
2253 * Create an anonymous ConstantStruct with the specified values.
2254 *
2255 * @see llvm::ConstantStruct::getAnon()
2256 */
2258 LLVMValueRef *ConstantVals,
2259 unsigned Count, LLVMBool Packed);
2260
2261/**
2262 * Create a ConstantStruct in the global Context.
2263 *
2264 * This is the same as LLVMConstStructInContext except it operates on the
2265 * global Context.
2266 *
2267 * @see LLVMConstStructInContext()
2268 */
2269LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
2270 LLVMBool Packed);
2271
2272/**
2273 * Create a ConstantArray from values.
2274 *
2275 * @deprecated LLVMConstArray is deprecated in favor of the API accurate
2276 * LLVMConstArray2
2277 * @see llvm::ConstantArray::get()
2278 */
2280 LLVMValueRef *ConstantVals, unsigned Length);
2281
2282/**
2283 * Create a ConstantArray from values.
2284 *
2285 * @see llvm::ConstantArray::get()
2286 */
2287LLVMValueRef LLVMConstArray2(LLVMTypeRef ElementTy, LLVMValueRef *ConstantVals,
2288 uint64_t Length);
2289
2290/**
2291 * Create a non-anonymous ConstantStruct from values.
2292 *
2293 * @see llvm::ConstantStruct::get()
2294 */
2296 LLVMValueRef *ConstantVals,
2297 unsigned Count);
2298
2299/**
2300 * Get element of a constant aggregate (struct, array or vector) at the
2301 * specified index. Returns null if the index is out of range, or it's not
2302 * possible to determine the element (e.g., because the constant is a
2303 * constant expression.)
2304 *
2305 * @see llvm::Constant::getAggregateElement()
2306 */
2308
2309/**
2310 * Get an element at specified index as a constant.
2311 *
2312 * @see ConstantDataSequential::getElementAsConstant()
2313 */
2316 "Use LLVMGetAggregateElement instead");
2317
2318/**
2319 * Create a ConstantVector from values.
2320 *
2321 * @see llvm::ConstantVector::get()
2322 */
2323LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
2324
2325/**
2326 * @}
2327 */
2328
2329/**
2330 * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
2331 *
2332 * Functions in this group correspond to APIs on llvm::ConstantExpr.
2333 *
2334 * @see llvm::ConstantExpr.
2335 *
2336 * @{
2337 */
2345 "Use LLVMConstNull instead.");
2347LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2348LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2349LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2350LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2351LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2352LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2353LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2354LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2355LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2356LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2358 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2360 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2361LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2363 LLVMValueRef *ConstantIndices, unsigned NumIndices);
2365 LLVMValueRef *ConstantIndices,
2366 unsigned NumIndices);
2373 LLVMTypeRef ToType);
2375 LLVMTypeRef ToType);
2377 LLVMValueRef IndexConstant);
2379 LLVMValueRef ElementValueConstant,
2380 LLVMValueRef IndexConstant);
2382 LLVMValueRef VectorBConstant,
2383 LLVMValueRef MaskConstant);
2385
2386/**
2387 * Gets the function associated with a given BlockAddress constant value.
2388 */
2390
2391/**
2392 * Gets the basic block associated with a given BlockAddress constant value.
2393 */
2395
2396/** Deprecated: Use LLVMGetInlineAsm instead. */
2398 const char *AsmString, const char *Constraints,
2399 LLVMBool HasSideEffects, LLVMBool IsAlignStack);
2400
2401/**
2402 * @}
2403 */
2404
2405/**
2406 * @defgroup LLVMCCoreValueConstantGlobals Global Values
2407 *
2408 * This group contains functions that operate on global values. Functions in
2409 * this group relate to functions in the llvm::GlobalValue class tree.
2410 *
2411 * @see llvm::GlobalValue
2412 *
2413 * @{
2414 */
2415
2419void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
2420const char *LLVMGetSection(LLVMValueRef Global);
2421void LLVMSetSection(LLVMValueRef Global, const char *Section);
2427void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr);
2428
2429/**
2430 * Returns the "value type" of a global value. This differs from the formal
2431 * type of a global value which is always a pointer type.
2432 *
2433 * @see llvm::GlobalValue::getValueType()
2434 */
2436
2437/** Deprecated: Use LLVMGetUnnamedAddress instead. */
2439/** Deprecated: Use LLVMSetUnnamedAddress instead. */
2440void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
2441
2442/**
2443 * @defgroup LLVMCCoreValueWithAlignment Values with alignment
2444 *
2445 * Functions in this group only apply to values with alignment, i.e.
2446 * global variables, load and store instructions.
2447 */
2448
2449/**
2450 * Obtain the preferred alignment of the value.
2451 * @see llvm::AllocaInst::getAlignment()
2452 * @see llvm::LoadInst::getAlignment()
2453 * @see llvm::StoreInst::getAlignment()
2454 * @see llvm::AtomicRMWInst::setAlignment()
2455 * @see llvm::AtomicCmpXchgInst::setAlignment()
2456 * @see llvm::GlobalValue::getAlignment()
2457 */
2458unsigned LLVMGetAlignment(LLVMValueRef V);
2459
2460/**
2461 * Set the preferred alignment of the value.
2462 * @see llvm::AllocaInst::setAlignment()
2463 * @see llvm::LoadInst::setAlignment()
2464 * @see llvm::StoreInst::setAlignment()
2465 * @see llvm::AtomicRMWInst::setAlignment()
2466 * @see llvm::AtomicCmpXchgInst::setAlignment()
2467 * @see llvm::GlobalValue::setAlignment()
2468 */
2469void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
2470
2471/**
2472 * Sets a metadata attachment, erasing the existing metadata attachment if
2473 * it already exists for the given kind.
2474 *
2475 * @see llvm::GlobalObject::setMetadata()
2476 */
2477void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind,
2478 LLVMMetadataRef MD);
2479
2480/**
2481 * Erases a metadata attachment of the given kind if it exists.
2482 *
2483 * @see llvm::GlobalObject::eraseMetadata()
2484 */
2485void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind);
2486
2487/**
2488 * Removes all metadata attachments from this value.
2489 *
2490 * @see llvm::GlobalObject::clearMetadata()
2491 */
2493
2494/**
2495 * Retrieves an array of metadata entries representing the metadata attached to
2496 * this value. The caller is responsible for freeing this array by calling
2497 * \c LLVMDisposeValueMetadataEntries.
2498 *
2499 * @see llvm::GlobalObject::getAllMetadata()
2500 */
2502 size_t *NumEntries);
2503
2504/**
2505 * Destroys value metadata entries.
2506 */
2508
2509/**
2510 * Returns the kind of a value metadata entry at a specific index.
2511 */
2513 unsigned Index);
2514
2515/**
2516 * Returns the underlying metadata node of a value metadata entry at a
2517 * specific index.
2518 */
2521 unsigned Index);
2522
2523/**
2524 * @}
2525 */
2526
2527/**
2528 * @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
2529 *
2530 * This group contains functions that operate on global variable values.
2531 *
2532 * @see llvm::GlobalVariable
2533 *
2534 * @{
2535 */
2538 const char *Name,
2539 unsigned AddressSpace);
2545void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
2547void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
2549void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
2551void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant);
2555void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit);
2556
2557/**
2558 * @}
2559 */
2560
2561/**
2562 * @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
2563 *
2564 * This group contains function that operate on global alias values.
2565 *
2566 * @see llvm::GlobalAlias
2567 *
2568 * @{
2569 */
2570
2571/**
2572 * Add a GlobalAlias with the given value type, address space and aliasee.
2573 *
2574 * @see llvm::GlobalAlias::create()
2575 */
2577 unsigned AddrSpace, LLVMValueRef Aliasee,
2578 const char *Name);
2579
2580/**
2581 * Obtain a GlobalAlias value from a Module by its name.
2582 *
2583 * The returned value corresponds to a llvm::GlobalAlias value.
2584 *
2585 * @see llvm::Module::getNamedAlias()
2586 */
2588 const char *Name, size_t NameLen);
2589
2590/**
2591 * Obtain an iterator to the first GlobalAlias in a Module.
2592 *
2593 * @see llvm::Module::alias_begin()
2594 */
2596
2597/**
2598 * Obtain an iterator to the last GlobalAlias in a Module.
2599 *
2600 * @see llvm::Module::alias_end()
2601 */
2603
2604/**
2605 * Advance a GlobalAlias iterator to the next GlobalAlias.
2606 *
2607 * Returns NULL if the iterator was already at the end and there are no more
2608 * global aliases.
2609 */
2611
2612/**
2613 * Decrement a GlobalAlias iterator to the previous GlobalAlias.
2614 *
2615 * Returns NULL if the iterator was already at the beginning and there are
2616 * no previous global aliases.
2617 */
2619
2620/**
2621 * Retrieve the target value of an alias.
2622 */
2624
2625/**
2626 * Set the target value of an alias.
2627 */
2628void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee);
2629
2630/**
2631 * @}
2632 */
2633
2634/**
2635 * @defgroup LLVMCCoreValueFunction Function values
2636 *
2637 * Functions in this group operate on LLVMValueRef instances that
2638 * correspond to llvm::Function instances.
2639 *
2640 * @see llvm::Function
2641 *
2642 * @{
2643 */
2644
2645/**
2646 * Remove a function from its containing module and deletes it.
2647 *
2648 * @see llvm::Function::eraseFromParent()
2649 */
2651
2652/**
2653 * Check whether the given function has a personality function.
2654 *
2655 * @see llvm::Function::hasPersonalityFn()
2656 */
2658
2659/**
2660 * Obtain the personality function attached to the function.
2661 *
2662 * @see llvm::Function::getPersonalityFn()
2663 */
2665
2666/**
2667 * Set the personality function attached to the function.
2668 *
2669 * @see llvm::Function::setPersonalityFn()
2670 */
2671void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
2672
2673/**
2674 * Obtain the intrinsic ID number which matches the given function name.
2675 *
2676 * @see llvm::Function::lookupIntrinsicID()
2677 */
2678unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
2679
2680/**
2681 * Obtain the ID number from a function instance.
2682 *
2683 * @see llvm::Function::getIntrinsicID()
2684 */
2685unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
2686
2687/**
2688 * Create or insert the declaration of an intrinsic. For overloaded intrinsics,
2689 * parameter types must be provided to uniquely identify an overload.
2690 *
2691 * @see llvm::Intrinsic::getDeclaration()
2692 */
2694 unsigned ID,
2695 LLVMTypeRef *ParamTypes,
2696 size_t ParamCount);
2697
2698/**
2699 * Retrieves the type of an intrinsic. For overloaded intrinsics, parameter
2700 * types must be provided to uniquely identify an overload.
2701 *
2702 * @see llvm::Intrinsic::getType()
2703 */
2705 LLVMTypeRef *ParamTypes, size_t ParamCount);
2706
2707/**
2708 * Retrieves the name of an intrinsic.
2709 *
2710 * @see llvm::Intrinsic::getName()
2711 */
2712const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength);
2713
2714/** Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead. */
2715const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
2716 LLVMTypeRef *ParamTypes,
2717 size_t ParamCount,
2718 size_t *NameLength);
2719
2720/**
2721 * Copies the name of an overloaded intrinsic identified by a given list of
2722 * parameter types.
2723 *
2724 * Unlike LLVMIntrinsicGetName, the caller is responsible for freeing the
2725 * returned string.
2726 *
2727 * This version also supports unnamed types.
2728 *
2729 * @see llvm::Intrinsic::getName()
2730 */
2731const char *LLVMIntrinsicCopyOverloadedName2(LLVMModuleRef Mod, unsigned ID,
2732 LLVMTypeRef *ParamTypes,
2733 size_t ParamCount,
2734 size_t *NameLength);
2735
2736/**
2737 * Obtain if the intrinsic identified by the given ID is overloaded.
2738 *
2739 * @see llvm::Intrinsic::isOverloaded()
2740 */
2742
2743/**
2744 * Obtain the calling function of a function.
2745 *
2746 * The returned value corresponds to the LLVMCallConv enumeration.
2747 *
2748 * @see llvm::Function::getCallingConv()
2749 */
2751
2752/**
2753 * Set the calling convention of a function.
2754 *
2755 * @see llvm::Function::setCallingConv()
2756 *
2757 * @param Fn Function to operate on
2758 * @param CC LLVMCallConv to set calling convention to
2759 */
2760void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
2761
2762/**
2763 * Obtain the name of the garbage collector to use during code
2764 * generation.
2765 *
2766 * @see llvm::Function::getGC()
2767 */
2768const char *LLVMGetGC(LLVMValueRef Fn);
2769
2770/**
2771 * Define the garbage collector to use during code generation.
2772 *
2773 * @see llvm::Function::setGC()
2774 */
2775void LLVMSetGC(LLVMValueRef Fn, const char *Name);
2776
2777/**
2778 * Gets the prefix data associated with a function. Only valid on functions, and
2779 * only if LLVMHasPrefixData returns true.
2780 * See https://llvm.org/docs/LangRef.html#prefix-data
2781 */
2783
2784/**
2785 * Check if a given function has prefix data. Only valid on functions.
2786 * See https://llvm.org/docs/LangRef.html#prefix-data
2787 */
2789
2790/**
2791 * Sets the prefix data for the function. Only valid on functions.
2792 * See https://llvm.org/docs/LangRef.html#prefix-data
2793 */
2794void LLVMSetPrefixData(LLVMValueRef Fn, LLVMValueRef prefixData);
2795
2796/**
2797 * Gets the prologue data associated with a function. Only valid on functions,
2798 * and only if LLVMHasPrologueData returns true.
2799 * See https://llvm.org/docs/LangRef.html#prologue-data
2800 */
2802
2803/**
2804 * Check if a given function has prologue data. Only valid on functions.
2805 * See https://llvm.org/docs/LangRef.html#prologue-data
2806 */
2808
2809/**
2810 * Sets the prologue data for the function. Only valid on functions.
2811 * See https://llvm.org/docs/LangRef.html#prologue-data
2812 */
2813void LLVMSetPrologueData(LLVMValueRef Fn, LLVMValueRef prologueData);
2814
2815/**
2816 * Add an attribute to a function.
2817 *
2818 * @see llvm::Function::addAttribute()
2819 */
2824 LLVMAttributeRef *Attrs);
2827 unsigned KindID);
2830 const char *K, unsigned KLen);
2832 unsigned KindID);
2834 const char *K, unsigned KLen);
2835
2836/**
2837 * Add a target-dependent attribute to a function
2838 * @see llvm::AttrBuilder::addAttribute()
2839 */
2841 const char *V);
2842
2843/**
2844 * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
2845 *
2846 * Functions in this group relate to arguments/parameters on functions.
2847 *
2848 * Functions in this group expect LLVMValueRef instances that correspond
2849 * to llvm::Function instances.
2850 *
2851 * @{
2852 */
2853
2854/**
2855 * Obtain the number of parameters in a function.
2856 *
2857 * @see llvm::Function::arg_size()
2858 */
2859unsigned LLVMCountParams(LLVMValueRef Fn);
2860
2861/**
2862 * Obtain the parameters in a function.
2863 *
2864 * The takes a pointer to a pre-allocated array of LLVMValueRef that is
2865 * at least LLVMCountParams() long. This array will be filled with
2866 * LLVMValueRef instances which correspond to the parameters the
2867 * function receives. Each LLVMValueRef corresponds to a llvm::Argument
2868 * instance.
2869 *
2870 * @see llvm::Function::arg_begin()
2871 */
2872void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
2873
2874/**
2875 * Obtain the parameter at the specified index.
2876 *
2877 * Parameters are indexed from 0.
2878 *
2879 * @see llvm::Function::arg_begin()
2880 */
2882
2883/**
2884 * Obtain the function to which this argument belongs.
2885 *
2886 * Unlike other functions in this group, this one takes an LLVMValueRef
2887 * that corresponds to a llvm::Attribute.
2888 *
2889 * The returned LLVMValueRef is the llvm::Function to which this
2890 * argument belongs.
2891 */
2893
2894/**
2895 * Obtain the first parameter to a function.
2896 *
2897 * @see llvm::Function::arg_begin()
2898 */
2900
2901/**
2902 * Obtain the last parameter to a function.
2903 *
2904 * @see llvm::Function::arg_end()
2905 */
2907
2908/**
2909 * Obtain the next parameter to a function.
2910 *
2911 * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
2912 * actually a wrapped iterator) and obtains the next parameter from the
2913 * underlying iterator.
2914 */
2916
2917/**
2918 * Obtain the previous parameter to a function.
2919 *
2920 * This is the opposite of LLVMGetNextParam().
2921 */
2923
2924/**
2925 * Set the alignment for a function parameter.
2926 *
2927 * @see llvm::Argument::addAttr()
2928 * @see llvm::AttrBuilder::addAlignmentAttr()
2929 */
2930void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned Align);
2931
2932/**
2933 * @}
2934 */
2935
2936/**
2937 * @defgroup LLVMCCoreValueGlobalIFunc IFuncs
2938 *
2939 * Functions in this group relate to indirect functions.
2940 *
2941 * Functions in this group expect LLVMValueRef instances that correspond
2942 * to llvm::GlobalIFunc instances.
2943 *
2944 * @{
2945 */
2946
2947/**
2948 * Add a global indirect function to a module under a specified name.
2949 *
2950 * @see llvm::GlobalIFunc::create()
2951 */
2953 const char *Name, size_t NameLen,
2954 LLVMTypeRef Ty, unsigned AddrSpace,
2955 LLVMValueRef Resolver);
2956
2957/**
2958 * Obtain a GlobalIFunc value from a Module by its name.
2959 *
2960 * The returned value corresponds to a llvm::GlobalIFunc value.
2961 *
2962 * @see llvm::Module::getNamedIFunc()
2963 */
2965 const char *Name, size_t NameLen);
2966
2967/**
2968 * Obtain an iterator to the first GlobalIFunc in a Module.
2969 *
2970 * @see llvm::Module::ifunc_begin()
2971 */
2973
2974/**
2975 * Obtain an iterator to the last GlobalIFunc in a Module.
2976 *
2977 * @see llvm::Module::ifunc_end()
2978 */
2980
2981/**
2982 * Advance a GlobalIFunc iterator to the next GlobalIFunc.
2983 *
2984 * Returns NULL if the iterator was already at the end and there are no more
2985 * global aliases.
2986 */
2988
2989/**
2990 * Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
2991 *
2992 * Returns NULL if the iterator was already at the beginning and there are
2993 * no previous global aliases.
2994 */
2996
2997/**
2998 * Retrieves the resolver function associated with this indirect function, or
2999 * NULL if it doesn't not exist.
3000 *
3001 * @see llvm::GlobalIFunc::getResolver()
3002 */
3004
3005/**
3006 * Sets the resolver function associated with this indirect function.
3007 *
3008 * @see llvm::GlobalIFunc::setResolver()
3009 */
3011
3012/**
3013 * Remove a global indirect function from its parent module and delete it.
3014 *
3015 * @see llvm::GlobalIFunc::eraseFromParent()
3016 */
3018
3019/**
3020 * Remove a global indirect function from its parent module.
3021 *
3022 * This unlinks the global indirect function from its containing module but
3023 * keeps it alive.
3024 *
3025 * @see llvm::GlobalIFunc::removeFromParent()
3026 */
3028
3029/**
3030 * @}
3031 */
3032
3033/**
3034 * @}
3035 */
3036
3037/**
3038 * @}
3039 */
3040
3041/**
3042 * @}
3043 */
3044
3045/**
3046 * @defgroup LLVMCCoreValueMetadata Metadata
3047 *
3048 * @{
3049 */
3050
3051/**
3052 * Create an MDString value from a given string value.
3053 *
3054 * The MDString value does not take ownership of the given string, it remains
3055 * the responsibility of the caller to free it.
3056 *
3057 * @see llvm::MDString::get()
3058 */
3060 size_t SLen);
3061
3062/**
3063 * Create an MDNode value with the given array of operands.
3064 *
3065 * @see llvm::MDNode::get()
3066 */
3068 size_t Count);
3069
3070/**
3071 * Obtain a Metadata as a Value.
3072 */
3074
3075/**
3076 * Obtain a Value as a Metadata.
3077 */
3079
3080/**
3081 * Obtain the underlying string from a MDString value.
3082 *
3083 * @param V Instance to obtain string from.
3084 * @param Length Memory address which will hold length of returned string.
3085 * @return String data in MDString.
3086 */
3087const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length);
3088
3089/**
3090 * Obtain the number of operands from an MDNode value.
3091 *
3092 * @param V MDNode to get number of operands from.
3093 * @return Number of operands of the MDNode.
3094 */
3096
3097/**
3098 * Obtain the given MDNode's operands.
3099 *
3100 * The passed LLVMValueRef pointer should point to enough memory to hold all of
3101 * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
3102 * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
3103 * MDNode's operands.
3104 *
3105 * @param V MDNode to get the operands from.
3106 * @param Dest Destination array for operands.
3107 */
3109
3110/**
3111 * Replace an operand at a specific index in a llvm::MDNode value.
3112 *
3113 * @see llvm::MDNode::replaceOperandWith()
3114 */
3116 LLVMMetadataRef Replacement);
3117
3118/** Deprecated: Use LLVMMDStringInContext2 instead. */
3120 unsigned SLen);
3121/** Deprecated: Use LLVMMDStringInContext2 instead. */
3122LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
3123/** Deprecated: Use LLVMMDNodeInContext2 instead. */
3125 unsigned Count);
3126/** Deprecated: Use LLVMMDNodeInContext2 instead. */
3127LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
3128
3129/**
3130 * @}
3131 */
3132
3133/**
3134 * @defgroup LLVMCCoreOperandBundle Operand Bundles
3135 *
3136 * Functions in this group operate on LLVMOperandBundleRef instances that
3137 * correspond to llvm::OperandBundleDef instances.
3138 *
3139 * @see llvm::OperandBundleDef
3140 *
3141 * @{
3142 */
3143
3144/**
3145 * Create a new operand bundle.
3146 *
3147 * Every invocation should be paired with LLVMDisposeOperandBundle() or memory
3148 * will be leaked.
3149 *
3150 * @param Tag Tag name of the operand bundle
3151 * @param TagLen Length of Tag
3152 * @param Args Memory address of an array of bundle operands
3153 * @param NumArgs Length of Args
3154 */
3155LLVMOperandBundleRef LLVMCreateOperandBundle(const char *Tag, size_t TagLen,
3156 LLVMValueRef *Args,
3157 unsigned NumArgs);
3158
3159/**
3160 * Destroy an operand bundle.
3161 *
3162 * This must be called for every created operand bundle or memory will be
3163 * leaked.
3164 */
3166
3167/**
3168 * Obtain the tag of an operand bundle as a string.
3169 *
3170 * @param Bundle Operand bundle to obtain tag of.
3171 * @param Len Out parameter which holds the length of the returned string.
3172 * @return The tag name of Bundle.
3173 * @see OperandBundleDef::getTag()
3174 */
3175const char *LLVMGetOperandBundleTag(LLVMOperandBundleRef Bundle, size_t *Len);
3176
3177/**
3178 * Obtain the number of operands for an operand bundle.
3179 *
3180 * @param Bundle Operand bundle to obtain operand count of.
3181 * @return The number of operands.
3182 * @see OperandBundleDef::input_size()
3183 */
3185
3186/**
3187 * Obtain the operand for an operand bundle at the given index.
3188 *
3189 * @param Bundle Operand bundle to obtain operand of.
3190 * @param Index An operand index, must be less than
3191 * LLVMGetNumOperandBundleArgs().
3192 * @return The operand.
3193 */
3195 unsigned Index);
3196
3197/**
3198 * @}
3199 */
3200
3201/**
3202 * @defgroup LLVMCCoreValueBasicBlock Basic Block
3203 *
3204 * A basic block represents a single entry single exit section of code.
3205 * Basic blocks contain a list of instructions which form the body of
3206 * the block.
3207 *
3208 * Basic blocks belong to functions. They have the type of label.
3209 *
3210 * Basic blocks are themselves values. However, the C API models them as
3211 * LLVMBasicBlockRef.
3212 *
3213 * @see llvm::BasicBlock
3214 *
3215 * @{
3216 */
3217
3218/**
3219 * Convert a basic block instance to a value type.
3220 */
3222
3223/**
3224 * Determine whether an LLVMValueRef is itself a basic block.
3225 */
3227
3228/**
3229 * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
3230 */
3232
3233/**
3234 * Obtain the string name of a basic block.
3235 */
3237
3238/**
3239 * Obtain the function to which a basic block belongs.
3240 *
3241 * @see llvm::BasicBlock::getParent()
3242 */
3244
3245/**
3246 * Obtain the terminator instruction for a basic block.
3247 *
3248 * If the basic block does not have a terminator (it is not well-formed
3249 * if it doesn't), then NULL is returned.
3250 *
3251 * The returned LLVMValueRef corresponds to an llvm::Instruction.
3252 *
3253 * @see llvm::BasicBlock::getTerminator()
3254 */
3256
3257/**
3258 * Obtain the number of basic blocks in a function.
3259 *
3260 * @param Fn Function value to operate on.
3261 */
3263
3264/**
3265 * Obtain all of the basic blocks in a function.
3266 *
3267 * This operates on a function value. The BasicBlocks parameter is a
3268 * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
3269 * LLVMCountBasicBlocks() in length. This array is populated with
3270 * LLVMBasicBlockRef instances.
3271 */
3273
3274/**
3275 * Obtain the first basic block in a function.
3276 *
3277 * The returned basic block can be used as an iterator. You will likely
3278 * eventually call into LLVMGetNextBasicBlock() with it.
3279 *
3280 * @see llvm::Function::begin()
3281 */
3283
3284/**
3285 * Obtain the last basic block in a function.
3286 *
3287 * @see llvm::Function::end()
3288 */
3290
3291/**
3292 * Advance a basic block iterator.
3293 */
3295
3296/**
3297 * Go backwards in a basic block iterator.
3298 */
3300
3301/**
3302 * Obtain the basic block that corresponds to the entry point of a
3303 * function.
3304 *
3305 * @see llvm::Function::getEntryBlock()
3306 */
3308
3309/**
3310 * Insert the given basic block after the insertion point of the given builder.
3311 *
3312 * The insertion point must be valid.
3313 *
3314 * @see llvm::Function::BasicBlockListType::insertAfter()
3315 */
3318
3319/**
3320 * Append the given basic block to the basic block list of the given function.
3321 *
3322 * @see llvm::Function::BasicBlockListType::push_back()
3323 */
3326
3327/**
3328 * Create a new basic block without inserting it into a function.
3329 *
3330 * @see llvm::BasicBlock::Create()
3331 */
3333 const char *Name);
3334
3335/**
3336 * Append a basic block to the end of a function.
3337 *
3338 * @see llvm::BasicBlock::Create()
3339 */
3341 LLVMValueRef Fn,
3342 const char *Name);
3343
3344/**
3345 * Append a basic block to the end of a function using the global
3346 * context.
3347 *
3348 * @see llvm::BasicBlock::Create()
3349 */
3351
3352/**
3353 * Insert a basic block in a function before another basic block.
3354 *
3355 * The function to add to is determined by the function of the
3356 * passed basic block.
3357 *
3358 * @see llvm::BasicBlock::Create()
3359 */
3362 const char *Name);
3363
3364/**
3365 * Insert a basic block in a function using the global context.
3366 *
3367 * @see llvm::BasicBlock::Create()
3368 */
3370 const char *Name);
3371
3372/**
3373 * Remove a basic block from a function and delete it.
3374 *
3375 * This deletes the basic block from its containing function and deletes
3376 * the basic block itself.
3377 *
3378 * @see llvm::BasicBlock::eraseFromParent()
3379 */
3381
3382/**
3383 * Remove a basic block from a function.
3384 *
3385 * This deletes the basic block from its containing function but keep
3386 * the basic block alive.
3387 *
3388 * @see llvm::BasicBlock::removeFromParent()
3389 */
3391
3392/**
3393 * Move a basic block to before another one.
3394 *
3395 * @see llvm::BasicBlock::moveBefore()
3396 */
3398
3399/**
3400 * Move a basic block to after another one.
3401 *
3402 * @see llvm::BasicBlock::moveAfter()
3403 */
3405
3406/**
3407 * Obtain the first instruction in a basic block.
3408 *
3409 * The returned LLVMValueRef corresponds to a llvm::Instruction
3410 * instance.
3411 */
3413
3414/**
3415 * Obtain the last instruction in a basic block.
3416 *
3417 * The returned LLVMValueRef corresponds to an LLVM:Instruction.
3418 */
3420
3421/**
3422 * @}
3423 */
3424
3425/**
3426 * @defgroup LLVMCCoreValueInstruction Instructions
3427 *
3428 * Functions in this group relate to the inspection and manipulation of
3429 * individual instructions.
3430 *
3431 * In the C++ API, an instruction is modeled by llvm::Instruction. This
3432 * class has a large number of descendents. llvm::Instruction is a
3433 * llvm::Value and in the C API, instructions are modeled by
3434 * LLVMValueRef.
3435 *
3436 * This group also contains sub-groups which operate on specific
3437 * llvm::Instruction types, e.g. llvm::CallInst.
3438 *
3439 * @{
3440 */
3441
3442/**
3443 * Determine whether an instruction has any metadata attached.
3444 */
3446
3447/**
3448 * Return metadata associated with an instruction value.
3449 */
3450LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
3451
3452/**
3453 * Set metadata associated with an instruction value.
3454 */
3455void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
3456
3457/**
3458 * Returns the metadata associated with an instruction value, but filters out
3459 * all the debug locations.
3460 *
3461 * @see llvm::Instruction::getAllMetadataOtherThanDebugLoc()
3462 */
3465 size_t *NumEntries);
3466
3467/**
3468 * Obtain the basic block to which an instruction belongs.
3469 *
3470 * @see llvm::Instruction::getParent()
3471 */
3473
3474/**
3475 * Obtain the instruction that occurs after the one specified.
3476 *
3477 * The next instruction will be from the same basic block.
3478 *
3479 * If this is the last instruction in a basic block, NULL will be
3480 * returned.
3481 */
3483
3484/**
3485 * Obtain the instruction that occurred before this one.
3486 *
3487 * If the instruction is the first instruction in a basic block, NULL
3488 * will be returned.
3489 */
3491
3492/**
3493 * Remove an instruction.
3494 *
3495 * The instruction specified is removed from its containing building
3496 * block but is kept alive.
3497 *
3498 * @see llvm::Instruction::removeFromParent()
3499 */
3501
3502/**
3503 * Remove and delete an instruction.
3504 *
3505 * The instruction specified is removed from its containing building
3506 * block and then deleted.
3507 *
3508 * @see llvm::Instruction::eraseFromParent()
3509 */
3511
3512/**
3513 * Delete an instruction.
3514 *
3515 * The instruction specified is deleted. It must have previously been
3516 * removed from its containing building block.
3517 *
3518 * @see llvm::Value::deleteValue()
3519 */
3521
3522/**
3523 * Obtain the code opcode for an individual instruction.
3524 *
3525 * @see llvm::Instruction::getOpCode()
3526 */
3528
3529/**
3530 * Obtain the predicate of an instruction.
3531 *
3532 * This is only valid for instructions that correspond to llvm::ICmpInst
3533 * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
3534 *
3535 * @see llvm::ICmpInst::getPredicate()
3536 */
3538
3539/**
3540 * Obtain the float predicate of an instruction.
3541 *
3542 * This is only valid for instructions that correspond to llvm::FCmpInst
3543 * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
3544 *
3545 * @see llvm::FCmpInst::getPredicate()
3546 */
3548
3549/**
3550 * Create a copy of 'this' instruction that is identical in all ways
3551 * except the following:
3552 * * The instruction has no parent
3553 * * The instruction has no name
3554 *
3555 * @see llvm::Instruction::clone()
3556 */
3558
3559/**
3560 * Determine whether an instruction is a terminator. This routine is named to
3561 * be compatible with historical functions that did this by querying the
3562 * underlying C++ type.
3563 *
3564 * @see llvm::Instruction::isTerminator()
3565 */
3567
3568/**
3569 * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
3570 *
3571 * Functions in this group apply to instructions that refer to call
3572 * sites and invocations. These correspond to C++ types in the
3573 * llvm::CallInst class tree.
3574 *
3575 * @{
3576 */
3577
3578/**
3579 * Obtain the argument count for a call instruction.
3580 *
3581 * This expects an LLVMValueRef that corresponds to a llvm::CallInst,
3582 * llvm::InvokeInst, or llvm:FuncletPadInst.
3583 *
3584 * @see llvm::CallInst::getNumArgOperands()
3585 * @see llvm::InvokeInst::getNumArgOperands()
3586 * @see llvm::FuncletPadInst::getNumArgOperands()
3587 */
3588unsigned LLVMGetNumArgOperands(LLVMValueRef Instr);
3589
3590/**
3591 * Set the calling convention for a call instruction.
3592 *
3593 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3594 * llvm::InvokeInst.
3595 *
3596 * @see llvm::CallInst::setCallingConv()
3597 * @see llvm::InvokeInst::setCallingConv()
3598 */
3599void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
3600
3601/**
3602 * Obtain the calling convention for a call instruction.
3603 *
3604 * This is the opposite of LLVMSetInstructionCallConv(). Reads its
3605 * usage.
3606 *
3607 * @see LLVMSetInstructionCallConv()
3608 */
3610
3612 unsigned Align);
3613
3618 LLVMAttributeRef *Attrs);
3621 unsigned KindID);
3624 const char *K, unsigned KLen);
3626 unsigned KindID);
3628 const char *K, unsigned KLen);
3629
3630/**
3631 * Obtain the function type called by this instruction.
3632 *
3633 * @see llvm::CallBase::getFunctionType()
3634 */
3636
3637/**
3638 * Obtain the pointer to the function invoked by this instruction.
3639 *
3640 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3641 * llvm::InvokeInst.
3642 *
3643 * @see llvm::CallInst::getCalledOperand()
3644 * @see llvm::InvokeInst::getCalledOperand()
3645 */
3647
3648/**
3649 * Obtain the number of operand bundles attached to this instruction.
3650 *
3651 * This only works on llvm::CallInst and llvm::InvokeInst instructions.
3652 *
3653 * @see llvm::CallBase::getNumOperandBundles()
3654 */
3656
3657/**
3658 * Obtain the operand bundle attached to this instruction at the given index.
3659 * Use LLVMDisposeOperandBundle to free the operand bundle.
3660 *
3661 * This only works on llvm::CallInst and llvm::InvokeInst instructions.
3662 */
3664 unsigned Index);
3665
3666/**
3667 * Obtain whether a call instruction is a tail call.
3668 *
3669 * This only works on llvm::CallInst instructions.
3670 *
3671 * @see llvm::CallInst::isTailCall()
3672 */
3674
3675/**
3676 * Set whether a call instruction is a tail call.
3677 *
3678 * This only works on llvm::CallInst instructions.
3679 *
3680 * @see llvm::CallInst::setTailCall()
3681 */
3682void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
3683
3684/**
3685 * Obtain a tail call kind of the call instruction.
3686 *
3687 * @see llvm::CallInst::setTailCallKind()
3688 */
3690
3691/**
3692 * Set the call kind of the call instruction.
3693 *
3694 * @see llvm::CallInst::getTailCallKind()
3695 */
3697
3698/**
3699 * Return the normal destination basic block.
3700 *
3701 * This only works on llvm::InvokeInst instructions.
3702 *
3703 * @see llvm::InvokeInst::getNormalDest()
3704 */
3706
3707/**
3708 * Return the unwind destination basic block.
3709 *
3710 * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3711 * llvm::CatchSwitchInst instructions.
3712 *
3713 * @see llvm::InvokeInst::getUnwindDest()
3714 * @see llvm::CleanupReturnInst::getUnwindDest()
3715 * @see llvm::CatchSwitchInst::getUnwindDest()
3716 */
3718
3719/**
3720 * Set the normal destination basic block.
3721 *
3722 * This only works on llvm::InvokeInst instructions.
3723 *
3724 * @see llvm::InvokeInst::setNormalDest()
3725 */
3727
3728/**
3729 * Set the unwind destination basic block.
3730 *
3731 * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3732 * llvm::CatchSwitchInst instructions.
3733 *
3734 * @see llvm::InvokeInst::setUnwindDest()
3735 * @see llvm::CleanupReturnInst::setUnwindDest()
3736 * @see llvm::CatchSwitchInst::setUnwindDest()
3737 */
3739
3740/**
3741 * Get the default destination of a CallBr instruction.
3742 *
3743 * @see llvm::CallBrInst::getDefaultDest()
3744 */
3746
3747/**
3748 * Get the number of indirect destinations of a CallBr instruction.
3749 *
3750 * @see llvm::CallBrInst::getNumIndirectDests()
3751
3752 */
3754
3755/**
3756 * Get the indirect destination of a CallBr instruction at the given index.
3757 *
3758 * @see llvm::CallBrInst::getIndirectDest()
3759 */
3761
3762/**
3763 * @}
3764 */
3765
3766/**
3767 * @defgroup LLVMCCoreValueInstructionTerminator Terminators
3768 *
3769 * Functions in this group only apply to instructions for which
3770 * LLVMIsATerminatorInst returns true.
3771 *
3772 * @{
3773 */
3774
3775/**
3776 * Return the number of successors that this terminator has.
3777 *
3778 * @see llvm::Instruction::getNumSuccessors
3779 */
3780unsigned LLVMGetNumSuccessors(LLVMValueRef Term);
3781
3782/**
3783 * Return the specified successor.
3784 *
3785 * @see llvm::Instruction::getSuccessor
3786 */
3788
3789/**
3790 * Update the specified successor to point at the provided block.
3791 *
3792 * @see llvm::Instruction::setSuccessor
3793 */
3795
3796/**
3797 * Return if a branch is conditional.
3798 *
3799 * This only works on llvm::BranchInst instructions.
3800 *
3801 * @see llvm::BranchInst::isConditional
3802 */
3804
3805/**
3806 * Return the condition of a branch instruction.
3807 *
3808 * This only works on llvm::BranchInst instructions.
3809 *
3810 * @see llvm::BranchInst::getCondition
3811 */
3813
3814/**
3815 * Set the condition of a branch instruction.
3816 *
3817 * This only works on llvm::BranchInst instructions.
3818 *
3819 * @see llvm::BranchInst::setCondition
3820 */
3822
3823/**
3824 * Obtain the default destination basic block of a switch instruction.
3825 *
3826 * This only works on llvm::SwitchInst instructions.
3827 *
3828 * @see llvm::SwitchInst::getDefaultDest()
3829 */
3831
3832/**
3833 * @}
3834 */
3835
3836/**
3837 * @defgroup LLVMCCoreValueInstructionAlloca Allocas
3838 *
3839 * Functions in this group only apply to instructions that map to
3840 * llvm::AllocaInst instances.
3841 *
3842 * @{
3843 */
3844
3845/**
3846 * Obtain the type that is being allocated by the alloca instruction.
3847 */
3849
3850/**
3851 * @}
3852 */
3853
3854/**
3855 * @defgroup LLVMCCoreValueInstructionGetElementPointer GEPs
3856 *
3857 * Functions in this group only apply to instructions that map to
3858 * llvm::GetElementPtrInst instances.
3859 *
3860 * @{
3861 */
3862
3863/**
3864 * Check whether the given GEP operator is inbounds.
3865 */
3867
3868/**
3869 * Set the given GEP instruction to be inbounds or not.
3870 */
3872
3873/**
3874 * Get the source element type of the given GEP operator.
3875 */
3877
3878/**
3879 * @}
3880 */
3881
3882/**
3883 * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
3884 *
3885 * Functions in this group only apply to instructions that map to
3886 * llvm::PHINode instances.
3887 *
3888 * @{
3889 */
3890
3891/**
3892 * Add an incoming value to the end of a PHI list.
3893 */
3894void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3895 LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
3896
3897/**
3898 * Obtain the number of incoming basic blocks to a PHI node.
3899 */
3900unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
3901
3902/**
3903 * Obtain an incoming value to a PHI node as an LLVMValueRef.
3904 */
3906
3907/**
3908 * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
3909 */
3911
3912/**
3913 * @}
3914 */
3915
3916/**
3917 * @defgroup LLVMCCoreValueInstructionExtractValue ExtractValue
3918 * @defgroup LLVMCCoreValueInstructionInsertValue InsertValue
3919 *
3920 * Functions in this group only apply to instructions that map to
3921 * llvm::ExtractValue and llvm::InsertValue instances.
3922 *
3923 * @{
3924 */
3925
3926/**
3927 * Obtain the number of indices.
3928 * NB: This also works on GEP operators.
3929 */
3930unsigned LLVMGetNumIndices(LLVMValueRef Inst);
3931
3932/**
3933 * Obtain the indices as an array.
3934 */
3935const unsigned *LLVMGetIndices(LLVMValueRef Inst);
3936
3937/**
3938 * @}
3939 */
3940
3941/**
3942 * @}
3943 */
3944
3945/**
3946 * @}
3947 */
3948
3949/**
3950 * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
3951 *
3952 * An instruction builder represents a point within a basic block and is
3953 * the exclusive means of building instructions using the C interface.
3954 *
3955 * @{
3956 */
3957
3961 LLVMValueRef Instr);
3968 const char *Name);
3970
3971/* Metadata */
3972
3973/**
3974 * Get location information used by debugging information.
3975 *
3976 * @see llvm::IRBuilder::getCurrentDebugLocation()
3977 */
3979
3980/**
3981 * Set location information used by debugging information.
3982 *
3983 * To clear the location metadata of the given instruction, pass NULL to \p Loc.
3984 *
3985 * @see llvm::IRBuilder::SetCurrentDebugLocation()
3986 */
3988
3989/**
3990 * Attempts to set the debug location for the given instruction using the
3991 * current debug location for the given builder. If the builder has no current
3992 * debug location, this function is a no-op.
3993 *
3994 * @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general
3995 * LLVMAddMetadataToInst.
3996 *
3997 * @see llvm::IRBuilder::SetInstDebugLocation()
3998 */
4000
4001/**
4002 * Adds the metadata registered with the given builder to the given instruction.
4003 *
4004 * @see llvm::IRBuilder::AddMetadataToInst()
4005 */
4007
4008/**
4009 * Get the dafult floating-point math metadata for a given builder.
4010 *
4011 * @see llvm::IRBuilder::getDefaultFPMathTag()
4012 */
4014
4015/**
4016 * Set the default floating-point math metadata for the given builder.
4017 *
4018 * To clear the metadata, pass NULL to \p FPMathTag.
4019 *
4020 * @see llvm::IRBuilder::setDefaultFPMathTag()
4021 */
4023 LLVMMetadataRef FPMathTag);
4024
4025/**
4026 * Deprecated: Passing the NULL location will crash.
4027 * Use LLVMGetCurrentDebugLocation2 instead.
4028 */
4030/**
4031 * Deprecated: Returning the NULL location will crash.
4032 * Use LLVMGetCurrentDebugLocation2 instead.
4033 */
4035
4036/* Terminators */
4040 unsigned N);
4045 LLVMBasicBlockRef Else, unsigned NumCases);
4047 unsigned NumDests);
4049 LLVMBasicBlockRef DefaultDest,
4050 LLVMBasicBlockRef *IndirectDests,
4051 unsigned NumIndirectDests, LLVMValueRef *Args,
4052 unsigned NumArgs, LLVMOperandBundleRef *Bundles,
4053 unsigned NumBundles, const char *Name);
4055 LLVMValueRef *Args, unsigned NumArgs,
4057 const char *Name);
4060 unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
4061 LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name);
4063
4064/* Exception Handling */
4067 LLVMValueRef PersFn, unsigned NumClauses,
4068 const char *Name);
4074 LLVMValueRef *Args, unsigned NumArgs,
4075 const char *Name);
4077 LLVMValueRef *Args, unsigned NumArgs,
4078 const char *Name);
4080 LLVMBasicBlockRef UnwindBB,
4081 unsigned NumHandlers, const char *Name);
4082
4083/* Add a case to the switch instruction */
4084void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
4085 LLVMBasicBlockRef Dest);
4086
4087/* Add a destination to the indirectbr instruction */
4089
4090/* Get the number of clauses on the landingpad instruction */
4091unsigned LLVMGetNumClauses(LLVMValueRef LandingPad);
4092
4093/* Get the value of the clause at index Idx on the landingpad instruction */
4094LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx);
4095
4096/* Add a catch or filter clause to the landingpad instruction */
4097void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
4098
4099/* Get the 'cleanup' flag in the landingpad instruction */
4101
4102/* Set the 'cleanup' flag in the landingpad instruction */
4103void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
4104
4105/* Add a destination to the catchswitch instruction */
4106void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest);
4107
4108/* Get the number of handlers on the catchswitch instruction */
4109unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch);
4110
4111/**
4112 * Obtain the basic blocks acting as handlers for a catchswitch instruction.
4113 *
4114 * The Handlers parameter should point to a pre-allocated array of
4115 * LLVMBasicBlockRefs at least LLVMGetNumHandlers() large. On return, the
4116 * first LLVMGetNumHandlers() entries in the array will be populated
4117 * with LLVMBasicBlockRef instances.
4118 *
4119 * @param CatchSwitch The catchswitch instruction to operate on.
4120 * @param Handlers Memory address of an array to be filled with basic blocks.
4121 */
4122void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers);
4123
4124/* Funclets */
4125
4126/* Get the number of funcletpad arguments. */
4127LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i);
4128
4129/* Set a funcletpad argument at the given index. */
4130void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value);
4131
4132/**
4133 * Get the parent catchswitch instruction of a catchpad instruction.
4134 *
4135 * This only works on llvm::CatchPadInst instructions.
4136 *
4137 * @see llvm::CatchPadInst::getCatchSwitch()
4138 */
4140
4141/**
4142 * Set the parent catchswitch instruction of a catchpad instruction.
4143 *
4144 * This only works on llvm::CatchPadInst instructions.
4145 *
4146 * @see llvm::CatchPadInst::setCatchSwitch()
4147 */
4148void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch);
4149
4150/* Arithmetic */
4152 const char *Name);
4154 const char *Name);
4156 const char *Name);
4158 const char *Name);
4160 const char *Name);
4162 const char *Name);
4164 const char *Name);
4166 const char *Name);
4168 const char *Name);
4170 const char *Name);
4172 const char *Name);
4174 const char *Name);
4176 const char *Name);
4178 const char *Name);
4180 const char *Name);
4182 const char *Name);
4184 const char *Name);
4186 const char *Name);
4188 const char *Name);
4190 const char *Name);
4192 const char *Name);
4194 const char *Name);
4196 const char *Name);
4198 const char *Name);
4200 const char *Name);
4202 const char *Name);
4205 const char *Name);
4208 const char *Name);
4210 LLVMValueRef V,
4211 const char *Name),
4212 "Use LLVMBuildNeg + LLVMSetNUW instead.");
4215
4217void LLVMSetNUW(LLVMValueRef ArithInst, LLVMBool HasNUW);
4219void LLVMSetNSW(LLVMValueRef ArithInst, LLVMBool HasNSW);
4220LLVMBool LLVMGetExact(LLVMValueRef DivOrShrInst);
4221void LLVMSetExact(LLVMValueRef DivOrShrInst, LLVMBool IsExact);
4222
4223/**
4224 * Gets if the instruction has the non-negative flag set.
4225 * Only valid for zext instructions.
4226 */
4228/**
4229 * Sets the non-negative flag for the instruction.
4230 * Only valid for zext instructions.
4231 */
4232void LLVMSetNNeg(LLVMValueRef NonNegInst, LLVMBool IsNonNeg);
4233
4234/**
4235 * Get the flags for which fast-math-style optimizations are allowed for this
4236 * value.
4237 *
4238 * Only valid on floating point instructions.
4239 * @see LLVMCanValueUseFastMathFlags
4240 */
4242
4243/**
4244 * Sets the flags for which fast-math-style optimizations are allowed for this
4245 * value.
4246 *
4247 * Only valid on floating point instructions.
4248 * @see LLVMCanValueUseFastMathFlags
4249 */
4251
4252/**
4253 * Check if a given value can potentially have fast math flags.
4254 *
4255 * Will return true for floating point arithmetic instructions, and for select,
4256 * phi, and call instructions whose type is a floating point type, or a vector
4257 * or array thereof. See https://llvm.org/docs/LangRef.html#fast-math-flags
4258 */
4260
4261/**
4262 * Gets whether the instruction has the disjoint flag set.
4263 * Only valid for or instructions.
4264 */
4266/**
4267 * Sets the disjoint flag for the instruction.
4268 * Only valid for or instructions.
4269 */
4270void LLVMSetIsDisjoint(LLVMValueRef Inst, LLVMBool IsDisjoint);
4271
4272/* Memory */
4275 LLVMValueRef Val, const char *Name);
4276
4277/**
4278 * Creates and inserts a memset to the specified pointer and the
4279 * specified value.
4280 *
4281 * @see llvm::IRRBuilder::CreateMemSet()
4282 */
4284 LLVMValueRef Val, LLVMValueRef Len,
4285 unsigned Align);
4286/**
4287 * Creates and inserts a memcpy between the specified pointers.
4288 *
4289 * @see llvm::IRRBuilder::CreateMemCpy()
4290 */
4292 LLVMValueRef Dst, unsigned DstAlign,
4293 LLVMValueRef Src, unsigned SrcAlign,
4295/**
4296 * Creates and inserts a memmove between the specified pointers.
4297 *
4298 * @see llvm::IRRBuilder::CreateMemMove()
4299 */
4301 LLVMValueRef Dst, unsigned DstAlign,
4302 LLVMValueRef Src, unsigned SrcAlign,
4304
4307 LLVMValueRef Val, const char *Name);
4310 LLVMValueRef PointerVal, const char *Name);
4313 LLVMValueRef Pointer, LLVMValueRef *Indices,
4314 unsigned NumIndices, const char *Name);
4316 LLVMValueRef Pointer, LLVMValueRef *Indices,
4317 unsigned NumIndices, const char *Name);
4319 LLVMValueRef Pointer, unsigned Idx,
4320 const char *Name);
4322 const char *Name);
4324 const char *Name);
4325LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
4326void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
4327LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst);
4328void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool IsWeak);
4330void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering);
4332void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst, LLVMAtomicRMWBinOp BinOp);
4333
4334/* Casts */
4336 LLVMTypeRef DestTy, const char *Name);
4338 LLVMTypeRef DestTy, const char *Name);
4340 LLVMTypeRef DestTy, const char *Name);
4342 LLVMTypeRef DestTy, const char *Name);
4344 LLVMTypeRef DestTy, const char *Name);
4346 LLVMTypeRef DestTy, const char *Name);
4348 LLVMTypeRef DestTy, const char *Name);
4350 LLVMTypeRef DestTy, const char *Name);
4352 LLVMTypeRef DestTy, const char *Name);
4354 LLVMTypeRef DestTy, const char *Name);
4356 LLVMTypeRef DestTy, const char *Name);
4358 LLVMTypeRef DestTy, const char *Name);
4360 LLVMTypeRef DestTy, const char *Name);
4362 LLVMTypeRef DestTy, const char *Name);
4364 LLVMTypeRef DestTy, const char *Name);
4366 LLVMTypeRef DestTy, const char *Name);
4368 LLVMTypeRef DestTy, const char *Name);
4370 LLVMTypeRef DestTy, const char *Name);
4372 LLVMTypeRef DestTy, LLVMBool IsSigned,
4373 const char *Name);
4375 LLVMTypeRef DestTy, const char *Name);
4376
4377/** Deprecated: This cast is always signed. Use LLVMBuildIntCast2 instead. */
4379 LLVMTypeRef DestTy, const char *Name);
4380
4382 LLVMTypeRef DestTy, LLVMBool DestIsSigned);
4383
4384/* Comparisons */
4387 const char *Name);
4390 const char *Name);
4391
4392/* Miscellaneous instructions */
4395 LLVMValueRef *Args, unsigned NumArgs,
4396 const char *Name);
4399 LLVMValueRef *Args, unsigned NumArgs,
4400 LLVMOperandBundleRef *Bundles,
4401 unsigned NumBundles, const char *Name);
4403 LLVMValueRef Then, LLVMValueRef Else,
4404 const char *Name);
4406 const char *Name);
4408 LLVMValueRef Index, const char *Name);
4411 const char *Name);
4413 LLVMValueRef V2, LLVMValueRef Mask,
4414 const char *Name);
4416 unsigned Index, const char *Name);
4418 LLVMValueRef EltVal, unsigned Index,
4419 const char *Name);
4421 const char *Name);
4422
4424 const char *Name);
4426 const char *Name);
4429 const char *Name);
4431 LLVMBool singleThread, const char *Name);
4433 LLVMValueRef PTR, LLVMValueRef Val,
4434 LLVMAtomicOrdering ordering,
4435 LLVMBool singleThread);
4437 LLVMValueRef Cmp, LLVMValueRef New,
4438 LLVMAtomicOrdering SuccessOrdering,
4439 LLVMAtomicOrdering FailureOrdering,
4441
4442/**
4443 * Get the number of elements in the mask of a ShuffleVector instruction.
4444 */
4445unsigned LLVMGetNumMaskElements(LLVMValueRef ShuffleVectorInst);
4446
4447/**
4448 * \returns a constant that specifies that the result of a \c ShuffleVectorInst
4449 * is undefined.
4450 */
4451int LLVMGetUndefMaskElem(void);
4452
4453/**
4454 * Get the mask value at position Elt in the mask of a ShuffleVector
4455 * instruction.
4456 *
4457 * \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is
4458 * poison at that position.
4459 */
4460int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt);
4461
4464
4467 LLVMAtomicOrdering Ordering);
4470 LLVMAtomicOrdering Ordering);
4471
4472/**
4473 * @}
4474 */
4475
4476/**
4477 * @defgroup LLVMCCoreModuleProvider Module Providers
4478 *
4479 * @{
4480 */
4481
4482/**
4483 * Changes the type of M so it can be passed to FunctionPassManagers and the
4484 * JIT. They take ModuleProviders for historical reasons.
4485 */
4488
4489/**
4490 * Destroys the module M.
4491 */
4493
4494/**
4495 * @}
4496 */
4497
4498/**
4499 * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
4500 *
4501 * @{
4502 */
4503
4505 LLVMMemoryBufferRef *OutMemBuf,
4506 char **OutMessage);
4508 char **OutMessage);
4510 size_t InputDataLength,
4511 const char *BufferName,
4512 LLVMBool RequiresNullTerminator);
4514 size_t InputDataLength,
4515 const char *BufferName);
4516const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
4519
4520/**
4521 * @}
4522 */
4523
4524/**
4525 * @defgroup LLVMCCorePassManagers Pass Managers
4526 * @ingroup LLVMCCore
4527 *
4528 * @{
4529 */
4530
4531/** Constructs a new whole-module pass pipeline. This type of pipeline is
4532 suitable for link-time optimization and whole-module transformations.
4533 @see llvm::PassManager::PassManager */
4535
4536/** Constructs a new function-by-function pass pipeline over the module
4537 provider. It does not take ownership of the module provider. This type of
4538 pipeline is suitable for code generation and JIT compilation tasks.
4539 @see llvm::FunctionPassManager::FunctionPassManager */
4541
4542/** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
4544
4545/** Initializes, executes on the provided module, and finalizes all of the
4546 passes scheduled in the pass manager. Returns 1 if any of the passes
4547 modified the module, 0 otherwise.
4548 @see llvm::PassManager::run(Module&) */
4550
4551/** Initializes all of the function passes scheduled in the function pass
4552 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4553 @see llvm::FunctionPassManager::doInitialization */
4555
4556/** Executes all of the function passes scheduled in the function pass manager
4557 on the provided function. Returns 1 if any of the passes modified the
4558 function, false otherwise.
4559 @see llvm::FunctionPassManager::run(Function&) */
4561
4562/** Finalizes all of the function passes scheduled in the function pass
4563 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4564 @see llvm::FunctionPassManager::doFinalization */
4566
4567/** Frees the memory of a pass pipeline. For function pipelines, does not free
4568 the module provider.
4569 @see llvm::PassManagerBase::~PassManagerBase. */
4571
4572/**
4573 * @}
4574 */
4575
4576/**
4577 * @defgroup LLVMCCoreThreading Threading
4578 *
4579 * Handle the structures needed to make LLVM safe for multithreading.
4580 *
4581 * @{
4582 */
4583
4584/** Deprecated: Multi-threading can only be enabled/disabled with the compile
4585 time define LLVM_ENABLE_THREADS. This function always returns
4586 LLVMIsMultithreaded(). */
4588
4589/** Deprecated: Multi-threading can only be enabled/disabled with the compile
4590 time define LLVM_ENABLE_THREADS. */
4591void LLVMStopMultithreaded(void);
4592
4593/** Check whether LLVM is executing in thread-safe mode or not.
4594 @see llvm::llvm_is_multithreaded */
4596
4597/**
4598 * @}
4599 */
4600
4601/**
4602 * @}
4603 */
4604
4605/**
4606 * @}
4607 */
4608
4610
4611#endif /* LLVM_C_CORE_H */
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Given that RA is a live value
#define LLVM_ATTRIBUTE_C_DEPRECATED(decl, message)
Definition: Deprecated.h:34
uint64_t Align
uint64_t Addr
std::string Name
uint32_t Index
uint64_t Size
#define LLVM_C_EXTERN_C_BEGIN
Definition: ExternC.h:35
#define LLVM_C_EXTERN_C_END
Definition: ExternC.h:36
#define op(i)
Hexagon Common GEP
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition: Core.cpp:1586
LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3623
LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal)
Definition: Core.cpp:1684
static cl::opt< bool > SingleThread("licm-force-thread-model-single", cl::Hidden, cl::init(false), cl::desc("Force thread model single in LICM pass"))
#define F(x, y, z)
Definition: MD5.cpp:55
Module * Mod
const SmallVectorImpl< MachineOperand > & Cond
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
unify loop Fixup each natural loop to have a single exit block
Value * RHS
Value * LHS
LLVMContextRef LLVMGetGlobalContext(void)
Obtain the global context instance.
Definition: Core.cpp:101
unsigned LLVMGetEnumAttributeKind(LLVMAttributeRef A)
Get the unique id corresponding to the enum attribute passed as argument.
Definition: Core.cpp:164
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition: Core.cpp:132
uint64_t LLVMGetEnumAttributeValue(LLVMAttributeRef A)
Get the enum attribute's value.
Definition: Core.cpp:168
LLVMTypeRef LLVMGetTypeAttributeValue(LLVMAttributeRef A)
Get the type attribute's value.
Definition: Core.cpp:182
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition: Core.cpp:140
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition: Core.cpp:246
char * LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI)
Return a string representation of the DiagnosticInfo.
Definition: Core.cpp:235
unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen)
Return an unique id given the name of a enum attribute, or 0 if no attribute by that name exists.
Definition: Core.cpp:149
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition: Core.cpp:112
LLVMBool LLVMContextShouldDiscardValueNames(LLVMContextRef C)
Retrieve whether the given context is set to discard all value names.
Definition: Core.cpp:128
LLVMAttributeRef LLVMCreateTypeAttribute(LLVMContextRef C, unsigned KindID, LLVMTypeRef type_ref)
Create a type attribute.
Definition: Core.cpp:175
LLVMAttributeRef LLVMCreateStringAttribute(LLVMContextRef C, const char *K, unsigned KLength, const char *V, unsigned VLength)
Create a string attribute.
Definition: Core.cpp:201
LLVMAttributeRef LLVMCreateConstantRangeAttribute(LLVMContextRef C, unsigned KindID, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[])
Create a ConstantRange attribute.
Definition: Core.cpp:187
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
Definition: Core.cpp:136
LLVMAttributeRef LLVMCreateEnumAttribute(LLVMContextRef C, unsigned KindID, uint64_t Val)
Create an enum attribute.
Definition: Core.cpp:157
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition: Core.cpp:208
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition: Core.cpp:854
LLVMContextRef LLVMContextCreate(void)
Create a new context.
Definition: Core.cpp:97
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition: Core.h:550
unsigned LLVMGetLastEnumAttributeKind(void)
Definition: Core.cpp:153
LLVMBool LLVMIsStringAttribute(LLVMAttributeRef A)
Definition: Core.cpp:227
LLVMBool LLVMIsTypeAttribute(LLVMAttributeRef A)
Definition: Core.cpp:231
const char * LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's value.
Definition: Core.cpp:215
void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback, void *OpaqueHandle)
Set the yield callback function for this context.
Definition: Core.cpp:121
unsigned LLVMGetMDKindID(const char *Name, unsigned SLen)
Definition: Core.cpp:145
void LLVMContextSetDiagnosticHandler(LLVMContextRef C, LLVMDiagnosticHandler Handler, void *DiagnosticContext)
Set the diagnostic handler for this context.
Definition: Core.cpp:103
void(* LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *)
Definition: Core.h:549
void * LLVMContextGetDiagnosticContext(LLVMContextRef C)
Get the diagnostic context of this context.
Definition: Core.cpp:117
LLVMBool LLVMIsEnumAttribute(LLVMAttributeRef A)
Check for the different types of attributes.
Definition: Core.cpp:222
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition: Core.cpp:3764
LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str, const char *Name)
Definition: Core.cpp:3897
LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering, LLVMBool singleThread, const char *Name)
Definition: Core.cpp:3861
LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op, LLVMValueRef PTR, LLVMValueRef Val, LLVMAtomicOrdering ordering, LLVMBool singleThread)
Definition: Core.cpp:4198
LLVMBool LLVMGetIsDisjoint(LLVMValueRef Inst)
Gets whether the instruction has the disjoint flag set.
Definition: Core.cpp:3695
LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3635
LLVMValueRef LLVMBuildInvokeWithOperandBundles(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch, LLVMOperandBundleRef *Bundles, unsigned NumBundles, const char *Name)
Definition: Core.cpp:3305
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3502