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