LLVM  14.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/ErrorHandling.h"
19 #include "llvm-c/ExternC.h"
20 #include "llvm-c/Types.h"
21 
23 
24 /**
25  * @defgroup LLVMC LLVM-C: C interface to LLVM
26  *
27  * This module exposes parts of the LLVM library as a C API.
28  *
29  * @{
30  */
31 
32 /**
33  * @defgroup LLVMCTransforms Transforms
34  */
35 
36 /**
37  * @defgroup LLVMCCore Core
38  *
39  * This modules provide an interface to libLLVMCore, which implements
40  * the LLVM intermediate representation as well as other related types
41  * and utilities.
42  *
43  * Many exotic languages can interoperate with C code but have a harder time
44  * with C++ due to name mangling. So in addition to C, this interface enables
45  * tools written in such languages.
46  *
47  * @{
48  */
49 
50 /**
51  * @defgroup LLVMCCoreTypes Types and Enumerations
52  *
53  * @{
54  */
55 
56 /// External users depend on the following values being stable. It is not safe
57 /// to reorder them.
58 typedef enum {
59  /* Terminator Instructions */
60  LLVMRet = 1,
61  LLVMBr = 2,
65  /* removed 6 due to API changes */
67  LLVMCallBr = 67,
68 
69  /* Standard Unary Operators */
70  LLVMFNeg = 66,
71 
72  /* Standard Binary Operators */
73  LLVMAdd = 8,
74  LLVMFAdd = 9,
75  LLVMSub = 10,
76  LLVMFSub = 11,
77  LLVMMul = 12,
78  LLVMFMul = 13,
79  LLVMUDiv = 14,
80  LLVMSDiv = 15,
81  LLVMFDiv = 16,
82  LLVMURem = 17,
83  LLVMSRem = 18,
84  LLVMFRem = 19,
85 
86  /* Logical Operators */
87  LLVMShl = 20,
88  LLVMLShr = 21,
89  LLVMAShr = 22,
90  LLVMAnd = 23,
91  LLVMOr = 24,
92  LLVMXor = 25,
93 
94  /* Memory Operators */
95  LLVMAlloca = 26,
96  LLVMLoad = 27,
97  LLVMStore = 28,
99 
100  /* Cast Operators */
101  LLVMTrunc = 30,
102  LLVMZExt = 31,
103  LLVMSExt = 32,
109  LLVMFPExt = 38,
114 
115  /* Other Operators */
116  LLVMICmp = 42,
117  LLVMFCmp = 43,
118  LLVMPHI = 44,
119  LLVMCall = 45,
123  LLVMVAArg = 49,
130 
131  /* Atomic operators */
132  LLVMFence = 55,
135 
136  /* Exception Handling Operators */
144 } LLVMOpcode;
145 
146 typedef enum {
147  LLVMVoidTypeKind, /**< type with no size */
148  LLVMHalfTypeKind, /**< 16 bit floating point type */
149  LLVMFloatTypeKind, /**< 32 bit floating point type */
150  LLVMDoubleTypeKind, /**< 64 bit floating point type */
151  LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */
152  LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/
153  LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */
154  LLVMLabelTypeKind, /**< Labels */
155  LLVMIntegerTypeKind, /**< Arbitrary bit width integers */
156  LLVMFunctionTypeKind, /**< Functions */
157  LLVMStructTypeKind, /**< Structures */
158  LLVMArrayTypeKind, /**< Arrays */
159  LLVMPointerTypeKind, /**< Pointers */
160  LLVMVectorTypeKind, /**< Fixed width SIMD vector type */
161  LLVMMetadataTypeKind, /**< Metadata */
162  LLVMX86_MMXTypeKind, /**< X86 MMX */
163  LLVMTokenTypeKind, /**< Tokens */
164  LLVMScalableVectorTypeKind, /**< Scalable SIMD vector type */
165  LLVMBFloatTypeKind, /**< 16 bit brain floating point type */
166  LLVMX86_AMXTypeKind /**< X86 AMX */
167 } LLVMTypeKind;
168 
169 typedef enum {
170  LLVMExternalLinkage, /**< Externally visible function */
172  LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
173  LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
174  equivalent. */
176  LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
177  LLVMWeakODRLinkage, /**< Same, but only replaced by something
178  equivalent. */
179  LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
180  LLVMInternalLinkage, /**< Rename collisions when linking (static
181  functions) */
182  LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
183  LLVMDLLImportLinkage, /**< Obsolete */
184  LLVMDLLExportLinkage, /**< Obsolete */
185  LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
186  LLVMGhostLinkage, /**< Obsolete */
187  LLVMCommonLinkage, /**< Tentative definitions */
188  LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
189  LLVMLinkerPrivateWeakLinkage /**< Like LinkerPrivate, but is weak. */
190 } LLVMLinkage;
191 
192 typedef enum {
193  LLVMDefaultVisibility, /**< The GV is visible */
194  LLVMHiddenVisibility, /**< The GV is hidden */
195  LLVMProtectedVisibility /**< The GV is protected */
197 
198 typedef enum {
199  LLVMNoUnnamedAddr, /**< Address of the GV is significant. */
200  LLVMLocalUnnamedAddr, /**< Address of the GV is locally insignificant. */
201  LLVMGlobalUnnamedAddr /**< Address of the GV is globally insignificant. */
203 
204 typedef enum {
206  LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
207  LLVMDLLExportStorageClass = 2 /**< Function to be accessible from DLL. */
209 
210 typedef enum {
253 } LLVMCallConv;
254 
255 typedef enum {
261 
271 
280 
283 
286 } LLVMValueKind;
287 
288 typedef enum {
289  LLVMIntEQ = 32, /**< equal */
290  LLVMIntNE, /**< not equal */
291  LLVMIntUGT, /**< unsigned greater than */
292  LLVMIntUGE, /**< unsigned greater or equal */
293  LLVMIntULT, /**< unsigned less than */
294  LLVMIntULE, /**< unsigned less or equal */
295  LLVMIntSGT, /**< signed greater than */
296  LLVMIntSGE, /**< signed greater or equal */
297  LLVMIntSLT, /**< signed less than */
298  LLVMIntSLE /**< signed less or equal */
300 
301 typedef enum {
302  LLVMRealPredicateFalse, /**< Always false (always folded) */
303  LLVMRealOEQ, /**< True if ordered and equal */
304  LLVMRealOGT, /**< True if ordered and greater than */
305  LLVMRealOGE, /**< True if ordered and greater than or equal */
306  LLVMRealOLT, /**< True if ordered and less than */
307  LLVMRealOLE, /**< True if ordered and less than or equal */
308  LLVMRealONE, /**< True if ordered and operands are unequal */
309  LLVMRealORD, /**< True if ordered (no nans) */
310  LLVMRealUNO, /**< True if unordered: isnan(X) | isnan(Y) */
311  LLVMRealUEQ, /**< True if unordered or equal */
312  LLVMRealUGT, /**< True if unordered or greater than */
313  LLVMRealUGE, /**< True if unordered, greater than, or equal */
314  LLVMRealULT, /**< True if unordered or less than */
315  LLVMRealULE, /**< True if unordered, less than, or equal */
316  LLVMRealUNE, /**< True if unordered or not equal */
317  LLVMRealPredicateTrue /**< Always true (always folded) */
319 
320 typedef enum {
321  LLVMLandingPadCatch, /**< A catch clause */
322  LLVMLandingPadFilter /**< A filter clause */
324 
325 typedef enum {
332 
333 typedef enum {
334  LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */
335  LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees
336  somewhat sane results, lock free. */
337  LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the
338  operations affecting a specific address,
339  a consistent ordering exists */
340  LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort
341  necessary to acquire a lock to access other
342  memory with normal loads and stores. */
343  LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with
344  a barrier of the sort necessary to release
345  a lock. */
346  LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a
347  Release barrier (for fences and
348  operations which both read and write
349  memory). */
350  LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics
351  for loads and Release
352  semantics for stores.
353  Additionally, it guarantees
354  that a total ordering exists
355  between all
356  SequentiallyConsistent
357  operations. */
359 
360 typedef enum {
361  LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
362  LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
363  LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
364  LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
365  LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
366  LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
367  LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
368  LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
369  original using a signed comparison and return
370  the old one */
371  LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
372  original using a signed comparison and return
373  the old one */
374  LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
375  original using an unsigned comparison and return
376  the old one */
377  LLVMAtomicRMWBinOpUMin, /**< Sets the value if it's greater than the
378  original using an unsigned comparison and return
379  the old one */
380  LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the
381  old one */
382  LLVMAtomicRMWBinOpFSub /**< Subtract a floating point value and return the
383  old one */
385 
386 typedef enum {
392 
393 typedef enum {
397 
398 typedef enum {
399  /**
400  * Emits an error if two values disagree, otherwise the resulting value is
401  * that of the operands.
402  *
403  * @see Module::ModFlagBehavior::Error
404  */
406  /**
407  * Emits a warning if two values disagree. The result value will be the
408  * operand for the flag from the first module being linked.
409  *
410  * @see Module::ModFlagBehavior::Warning
411  */
413  /**
414  * Adds a requirement that another module flag be present and have a
415  * specified value after linking is performed. The value must be a metadata
416  * pair, where the first element of the pair is the ID of the module flag
417  * to be restricted, and the second element of the pair is the value the
418  * module flag should be restricted to. This behavior can be used to
419  * restrict the allowable results (via triggering of an error) of linking
420  * IDs with the **Override** behavior.
421  *
422  * @see Module::ModFlagBehavior::Require
423  */
425  /**
426  * Uses the specified value, regardless of the behavior or value of the
427  * other module. If both modules specify **Override**, but the values
428  * differ, an error will be emitted.
429  *
430  * @see Module::ModFlagBehavior::Override
431  */
433  /**
434  * Appends the two values, which are required to be metadata nodes.
435  *
436  * @see Module::ModFlagBehavior::Append
437  */
439  /**
440  * Appends the two values, which are required to be metadata
441  * nodes. However, duplicate entries in the second list are dropped
442  * during the append operation.
443  *
444  * @see Module::ModFlagBehavior::AppendUnique
445  */
448 
449 /**
450  * Attribute index are either LLVMAttributeReturnIndex,
451  * LLVMAttributeFunctionIndex or a parameter number from 1 to N.
452  */
453 enum {
455  // ISO C restricts enumerator values to range of 'int'
456  // (4294967295 is too large)
457  // LLVMAttributeFunctionIndex = ~0U,
459 };
460 
461 typedef unsigned LLVMAttributeIndex;
462 
463 /**
464  * @}
465  */
466 
468 
469 /** Deallocate and destroy all ManagedStatic variables.
470  @see llvm::llvm_shutdown
471  @see ManagedStatic */
472 void LLVMShutdown(void);
473 
474 /*===-- Error handling ----------------------------------------------------===*/
475 
476 char *LLVMCreateMessage(const char *Message);
477 void LLVMDisposeMessage(char *Message);
478 
479 /**
480  * @defgroup LLVMCCoreContext Contexts
481  *
482  * Contexts are execution states for the core LLVM IR system.
483  *
484  * Most types are tied to a context instance. Multiple contexts can
485  * exist simultaneously. A single context is not thread safe. However,
486  * different contexts can execute on different threads simultaneously.
487  *
488  * @{
489  */
490 
492 typedef void (*LLVMYieldCallback)(LLVMContextRef, void *);
493 
494 /**
495  * Create a new context.
496  *
497  * Every call to this function should be paired with a call to
498  * LLVMContextDispose() or the context will leak memory.
499  */
501 
502 /**
503  * Obtain the global context instance.
504  */
506 
507 /**
508  * Set the diagnostic handler for this context.
509  */
511  LLVMDiagnosticHandler Handler,
512  void *DiagnosticContext);
513 
514 /**
515  * Get the diagnostic handler of this context.
516  */
518 
519 /**
520  * Get the diagnostic context of this context.
521  */
523 
524 /**
525  * Set the yield callback function for this context.
526  *
527  * @see LLVMContext::setYieldCallback()
528  */
530  void *OpaqueHandle);
531 
532 /**
533  * Retrieve whether the given context is set to discard all value names.
534  *
535  * @see LLVMContext::shouldDiscardValueNames()
536  */
538 
539 /**
540  * Set whether the given context discards all value names.
541  *
542  * If true, only the names of GlobalValue objects will be available in the IR.
543  * This can be used to save memory and runtime, especially in release mode.
544  *
545  * @see LLVMContext::setDiscardValueNames()
546  */
548 
549 /**
550  * Destroy a context instance.
551  *
552  * This should be called for every call to LLVMContextCreate() or memory
553  * will be leaked.
554  */
556 
557 /**
558  * Return a string representation of the DiagnosticInfo. Use
559  * LLVMDisposeMessage to free the string.
560  *
561  * @see DiagnosticInfo::print()
562  */
564 
565 /**
566  * Return an enum LLVMDiagnosticSeverity.
567  *
568  * @see DiagnosticInfo::getSeverity()
569  */
571 
572 unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
573  unsigned SLen);
574 unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
575 
576 /**
577  * Return an unique id given the name of a enum attribute,
578  * or 0 if no attribute by that name exists.
579  *
580  * See http://llvm.org/docs/LangRef.html#parameter-attributes
581  * and http://llvm.org/docs/LangRef.html#function-attributes
582  * for the list of available attributes.
583  *
584  * NB: Attribute names and/or id are subject to change without
585  * going through the C API deprecation cycle.
586  */
587 unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen);
588 unsigned LLVMGetLastEnumAttributeKind(void);
589 
590 /**
591  * Create an enum attribute.
592  */
594  uint64_t Val);
595 
596 /**
597  * Get the unique id corresponding to the enum attribute
598  * passed as argument.
599  */
601 
602 /**
603  * Get the enum attribute's value. 0 is returned if none exists.
604  */
606 
607 /**
608  * Create a type attribute
609  */
611  LLVMTypeRef type_ref);
612 
613 /**
614  * Get the type attribute's value.
615  */
617 
618 /**
619  * Create a string attribute.
620  */
622  const char *K, unsigned KLength,
623  const char *V, unsigned VLength);
624 
625 /**
626  * Get the string attribute's kind.
627  */
628 const char *LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length);
629 
630 /**
631  * Get the string attribute's value.
632  */
633 const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
634 
635 /**
636  * Check for the different types of attributes.
637  */
641 
642 /**
643  * Obtain a Type from a context by its registered name.
644  */
646 
647 /**
648  * @}
649  */
650 
651 /**
652  * @defgroup LLVMCCoreModule Modules
653  *
654  * Modules represent the top-level structure in an LLVM program. An LLVM
655  * module is effectively a translation unit or a collection of
656  * translation units merged together.
657  *
658  * @{
659  */
660 
661 /**
662  * Create a new, empty module in the global context.
663  *
664  * This is equivalent to calling LLVMModuleCreateWithNameInContext with
665  * LLVMGetGlobalContext() as the context parameter.
666  *
667  * Every invocation should be paired with LLVMDisposeModule() or memory
668  * will be leaked.
669  */
670 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
671 
672 /**
673  * Create a new, empty module in a specific context.
674  *
675  * Every invocation should be paired with LLVMDisposeModule() or memory
676  * will be leaked.
677  */
679  LLVMContextRef C);
680 /**
681  * Return an exact copy of the specified module.
682  */
684 
685 /**
686  * Destroy a module instance.
687  *
688  * This must be called for every created module or memory will be
689  * leaked.
690  */
692 
693 /**
694  * Obtain the identifier of a module.
695  *
696  * @param M Module to obtain identifier of
697  * @param Len Out parameter which holds the length of the returned string.
698  * @return The identifier of M.
699  * @see Module::getModuleIdentifier()
700  */
701 const char *LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len);
702 
703 /**
704  * Set the identifier of a module to a string Ident with length Len.
705  *
706  * @param M The module to set identifier
707  * @param Ident The string to set M's identifier to
708  * @param Len Length of Ident
709  * @see Module::setModuleIdentifier()
710  */
711 void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len);
712 
713 /**
714  * Obtain the module's original source file name.
715  *
716  * @param M Module to obtain the name of
717  * @param Len Out parameter which holds the length of the returned string
718  * @return The original source file name of M
719  * @see Module::getSourceFileName()
720  */
721 const char *LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len);
722 
723 /**
724  * Set the original source file name of a module to a string Name with length
725  * Len.
726  *
727  * @param M The module to set the source file name of
728  * @param Name The string to set M's source file name to
729  * @param Len Length of Name
730  * @see Module::setSourceFileName()
731  */
732 void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len);
733 
734 /**
735  * Obtain the data layout for a module.
736  *
737  * @see Module::getDataLayoutStr()
738  *
739  * LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect,
740  * but match the name of another method on the module. Prefer the use
741  * of LLVMGetDataLayoutStr, which is not ambiguous.
742  */
744 const char *LLVMGetDataLayout(LLVMModuleRef M);
745 
746 /**
747  * Set the data layout for a module.
748  *
749  * @see Module::setDataLayout()
750  */
751 void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr);
752 
753 /**
754  * Obtain the target triple for a module.
755  *
756  * @see Module::getTargetTriple()
757  */
758 const char *LLVMGetTarget(LLVMModuleRef M);
759 
760 /**
761  * Set the target triple for a module.
762  *
763  * @see Module::setTargetTriple()
764  */
765 void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
766 
767 /**
768  * Returns the module flags as an array of flag-key-value triples. The caller
769  * is responsible for freeing this array by calling
770  * \c LLVMDisposeModuleFlagsMetadata.
771  *
772  * @see Module::getModuleFlagsMetadata()
773  */
775 
776 /**
777  * Destroys module flags metadata entries.
778  */
780 
781 /**
782  * Returns the flag behavior for a module flag entry at a specific index.
783  *
784  * @see Module::ModuleFlagEntry::Behavior
785  */
788  unsigned Index);
789 
790 /**
791  * Returns the key for a module flag entry at a specific index.
792  *
793  * @see Module::ModuleFlagEntry::Key
794  */
796  unsigned Index, size_t *Len);
797 
798 /**
799  * Returns the metadata for a module flag entry at a specific index.
800  *
801  * @see Module::ModuleFlagEntry::Val
802  */
804  unsigned Index);
805 
806 /**
807  * Add a module-level flag to the module-level flags metadata if it doesn't
808  * already exist.
809  *
810  * @see Module::getModuleFlag()
811  */
813  const char *Key, size_t KeyLen);
814 
815 /**
816  * Add a module-level flag to the module-level flags metadata if it doesn't
817  * already exist.
818  *
819  * @see Module::addModuleFlag()
820  */
822  const char *Key, size_t KeyLen,
823  LLVMMetadataRef Val);
824 
825 /**
826  * Dump a representation of a module to stderr.
827  *
828  * @see Module::dump()
829  */
831 
832 /**
833  * Print a representation of a module to a file. The ErrorMessage needs to be
834  * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
835  *
836  * @see Module::print()
837  */
838 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
839  char **ErrorMessage);
840 
841 /**
842  * Return a string representation of the module. Use
843  * LLVMDisposeMessage to free the string.
844  *
845  * @see Module::print()
846  */
848 
849 /**
850  * Get inline assembly for a module.
851  *
852  * @see Module::getModuleInlineAsm()
853  */
854 const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len);
855 
856 /**
857  * Set inline assembly for a module.
858  *
859  * @see Module::setModuleInlineAsm()
860  */
861 void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len);
862 
863 /**
864  * Append inline assembly to a module.
865  *
866  * @see Module::appendModuleInlineAsm()
867  */
868 void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len);
869 
870 /**
871  * Create the specified uniqued inline asm string.
872  *
873  * @see InlineAsm::get()
874  */
875 LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, char *AsmString,
876  size_t AsmStringSize, char *Constraints,
877  size_t ConstraintsSize, LLVMBool HasSideEffects,
878  LLVMBool IsAlignStack,
879  LLVMInlineAsmDialect Dialect, LLVMBool CanThrow);
880 
881 /**
882  * Obtain the context to which this module is associated.
883  *
884  * @see Module::getContext()
885  */
887 
888 /** Deprecated: Use LLVMGetTypeByName2 instead. */
890 
891 /**
892  * Obtain an iterator to the first NamedMDNode in a Module.
893  *
894  * @see llvm::Module::named_metadata_begin()
895  */
897 
898 /**
899  * Obtain an iterator to the last NamedMDNode in a Module.
900  *
901  * @see llvm::Module::named_metadata_end()
902  */
904 
905 /**
906  * Advance a NamedMDNode iterator to the next NamedMDNode.
907  *
908  * Returns NULL if the iterator was already at the end and there are no more
909  * named metadata nodes.
910  */
912 
913 /**
914  * Decrement a NamedMDNode iterator to the previous NamedMDNode.
915  *
916  * Returns NULL if the iterator was already at the beginning and there are
917  * no previous named metadata nodes.
918  */
920 
921 /**
922  * Retrieve a NamedMDNode with the given name, returning NULL if no such
923  * node exists.
924  *
925  * @see llvm::Module::getNamedMetadata()
926  */
928  const char *Name, size_t NameLen);
929 
930 /**
931  * Retrieve a NamedMDNode with the given name, creating a new node if no such
932  * node exists.
933  *
934  * @see llvm::Module::getOrInsertNamedMetadata()
935  */
937  const char *Name,
938  size_t NameLen);
939 
940 /**
941  * Retrieve the name of a NamedMDNode.
942  *
943  * @see llvm::NamedMDNode::getName()
944  */
945 const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NamedMD,
946  size_t *NameLen);
947 
948 /**
949  * Obtain the number of operands for named metadata in a module.
950  *
951  * @see llvm::Module::getNamedMetadata()
952  */
953 unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name);
954 
955 /**
956  * Obtain the named metadata operands for a module.
957  *
958  * The passed LLVMValueRef pointer should refer to an array of
959  * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
960  * array will be populated with the LLVMValueRef instances. Each
961  * instance corresponds to a llvm::MDNode.
962  *
963  * @see llvm::Module::getNamedMetadata()
964  * @see llvm::MDNode::getOperand()
965  */
967  LLVMValueRef *Dest);
968 
969 /**
970  * Add an operand to named metadata.
971  *
972  * @see llvm::Module::getNamedMetadata()
973  * @see llvm::MDNode::addOperand()
974  */
976  LLVMValueRef Val);
977 
978 /**
979  * Return the directory of the debug location for this value, which must be
980  * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
981  *
982  * @see llvm::Instruction::getDebugLoc()
983  * @see llvm::GlobalVariable::getDebugInfo()
984  * @see llvm::Function::getSubprogram()
985  */
986 const char *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length);
987 
988 /**
989  * Return the filename of the debug location for this value, which must be
990  * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
991  *
992  * @see llvm::Instruction::getDebugLoc()
993  * @see llvm::GlobalVariable::getDebugInfo()
994  * @see llvm::Function::getSubprogram()
995  */
996 const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length);
997 
998 /**
999  * Return the line number of the debug location for this value, which must be
1000  * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1001  *
1002  * @see llvm::Instruction::getDebugLoc()
1003  * @see llvm::GlobalVariable::getDebugInfo()
1004  * @see llvm::Function::getSubprogram()
1005  */
1006 unsigned LLVMGetDebugLocLine(LLVMValueRef Val);
1007 
1008 /**
1009  * Return the column number of the debug location for this value, which must be
1010  * an llvm::Instruction.
1011  *
1012  * @see llvm::Instruction::getDebugLoc()
1013  */
1014 unsigned LLVMGetDebugLocColumn(LLVMValueRef Val);
1015 
1016 /**
1017  * Add a function to a module under a specified name.
1018  *
1019  * @see llvm::Function::Create()
1020  */
1022  LLVMTypeRef FunctionTy);
1023 
1024 /**
1025  * Obtain a Function value from a Module by its name.
1026  *
1027  * The returned value corresponds to a llvm::Function value.
1028  *
1029  * @see llvm::Module::getFunction()
1030  */
1032 
1033 /**
1034  * Obtain an iterator to the first Function in a Module.
1035  *
1036  * @see llvm::Module::begin()
1037  */
1039 
1040 /**
1041  * Obtain an iterator to the last Function in a Module.
1042  *
1043  * @see llvm::Module::end()
1044  */
1046 
1047 /**
1048  * Advance a Function iterator to the next Function.
1049  *
1050  * Returns NULL if the iterator was already at the end and there are no more
1051  * functions.
1052  */
1054 
1055 /**
1056  * Decrement a Function iterator to the previous Function.
1057  *
1058  * Returns NULL if the iterator was already at the beginning and there are
1059  * no previous functions.
1060  */
1062 
1063 /** Deprecated: Use LLVMSetModuleInlineAsm2 instead. */
1064 void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
1065 
1066 /**
1067  * @}
1068  */
1069 
1070 /**
1071  * @defgroup LLVMCCoreType Types
1072  *
1073  * Types represent the type of a value.
1074  *
1075  * Types are associated with a context instance. The context internally
1076  * deduplicates types so there is only 1 instance of a specific type
1077  * alive at a time. In other words, a unique type is shared among all
1078  * consumers within a context.
1079  *
1080  * A Type in the C API corresponds to llvm::Type.
1081  *
1082  * Types have the following hierarchy:
1083  *
1084  * types:
1085  * integer type
1086  * real type
1087  * function type
1088  * sequence types:
1089  * array type
1090  * pointer type
1091  * vector type
1092  * void type
1093  * label type
1094  * opaque type
1095  *
1096  * @{
1097  */
1098 
1099 /**
1100  * Obtain the enumerated type of a Type instance.
1101  *
1102  * @see llvm::Type:getTypeID()
1103  */
1105 
1106 /**
1107  * Whether the type has a known size.
1108  *
1109  * Things that don't have a size are abstract types, labels, and void.a
1110  *
1111  * @see llvm::Type::isSized()
1112  */
1114 
1115 /**
1116  * Obtain the context to which this type instance is associated.
1117  *
1118  * @see llvm::Type::getContext()
1119  */
1121 
1122 /**
1123  * Dump a representation of a type to stderr.
1124  *
1125  * @see llvm::Type::dump()
1126  */
1127 void LLVMDumpType(LLVMTypeRef Val);
1128 
1129 /**
1130  * Return a string representation of the type. Use
1131  * LLVMDisposeMessage to free the string.
1132  *
1133  * @see llvm::Type::print()
1134  */
1136 
1137 /**
1138  * @defgroup LLVMCCoreTypeInt Integer Types
1139  *
1140  * Functions in this section operate on integer types.
1141  *
1142  * @{
1143  */
1144 
1145 /**
1146  * Obtain an integer type from a context with specified bit width.
1147  */
1155 
1156 /**
1157  * Obtain an integer type from the global context with a specified bit
1158  * width.
1159  */
1166 LLVMTypeRef LLVMIntType(unsigned NumBits);
1167 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
1168 
1169 /**
1170  * @}
1171  */
1172 
1173 /**
1174  * @defgroup LLVMCCoreTypeFloat Floating Point Types
1175  *
1176  * @{
1177  */
1178 
1179 /**
1180  * Obtain a 16-bit floating point type from a context.
1181  */
1183 
1184 /**
1185  * Obtain a 16-bit brain floating point type from a context.
1186  */
1188 
1189 /**
1190  * Obtain a 32-bit floating point type from a context.
1191  */
1193 
1194 /**
1195  * Obtain a 64-bit floating point type from a context.
1196  */
1198 
1199 /**
1200  * Obtain a 80-bit floating point type (X87) from a context.
1201  */
1203 
1204 /**
1205  * Obtain a 128-bit floating point type (112-bit mantissa) from a
1206  * context.
1207  */
1209 
1210 /**
1211  * Obtain a 128-bit floating point type (two 64-bits) from a context.
1212  */
1214 
1215 /**
1216  * Obtain a floating point type from the global context.
1217  *
1218  * These map to the functions in this group of the same name.
1219  */
1227 
1228 /**
1229  * @}
1230  */
1231 
1232 /**
1233  * @defgroup LLVMCCoreTypeFunction Function Types
1234  *
1235  * @{
1236  */
1237 
1238 /**
1239  * Obtain a function type consisting of a specified signature.
1240  *
1241  * The function is defined as a tuple of a return Type, a list of
1242  * parameter types, and whether the function is variadic.
1243  */
1245  LLVMTypeRef *ParamTypes, unsigned ParamCount,
1246  LLVMBool IsVarArg);
1247 
1248 /**
1249  * Returns whether a function type is variadic.
1250  */
1252 
1253 /**
1254  * Obtain the Type this function Type returns.
1255  */
1257 
1258 /**
1259  * Obtain the number of parameters this function accepts.
1260  */
1261 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
1262 
1263 /**
1264  * Obtain the types of a function's parameters.
1265  *
1266  * The Dest parameter should point to a pre-allocated array of
1267  * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
1268  * first LLVMCountParamTypes() entries in the array will be populated
1269  * with LLVMTypeRef instances.
1270  *
1271  * @param FunctionTy The function type to operate on.
1272  * @param Dest Memory address of an array to be filled with result.
1273  */
1274 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
1275 
1276 /**
1277  * @}
1278  */
1279 
1280 /**
1281  * @defgroup LLVMCCoreTypeStruct Structure Types
1282  *
1283  * These functions relate to LLVMTypeRef instances.
1284  *
1285  * @see llvm::StructType
1286  *
1287  * @{
1288  */
1289 
1290 /**
1291  * Create a new structure type in a context.
1292  *
1293  * A structure is specified by a list of inner elements/types and
1294  * whether these can be packed together.
1295  *
1296  * @see llvm::StructType::create()
1297  */
1299  unsigned ElementCount, LLVMBool Packed);
1300 
1301 /**
1302  * Create a new structure type in the global context.
1303  *
1304  * @see llvm::StructType::create()
1305  */
1306 LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
1307  LLVMBool Packed);
1308 
1309 /**
1310  * Create an empty structure in a context having a specified name.
1311  *
1312  * @see llvm::StructType::create()
1313  */
1315 
1316 /**
1317  * Obtain the name of a structure.
1318  *
1319  * @see llvm::StructType::getName()
1320  */
1321 const char *LLVMGetStructName(LLVMTypeRef Ty);
1322 
1323 /**
1324  * Set the contents of a structure type.
1325  *
1326  * @see llvm::StructType::setBody()
1327  */
1328 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
1329  unsigned ElementCount, LLVMBool Packed);
1330 
1331 /**
1332  * Get the number of elements defined inside the structure.
1333  *
1334  * @see llvm::StructType::getNumElements()
1335  */
1336 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
1337 
1338 /**
1339  * Get the elements within a structure.
1340  *
1341  * The function is passed the address of a pre-allocated array of
1342  * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
1343  * invocation, this array will be populated with the structure's
1344  * elements. The objects in the destination array will have a lifetime
1345  * of the structure type itself, which is the lifetime of the context it
1346  * is contained in.
1347  */
1348 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
1349 
1350 /**
1351  * Get the type of the element at a given index in the structure.
1352  *
1353  * @see llvm::StructType::getTypeAtIndex()
1354  */
1356 
1357 /**
1358  * Determine whether a structure is packed.
1359  *
1360  * @see llvm::StructType::isPacked()
1361  */
1363 
1364 /**
1365  * Determine whether a structure is opaque.
1366  *
1367  * @see llvm::StructType::isOpaque()
1368  */
1370 
1371 /**
1372  * Determine whether a structure is literal.
1373  *
1374  * @see llvm::StructType::isLiteral()
1375  */
1377 
1378 /**
1379  * @}
1380  */
1381 
1382 /**
1383  * @defgroup LLVMCCoreTypeSequential Sequential Types
1384  *
1385  * Sequential types represents "arrays" of types. This is a super class
1386  * for array, vector, and pointer types.
1387  *
1388  * @{
1389  */
1390 
1391 /**
1392  * Obtain the type of elements within a sequential type.
1393  *
1394  * This works on array, vector, and pointer types.
1395  *
1396  * @see llvm::SequentialType::getElementType()
1397  */
1399 
1400 /**
1401  * Returns type's subtypes
1402  *
1403  * @see llvm::Type::subtypes()
1404  */
1405 void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr);
1406 
1407 /**
1408  * Return the number of types in the derived type.
1409  *
1410  * @see llvm::Type::getNumContainedTypes()
1411  */
1413 
1414 /**
1415  * Create a fixed size array type that refers to a specific type.
1416  *
1417  * The created type will exist in the context that its element type
1418  * exists in.
1419  *
1420  * @see llvm::ArrayType::get()
1421  */
1422 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
1423 
1424 /**
1425  * Obtain the length of an array type.
1426  *
1427  * This only works on types that represent arrays.
1428  *
1429  * @see llvm::ArrayType::getNumElements()
1430  */
1431 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
1432 
1433 /**
1434  * Create a pointer type that points to a defined type.
1435  *
1436  * The created type will exist in the context that its pointee type
1437  * exists in.
1438  *
1439  * @see llvm::PointerType::get()
1440  */
1441 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
1442 
1443 /**
1444  * Obtain the address space of a pointer type.
1445  *
1446  * This only works on types that represent pointers.
1447  *
1448  * @see llvm::PointerType::getAddressSpace()
1449  */
1451 
1452 /**
1453  * Create a vector type that contains a defined type and has a specific
1454  * number of elements.
1455  *
1456  * The created type will exist in the context thats its element type
1457  * exists in.
1458  *
1459  * @see llvm::VectorType::get()
1460  */
1461 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
1462 
1463 /**
1464  * Create a vector type that contains a defined type and has a scalable
1465  * number of elements.
1466  *
1467  * The created type will exist in the context thats its element type
1468  * exists in.
1469  *
1470  * @see llvm::ScalableVectorType::get()
1471  */
1473  unsigned ElementCount);
1474 
1475 /**
1476  * Obtain the (possibly scalable) number of elements in a vector type.
1477  *
1478  * This only works on types that represent vectors (fixed or scalable).
1479  *
1480  * @see llvm::VectorType::getNumElements()
1481  */
1482 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
1483 
1484 /**
1485  * @}
1486  */
1487 
1488 /**
1489  * @defgroup LLVMCCoreTypeOther Other Types
1490  *
1491  * @{
1492  */
1493 
1494 /**
1495  * Create a void type in a context.
1496  */
1498 
1499 /**
1500  * Create a label type in a context.
1501  */
1503 
1504 /**
1505  * Create a X86 MMX type in a context.
1506  */
1508 
1509 /**
1510  * Create a X86 AMX type in a context.
1511  */
1513 
1514 /**
1515  * Create a token type in a context.
1516  */
1518 
1519 /**
1520  * Create a metadata type in a context.
1521  */
1523 
1524 /**
1525  * These are similar to the above functions except they operate on the
1526  * global context.
1527  */
1532 
1533 /**
1534  * @}
1535  */
1536 
1537 /**
1538  * @}
1539  */
1540 
1541 /**
1542  * @defgroup LLVMCCoreValues Values
1543  *
1544  * The bulk of LLVM's object model consists of values, which comprise a very
1545  * rich type hierarchy.
1546  *
1547  * LLVMValueRef essentially represents llvm::Value. There is a rich
1548  * hierarchy of classes within this type. Depending on the instance
1549  * obtained, not all APIs are available.
1550  *
1551  * Callers can determine the type of an LLVMValueRef by calling the
1552  * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1553  * functions are defined by a macro, so it isn't obvious which are
1554  * available by looking at the Doxygen source code. Instead, look at the
1555  * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1556  * of value names given. These value names also correspond to classes in
1557  * the llvm::Value hierarchy.
1558  *
1559  * @{
1560  */
1561 
1562 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1563  macro(Argument) \
1564  macro(BasicBlock) \
1565  macro(InlineAsm) \
1566  macro(User) \
1567  macro(Constant) \
1568  macro(BlockAddress) \
1569  macro(ConstantAggregateZero) \
1570  macro(ConstantArray) \
1571  macro(ConstantDataSequential) \
1572  macro(ConstantDataArray) \
1573  macro(ConstantDataVector) \
1574  macro(ConstantExpr) \
1575  macro(ConstantFP) \
1576  macro(ConstantInt) \
1577  macro(ConstantPointerNull) \
1578  macro(ConstantStruct) \
1579  macro(ConstantTokenNone) \
1580  macro(ConstantVector) \
1581  macro(GlobalValue) \
1582  macro(GlobalAlias) \
1583  macro(GlobalObject) \
1584  macro(Function) \
1585  macro(GlobalVariable) \
1586  macro(GlobalIFunc) \
1587  macro(UndefValue) \
1588  macro(PoisonValue) \
1589  macro(Instruction) \
1590  macro(UnaryOperator) \
1591  macro(BinaryOperator) \
1592  macro(CallInst) \
1593  macro(IntrinsicInst) \
1594  macro(DbgInfoIntrinsic) \
1595  macro(DbgVariableIntrinsic) \
1596  macro(DbgDeclareInst) \
1597  macro(DbgLabelInst) \
1598  macro(MemIntrinsic) \
1599  macro(MemCpyInst) \
1600  macro(MemMoveInst) \
1601  macro(MemSetInst) \
1602  macro(CmpInst) \
1603  macro(FCmpInst) \
1604  macro(ICmpInst) \
1605  macro(ExtractElementInst) \
1606  macro(GetElementPtrInst) \
1607  macro(InsertElementInst) \
1608  macro(InsertValueInst) \
1609  macro(LandingPadInst) \
1610  macro(PHINode) \
1611  macro(SelectInst) \
1612  macro(ShuffleVectorInst) \
1613  macro(StoreInst) \
1614  macro(BranchInst) \
1615  macro(IndirectBrInst) \
1616  macro(InvokeInst) \
1617  macro(ReturnInst) \
1618  macro(SwitchInst) \
1619  macro(UnreachableInst) \
1620  macro(ResumeInst) \
1621  macro(CleanupReturnInst) \
1622  macro(CatchReturnInst) \
1623  macro(CatchSwitchInst) \
1624  macro(CallBrInst) \
1625  macro(FuncletPadInst) \
1626  macro(CatchPadInst) \
1627  macro(CleanupPadInst) \
1628  macro(UnaryInstruction) \
1629  macro(AllocaInst) \
1630  macro(CastInst) \
1631  macro(AddrSpaceCastInst) \
1632  macro(BitCastInst) \
1633  macro(FPExtInst) \
1634  macro(FPToSIInst) \
1635  macro(FPToUIInst) \
1636  macro(FPTruncInst) \
1637  macro(IntToPtrInst) \
1638  macro(PtrToIntInst) \
1639  macro(SExtInst) \
1640  macro(SIToFPInst) \
1641  macro(TruncInst) \
1642  macro(UIToFPInst) \
1643  macro(ZExtInst) \
1644  macro(ExtractValueInst) \
1645  macro(LoadInst) \
1646  macro(VAArgInst) \
1647  macro(FreezeInst) \
1648  macro(AtomicCmpXchgInst) \
1649  macro(AtomicRMWInst) \
1650  macro(FenceInst)
1651 
1652 /**
1653  * @defgroup LLVMCCoreValueGeneral General APIs
1654  *
1655  * Functions in this section work on all LLVMValueRef instances,
1656  * regardless of their sub-type. They correspond to functions available
1657  * on llvm::Value.
1658  *
1659  * @{
1660  */
1661 
1662 /**
1663  * Obtain the type of a value.
1664  *
1665  * @see llvm::Value::getType()
1666  */
1668 
1669 /**
1670  * Obtain the enumerated type of a Value instance.
1671  *
1672  * @see llvm::Value::getValueID()
1673  */
1675 
1676 /**
1677  * Obtain the string name of a value.
1678  *
1679  * @see llvm::Value::getName()
1680  */
1681 const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length);
1682 
1683 /**
1684  * Set the string name of a value.
1685  *
1686  * @see llvm::Value::setName()
1687  */
1688 void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen);
1689 
1690 /**
1691  * Dump a representation of a value to stderr.
1692  *
1693  * @see llvm::Value::dump()
1694  */
1695 void LLVMDumpValue(LLVMValueRef Val);
1696 
1697 /**
1698  * Return a string representation of the value. Use
1699  * LLVMDisposeMessage to free the string.
1700  *
1701  * @see llvm::Value::print()
1702  */
1704 
1705 /**
1706  * Replace all uses of a value with another one.
1707  *
1708  * @see llvm::Value::replaceAllUsesWith()
1709  */
1710 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
1711 
1712 /**
1713  * Determine whether the specified value instance is constant.
1714  */
1716 
1717 /**
1718  * Determine whether a value instance is undefined.
1719  */
1721 
1722 /**
1723  * Determine whether a value instance is poisonous.
1724  */
1726 
1727 /**
1728  * Convert value instances between types.
1729  *
1730  * Internally, an LLVMValueRef is "pinned" to a specific type. This
1731  * series of functions allows you to cast an instance to a specific
1732  * type.
1733  *
1734  * If the cast is not valid for the specified type, NULL is returned.
1735  *
1736  * @see llvm::dyn_cast_or_null<>
1737  */
1738 #define LLVM_DECLARE_VALUE_CAST(name) \
1739  LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1741 
1744 
1745 /** Deprecated: Use LLVMGetValueName2 instead. */
1746 const char *LLVMGetValueName(LLVMValueRef Val);
1747 /** Deprecated: Use LLVMSetValueName2 instead. */
1748 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
1749 
1750 /**
1751  * @}
1752  */
1753 
1754 /**
1755  * @defgroup LLVMCCoreValueUses Usage
1756  *
1757  * This module defines functions that allow you to inspect the uses of a
1758  * LLVMValueRef.
1759  *
1760  * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1761  * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1762  * llvm::User and llvm::Value.
1763  *
1764  * @{
1765  */
1766 
1767 /**
1768  * Obtain the first use of a value.
1769  *
1770  * Uses are obtained in an iterator fashion. First, call this function
1771  * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1772  * on that instance and all subsequently obtained instances until
1773  * LLVMGetNextUse() returns NULL.
1774  *
1775  * @see llvm::Value::use_begin()
1776  */
1778 
1779 /**
1780  * Obtain the next use of a value.
1781  *
1782  * This effectively advances the iterator. It returns NULL if you are on
1783  * the final use and no more are available.
1784  */
1786 
1787 /**
1788  * Obtain the user value for a user.
1789  *
1790  * The returned value corresponds to a llvm::User type.
1791  *
1792  * @see llvm::Use::getUser()
1793  */
1795 
1796 /**
1797  * Obtain the value this use corresponds to.
1798  *
1799  * @see llvm::Use::get().
1800  */
1802 
1803 /**
1804  * @}
1805  */
1806 
1807 /**
1808  * @defgroup LLVMCCoreValueUser User value
1809  *
1810  * Function in this group pertain to LLVMValueRef instances that descent
1811  * from llvm::User. This includes constants, instructions, and
1812  * operators.
1813  *
1814  * @{
1815  */
1816 
1817 /**
1818  * Obtain an operand at a specific index in a llvm::User value.
1819  *
1820  * @see llvm::User::getOperand()
1821  */
1823 
1824 /**
1825  * Obtain the use of an operand at a specific index in a llvm::User value.
1826  *
1827  * @see llvm::User::getOperandUse()
1828  */
1830 
1831 /**
1832  * Set an operand at a specific index in a llvm::User value.
1833  *
1834  * @see llvm::User::setOperand()
1835  */
1836 void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
1837 
1838 /**
1839  * Obtain the number of operands in a llvm::User value.
1840  *
1841  * @see llvm::User::getNumOperands()
1842  */
1844 
1845 /**
1846  * @}
1847  */
1848 
1849 /**
1850  * @defgroup LLVMCCoreValueConstant Constants
1851  *
1852  * This section contains APIs for interacting with LLVMValueRef that
1853  * correspond to llvm::Constant instances.
1854  *
1855  * These functions will work for any LLVMValueRef in the llvm::Constant
1856  * class hierarchy.
1857  *
1858  * @{
1859  */
1860 
1861 /**
1862  * Obtain a constant value referring to the null instance of a type.
1863  *
1864  * @see llvm::Constant::getNullValue()
1865  */
1866 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
1867 
1868 /**
1869  * Obtain a constant value referring to the instance of a type
1870  * consisting of all ones.
1871  *
1872  * This is only valid for integer types.
1873  *
1874  * @see llvm::Constant::getAllOnesValue()
1875  */
1877 
1878 /**
1879  * Obtain a constant value referring to an undefined value of a type.
1880  *
1881  * @see llvm::UndefValue::get()
1882  */
1884 
1885 /**
1886  * Obtain a constant value referring to a poison value of a type.
1887  *
1888  * @see llvm::PoisonValue::get()
1889  */
1891 
1892 /**
1893  * Determine whether a value instance is null.
1894  *
1895  * @see llvm::Constant::isNullValue()
1896  */
1898 
1899 /**
1900  * Obtain a constant that is a constant pointer pointing to NULL for a
1901  * specified type.
1902  */
1904 
1905 /**
1906  * @defgroup LLVMCCoreValueConstantScalar Scalar constants
1907  *
1908  * Functions in this group model LLVMValueRef instances that correspond
1909  * to constants referring to scalar types.
1910  *
1911  * For integer types, the LLVMTypeRef parameter should correspond to a
1912  * llvm::IntegerType instance and the returned LLVMValueRef will
1913  * correspond to a llvm::ConstantInt.
1914  *
1915  * For floating point types, the LLVMTypeRef returned corresponds to a
1916  * llvm::ConstantFP.
1917  *
1918  * @{
1919  */
1920 
1921 /**
1922  * Obtain a constant value for an integer type.
1923  *
1924  * The returned value corresponds to a llvm::ConstantInt.
1925  *
1926  * @see llvm::ConstantInt::get()
1927  *
1928  * @param IntTy Integer type to obtain value of.
1929  * @param N The value the returned instance should refer to.
1930  * @param SignExtend Whether to sign extend the produced value.
1931  */
1932 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1933  LLVMBool SignExtend);
1934 
1935 /**
1936  * Obtain a constant value for an integer of arbitrary precision.
1937  *
1938  * @see llvm::ConstantInt::get()
1939  */
1941  unsigned NumWords,
1942  const uint64_t Words[]);
1943 
1944 /**
1945  * Obtain a constant value for an integer parsed from a string.
1946  *
1947  * A similar API, LLVMConstIntOfStringAndSize is also available. If the
1948  * string's length is available, it is preferred to call that function
1949  * instead.
1950  *
1951  * @see llvm::ConstantInt::get()
1952  */
1953 LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
1954  uint8_t Radix);
1955 
1956 /**
1957  * Obtain a constant value for an integer parsed from a string with
1958  * specified length.
1959  *
1960  * @see llvm::ConstantInt::get()
1961  */
1962 LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
1963  unsigned SLen, uint8_t Radix);
1964 
1965 /**
1966  * Obtain a constant value referring to a double floating point value.
1967  */
1968 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
1969 
1970 /**
1971  * Obtain a constant for a floating point value parsed from a string.
1972  *
1973  * A similar API, LLVMConstRealOfStringAndSize is also available. It
1974  * should be used if the input string's length is known.
1975  */
1976 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
1977 
1978 /**
1979  * Obtain a constant for a floating point value parsed from a string.
1980  */
1981 LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
1982  unsigned SLen);
1983 
1984 /**
1985  * Obtain the zero extended value for an integer constant value.
1986  *
1987  * @see llvm::ConstantInt::getZExtValue()
1988  */
1989 unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
1990 
1991 /**
1992  * Obtain the sign extended value for an integer constant value.
1993  *
1994  * @see llvm::ConstantInt::getSExtValue()
1995  */
1996 long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
1997 
1998 /**
1999  * Obtain the double value for an floating point constant value.
2000  * losesInfo indicates if some precision was lost in the conversion.
2001  *
2002  * @see llvm::ConstantFP::getDoubleValue
2003  */
2004 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
2005 
2006 /**
2007  * @}
2008  */
2009 
2010 /**
2011  * @defgroup LLVMCCoreValueConstantComposite Composite Constants
2012  *
2013  * Functions in this group operate on composite constants.
2014  *
2015  * @{
2016  */
2017 
2018 /**
2019  * Create a ConstantDataSequential and initialize it with a string.
2020  *
2021  * @see llvm::ConstantDataArray::getString()
2022  */
2024  unsigned Length, LLVMBool DontNullTerminate);
2025 
2026 /**
2027  * Create a ConstantDataSequential with string content in the global context.
2028  *
2029  * This is the same as LLVMConstStringInContext except it operates on the
2030  * global context.
2031  *
2032  * @see LLVMConstStringInContext()
2033  * @see llvm::ConstantDataArray::getString()
2034  */
2035 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
2036  LLVMBool DontNullTerminate);
2037 
2038 /**
2039  * Returns true if the specified constant is an array of i8.
2040  *
2041  * @see ConstantDataSequential::getAsString()
2042  */
2044 
2045 /**
2046  * Get the given constant data sequential as a string.
2047  *
2048  * @see ConstantDataSequential::getAsString()
2049  */
2050 const char *LLVMGetAsString(LLVMValueRef c, size_t *Length);
2051 
2052 /**
2053  * Create an anonymous ConstantStruct with the specified values.
2054  *
2055  * @see llvm::ConstantStruct::getAnon()
2056  */
2058  LLVMValueRef *ConstantVals,
2059  unsigned Count, LLVMBool Packed);
2060 
2061 /**
2062  * Create a ConstantStruct in the global Context.
2063  *
2064  * This is the same as LLVMConstStructInContext except it operates on the
2065  * global Context.
2066  *
2067  * @see LLVMConstStructInContext()
2068  */
2069 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
2070  LLVMBool Packed);
2071 
2072 /**
2073  * Create a ConstantArray from values.
2074  *
2075  * @see llvm::ConstantArray::get()
2076  */
2078  LLVMValueRef *ConstantVals, unsigned Length);
2079 
2080 /**
2081  * Create a non-anonymous ConstantStruct from values.
2082  *
2083  * @see llvm::ConstantStruct::get()
2084  */
2086  LLVMValueRef *ConstantVals,
2087  unsigned Count);
2088 
2089 /**
2090  * Get an element at specified index as a constant.
2091  *
2092  * @see ConstantDataSequential::getElementAsConstant()
2093  */
2095 
2096 /**
2097  * Create a ConstantVector from values.
2098  *
2099  * @see llvm::ConstantVector::get()
2100  */
2101 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
2102 
2103 /**
2104  * @}
2105  */
2106 
2107 /**
2108  * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
2109  *
2110  * Functions in this group correspond to APIs on llvm::ConstantExpr.
2111  *
2112  * @see llvm::ConstantExpr.
2113  *
2114  * @{
2115  */
2124 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2125 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2126 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2127 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2128 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2129 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2130 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2131 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2132 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2133 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2134 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2135 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2136 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2137 LLVMValueRef LLVMConstExactUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2138 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2139 LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2140 LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2141 LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2142 LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2143 LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2144 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2145 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2146 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2148  LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2150  LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2151 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2152 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2153 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2155  LLVMValueRef *ConstantIndices, unsigned NumIndices);
2157  LLVMValueRef *ConstantIndices, unsigned NumIndices);
2159  LLVMValueRef *ConstantIndices,
2160  unsigned NumIndices);
2162  LLVMValueRef *ConstantIndices,
2163  unsigned NumIndices);
2165 LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
2166 LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
2178  LLVMTypeRef ToType);
2180  LLVMTypeRef ToType);
2182  LLVMTypeRef ToType);
2184  LLVMTypeRef ToType);
2186  LLVMBool isSigned);
2188 LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
2189  LLVMValueRef ConstantIfTrue,
2190  LLVMValueRef ConstantIfFalse);
2192  LLVMValueRef IndexConstant);
2194  LLVMValueRef ElementValueConstant,
2195  LLVMValueRef IndexConstant);
2197  LLVMValueRef VectorBConstant,
2198  LLVMValueRef MaskConstant);
2199 LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
2200  unsigned NumIdx);
2202  LLVMValueRef ElementValueConstant,
2203  unsigned *IdxList, unsigned NumIdx);
2205 
2206 /** Deprecated: Use LLVMGetInlineAsm instead. */
2208  const char *AsmString, const char *Constraints,
2209  LLVMBool HasSideEffects, LLVMBool IsAlignStack);
2210 
2211 /**
2212  * @}
2213  */
2214 
2215 /**
2216  * @defgroup LLVMCCoreValueConstantGlobals Global Values
2217  *
2218  * This group contains functions that operate on global values. Functions in
2219  * this group relate to functions in the llvm::GlobalValue class tree.
2220  *
2221  * @see llvm::GlobalValue
2222  *
2223  * @{
2224  */
2225 
2230 const char *LLVMGetSection(LLVMValueRef Global);
2231 void LLVMSetSection(LLVMValueRef Global, const char *Section);
2237 void LLVMSetUnnamedAddress(LLVMValueRef Global, LLVMUnnamedAddr UnnamedAddr);
2238 
2239 /**
2240  * Returns the "value type" of a global value. This differs from the formal
2241  * type of a global value which is always a pointer type.
2242  *
2243  * @see llvm::GlobalValue::getValueType()
2244  */
2246 
2247 /** Deprecated: Use LLVMGetUnnamedAddress instead. */
2249 /** Deprecated: Use LLVMSetUnnamedAddress instead. */
2250 void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
2251 
2252 /**
2253  * @defgroup LLVMCCoreValueWithAlignment Values with alignment
2254  *
2255  * Functions in this group only apply to values with alignment, i.e.
2256  * global variables, load and store instructions.
2257  */
2258 
2259 /**
2260  * Obtain the preferred alignment of the value.
2261  * @see llvm::AllocaInst::getAlignment()
2262  * @see llvm::LoadInst::getAlignment()
2263  * @see llvm::StoreInst::getAlignment()
2264  * @see llvm::AtomicRMWInst::setAlignment()
2265  * @see llvm::AtomicCmpXchgInst::setAlignment()
2266  * @see llvm::GlobalValue::getAlignment()
2267  */
2268 unsigned LLVMGetAlignment(LLVMValueRef V);
2269 
2270 /**
2271  * Set the preferred alignment of the value.
2272  * @see llvm::AllocaInst::setAlignment()
2273  * @see llvm::LoadInst::setAlignment()
2274  * @see llvm::StoreInst::setAlignment()
2275  * @see llvm::AtomicRMWInst::setAlignment()
2276  * @see llvm::AtomicCmpXchgInst::setAlignment()
2277  * @see llvm::GlobalValue::setAlignment()
2278  */
2279 void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
2280 
2281 /**
2282  * Sets a metadata attachment, erasing the existing metadata attachment if
2283  * it already exists for the given kind.
2284  *
2285  * @see llvm::GlobalObject::setMetadata()
2286  */
2287 void LLVMGlobalSetMetadata(LLVMValueRef Global, unsigned Kind,
2288  LLVMMetadataRef MD);
2289 
2290 /**
2291  * Erases a metadata attachment of the given kind if it exists.
2292  *
2293  * @see llvm::GlobalObject::eraseMetadata()
2294  */
2295 void LLVMGlobalEraseMetadata(LLVMValueRef Global, unsigned Kind);
2296 
2297 /**
2298  * Removes all metadata attachments from this value.
2299  *
2300  * @see llvm::GlobalObject::clearMetadata()
2301  */
2303 
2304 /**
2305  * Retrieves an array of metadata entries representing the metadata attached to
2306  * this value. The caller is responsible for freeing this array by calling
2307  * \c LLVMDisposeValueMetadataEntries.
2308  *
2309  * @see llvm::GlobalObject::getAllMetadata()
2310  */
2312  size_t *NumEntries);
2313 
2314 /**
2315  * Destroys value metadata entries.
2316  */
2318 
2319 /**
2320  * Returns the kind of a value metadata entry at a specific index.
2321  */
2323  unsigned Index);
2324 
2325 /**
2326  * Returns the underlying metadata node of a value metadata entry at a
2327  * specific index.
2328  */
2331  unsigned Index);
2332 
2333 /**
2334  * @}
2335  */
2336 
2337 /**
2338  * @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
2339  *
2340  * This group contains functions that operate on global variable values.
2341  *
2342  * @see llvm::GlobalVariable
2343  *
2344  * @{
2345  */
2348  const char *Name,
2349  unsigned AddressSpace);
2359 void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
2366 
2367 /**
2368  * @}
2369  */
2370 
2371 /**
2372  * @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
2373  *
2374  * This group contains function that operate on global alias values.
2375  *
2376  * @see llvm::GlobalAlias
2377  *
2378  * @{
2379  */
2381  const char *Name);
2382 
2383 /**
2384  * Obtain a GlobalAlias value from a Module by its name.
2385  *
2386  * The returned value corresponds to a llvm::GlobalAlias value.
2387  *
2388  * @see llvm::Module::getNamedAlias()
2389  */
2391  const char *Name, size_t NameLen);
2392 
2393 /**
2394  * Obtain an iterator to the first GlobalAlias in a Module.
2395  *
2396  * @see llvm::Module::alias_begin()
2397  */
2399 
2400 /**
2401  * Obtain an iterator to the last GlobalAlias in a Module.
2402  *
2403  * @see llvm::Module::alias_end()
2404  */
2406 
2407 /**
2408  * Advance a GlobalAlias iterator to the next GlobalAlias.
2409  *
2410  * Returns NULL if the iterator was already at the end and there are no more
2411  * global aliases.
2412  */
2414 
2415 /**
2416  * Decrement a GlobalAlias iterator to the previous GlobalAlias.
2417  *
2418  * Returns NULL if the iterator was already at the beginning and there are
2419  * no previous global aliases.
2420  */
2422 
2423 /**
2424  * Retrieve the target value of an alias.
2425  */
2427 
2428 /**
2429  * Set the target value of an alias.
2430  */
2431 void LLVMAliasSetAliasee(LLVMValueRef Alias, LLVMValueRef Aliasee);
2432 
2433 /**
2434  * @}
2435  */
2436 
2437 /**
2438  * @defgroup LLVMCCoreValueFunction Function values
2439  *
2440  * Functions in this group operate on LLVMValueRef instances that
2441  * correspond to llvm::Function instances.
2442  *
2443  * @see llvm::Function
2444  *
2445  * @{
2446  */
2447 
2448 /**
2449  * Remove a function from its containing module and deletes it.
2450  *
2451  * @see llvm::Function::eraseFromParent()
2452  */
2454 
2455 /**
2456  * Check whether the given function has a personality function.
2457  *
2458  * @see llvm::Function::hasPersonalityFn()
2459  */
2461 
2462 /**
2463  * Obtain the personality function attached to the function.
2464  *
2465  * @see llvm::Function::getPersonalityFn()
2466  */
2468 
2469 /**
2470  * Set the personality function attached to the function.
2471  *
2472  * @see llvm::Function::setPersonalityFn()
2473  */
2474 void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
2475 
2476 /**
2477  * Obtain the intrinsic ID number which matches the given function name.
2478  *
2479  * @see llvm::Function::lookupIntrinsicID()
2480  */
2481 unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
2482 
2483 /**
2484  * Obtain the ID number from a function instance.
2485  *
2486  * @see llvm::Function::getIntrinsicID()
2487  */
2488 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
2489 
2490 /**
2491  * Create or insert the declaration of an intrinsic. For overloaded intrinsics,
2492  * parameter types must be provided to uniquely identify an overload.
2493  *
2494  * @see llvm::Intrinsic::getDeclaration()
2495  */
2497  unsigned ID,
2498  LLVMTypeRef *ParamTypes,
2499  size_t ParamCount);
2500 
2501 /**
2502  * Retrieves the type of an intrinsic. For overloaded intrinsics, parameter
2503  * types must be provided to uniquely identify an overload.
2504  *
2505  * @see llvm::Intrinsic::getType()
2506  */
2508  LLVMTypeRef *ParamTypes, size_t ParamCount);
2509 
2510 /**
2511  * Retrieves the name of an intrinsic.
2512  *
2513  * @see llvm::Intrinsic::getName()
2514  */
2515 const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength);
2516 
2517 /** Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead. */
2518 const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
2519  LLVMTypeRef *ParamTypes,
2520  size_t ParamCount,
2521  size_t *NameLength);
2522 
2523 /**
2524  * Copies the name of an overloaded intrinsic identified by a given list of
2525  * parameter types.
2526  *
2527  * Unlike LLVMIntrinsicGetName, the caller is responsible for freeing the
2528  * returned string.
2529  *
2530  * This version also supports unnamed types.
2531  *
2532  * @see llvm::Intrinsic::getName()
2533  */
2535  LLVMTypeRef *ParamTypes,
2536  size_t ParamCount,
2537  size_t *NameLength);
2538 
2539 /**
2540  * Obtain if the intrinsic identified by the given ID is overloaded.
2541  *
2542  * @see llvm::Intrinsic::isOverloaded()
2543  */
2545 
2546 /**
2547  * Obtain the calling function of a function.
2548  *
2549  * The returned value corresponds to the LLVMCallConv enumeration.
2550  *
2551  * @see llvm::Function::getCallingConv()
2552  */
2554 
2555 /**
2556  * Set the calling convention of a function.
2557  *
2558  * @see llvm::Function::setCallingConv()
2559  *
2560  * @param Fn Function to operate on
2561  * @param CC LLVMCallConv to set calling convention to
2562  */
2563 void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
2564 
2565 /**
2566  * Obtain the name of the garbage collector to use during code
2567  * generation.
2568  *
2569  * @see llvm::Function::getGC()
2570  */
2571 const char *LLVMGetGC(LLVMValueRef Fn);
2572 
2573 /**
2574  * Define the garbage collector to use during code generation.
2575  *
2576  * @see llvm::Function::setGC()
2577  */
2578 void LLVMSetGC(LLVMValueRef Fn, const char *Name);
2579 
2580 /**
2581  * Add an attribute to a function.
2582  *
2583  * @see llvm::Function::addAttribute()
2584  */
2591  LLVMAttributeIndex Idx,
2592  unsigned KindID);
2594  LLVMAttributeIndex Idx,
2595  const char *K, unsigned KLen);
2597  unsigned KindID);
2599  const char *K, unsigned KLen);
2600 
2601 /**
2602  * Add a target-dependent attribute to a function
2603  * @see llvm::AttrBuilder::addAttribute()
2604  */
2606  const char *V);
2607 
2608 /**
2609  * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
2610  *
2611  * Functions in this group relate to arguments/parameters on functions.
2612  *
2613  * Functions in this group expect LLVMValueRef instances that correspond
2614  * to llvm::Function instances.
2615  *
2616  * @{
2617  */
2618 
2619 /**
2620  * Obtain the number of parameters in a function.
2621  *
2622  * @see llvm::Function::arg_size()
2623  */
2624 unsigned LLVMCountParams(LLVMValueRef Fn);
2625 
2626 /**
2627  * Obtain the parameters in a function.
2628  *
2629  * The takes a pointer to a pre-allocated array of LLVMValueRef that is
2630  * at least LLVMCountParams() long. This array will be filled with
2631  * LLVMValueRef instances which correspond to the parameters the
2632  * function receives. Each LLVMValueRef corresponds to a llvm::Argument
2633  * instance.
2634  *
2635  * @see llvm::Function::arg_begin()
2636  */
2637 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
2638 
2639 /**
2640  * Obtain the parameter at the specified index.
2641  *
2642  * Parameters are indexed from 0.
2643  *
2644  * @see llvm::Function::arg_begin()
2645  */
2647 
2648 /**
2649  * Obtain the function to which this argument belongs.
2650  *
2651  * Unlike other functions in this group, this one takes an LLVMValueRef
2652  * that corresponds to a llvm::Attribute.
2653  *
2654  * The returned LLVMValueRef is the llvm::Function to which this
2655  * argument belongs.
2656  */
2658 
2659 /**
2660  * Obtain the first parameter to a function.
2661  *
2662  * @see llvm::Function::arg_begin()
2663  */
2665 
2666 /**
2667  * Obtain the last parameter to a function.
2668  *
2669  * @see llvm::Function::arg_end()
2670  */
2672 
2673 /**
2674  * Obtain the next parameter to a function.
2675  *
2676  * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
2677  * actually a wrapped iterator) and obtains the next parameter from the
2678  * underlying iterator.
2679  */
2681 
2682 /**
2683  * Obtain the previous parameter to a function.
2684  *
2685  * This is the opposite of LLVMGetNextParam().
2686  */
2688 
2689 /**
2690  * Set the alignment for a function parameter.
2691  *
2692  * @see llvm::Argument::addAttr()
2693  * @see llvm::AttrBuilder::addAlignmentAttr()
2694  */
2696 
2697 /**
2698  * @}
2699  */
2700 
2701 /**
2702  * @defgroup LLVMCCoreValueGlobalIFunc IFuncs
2703  *
2704  * Functions in this group relate to indirect functions.
2705  *
2706  * Functions in this group expect LLVMValueRef instances that correspond
2707  * to llvm::GlobalIFunc instances.
2708  *
2709  * @{
2710  */
2711 
2712 /**
2713  * Add a global indirect function to a module under a specified name.
2714  *
2715  * @see llvm::GlobalIFunc::create()
2716  */
2718  const char *Name, size_t NameLen,
2719  LLVMTypeRef Ty, unsigned AddrSpace,
2720  LLVMValueRef Resolver);
2721 
2722 /**
2723  * Obtain a GlobalIFunc value from a Module by its name.
2724  *
2725  * The returned value corresponds to a llvm::GlobalIFunc value.
2726  *
2727  * @see llvm::Module::getNamedIFunc()
2728  */
2730  const char *Name, size_t NameLen);
2731 
2732 /**
2733  * Obtain an iterator to the first GlobalIFunc in a Module.
2734  *
2735  * @see llvm::Module::ifunc_begin()
2736  */
2738 
2739 /**
2740  * Obtain an iterator to the last GlobalIFunc in a Module.
2741  *
2742  * @see llvm::Module::ifunc_end()
2743  */
2745 
2746 /**
2747  * Advance a GlobalIFunc iterator to the next GlobalIFunc.
2748  *
2749  * Returns NULL if the iterator was already at the end and there are no more
2750  * global aliases.
2751  */
2753 
2754 /**
2755  * Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
2756  *
2757  * Returns NULL if the iterator was already at the beginning and there are
2758  * no previous global aliases.
2759  */
2761 
2762 /**
2763  * Retrieves the resolver function associated with this indirect function, or
2764  * NULL if it doesn't not exist.
2765  *
2766  * @see llvm::GlobalIFunc::getResolver()
2767  */
2769 
2770 /**
2771  * Sets the resolver function associated with this indirect function.
2772  *
2773  * @see llvm::GlobalIFunc::setResolver()
2774  */
2776 
2777 /**
2778  * Remove a global indirect function from its parent module and delete it.
2779  *
2780  * @see llvm::GlobalIFunc::eraseFromParent()
2781  */
2783 
2784 /**
2785  * Remove a global indirect function from its parent module.
2786  *
2787  * This unlinks the global indirect function from its containing module but
2788  * keeps it alive.
2789  *
2790  * @see llvm::GlobalIFunc::removeFromParent()
2791  */
2793 
2794 /**
2795  * @}
2796  */
2797 
2798 /**
2799  * @}
2800  */
2801 
2802 /**
2803  * @}
2804  */
2805 
2806 /**
2807  * @}
2808  */
2809 
2810 /**
2811  * @defgroup LLVMCCoreValueMetadata Metadata
2812  *
2813  * @{
2814  */
2815 
2816 /**
2817  * Create an MDString value from a given string value.
2818  *
2819  * The MDString value does not take ownership of the given string, it remains
2820  * the responsibility of the caller to free it.
2821  *
2822  * @see llvm::MDString::get()
2823  */
2825  size_t SLen);
2826 
2827 /**
2828  * Create an MDNode value with the given array of operands.
2829  *
2830  * @see llvm::MDNode::get()
2831  */
2833  size_t Count);
2834 
2835 /**
2836  * Obtain a Metadata as a Value.
2837  */
2839 
2840 /**
2841  * Obtain a Value as a Metadata.
2842  */
2844 
2845 /**
2846  * Obtain the underlying string from a MDString value.
2847  *
2848  * @param V Instance to obtain string from.
2849  * @param Length Memory address which will hold length of returned string.
2850  * @return String data in MDString.
2851  */
2852 const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length);
2853 
2854 /**
2855  * Obtain the number of operands from an MDNode value.
2856  *
2857  * @param V MDNode to get number of operands from.
2858  * @return Number of operands of the MDNode.
2859  */
2861 
2862 /**
2863  * Obtain the given MDNode's operands.
2864  *
2865  * The passed LLVMValueRef pointer should point to enough memory to hold all of
2866  * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
2867  * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
2868  * MDNode's operands.
2869  *
2870  * @param V MDNode to get the operands from.
2871  * @param Dest Destination array for operands.
2872  */
2874 
2875 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2877  unsigned SLen);
2878 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2879 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2880 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2882  unsigned Count);
2883 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2884 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
2885 
2886 /**
2887  * @}
2888  */
2889 
2890 /**
2891  * @defgroup LLVMCCoreValueBasicBlock Basic Block
2892  *
2893  * A basic block represents a single entry single exit section of code.
2894  * Basic blocks contain a list of instructions which form the body of
2895  * the block.
2896  *
2897  * Basic blocks belong to functions. They have the type of label.
2898  *
2899  * Basic blocks are themselves values. However, the C API models them as
2900  * LLVMBasicBlockRef.
2901  *
2902  * @see llvm::BasicBlock
2903  *
2904  * @{
2905  */
2906 
2907 /**
2908  * Convert a basic block instance to a value type.
2909  */
2911 
2912 /**
2913  * Determine whether an LLVMValueRef is itself a basic block.
2914  */
2916 
2917 /**
2918  * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
2919  */
2921 
2922 /**
2923  * Obtain the string name of a basic block.
2924  */
2926 
2927 /**
2928  * Obtain the function to which a basic block belongs.
2929  *
2930  * @see llvm::BasicBlock::getParent()
2931  */
2933 
2934 /**
2935  * Obtain the terminator instruction for a basic block.
2936  *
2937  * If the basic block does not have a terminator (it is not well-formed
2938  * if it doesn't), then NULL is returned.
2939  *
2940  * The returned LLVMValueRef corresponds to an llvm::Instruction.
2941  *
2942  * @see llvm::BasicBlock::getTerminator()
2943  */
2945 
2946 /**
2947  * Obtain the number of basic blocks in a function.
2948  *
2949  * @param Fn Function value to operate on.
2950  */
2951 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
2952 
2953 /**
2954  * Obtain all of the basic blocks in a function.
2955  *
2956  * This operates on a function value. The BasicBlocks parameter is a
2957  * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
2958  * LLVMCountBasicBlocks() in length. This array is populated with
2959  * LLVMBasicBlockRef instances.
2960  */
2961 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
2962 
2963 /**
2964  * Obtain the first basic block in a function.
2965  *
2966  * The returned basic block can be used as an iterator. You will likely
2967  * eventually call into LLVMGetNextBasicBlock() with it.
2968  *
2969  * @see llvm::Function::begin()
2970  */
2972 
2973 /**
2974  * Obtain the last basic block in a function.
2975  *
2976  * @see llvm::Function::end()
2977  */
2979 
2980 /**
2981  * Advance a basic block iterator.
2982  */
2984 
2985 /**
2986  * Go backwards in a basic block iterator.
2987  */
2989 
2990 /**
2991  * Obtain the basic block that corresponds to the entry point of a
2992  * function.
2993  *
2994  * @see llvm::Function::getEntryBlock()
2995  */
2997 
2998 /**
2999  * Insert the given basic block after the insertion point of the given builder.
3000  *
3001  * The insertion point must be valid.
3002  *
3003  * @see llvm::Function::BasicBlockListType::insertAfter()
3004  */
3007 
3008 /**
3009  * Append the given basic block to the basic block list of the given function.
3010  *
3011  * @see llvm::Function::BasicBlockListType::push_back()
3012  */
3015 
3016 /**
3017  * Create a new basic block without inserting it into a function.
3018  *
3019  * @see llvm::BasicBlock::Create()
3020  */
3022  const char *Name);
3023 
3024 /**
3025  * Append a basic block to the end of a function.
3026  *
3027  * @see llvm::BasicBlock::Create()
3028  */
3030  LLVMValueRef Fn,
3031  const char *Name);
3032 
3033 /**
3034  * Append a basic block to the end of a function using the global
3035  * context.
3036  *
3037  * @see llvm::BasicBlock::Create()
3038  */
3040 
3041 /**
3042  * Insert a basic block in a function before another basic block.
3043  *
3044  * The function to add to is determined by the function of the
3045  * passed basic block.
3046  *
3047  * @see llvm::BasicBlock::Create()
3048  */
3051  const char *Name);
3052 
3053 /**
3054  * Insert a basic block in a function using the global context.
3055  *
3056  * @see llvm::BasicBlock::Create()
3057  */
3059  const char *Name);
3060 
3061 /**
3062  * Remove a basic block from a function and delete it.
3063  *
3064  * This deletes the basic block from its containing function and deletes
3065  * the basic block itself.
3066  *
3067  * @see llvm::BasicBlock::eraseFromParent()
3068  */
3070 
3071 /**
3072  * Remove a basic block from a function.
3073  *
3074  * This deletes the basic block from its containing function but keep
3075  * the basic block alive.
3076  *
3077  * @see llvm::BasicBlock::removeFromParent()
3078  */
3080 
3081 /**
3082  * Move a basic block to before another one.
3083  *
3084  * @see llvm::BasicBlock::moveBefore()
3085  */
3087 
3088 /**
3089  * Move a basic block to after another one.
3090  *
3091  * @see llvm::BasicBlock::moveAfter()
3092  */
3094 
3095 /**
3096  * Obtain the first instruction in a basic block.
3097  *
3098  * The returned LLVMValueRef corresponds to a llvm::Instruction
3099  * instance.
3100  */
3102 
3103 /**
3104  * Obtain the last instruction in a basic block.
3105  *
3106  * The returned LLVMValueRef corresponds to an LLVM:Instruction.
3107  */
3109 
3110 /**
3111  * @}
3112  */
3113 
3114 /**
3115  * @defgroup LLVMCCoreValueInstruction Instructions
3116  *
3117  * Functions in this group relate to the inspection and manipulation of
3118  * individual instructions.
3119  *
3120  * In the C++ API, an instruction is modeled by llvm::Instruction. This
3121  * class has a large number of descendents. llvm::Instruction is a
3122  * llvm::Value and in the C API, instructions are modeled by
3123  * LLVMValueRef.
3124  *
3125  * This group also contains sub-groups which operate on specific
3126  * llvm::Instruction types, e.g. llvm::CallInst.
3127  *
3128  * @{
3129  */
3130 
3131 /**
3132  * Determine whether an instruction has any metadata attached.
3133  */
3134 int LLVMHasMetadata(LLVMValueRef Val);
3135 
3136 /**
3137  * Return metadata associated with an instruction value.
3138  */
3139 LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
3140 
3141 /**
3142  * Set metadata associated with an instruction value.
3143  */
3144 void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
3145 
3146 /**
3147  * Returns the metadata associated with an instruction value, but filters out
3148  * all the debug locations.
3149  *
3150  * @see llvm::Instruction::getAllMetadataOtherThanDebugLoc()
3151  */
3154  size_t *NumEntries);
3155 
3156 /**
3157  * Obtain the basic block to which an instruction belongs.
3158  *
3159  * @see llvm::Instruction::getParent()
3160  */
3162 
3163 /**
3164  * Obtain the instruction that occurs after the one specified.
3165  *
3166  * The next instruction will be from the same basic block.
3167  *
3168  * If this is the last instruction in a basic block, NULL will be
3169  * returned.
3170  */
3172 
3173 /**
3174  * Obtain the instruction that occurred before this one.
3175  *
3176  * If the instruction is the first instruction in a basic block, NULL
3177  * will be returned.
3178  */
3180 
3181 /**
3182  * Remove and delete an instruction.
3183  *
3184  * The instruction specified is removed from its containing building
3185  * block but is kept alive.
3186  *
3187  * @see llvm::Instruction::removeFromParent()
3188  */
3190 
3191 /**
3192  * Remove and delete an instruction.
3193  *
3194  * The instruction specified is removed from its containing building
3195  * block and then deleted.
3196  *
3197  * @see llvm::Instruction::eraseFromParent()
3198  */
3200 
3201 /**
3202  * Obtain the code opcode for an individual instruction.
3203  *
3204  * @see llvm::Instruction::getOpCode()
3205  */
3207 
3208 /**
3209  * Obtain the predicate of an instruction.
3210  *
3211  * This is only valid for instructions that correspond to llvm::ICmpInst
3212  * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
3213  *
3214  * @see llvm::ICmpInst::getPredicate()
3215  */
3217 
3218 /**
3219  * Obtain the float predicate of an instruction.
3220  *
3221  * This is only valid for instructions that correspond to llvm::FCmpInst
3222  * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
3223  *
3224  * @see llvm::FCmpInst::getPredicate()
3225  */
3227 
3228 /**
3229  * Create a copy of 'this' instruction that is identical in all ways
3230  * except the following:
3231  * * The instruction has no parent
3232  * * The instruction has no name
3233  *
3234  * @see llvm::Instruction::clone()
3235  */
3237 
3238 /**
3239  * Determine whether an instruction is a terminator. This routine is named to
3240  * be compatible with historical functions that did this by querying the
3241  * underlying C++ type.
3242  *
3243  * @see llvm::Instruction::isTerminator()
3244  */
3246 
3247 /**
3248  * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
3249  *
3250  * Functions in this group apply to instructions that refer to call
3251  * sites and invocations. These correspond to C++ types in the
3252  * llvm::CallInst class tree.
3253  *
3254  * @{
3255  */
3256 
3257 /**
3258  * Obtain the argument count for a call instruction.
3259  *
3260  * This expects an LLVMValueRef that corresponds to a llvm::CallInst,
3261  * llvm::InvokeInst, or llvm:FuncletPadInst.
3262  *
3263  * @see llvm::CallInst::getNumArgOperands()
3264  * @see llvm::InvokeInst::getNumArgOperands()
3265  * @see llvm::FuncletPadInst::getNumArgOperands()
3266  */
3267 unsigned LLVMGetNumArgOperands(LLVMValueRef Instr);
3268 
3269 /**
3270  * Set the calling convention for a call instruction.
3271  *
3272  * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3273  * llvm::InvokeInst.
3274  *
3275  * @see llvm::CallInst::setCallingConv()
3276  * @see llvm::InvokeInst::setCallingConv()
3277  */
3278 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
3279 
3280 /**
3281  * Obtain the calling convention for a call instruction.
3282  *
3283  * This is the opposite of LLVMSetInstructionCallConv(). Reads its
3284  * usage.
3285  *
3286  * @see LLVMSetInstructionCallConv()
3287  */
3289 
3291  unsigned Align);
3292 
3299  LLVMAttributeIndex Idx,
3300  unsigned KindID);
3302  LLVMAttributeIndex Idx,
3303  const char *K, unsigned KLen);
3305  unsigned KindID);
3307  const char *K, unsigned KLen);
3308 
3309 /**
3310  * Obtain the function type called by this instruction.
3311  *
3312  * @see llvm::CallBase::getFunctionType()
3313  */
3315 
3316 /**
3317  * Obtain the pointer to the function invoked by this instruction.
3318  *
3319  * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3320  * llvm::InvokeInst.
3321  *
3322  * @see llvm::CallInst::getCalledOperand()
3323  * @see llvm::InvokeInst::getCalledOperand()
3324  */
3326 
3327 /**
3328  * Obtain whether a call instruction is a tail call.
3329  *
3330  * This only works on llvm::CallInst instructions.
3331  *
3332  * @see llvm::CallInst::isTailCall()
3333  */
3335 
3336 /**
3337  * Set whether a call instruction is a tail call.
3338  *
3339  * This only works on llvm::CallInst instructions.
3340  *
3341  * @see llvm::CallInst::setTailCall()
3342  */
3343 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
3344 
3345 /**
3346  * Return the normal destination basic block.
3347  *
3348  * This only works on llvm::InvokeInst instructions.
3349  *
3350  * @see llvm::InvokeInst::getNormalDest()
3351  */
3353 
3354 /**
3355  * Return the unwind destination basic block.
3356  *
3357  * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3358  * llvm::CatchSwitchInst instructions.
3359  *
3360  * @see llvm::InvokeInst::getUnwindDest()
3361  * @see llvm::CleanupReturnInst::getUnwindDest()
3362  * @see llvm::CatchSwitchInst::getUnwindDest()
3363  */
3365 
3366 /**
3367  * Set the normal destination basic block.
3368  *
3369  * This only works on llvm::InvokeInst instructions.
3370  *
3371  * @see llvm::InvokeInst::setNormalDest()
3372  */
3374 
3375 /**
3376  * Set the unwind destination basic block.
3377  *
3378  * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3379  * llvm::CatchSwitchInst instructions.
3380  *
3381  * @see llvm::InvokeInst::setUnwindDest()
3382  * @see llvm::CleanupReturnInst::setUnwindDest()
3383  * @see llvm::CatchSwitchInst::setUnwindDest()
3384  */
3386 
3387 /**
3388  * @}
3389  */
3390 
3391 /**
3392  * @defgroup LLVMCCoreValueInstructionTerminator Terminators
3393  *
3394  * Functions in this group only apply to instructions for which
3395  * LLVMIsATerminatorInst returns true.
3396  *
3397  * @{
3398  */
3399 
3400 /**
3401  * Return the number of successors that this terminator has.
3402  *
3403  * @see llvm::Instruction::getNumSuccessors
3404  */
3406 
3407 /**
3408  * Return the specified successor.
3409  *
3410  * @see llvm::Instruction::getSuccessor
3411  */
3413 
3414 /**
3415  * Update the specified successor to point at the provided block.
3416  *
3417  * @see llvm::Instruction::setSuccessor
3418  */
3420 
3421 /**
3422  * Return if a branch is conditional.
3423  *
3424  * This only works on llvm::BranchInst instructions.
3425  *
3426  * @see llvm::BranchInst::isConditional
3427  */
3429 
3430 /**
3431  * Return the condition of a branch instruction.
3432  *
3433  * This only works on llvm::BranchInst instructions.
3434  *
3435  * @see llvm::BranchInst::getCondition
3436  */
3438 
3439 /**
3440  * Set the condition of a branch instruction.
3441  *
3442  * This only works on llvm::BranchInst instructions.
3443  *
3444  * @see llvm::BranchInst::setCondition
3445  */
3447 
3448 /**
3449  * Obtain the default destination basic block of a switch instruction.
3450  *
3451  * This only works on llvm::SwitchInst instructions.
3452  *
3453  * @see llvm::SwitchInst::getDefaultDest()
3454  */
3456 
3457 /**
3458  * @}
3459  */
3460 
3461 /**
3462  * @defgroup LLVMCCoreValueInstructionAlloca Allocas
3463  *
3464  * Functions in this group only apply to instructions that map to
3465  * llvm::AllocaInst instances.
3466  *
3467  * @{
3468  */
3469 
3470 /**
3471  * Obtain the type that is being allocated by the alloca instruction.
3472  */
3474 
3475 /**
3476  * @}
3477  */
3478 
3479 /**
3480  * @defgroup LLVMCCoreValueInstructionGetElementPointer GEPs
3481  *
3482  * Functions in this group only apply to instructions that map to
3483  * llvm::GetElementPtrInst instances.
3484  *
3485  * @{
3486  */
3487 
3488 /**
3489  * Check whether the given GEP instruction is inbounds.
3490  */
3492 
3493 /**
3494  * Set the given GEP instruction to be inbounds or not.
3495  */
3496 void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds);
3497 
3498 /**
3499  * @}
3500  */
3501 
3502 /**
3503  * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
3504  *
3505  * Functions in this group only apply to instructions that map to
3506  * llvm::PHINode instances.
3507  *
3508  * @{
3509  */
3510 
3511 /**
3512  * Add an incoming value to the end of a PHI list.
3513  */
3514 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3515  LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
3516 
3517 /**
3518  * Obtain the number of incoming basic blocks to a PHI node.
3519  */
3520 unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
3521 
3522 /**
3523  * Obtain an incoming value to a PHI node as an LLVMValueRef.
3524  */
3526 
3527 /**
3528  * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
3529  */
3531 
3532 /**
3533  * @}
3534  */
3535 
3536 /**
3537  * @defgroup LLVMCCoreValueInstructionExtractValue ExtractValue
3538  * @defgroup LLVMCCoreValueInstructionInsertValue InsertValue
3539  *
3540  * Functions in this group only apply to instructions that map to
3541  * llvm::ExtractValue and llvm::InsertValue instances.
3542  *
3543  * @{
3544  */
3545 
3546 /**
3547  * Obtain the number of indices.
3548  * NB: This also works on GEP.
3549  */
3550 unsigned LLVMGetNumIndices(LLVMValueRef Inst);
3551 
3552 /**
3553  * Obtain the indices as an array.
3554  */
3555 const unsigned *LLVMGetIndices(LLVMValueRef Inst);
3556 
3557 /**
3558  * @}
3559  */
3560 
3561 /**
3562  * @}
3563  */
3564 
3565 /**
3566  * @}
3567  */
3568 
3569 /**
3570  * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
3571  *
3572  * An instruction builder represents a point within a basic block and is
3573  * the exclusive means of building instructions using the C interface.
3574  *
3575  * @{
3576  */
3577 
3581  LLVMValueRef Instr);
3588  const char *Name);
3590 
3591 /* Metadata */
3592 
3593 /**
3594  * Get location information used by debugging information.
3595  *
3596  * @see llvm::IRBuilder::getCurrentDebugLocation()
3597  */
3599 
3600 /**
3601  * Set location information used by debugging information.
3602  *
3603  * To clear the location metadata of the given instruction, pass NULL to \p Loc.
3604  *
3605  * @see llvm::IRBuilder::SetCurrentDebugLocation()
3606  */
3608 
3609 /**
3610  * Attempts to set the debug location for the given instruction using the
3611  * current debug location for the given builder. If the builder has no current
3612  * debug location, this function is a no-op.
3613  *
3614  * @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general
3615  * LLVMAddMetadataToInst.
3616  *
3617  * @see llvm::IRBuilder::SetInstDebugLocation()
3618  */
3620 
3621 /**
3622  * Adds the metadata registered with the given builder to the given instruction.
3623  *
3624  * @see llvm::IRBuilder::AddMetadataToInst()
3625  */
3627 
3628 /**
3629  * Get the dafult floating-point math metadata for a given builder.
3630  *
3631  * @see llvm::IRBuilder::getDefaultFPMathTag()
3632  */
3634 
3635 /**
3636  * Set the default floating-point math metadata for the given builder.
3637  *
3638  * To clear the metadata, pass NULL to \p FPMathTag.
3639  *
3640  * @see llvm::IRBuilder::setDefaultFPMathTag()
3641  */
3643  LLVMMetadataRef FPMathTag);
3644 
3645 /**
3646  * Deprecated: Passing the NULL location will crash.
3647  * Use LLVMGetCurrentDebugLocation2 instead.
3648  */
3650 /**
3651  * Deprecated: Returning the NULL location will crash.
3652  * Use LLVMGetCurrentDebugLocation2 instead.
3653  */
3655 
3656 /* Terminators */
3660  unsigned N);
3665  LLVMBasicBlockRef Else, unsigned NumCases);
3667  unsigned NumDests);
3668 // LLVMBuildInvoke is deprecated in favor of LLVMBuildInvoke2, in preparation
3669 // for opaque pointer types.
3671  LLVMValueRef *Args, unsigned NumArgs,
3673  const char *Name);
3675  LLVMValueRef *Args, unsigned NumArgs,
3677  const char *Name);
3679 
3680 /* Exception Handling */
3683  LLVMValueRef PersFn, unsigned NumClauses,
3684  const char *Name);
3690  LLVMValueRef *Args, unsigned NumArgs,
3691  const char *Name);
3693  LLVMValueRef *Args, unsigned NumArgs,
3694  const char *Name);
3696  LLVMBasicBlockRef UnwindBB,
3697  unsigned NumHandlers, const char *Name);
3698 
3699 /* Add a case to the switch instruction */
3700 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
3701  LLVMBasicBlockRef Dest);
3702 
3703 /* Add a destination to the indirectbr instruction */
3704 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
3705 
3706 /* Get the number of clauses on the landingpad instruction */
3707 unsigned LLVMGetNumClauses(LLVMValueRef LandingPad);
3708 
3709 /* Get the value of the clause at index Idx on the landingpad instruction */
3710 LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx);
3711 
3712 /* Add a catch or filter clause to the landingpad instruction */
3713 void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
3714 
3715 /* Get the 'cleanup' flag in the landingpad instruction */
3716 LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad);
3717 
3718 /* Set the 'cleanup' flag in the landingpad instruction */
3719 void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
3720 
3721 /* Add a destination to the catchswitch instruction */
3722 void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest);
3723 
3724 /* Get the number of handlers on the catchswitch instruction */
3725 unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch);
3726 
3727 /**
3728  * Obtain the basic blocks acting as handlers for a catchswitch instruction.
3729  *
3730  * The Handlers parameter should point to a pre-allocated array of
3731  * LLVMBasicBlockRefs at least LLVMGetNumHandlers() large. On return, the
3732  * first LLVMGetNumHandlers() entries in the array will be populated
3733  * with LLVMBasicBlockRef instances.
3734  *
3735  * @param CatchSwitch The catchswitch instruction to operate on.
3736  * @param Handlers Memory address of an array to be filled with basic blocks.
3737  */
3738 void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers);
3739 
3740 /* Funclets */
3741 
3742 /* Get the number of funcletpad arguments. */
3743 LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i);
3744 
3745 /* Set a funcletpad argument at the given index. */
3746 void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value);
3747 
3748 /**
3749  * Get the parent catchswitch instruction of a catchpad instruction.
3750  *
3751  * This only works on llvm::CatchPadInst instructions.
3752  *
3753  * @see llvm::CatchPadInst::getCatchSwitch()
3754  */
3756 
3757 /**
3758  * Set the parent catchswitch instruction of a catchpad instruction.
3759  *
3760  * This only works on llvm::CatchPadInst instructions.
3761  *
3762  * @see llvm::CatchPadInst::setCatchSwitch()
3763  */
3764 void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch);
3765 
3766 /* Arithmetic */
3768  const char *Name);
3770  const char *Name);
3772  const char *Name);
3774  const char *Name);
3776  const char *Name);
3778  const char *Name);
3780  const char *Name);
3782  const char *Name);
3784  const char *Name);
3786  const char *Name);
3788  const char *Name);
3790  const char *Name);
3792  const char *Name);
3794  const char *Name);
3796  const char *Name);
3798  const char *Name);
3800  const char *Name);
3802  const char *Name);
3804  const char *Name);
3806  const char *Name);
3808  const char *Name);
3810  const char *Name);
3812  const char *Name);
3814  const char *Name);
3816  const char *Name);
3818  const char *Name);
3820  LLVMValueRef LHS, LLVMValueRef RHS,
3821  const char *Name);
3824  const char *Name);
3826  const char *Name);
3829 
3830 /* Memory */
3833  LLVMValueRef Val, const char *Name);
3834 
3835 /**
3836  * Creates and inserts a memset to the specified pointer and the
3837  * specified value.
3838  *
3839  * @see llvm::IRRBuilder::CreateMemSet()
3840  */
3842  LLVMValueRef Val, LLVMValueRef Len,
3843  unsigned Align);
3844 /**
3845  * Creates and inserts a memcpy between the specified pointers.
3846  *
3847  * @see llvm::IRRBuilder::CreateMemCpy()
3848  */
3850  LLVMValueRef Dst, unsigned DstAlign,
3851  LLVMValueRef Src, unsigned SrcAlign,
3852  LLVMValueRef Size);
3853 /**
3854  * Creates and inserts a memmove between the specified pointers.
3855  *
3856  * @see llvm::IRRBuilder::CreateMemMove()
3857  */
3859  LLVMValueRef Dst, unsigned DstAlign,
3860  LLVMValueRef Src, unsigned SrcAlign,
3861  LLVMValueRef Size);
3862 
3865  LLVMValueRef Val, const char *Name);
3867 // LLVMBuildLoad is deprecated in favor of LLVMBuildLoad2, in preparation for
3868 // opaque pointer types.
3870  const char *Name);
3872  LLVMValueRef PointerVal, const char *Name);
3874 // LLVMBuildGEP, LLVMBuildInBoundsGEP, and LLVMBuildStructGEP are deprecated in
3875 // favor of LLVMBuild*GEP2, in preparation for opaque pointer types.
3877  LLVMValueRef *Indices, unsigned NumIndices,
3878  const char *Name);
3880  LLVMValueRef *Indices, unsigned NumIndices,
3881  const char *Name);
3883  unsigned Idx, const char *Name);
3885  LLVMValueRef Pointer, LLVMValueRef *Indices,
3886  unsigned NumIndices, const char *Name);
3888  LLVMValueRef Pointer, LLVMValueRef *Indices,
3889  unsigned NumIndices, const char *Name);
3891  LLVMValueRef Pointer, unsigned Idx,
3892  const char *Name);
3894  const char *Name);
3896  const char *Name);
3897 LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
3898 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
3899 LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst);
3900 void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool IsWeak);
3902 void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering);
3904 void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst, LLVMAtomicRMWBinOp BinOp);
3905 
3906 /* Casts */
3908  LLVMTypeRef DestTy, const char *Name);
3910  LLVMTypeRef DestTy, const char *Name);
3912  LLVMTypeRef DestTy, const char *Name);
3914  LLVMTypeRef DestTy, const char *Name);
3916  LLVMTypeRef DestTy, const char *Name);
3918  LLVMTypeRef DestTy, const char *Name);
3920  LLVMTypeRef DestTy, const char *Name);
3922  LLVMTypeRef DestTy, const char *Name);
3924  LLVMTypeRef DestTy, const char *Name);
3926  LLVMTypeRef DestTy, const char *Name);
3928  LLVMTypeRef DestTy, const char *Name);
3930  LLVMTypeRef DestTy, const char *Name);
3932  LLVMTypeRef DestTy, const char *Name);
3934  LLVMTypeRef DestTy, const char *Name);
3936  LLVMTypeRef DestTy, const char *Name);
3938  LLVMTypeRef DestTy, const char *Name);
3940  LLVMTypeRef DestTy, const char *Name);
3942  LLVMTypeRef DestTy, const char *Name);
3944  LLVMTypeRef DestTy, LLVMBool IsSigned,
3945  const char *Name);
3947  LLVMTypeRef DestTy, const char *Name);
3948 
3949 /** Deprecated: This cast is always signed. Use LLVMBuildIntCast2 instead. */
3951  LLVMTypeRef DestTy, const char *Name);
3952 
3953 /* Comparisons */
3955  LLVMValueRef LHS, LLVMValueRef RHS,
3956  const char *Name);
3958  LLVMValueRef LHS, LLVMValueRef RHS,
3959  const char *Name);
3960 
3961 /* Miscellaneous instructions */
3963 // LLVMBuildCall is deprecated in favor of LLVMBuildCall2, in preparation for
3964 // opaque pointer types.
3966  LLVMValueRef *Args, unsigned NumArgs,
3967  const char *Name);
3969  LLVMValueRef *Args, unsigned NumArgs,
3970  const char *Name);
3973  const char *Name);
3975  const char *Name);
3977  LLVMValueRef Index, const char *Name);
3980  const char *Name);
3983  const char *Name);
3985  unsigned Index, const char *Name);
3987  LLVMValueRef EltVal, unsigned Index,
3988  const char *Name);
3990  const char *Name);
3991 
3993  const char *Name);
3995  const char *Name);
3997  LLVMValueRef RHS, const char *Name);
3999  LLVMBool singleThread, const char *Name);
4001  LLVMValueRef PTR, LLVMValueRef Val,
4002  LLVMAtomicOrdering ordering,
4003  LLVMBool singleThread);
4005  LLVMValueRef Cmp, LLVMValueRef New,
4006  LLVMAtomicOrdering SuccessOrdering,
4007  LLVMAtomicOrdering FailureOrdering,
4009 
4010 /**
4011  * Get the number of elements in the mask of a ShuffleVector instruction.
4012  */
4013 unsigned LLVMGetNumMaskElements(LLVMValueRef ShuffleVectorInst);
4014 
4015 /**
4016  * \returns a constant that specifies that the result of a \c ShuffleVectorInst
4017  * is undefined.
4018  */
4019 int LLVMGetUndefMaskElem(void);
4020 
4021 /**
4022  * Get the mask value at position Elt in the mask of a ShuffleVector
4023  * instruction.
4024  *
4025  * \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is undef
4026  * at that position.
4027  */
4028 int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt);
4029 
4032 
4035  LLVMAtomicOrdering Ordering);
4038  LLVMAtomicOrdering Ordering);
4039 
4040 /**
4041  * @}
4042  */
4043 
4044 /**
4045  * @defgroup LLVMCCoreModuleProvider Module Providers
4046  *
4047  * @{
4048  */
4049 
4050 /**
4051  * Changes the type of M so it can be passed to FunctionPassManagers and the
4052  * JIT. They take ModuleProviders for historical reasons.
4053  */
4056 
4057 /**
4058  * Destroys the module M.
4059  */
4061 
4062 /**
4063  * @}
4064  */
4065 
4066 /**
4067  * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
4068  *
4069  * @{
4070  */
4071 
4073  LLVMMemoryBufferRef *OutMemBuf,
4074  char **OutMessage);
4076  char **OutMessage);
4078  size_t InputDataLength,
4079  const char *BufferName,
4080  LLVMBool RequiresNullTerminator);
4082  size_t InputDataLength,
4083  const char *BufferName);
4084 const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
4085 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
4087 
4088 /**
4089  * @}
4090  */
4091 
4092 /**
4093  * @defgroup LLVMCCorePassRegistry Pass Registry
4094  *
4095  * @{
4096  */
4097 
4098 /** Return the global pass registry, for use with initialization functions.
4099  @see llvm::PassRegistry::getPassRegistry */
4101 
4102 /**
4103  * @}
4104  */
4105 
4106 /**
4107  * @defgroup LLVMCCorePassManagers Pass Managers
4108  *
4109  * @{
4110  */
4111 
4112 /** Constructs a new whole-module pass pipeline. This type of pipeline is
4113  suitable for link-time optimization and whole-module transformations.
4114  @see llvm::PassManager::PassManager */
4116 
4117 /** Constructs a new function-by-function pass pipeline over the module
4118  provider. It does not take ownership of the module provider. This type of
4119  pipeline is suitable for code generation and JIT compilation tasks.
4120  @see llvm::FunctionPassManager::FunctionPassManager */
4122 
4123 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
4125 
4126 /** Initializes, executes on the provided module, and finalizes all of the
4127  passes scheduled in the pass manager. Returns 1 if any of the passes
4128  modified the module, 0 otherwise.
4129  @see llvm::PassManager::run(Module&) */
4131 
4132 /** Initializes all of the function passes scheduled in the function pass
4133  manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4134  @see llvm::FunctionPassManager::doInitialization */
4136 
4137 /** Executes all of the function passes scheduled in the function pass manager
4138  on the provided function. Returns 1 if any of the passes modified the
4139  function, false otherwise.
4140  @see llvm::FunctionPassManager::run(Function&) */
4142 
4143 /** Finalizes all of the function passes scheduled in the function pass
4144  manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4145  @see llvm::FunctionPassManager::doFinalization */
4147 
4148 /** Frees the memory of a pass pipeline. For function pipelines, does not free
4149  the module provider.
4150  @see llvm::PassManagerBase::~PassManagerBase. */
4152 
4153 /**
4154  * @}
4155  */
4156 
4157 /**
4158  * @defgroup LLVMCCoreThreading Threading
4159  *
4160  * Handle the structures needed to make LLVM safe for multithreading.
4161  *
4162  * @{
4163  */
4164 
4165 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4166  time define LLVM_ENABLE_THREADS. This function always returns
4167  LLVMIsMultithreaded(). */
4169 
4170 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4171  time define LLVM_ENABLE_THREADS. */
4172 void LLVMStopMultithreaded(void);
4173 
4174 /** Check whether LLVM is executing in thread-safe mode or not.
4175  @see llvm::llvm_is_multithreaded */
4177 
4178 /**
4179  * @}
4180  */
4181 
4182 /**
4183  * @}
4184  */
4185 
4186 /**
4187  * @}
4188  */
4189 
4191 
4192 #endif /* LLVM_C_CORE_H */
llvm::Check::Size
@ Size
Definition: FileCheck.h:73
LLVMConstString
LLVMValueRef LLVMConstString(const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential with string content in the global context.
Definition: Core.cpp:1426
LLVMBlockAddressValueKind
@ LLVMBlockAddressValueKind
Definition: Core.h:266
i
i
Definition: README.txt:29
LLVMConstantExprValueKind
@ LLVMConstantExprValueKind
Definition: Core.h:267
LLVMBFloatType
LLVMTypeRef LLVMBFloatType(void)
Definition: Core.cpp:649
LLVMGetDiagInfoSeverity
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition: Core.cpp:224
LLVMIntEQ
@ LLVMIntEQ
equal
Definition: Core.h:289
LLVMBuildLShr
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3441
LLVMSetCleanup
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition: Core.cpp:3297
LLVMBuildIsNotNull
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3989
LLVMBuildPointerCast
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3871
LLVMGetInitializer
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition: Core.cpp:2184
LLVMBuildNUWMul
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3386
LLVMARMAAPCSVFPCallConv
@ LLVMARMAAPCSVFPCallConv
Definition: Core.h:226
block
we get the following basic block
Definition: README_ALTIVEC.txt:95
LLVMAtomicRMWBinOpFAdd
@ LLVMAtomicRMWBinOpFAdd
Add a floating point value and return the old one.
Definition: Core.h:380
LLVMHiddenVisibility
@ LLVMHiddenVisibility
The GV is hidden.
Definition: Core.h:194
LLVMIntelOCLBICallConv
@ LLVMIntelOCLBICallConv
Definition: Core.h:233
LLVMGlobalClearMetadata
void LLVMGlobalClearMetadata(LLVMValueRef Global)
Removes all metadata attachments from this value.
Definition: Core.cpp:2124
LLVMBuildFSub
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3371
LLVMConstantVectorValueKind
@ LLVMConstantVectorValueKind
Definition: Core.h:270
LLVMGetVolatile
LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst)
Definition: Core.cpp:3721
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
LLVMRealPredicateFalse
@ LLVMRealPredicateFalse
Always false (always folded)
Definition: Core.h:302
LLVMIsPackedStruct
LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy)
Determine whether a structure is packed.
Definition: Core.cpp:749
LLVMMSP430INTRCallConv
@ LLVMMSP430INTRCallConv
Definition: Core.h:227
LLVMGetNextParam
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition: Core.cpp:2548
LLVMSetTailCall
void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall)
Set whether a call instruction is a tail call.
Definition: Core.cpp:2927
LLVMGhostLinkage
@ LLVMGhostLinkage
Obsolete.
Definition: Core.h:186
LLVMGetBasicBlockTerminator
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition: Core.cpp:2655
LLVMGetTypeByName2
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition: Core.cpp:765
LLVMConstStringInContext
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition: Core.cpp:1417
LLVMGetOrdering
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemoryAccessInst)
Definition: Core.cpp:3751
LLVMBuildBr
LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3167
LLVMRealULE
@ LLVMRealULE
True if unordered, less than, or equal.
Definition: Core.h:315
LLVMInternalLinkage
@ LLVMInternalLinkage
Rename collisions when linking (static functions)
Definition: Core.h:180
LLVMContextRef
struct LLVMOpaqueContext * LLVMContextRef
The top-level container for all LLVM global data.
Definition: Types.h:53
LLVMGetNamedGlobalIFunc
LLVMValueRef LLVMGetNamedGlobalIFunc(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalIFunc value from a Module by its name.
Definition: Core.cpp:2580
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
LLVMGetMaskValue
int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt)
Get the mask value at position Elt in the mask of a ShuffleVector instruction.
Definition: Core.cpp:4029
LLVMConstRealOfStringAndSize
LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text, unsigned SLen)
Obtain a constant for a floating point value parsed from a string.
LLVMGetVectorSize
unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy)
Obtain the (possibly scalable) number of elements in a vector type.
Definition: Core.cpp:817
LLVMGetNextGlobalAlias
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition: Core.cpp:2290
LLVMSetPersonalityFn
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition: Core.cpp:2370
LLVMConstLShr
LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1679
LLVMFP128TypeInContext
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition: Core.cpp:633
LLVMGetGlobalContext
LLVMContextRef LLVMGetGlobalContext(void)
Obtain the global context instance.
Definition: Core.cpp:81
LLVMDisposePassManager
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition: Core.cpp:4190
LLVMBasicBlockValueKind
@ LLVMBasicBlockValueKind
Definition: Core.h:257
LLVMDLLImportLinkage
@ LLVMDLLImportLinkage
Obsolete.
Definition: Core.h:183
LLVMGetOperandUse
LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index)
Obtain the use of an operand at a specific index in a llvm::User value.
Definition: Core.cpp:1042
LLVMBuildStore
LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr)
Definition: Core.cpp:3572
LLVMGetPersonalityFn
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition: Core.cpp:2366
LLVMExternalLinkage
@ LLVMExternalLinkage
Externally visible function.
Definition: Core.h:170
LLVMGetNamedGlobal
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition: Core.cpp:2144
LLVMEraseGlobalIFunc
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition: Core.cpp:2625
LLVMInlineAsmDialect
LLVMInlineAsmDialect
Definition: Core.h:393
LLVMIntSGT
@ LLVMIntSGT
signed greater than
Definition: Core.h:295
LLVMConstNUWAdd
LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1548
LLVMBuildCatchRet
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition: Core.cpp:3255
LLVMPassRegistryRef
struct LLVMOpaquePassRegistry * LLVMPassRegistryRef
Definition: Types.h:130
LLVMPTXKernelCallConv
@ LLVMPTXKernelCallConv
Definition: Core.h:229
LLVMAtomicRMWBinOpXchg
@ LLVMAtomicRMWBinOpXchg
Set the new value and return the one old.
Definition: Core.h:361
LLVMBuildCall2
LLVMValueRef LLVMBuildCall2(LLVMBuilderRef, LLVMTypeRef, LLVMValueRef Fn, LLVMValueRef *Args, unsigned NumArgs, const char *Name)
Definition: Core.cpp:3927
LLVMARMAPCSCallConv
@ LLVMARMAPCSCallConv
Definition: Core.h:224
LLVMGetDebugLocDirectory
const char * LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length)
Return the directory of the debug location for this value, which must be an llvm::Instruction,...
Definition: Core.cpp:1271
LLVMConstantAggregateZeroValueKind
@ LLVMConstantAggregateZeroValueKind
Definition: Core.h:273
LLVMCreateBuilderInContext
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition: Core.cpp:3061
LLVMSRem
@ LLVMSRem
Definition: Core.h:83
LLVMAtomicOrderingAcquireRelease
@ LLVMAtomicOrderingAcquireRelease
provides both an Acquire and a Release barrier (for fences and operations which both read and write m...
Definition: Core.h:346
LLVMGetParentCatchSwitch
LLVMValueRef LLVMGetParentCatchSwitch(LLVMValueRef CatchPad)
Get the parent catchswitch instruction of a catchpad instruction.
Definition: Core.cpp:3315
LLVMConstAShr
LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1684
LLVMSub
@ LLVMSub
Definition: Core.h:75
LLVMGetParams
void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params)
Obtain the parameters in a function.
Definition: Core.cpp:2517
LLVMConstICmp
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1660
LLVMAttributeFunctionIndex
@ LLVMAttributeFunctionIndex
Definition: Core.h:458
LLVMSetThreadLocal
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition: Core.cpp:2200
LLVMYieldCallback
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition: Core.h:492
LLVMGetFirstGlobalIFunc
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition: Core.cpp:2585
LLVMFPToSI
@ LLVMFPToSI
Definition: Core.h:105
LLVMBuildZExtOrBitCast
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3847
LLVMSetSuccessor
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition: Core.cpp:2969
LLVMGetAllocatedType
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition: Core.cpp:2995
LLVMGeneralDynamicTLSModel
@ LLVMGeneralDynamicTLSModel
Definition: Core.h:327
LLVMBuildLoad
LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal, const char *Name)
Definition: Core.cpp:3559
LLVMAddCallSiteAttribute
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition: Core.cpp:2869
LLVMAtomicRMWBinOpOr
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition: Core.h:366
LLVMConstSExt
LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1715
LLVMBuildGEP2
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition: Core.cpp:3671
LLVMBuildFreeze
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3979
LLVMConstIntGetSExtValue
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition: Core.cpp:1394
LLVMFinalizeFunctionPassManager
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition: Core.cpp:4186
LLVMFloatType
LLVMTypeRef LLVMFloatType(void)
Definition: Core.cpp:652
LLVMIntegerTypeKind
@ LLVMIntegerTypeKind
Arbitrary bit width integers.
Definition: Core.h:155
op
#define op(i)
LLVMInitializeFunctionPassManager
LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM)
Initializes all of the function passes scheduled in the function pass manager.
Definition: Core.cpp:4178
LLVMBuildIntCast2
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition: Core.cpp:3876
LLVMGetIncomingValue
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition: Core.cpp:3022
Types.h
LLVMCreateMessage
char * LLVMCreateMessage(const char *Message)
Definition: Core.cpp:64
LLVMAttributeIndex
unsigned LLVMAttributeIndex
Definition: Core.h:461
LLVMDisposeMemoryBuffer
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition: Core.cpp:4149
LLVMXor
@ LLVMXor
Definition: Core.h:92
LLVMAtomicCmpXchg
@ LLVMAtomicCmpXchg
Definition: Core.h:133
LLVMBuildBinOp
LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3466
LLVMConstIntCast
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned)
Definition: Core.cpp:1800
LLVMGetNumOperands
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition: Core.cpp:1051
LLVMSetDataLayout
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
Definition: Core.cpp:289
LLVMSExt
@ LLVMSExt
Definition: Core.h:103
LLVMGetPreviousGlobalAlias
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition: Core.cpp:2298
LLVMGetNextInstruction
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition: Core.cpp:2784
LLVMAtomicRMWBinOp
LLVMAtomicRMWBinOp
Definition: Core.h:360
LLVMConstZExt
LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1720
LLVMInsertValue
@ LLVMInsertValue
Definition: Core.h:128
LLVMAddGlobal
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:2130
LLVMDSWarning
@ LLVMDSWarning
Definition: Core.h:388
LLVMFPToUI
@ LLVMFPToUI
Definition: Core.h:104
LLVMArrayTypeKind
@ LLVMArrayTypeKind
Arrays.
Definition: Core.h:158
LLVMGetDebugLocColumn
unsigned LLVMGetDebugLocColumn(LLVMValueRef Val)
Return the column number of the debug location for this value, which must be an llvm::Instruction.
Definition: Core.cpp:1341
LLVMConstNSWMul
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1586
LLVMCloneModule
LLVMModuleRef LLVMCloneModule(LLVMModuleRef M)
Return an exact copy of the specified module.
Definition: CloneModule.cpp:198
LLVMModuleFlagBehaviorWarning
@ LLVMModuleFlagBehaviorWarning
Emits a warning if two values disagree.
Definition: Core.h:412
LLVMFunctionValueKind
@ LLVMFunctionValueKind
Definition: Core.h:262
LLVMConstAllOnes
LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty)
Obtain a constant value referring to the instance of a type consisting of all ones.
Definition: Core.cpp:1065
LLVMGetCmpXchgFailureOrdering
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition: Core.cpp:4068
LLVMCreateModuleProviderForExistingModule
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition: Core.cpp:4084
LLVMBlockAddress
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition: Core.cpp:1865
LLVMInsertIntoBuilderWithName
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition: Core.cpp:3098
LLVMRealOGE
@ LLVMRealOGE
True if ordered and greater than or equal.
Definition: Core.h:305
LLVMConstGEP
LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition: Core.cpp:1689
LLVMAddAlias
LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee, const char *Name)
Definition: Core.cpp:2261
LLVMConstInBoundsGEP
LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal, LLVMValueRef *ConstantIndices, unsigned NumIndices)
Definition: Core.cpp:1699
LLVMContextGetDiagnosticHandler
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition: Core.cpp:92
LLVMOpaqueModuleFlagEntry
Definition: Core.cpp:303
LLVMCountBasicBlocks
unsigned LLVMCountBasicBlocks(LLVMValueRef Fn)
Obtain the number of basic blocks in a function.
Definition: Core.cpp:2659
LLVMGetValueKind
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition: Core.cpp:851
LLVMConstantFPValueKind
@ LLVMConstantFPValueKind
Definition: Core.h:277
LLVMRealORD
@ LLVMRealORD
True if ordered (no nans)
Definition: Core.h:309
LLVMGetEntryBasicBlock
LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn)
Obtain the basic block that corresponds to the entry point of a function.
Definition: Core.cpp:2669
LLVMShl
@ LLVMShl
Definition: Core.h:87
LLVMConstExtractElement
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition: Core.cpp:1819
LLVMGetGlobalParent
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition: Core.cpp:1871
LLVMLandingPadClauseTy
LLVMLandingPadClauseTy
Definition: Core.h:320
LLVMGetMDString
const char * LLVMGetMDString(LLVMValueRef V, unsigned *Length)
Obtain the underlying string from a MDString value.
Definition: Core.cpp:1166
LLVMMDNodeInContext2
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition: Core.cpp:1106
LLVMOpcode
LLVMOpcode
External users depend on the following values being stable.
Definition: Core.h:58
LLVMStructType
LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount, LLVMBool Packed)
Create a new structure type in the global context.
Definition: Core.cpp:709
LLVMConstFRem
LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1640
LLVMDisposeBuilder
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition: Core.cpp:3103
LLVMInlineAsmDialectATT
@ LLVMInlineAsmDialectATT
Definition: Core.h:394
LLVMGetFirstParam
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition: Core.cpp:2532
LLVMVoidTypeInContext
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition: Core.cpp:823
LLVMIsExternallyInitialized
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition: Core.cpp:2251
LLVMGetGlobalPassRegistry
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void)
Return the global pass registry, for use with initialization functions.
Definition: Core.cpp:4155
LLVMCreateBasicBlockInContext
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition: Core.cpp:2705
LLVMBuildSub
LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3356
LLVMBuildSelect
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition: Core.cpp:3935
LLVMSetUnnamedAddr
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition: Core.cpp:2032
LLVMGetOrInsertNamedMetadata
LLVMNamedMDNodeRef LLVMGetOrInsertNamedMetadata(LLVMModuleRef M, const char *Name, size_t NameLen)
Retrieve a NamedMDNode with the given name, creating a new node if no such node exists.
Definition: Core.cpp:1220
LLVMRealUNO
@ LLVMRealUNO
True if unordered: isnan(X) | isnan(Y)
Definition: Core.h:310
LLVMRemoveCallSiteEnumAttribute
void LLVMRemoveCallSiteEnumAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, unsigned KindID)
Definition: Core.cpp:2903
LLVMGetNextGlobal
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2164
LLVMBuildICmp
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3896
LLVMMemoryPhiValueKind
@ LLVMMemoryPhiValueKind
Definition: Core.h:260
LLVMGetSection
const char * LLVMGetSection(LLVMValueRef Global)
Definition: Core.cpp:1973
LLVMAMDGPULSCallConv
@ LLVMAMDGPULSCallConv
Definition: Core.h:251
LLVMIntUGT
@ LLVMIntUGT
unsigned greater than
Definition: Core.h:291
LLVMBuildArrayAlloca
LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3549
LLVMValueAsBasicBlock
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition: Core.cpp:2643
LLVMConstBitCast
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1765
LLVMScalableVectorType
LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType, unsigned ElementCount)
Create a vector type that contains a defined type and has a scalable number of elements.
Definition: Core.cpp:791
LLVMGetArrayLength
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition: Core.cpp:809
LLVMBuildAtomicCmpXchg
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool SingleThread)
Definition: Core.cpp:4010
LLVMConstFPToSI
LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1750
LLVMGetLastInstruction
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition: Core.cpp:2776
LLVMMDStringInContext
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1111
LLVMConstStruct
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
Definition: Core.cpp:1460
LLVMScalableVectorTypeKind
@ LLVMScalableVectorTypeKind
Scalable SIMD vector type.
Definition: Core.h:164
LLVMConstExactSDiv
LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1619
LLVMConstInlineAsm
LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, const char *AsmString, const char *Constraints, LLVMBool HasSideEffects, LLVMBool IsAlignStack)
Deprecated: Use LLVMGetInlineAsm instead.
Definition: Core.cpp:1857
LLVMAddModuleFlag
void LLVMAddModuleFlag(LLVMModuleRef M, LLVMModuleFlagBehavior Behavior, const char *Key, size_t KeyLen, LLVMMetadataRef Val)
Add a module-level flag to the module-level flags metadata if it doesn't already exist.
Definition: Core.cpp:398
LLVMInsertElement
@ LLVMInsertElement
Definition: Core.h:125
LLVMZExt
@ LLVMZExt
Definition: Core.h:102
LLVMConstAdd
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1537
LLVMGetPreviousFunction
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition: Core.cpp:2350
LLVMConstSDiv
LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1614
LLVMAtomicOrderingUnordered
@ LLVMAtomicOrderingUnordered
Lowest level of atomicity, guarantees somewhat sane results, lock free.
Definition: Core.h:335
LLVMIntTypeInContext
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits)
Definition: Core.cpp:586
LLVMContextSetDiscardValueNames
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition: Core.cpp:112
LLVMDisposeMessage
void LLVMDisposeMessage(char *Message)
Definition: Core.cpp:68
LLVMGetDebugLocLine
unsigned LLVMGetDebugLocLine(LLVMValueRef Val)
Return the line number of the debug location for this value, which must be an llvm::Instruction,...
Definition: Core.cpp:1319
LLVMConstRealGetDouble
double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo)
Obtain the double value for an floating point constant value.
Definition: Core.cpp:1398
LLVMFP128TypeKind
@ LLVMFP128TypeKind
128 bit floating point type (112-bit mantissa)
Definition: Core.h:152
LLVMAnd
@ LLVMAnd
Definition: Core.h:90
LLVMDSRemark
@ LLVMDSRemark
Definition: Core.h:389
LLVMX86FP80Type
LLVMTypeRef LLVMX86FP80Type(void)
Definition: Core.cpp:658
LLVMGetFirstFunction
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition: Core.cpp:2326
LLVMGetFirstUse
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition: Core.cpp:993
llvm::tgtok::Else
@ Else
Definition: TGLexer.h:75
LLVMResume
@ LLVMResume
Definition: Core.h:137
LLVMConstFMul
LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1598
LLVMModuleFlagEntriesGetKey
const char * LLVMModuleFlagEntriesGetKey(LLVMModuleFlagEntry *Entries, unsigned Index, size_t *Len)
Returns the key for a module flag entry at a specific index.
Definition: Core.cpp:378
LLVMAddFunction
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
Definition: Core.cpp:2316
LLVMDisposeModuleFlagsMetadata
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
Definition: Core.cpp:366
LLVMBuildLoad2
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition: Core.cpp:3567
LLVMHalfTypeKind
@ LLVMHalfTypeKind
16 bit floating point type
Definition: Core.h:148
LLVMSetCurrentDebugLocation
void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L)
Deprecated: Passing the NULL location will crash.
Definition: Core.cpp:3120
LLVMCreateBuilder
LLVMBuilderRef LLVMCreateBuilder(void)
Definition: Core.cpp:3065
LLVMMDString
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1118
LLVMBuildShl
LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3436
llvm::BitmaskEnumDetail::Mask
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
LLVMSetCmpXchgFailureOrdering
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition: Core.cpp:4073
LLVMBuilderGetDefaultFPMathTag
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition: Core.cpp:3148
LLVMSetDLLStorageClass
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition: Core.cpp:1998
LLVMConstantStructValueKind
@ LLVMConstantStructValueKind
Definition: Core.h:269
LLVMGetLastParam
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition: Core.cpp:2540
LLVMBuildPtrToInt
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3827
LLVMAppendExistingBasicBlock
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition: Core.cpp:2719
LLVMOpaqueValueMetadataEntry
Definition: Core.cpp:935
LLVMGHCCallConv
@ LLVMGHCCallConv
Definition: Core.h:214
LLVMBuildInsertElement
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:3953
LLVMHHVMCallConv
@ LLVMHHVMCallConv
Definition: Core.h:237
LLVMValueMetadataEntriesGetMetadata
LLVMMetadataRef LLVMValueMetadataEntriesGetMetadata(LLVMValueMetadataEntry *Entries, unsigned Index)
Returns the underlying metadata node of a value metadata entry at a specific index.
Definition: Core.cpp:2104
LLVMBuildZExt
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3787
LLVMGetInstructionCallConv
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition: Core.cpp:2852
LLVMGlobalUnnamedAddr
@ LLVMGlobalUnnamedAddr
Address of the GV is globally insignificant.
Definition: Core.h:201
LLVMAMDGPUKERNELCallConv
@ LLVMAMDGPUKERNELCallConv
Definition: Core.h:247
LLVMConstUDiv
LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1603
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::RISCVFenceField::R
@ R
Definition: RISCVBaseInfo.h:198
LLVMUDiv
@ LLVMUDiv
Definition: Core.h:79
LLVMUnnamedAddr
LLVMUnnamedAddr
Definition: Core.h:198
LLVMAddClause
void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal)
Definition: Core.cpp:3288
LLVMSetValueName
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition: Core.cpp:877
LLVMLabelTypeInContext
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition: Core.cpp:826
LLVMGetModuleInlineAsm
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition: Core.cpp:457
LLVMSetIsInBounds
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition: Core.cpp:3005
LLVMSetVolatile
void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile)
Definition: Core.cpp:3732
LLVMInsertBasicBlock
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB, const char *Name)
Insert a basic block in a function using the global context.
Definition: Core.cpp:2741
LLVMRemoveGlobalIFunc
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition: Core.cpp:2629
LLVMIsTailCall
LLVMBool LLVMIsTailCall(LLVMValueRef CallInst)
Obtain whether a call instruction is a tail call.
Definition: Core.cpp:2923
LLVMConstFDiv
LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1625
LLVMAddAttributeAtIndex
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition: Core.cpp:2461
LLVMUseRef
struct LLVMOpaqueUse * LLVMUseRef
Used to get the users and usees of a Value.
Definition: Types.h:136
LLVM_DECLARE_VALUE_CAST
#define LLVM_DECLARE_VALUE_CAST(name)
Convert value instances between types.
Definition: Core.h:1738
llvm::ARMBuildAttrs::Section
@ Section
Legacy Tags.
Definition: ARMBuildAttributes.h:78
LLVMDeleteBasicBlock
void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB)
Remove a basic block from a function and delete it.
Definition: Core.cpp:2746
LLVMIsConstantString
LLVMBool LLVMIsConstantString(LLVMValueRef c)
Returns true if the specified constant is an array of i8.
Definition: Core.cpp:1436
LLVMFAdd
@ LLVMFAdd
Definition: Core.h:74
LLVMConstFNeg
LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal)
Definition: Core.cpp:1529
LLVMGetStringAttributeKind
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition: Core.cpp:186
Arg
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
Definition: AMDGPULibCalls.cpp:206
LLVMModuleFlagBehaviorError
@ LLVMModuleFlagBehaviorError
Emits an error if two values disagree, otherwise the resulting value is that of the operands.
Definition: Core.h:405
LLVMGetAtomicRMWBinOp
LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst)
Definition: Core.cpp:3772
LLVMRealOLT
@ LLVMRealOLT
True if ordered and less than.
Definition: Core.h:306
LLVMGetPreviousGlobalIFunc
LLVMValueRef LLVMGetPreviousGlobalIFunc(LLVMValueRef IFunc)
Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
Definition: Core.cpp:2609
LLVMPrintValueToString
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition: Core.cpp:885
LLVMConstInt
LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N, LLVMBool SignExtend)
Obtain a constant value for an integer type.
Definition: Core.cpp:1351
LLVMBuildExtractElement
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:3947
LLVMIntNE
@ LLVMIntNE
not equal
Definition: Core.h:290
LLVMAtomicRMWBinOpAdd
@ LLVMAtomicRMWBinOpAdd
Add a value and return the old one.
Definition: Core.h:362
LLVMSetAtomicRMWBinOp
void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst, LLVMAtomicRMWBinOp BinOp)
Definition: Core.cpp:3776
LLVMIsAtomicSingleThread
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition: Core.cpp:4037
LLVMConstIntOfArbitraryPrecision
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition: Core.cpp:1356
llvm::tgtok::Then
@ Then
Definition: TGLexer.h:52
LLVMSetFunctionCallConv
void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC)
Set the calling convention of a function.
Definition: Core.cpp:2443
LLVMGetTarget
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
Definition: Core.cpp:294
LLVMConstantIntValueKind
@ LLVMConstantIntValueKind
Definition: Core.h:276
LLVMSetLinkage
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition: Core.cpp:1908
LLVMVAArg
@ LLVMVAArg
Definition: Core.h:123
LLVMGetICmpPredicate
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition: Core.cpp:2808
LLVMInt128TypeInContext
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition: Core.cpp:583
LLVMGetLastGlobal
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition: Core.cpp:2156
LLVMTypeIsSized
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition: Core.cpp:539
LLVMBuildFNeg
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3487
LLVMBuildExactUDiv
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3401
LLVMConstOr
LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1650
LLVMLinkerPrivateWeakLinkage
@ LLVMLinkerPrivateWeakLinkage
Like LinkerPrivate, but is weak.
Definition: Core.h:189
LLVMValueKind
LLVMValueKind
Definition: Core.h:255
LLVMBuildTruncOrBitCast
LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3859
LLVMInt1TypeInContext
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition: Core.cpp:568
LLVMBuildSExt
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3792
LLVMCatchPad
@ LLVMCatchPad
Definition: Core.h:141
LLVMIntType
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition: Core.cpp:608
LLVMInt16TypeInContext
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition: Core.cpp:574
LLVMIsAMDString
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition: Core.cpp:985
LLVMGetNamedGlobalAlias
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition: Core.cpp:2269
LLVMFloatTypeInContext
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition: Core.cpp:624
LLVMFPTrunc
@ LLVMFPTrunc
Definition: Core.h:108
LLVMGetMDKindIDInContext
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition: Core.cpp:120
LLVMSetModuleInlineAsm
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition: Core.cpp:449
LLVMGlobalGetValueType
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition: Core.cpp:2038
LLVMBuildSDiv
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3406
LLVMICmp
@ LLVMICmp
Definition: Core.h:116
LLVMBuildFPToSI
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3802
LLVMCreateFunctionPassManager
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition: Core.cpp:4169
LLVMClearInsertionPosition
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition: Core.cpp:3090
LLVMCountIncoming
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition: Core.cpp:3018
LLVMRealULT
@ LLVMRealULT
True if unordered or less than.
Definition: Core.h:314
LLVMBuildCast
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3865
LLVMBuildFRem
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3431
LLVMAShr
@ LLVMAShr
Definition: Core.h:89
LLVMPreserveAllCallConv
@ LLVMPreserveAllCallConv
Definition: Core.h:219
LLVMAMDGPUVSCallConv
@ LLVMAMDGPUVSCallConv
Definition: Core.h:243
LLVMSetGlobalConstant
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition: Core.cpp:2208
LLVMSetMetadata
void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node)
Set metadata associated with an instruction value.
Definition: Core.cpp:929
LLVMBuildNSWSub
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3361
LLVMGetUndefMaskElem
int LLVMGetUndefMaskElem(void)
Definition: Core.cpp:4035
LLVMAddrSpaceCast
@ LLVMAddrSpaceCast
Definition: Core.h:113
LLVMFP128Type
LLVMTypeRef LLVMFP128Type(void)
Definition: Core.cpp:661
LLVMGetPreviousGlobal
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2172
LLVMAMDGPUESCallConv
@ LLVMAMDGPUESCallConv
Definition: Core.h:252
LLVMLShr
@ LLVMLShr
Definition: Core.h:88
LLVMBuilderRef
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Definition: Types.h:110
LLVMGetNumContainedTypes
unsigned LLVMGetNumContainedTypes(LLVMTypeRef Tp)
Return the number of types in the derived type.
Definition: Core.cpp:805
LLVMContextDispose
void LLVMContextDispose(LLVMContextRef C)
Destroy a context instance.
Definition: Core.cpp:116
LLVMBuildFPToUI
LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy