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 /*===-- Version query -----------------------------------------------------===*/
483 
484 /**
485  * Return the major, minor, and patch version of LLVM
486  *
487  * The version components are returned via the function's three output
488  * parameters or skipped if a NULL pointer was supplied.
489  */
490 void LLVMGetVersion(unsigned *Major, unsigned *Minor, unsigned *Patch);
491 
492 /*===-- Error handling ----------------------------------------------------===*/
493 
494 char *LLVMCreateMessage(const char *Message);
495 void LLVMDisposeMessage(char *Message);
496 
497 /**
498  * @defgroup LLVMCCoreContext Contexts
499  *
500  * Contexts are execution states for the core LLVM IR system.
501  *
502  * Most types are tied to a context instance. Multiple contexts can
503  * exist simultaneously. A single context is not thread safe. However,
504  * different contexts can execute on different threads simultaneously.
505  *
506  * @{
507  */
508 
510 typedef void (*LLVMYieldCallback)(LLVMContextRef, void *);
511 
512 /**
513  * Create a new context.
514  *
515  * Every call to this function should be paired with a call to
516  * LLVMContextDispose() or the context will leak memory.
517  */
519 
520 /**
521  * Obtain the global context instance.
522  */
524 
525 /**
526  * Set the diagnostic handler for this context.
527  */
529  LLVMDiagnosticHandler Handler,
530  void *DiagnosticContext);
531 
532 /**
533  * Get the diagnostic handler of this context.
534  */
536 
537 /**
538  * Get the diagnostic context of this context.
539  */
541 
542 /**
543  * Set the yield callback function for this context.
544  *
545  * @see LLVMContext::setYieldCallback()
546  */
548  void *OpaqueHandle);
549 
550 /**
551  * Retrieve whether the given context is set to discard all value names.
552  *
553  * @see LLVMContext::shouldDiscardValueNames()
554  */
556 
557 /**
558  * Set whether the given context discards all value names.
559  *
560  * If true, only the names of GlobalValue objects will be available in the IR.
561  * This can be used to save memory and runtime, especially in release mode.
562  *
563  * @see LLVMContext::setDiscardValueNames()
564  */
566 
567 /**
568  * Set whether the given context is in opaque pointer mode.
569  *
570  * @see LLVMContext::setOpaquePointers()
571  */
573 
574 /**
575  * Destroy a context instance.
576  *
577  * This should be called for every call to LLVMContextCreate() or memory
578  * will be leaked.
579  */
581 
582 /**
583  * Return a string representation of the DiagnosticInfo. Use
584  * LLVMDisposeMessage to free the string.
585  *
586  * @see DiagnosticInfo::print()
587  */
589 
590 /**
591  * Return an enum LLVMDiagnosticSeverity.
592  *
593  * @see DiagnosticInfo::getSeverity()
594  */
596 
597 unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name,
598  unsigned SLen);
599 unsigned LLVMGetMDKindID(const char *Name, unsigned SLen);
600 
601 /**
602  * Return an unique id given the name of a enum attribute,
603  * or 0 if no attribute by that name exists.
604  *
605  * See http://llvm.org/docs/LangRef.html#parameter-attributes
606  * and http://llvm.org/docs/LangRef.html#function-attributes
607  * for the list of available attributes.
608  *
609  * NB: Attribute names and/or id are subject to change without
610  * going through the C API deprecation cycle.
611  */
612 unsigned LLVMGetEnumAttributeKindForName(const char *Name, size_t SLen);
613 unsigned LLVMGetLastEnumAttributeKind(void);
614 
615 /**
616  * Create an enum attribute.
617  */
619  uint64_t Val);
620 
621 /**
622  * Get the unique id corresponding to the enum attribute
623  * passed as argument.
624  */
626 
627 /**
628  * Get the enum attribute's value. 0 is returned if none exists.
629  */
631 
632 /**
633  * Create a type attribute
634  */
636  LLVMTypeRef type_ref);
637 
638 /**
639  * Get the type attribute's value.
640  */
642 
643 /**
644  * Create a string attribute.
645  */
647  const char *K, unsigned KLength,
648  const char *V, unsigned VLength);
649 
650 /**
651  * Get the string attribute's kind.
652  */
653 const char *LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length);
654 
655 /**
656  * Get the string attribute's value.
657  */
658 const char *LLVMGetStringAttributeValue(LLVMAttributeRef A, unsigned *Length);
659 
660 /**
661  * Check for the different types of attributes.
662  */
666 
667 /**
668  * Obtain a Type from a context by its registered name.
669  */
671 
672 /**
673  * @}
674  */
675 
676 /**
677  * @defgroup LLVMCCoreModule Modules
678  *
679  * Modules represent the top-level structure in an LLVM program. An LLVM
680  * module is effectively a translation unit or a collection of
681  * translation units merged together.
682  *
683  * @{
684  */
685 
686 /**
687  * Create a new, empty module in the global context.
688  *
689  * This is equivalent to calling LLVMModuleCreateWithNameInContext with
690  * LLVMGetGlobalContext() as the context parameter.
691  *
692  * Every invocation should be paired with LLVMDisposeModule() or memory
693  * will be leaked.
694  */
695 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
696 
697 /**
698  * Create a new, empty module in a specific context.
699  *
700  * Every invocation should be paired with LLVMDisposeModule() or memory
701  * will be leaked.
702  */
704  LLVMContextRef C);
705 /**
706  * Return an exact copy of the specified module.
707  */
709 
710 /**
711  * Destroy a module instance.
712  *
713  * This must be called for every created module or memory will be
714  * leaked.
715  */
717 
718 /**
719  * Obtain the identifier of a module.
720  *
721  * @param M Module to obtain identifier of
722  * @param Len Out parameter which holds the length of the returned string.
723  * @return The identifier of M.
724  * @see Module::getModuleIdentifier()
725  */
726 const char *LLVMGetModuleIdentifier(LLVMModuleRef M, size_t *Len);
727 
728 /**
729  * Set the identifier of a module to a string Ident with length Len.
730  *
731  * @param M The module to set identifier
732  * @param Ident The string to set M's identifier to
733  * @param Len Length of Ident
734  * @see Module::setModuleIdentifier()
735  */
736 void LLVMSetModuleIdentifier(LLVMModuleRef M, const char *Ident, size_t Len);
737 
738 /**
739  * Obtain the module's original source file name.
740  *
741  * @param M Module to obtain the name of
742  * @param Len Out parameter which holds the length of the returned string
743  * @return The original source file name of M
744  * @see Module::getSourceFileName()
745  */
746 const char *LLVMGetSourceFileName(LLVMModuleRef M, size_t *Len);
747 
748 /**
749  * Set the original source file name of a module to a string Name with length
750  * Len.
751  *
752  * @param M The module to set the source file name of
753  * @param Name The string to set M's source file name to
754  * @param Len Length of Name
755  * @see Module::setSourceFileName()
756  */
757 void LLVMSetSourceFileName(LLVMModuleRef M, const char *Name, size_t Len);
758 
759 /**
760  * Obtain the data layout for a module.
761  *
762  * @see Module::getDataLayoutStr()
763  *
764  * LLVMGetDataLayout is DEPRECATED, as the name is not only incorrect,
765  * but match the name of another method on the module. Prefer the use
766  * of LLVMGetDataLayoutStr, which is not ambiguous.
767  */
769 const char *LLVMGetDataLayout(LLVMModuleRef M);
770 
771 /**
772  * Set the data layout for a module.
773  *
774  * @see Module::setDataLayout()
775  */
776 void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr);
777 
778 /**
779  * Obtain the target triple for a module.
780  *
781  * @see Module::getTargetTriple()
782  */
783 const char *LLVMGetTarget(LLVMModuleRef M);
784 
785 /**
786  * Set the target triple for a module.
787  *
788  * @see Module::setTargetTriple()
789  */
790 void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
791 
792 /**
793  * Returns the module flags as an array of flag-key-value triples. The caller
794  * is responsible for freeing this array by calling
795  * \c LLVMDisposeModuleFlagsMetadata.
796  *
797  * @see Module::getModuleFlagsMetadata()
798  */
800 
801 /**
802  * Destroys module flags metadata entries.
803  */
805 
806 /**
807  * Returns the flag behavior for a module flag entry at a specific index.
808  *
809  * @see Module::ModuleFlagEntry::Behavior
810  */
813  unsigned Index);
814 
815 /**
816  * Returns the key for a module flag entry at a specific index.
817  *
818  * @see Module::ModuleFlagEntry::Key
819  */
821  unsigned Index, size_t *Len);
822 
823 /**
824  * Returns the metadata for a module flag entry at a specific index.
825  *
826  * @see Module::ModuleFlagEntry::Val
827  */
829  unsigned Index);
830 
831 /**
832  * Add a module-level flag to the module-level flags metadata if it doesn't
833  * already exist.
834  *
835  * @see Module::getModuleFlag()
836  */
838  const char *Key, size_t KeyLen);
839 
840 /**
841  * Add a module-level flag to the module-level flags metadata if it doesn't
842  * already exist.
843  *
844  * @see Module::addModuleFlag()
845  */
847  const char *Key, size_t KeyLen,
848  LLVMMetadataRef Val);
849 
850 /**
851  * Dump a representation of a module to stderr.
852  *
853  * @see Module::dump()
854  */
856 
857 /**
858  * Print a representation of a module to a file. The ErrorMessage needs to be
859  * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
860  *
861  * @see Module::print()
862  */
863 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
864  char **ErrorMessage);
865 
866 /**
867  * Return a string representation of the module. Use
868  * LLVMDisposeMessage to free the string.
869  *
870  * @see Module::print()
871  */
873 
874 /**
875  * Get inline assembly for a module.
876  *
877  * @see Module::getModuleInlineAsm()
878  */
879 const char *LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len);
880 
881 /**
882  * Set inline assembly for a module.
883  *
884  * @see Module::setModuleInlineAsm()
885  */
886 void LLVMSetModuleInlineAsm2(LLVMModuleRef M, const char *Asm, size_t Len);
887 
888 /**
889  * Append inline assembly to a module.
890  *
891  * @see Module::appendModuleInlineAsm()
892  */
893 void LLVMAppendModuleInlineAsm(LLVMModuleRef M, const char *Asm, size_t Len);
894 
895 /**
896  * Create the specified uniqued inline asm string.
897  *
898  * @see InlineAsm::get()
899  */
900 LLVMValueRef LLVMGetInlineAsm(LLVMTypeRef Ty, char *AsmString,
901  size_t AsmStringSize, char *Constraints,
902  size_t ConstraintsSize, LLVMBool HasSideEffects,
903  LLVMBool IsAlignStack,
904  LLVMInlineAsmDialect Dialect, LLVMBool CanThrow);
905 
906 /**
907  * Obtain the context to which this module is associated.
908  *
909  * @see Module::getContext()
910  */
912 
913 /** Deprecated: Use LLVMGetTypeByName2 instead. */
915 
916 /**
917  * Obtain an iterator to the first NamedMDNode in a Module.
918  *
919  * @see llvm::Module::named_metadata_begin()
920  */
922 
923 /**
924  * Obtain an iterator to the last NamedMDNode in a Module.
925  *
926  * @see llvm::Module::named_metadata_end()
927  */
929 
930 /**
931  * Advance a NamedMDNode iterator to the next NamedMDNode.
932  *
933  * Returns NULL if the iterator was already at the end and there are no more
934  * named metadata nodes.
935  */
937 
938 /**
939  * Decrement a NamedMDNode iterator to the previous NamedMDNode.
940  *
941  * Returns NULL if the iterator was already at the beginning and there are
942  * no previous named metadata nodes.
943  */
945 
946 /**
947  * Retrieve a NamedMDNode with the given name, returning NULL if no such
948  * node exists.
949  *
950  * @see llvm::Module::getNamedMetadata()
951  */
953  const char *Name, size_t NameLen);
954 
955 /**
956  * Retrieve a NamedMDNode with the given name, creating a new node if no such
957  * node exists.
958  *
959  * @see llvm::Module::getOrInsertNamedMetadata()
960  */
962  const char *Name,
963  size_t NameLen);
964 
965 /**
966  * Retrieve the name of a NamedMDNode.
967  *
968  * @see llvm::NamedMDNode::getName()
969  */
970 const char *LLVMGetNamedMetadataName(LLVMNamedMDNodeRef NamedMD,
971  size_t *NameLen);
972 
973 /**
974  * Obtain the number of operands for named metadata in a module.
975  *
976  * @see llvm::Module::getNamedMetadata()
977  */
978 unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char *Name);
979 
980 /**
981  * Obtain the named metadata operands for a module.
982  *
983  * The passed LLVMValueRef pointer should refer to an array of
984  * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
985  * array will be populated with the LLVMValueRef instances. Each
986  * instance corresponds to a llvm::MDNode.
987  *
988  * @see llvm::Module::getNamedMetadata()
989  * @see llvm::MDNode::getOperand()
990  */
992  LLVMValueRef *Dest);
993 
994 /**
995  * Add an operand to named metadata.
996  *
997  * @see llvm::Module::getNamedMetadata()
998  * @see llvm::MDNode::addOperand()
999  */
1001  LLVMValueRef Val);
1002 
1003 /**
1004  * Return the directory 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 *LLVMGetDebugLocDirectory(LLVMValueRef Val, unsigned *Length);
1012 
1013 /**
1014  * Return the filename 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 const char *LLVMGetDebugLocFilename(LLVMValueRef Val, unsigned *Length);
1022 
1023 /**
1024  * Return the line number of the debug location for this value, which must be
1025  * an llvm::Instruction, llvm::GlobalVariable, or llvm::Function.
1026  *
1027  * @see llvm::Instruction::getDebugLoc()
1028  * @see llvm::GlobalVariable::getDebugInfo()
1029  * @see llvm::Function::getSubprogram()
1030  */
1031 unsigned LLVMGetDebugLocLine(LLVMValueRef Val);
1032 
1033 /**
1034  * Return the column number of the debug location for this value, which must be
1035  * an llvm::Instruction.
1036  *
1037  * @see llvm::Instruction::getDebugLoc()
1038  */
1039 unsigned LLVMGetDebugLocColumn(LLVMValueRef Val);
1040 
1041 /**
1042  * Add a function to a module under a specified name.
1043  *
1044  * @see llvm::Function::Create()
1045  */
1047  LLVMTypeRef FunctionTy);
1048 
1049 /**
1050  * Obtain a Function value from a Module by its name.
1051  *
1052  * The returned value corresponds to a llvm::Function value.
1053  *
1054  * @see llvm::Module::getFunction()
1055  */
1057 
1058 /**
1059  * Obtain an iterator to the first Function in a Module.
1060  *
1061  * @see llvm::Module::begin()
1062  */
1064 
1065 /**
1066  * Obtain an iterator to the last Function in a Module.
1067  *
1068  * @see llvm::Module::end()
1069  */
1071 
1072 /**
1073  * Advance a Function iterator to the next Function.
1074  *
1075  * Returns NULL if the iterator was already at the end and there are no more
1076  * functions.
1077  */
1079 
1080 /**
1081  * Decrement a Function iterator to the previous Function.
1082  *
1083  * Returns NULL if the iterator was already at the beginning and there are
1084  * no previous functions.
1085  */
1087 
1088 /** Deprecated: Use LLVMSetModuleInlineAsm2 instead. */
1089 void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
1090 
1091 /**
1092  * @}
1093  */
1094 
1095 /**
1096  * @defgroup LLVMCCoreType Types
1097  *
1098  * Types represent the type of a value.
1099  *
1100  * Types are associated with a context instance. The context internally
1101  * deduplicates types so there is only 1 instance of a specific type
1102  * alive at a time. In other words, a unique type is shared among all
1103  * consumers within a context.
1104  *
1105  * A Type in the C API corresponds to llvm::Type.
1106  *
1107  * Types have the following hierarchy:
1108  *
1109  * types:
1110  * integer type
1111  * real type
1112  * function type
1113  * sequence types:
1114  * array type
1115  * pointer type
1116  * vector type
1117  * void type
1118  * label type
1119  * opaque type
1120  *
1121  * @{
1122  */
1123 
1124 /**
1125  * Obtain the enumerated type of a Type instance.
1126  *
1127  * @see llvm::Type:getTypeID()
1128  */
1130 
1131 /**
1132  * Whether the type has a known size.
1133  *
1134  * Things that don't have a size are abstract types, labels, and void.a
1135  *
1136  * @see llvm::Type::isSized()
1137  */
1139 
1140 /**
1141  * Obtain the context to which this type instance is associated.
1142  *
1143  * @see llvm::Type::getContext()
1144  */
1146 
1147 /**
1148  * Dump a representation of a type to stderr.
1149  *
1150  * @see llvm::Type::dump()
1151  */
1152 void LLVMDumpType(LLVMTypeRef Val);
1153 
1154 /**
1155  * Return a string representation of the type. Use
1156  * LLVMDisposeMessage to free the string.
1157  *
1158  * @see llvm::Type::print()
1159  */
1161 
1162 /**
1163  * @defgroup LLVMCCoreTypeInt Integer Types
1164  *
1165  * Functions in this section operate on integer types.
1166  *
1167  * @{
1168  */
1169 
1170 /**
1171  * Obtain an integer type from a context with specified bit width.
1172  */
1180 
1181 /**
1182  * Obtain an integer type from the global context with a specified bit
1183  * width.
1184  */
1191 LLVMTypeRef LLVMIntType(unsigned NumBits);
1192 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
1193 
1194 /**
1195  * @}
1196  */
1197 
1198 /**
1199  * @defgroup LLVMCCoreTypeFloat Floating Point Types
1200  *
1201  * @{
1202  */
1203 
1204 /**
1205  * Obtain a 16-bit floating point type from a context.
1206  */
1208 
1209 /**
1210  * Obtain a 16-bit brain floating point type from a context.
1211  */
1213 
1214 /**
1215  * Obtain a 32-bit floating point type from a context.
1216  */
1218 
1219 /**
1220  * Obtain a 64-bit floating point type from a context.
1221  */
1223 
1224 /**
1225  * Obtain a 80-bit floating point type (X87) from a context.
1226  */
1228 
1229 /**
1230  * Obtain a 128-bit floating point type (112-bit mantissa) from a
1231  * context.
1232  */
1234 
1235 /**
1236  * Obtain a 128-bit floating point type (two 64-bits) from a context.
1237  */
1239 
1240 /**
1241  * Obtain a floating point type from the global context.
1242  *
1243  * These map to the functions in this group of the same name.
1244  */
1252 
1253 /**
1254  * @}
1255  */
1256 
1257 /**
1258  * @defgroup LLVMCCoreTypeFunction Function Types
1259  *
1260  * @{
1261  */
1262 
1263 /**
1264  * Obtain a function type consisting of a specified signature.
1265  *
1266  * The function is defined as a tuple of a return Type, a list of
1267  * parameter types, and whether the function is variadic.
1268  */
1270  LLVMTypeRef *ParamTypes, unsigned ParamCount,
1271  LLVMBool IsVarArg);
1272 
1273 /**
1274  * Returns whether a function type is variadic.
1275  */
1277 
1278 /**
1279  * Obtain the Type this function Type returns.
1280  */
1282 
1283 /**
1284  * Obtain the number of parameters this function accepts.
1285  */
1286 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
1287 
1288 /**
1289  * Obtain the types of a function's parameters.
1290  *
1291  * The Dest parameter should point to a pre-allocated array of
1292  * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
1293  * first LLVMCountParamTypes() entries in the array will be populated
1294  * with LLVMTypeRef instances.
1295  *
1296  * @param FunctionTy The function type to operate on.
1297  * @param Dest Memory address of an array to be filled with result.
1298  */
1299 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
1300 
1301 /**
1302  * @}
1303  */
1304 
1305 /**
1306  * @defgroup LLVMCCoreTypeStruct Structure Types
1307  *
1308  * These functions relate to LLVMTypeRef instances.
1309  *
1310  * @see llvm::StructType
1311  *
1312  * @{
1313  */
1314 
1315 /**
1316  * Create a new structure type in a context.
1317  *
1318  * A structure is specified by a list of inner elements/types and
1319  * whether these can be packed together.
1320  *
1321  * @see llvm::StructType::create()
1322  */
1324  unsigned ElementCount, LLVMBool Packed);
1325 
1326 /**
1327  * Create a new structure type in the global context.
1328  *
1329  * @see llvm::StructType::create()
1330  */
1331 LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
1332  LLVMBool Packed);
1333 
1334 /**
1335  * Create an empty structure in a context having a specified name.
1336  *
1337  * @see llvm::StructType::create()
1338  */
1340 
1341 /**
1342  * Obtain the name of a structure.
1343  *
1344  * @see llvm::StructType::getName()
1345  */
1346 const char *LLVMGetStructName(LLVMTypeRef Ty);
1347 
1348 /**
1349  * Set the contents of a structure type.
1350  *
1351  * @see llvm::StructType::setBody()
1352  */
1353 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
1354  unsigned ElementCount, LLVMBool Packed);
1355 
1356 /**
1357  * Get the number of elements defined inside the structure.
1358  *
1359  * @see llvm::StructType::getNumElements()
1360  */
1361 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
1362 
1363 /**
1364  * Get the elements within a structure.
1365  *
1366  * The function is passed the address of a pre-allocated array of
1367  * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
1368  * invocation, this array will be populated with the structure's
1369  * elements. The objects in the destination array will have a lifetime
1370  * of the structure type itself, which is the lifetime of the context it
1371  * is contained in.
1372  */
1373 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
1374 
1375 /**
1376  * Get the type of the element at a given index in the structure.
1377  *
1378  * @see llvm::StructType::getTypeAtIndex()
1379  */
1381 
1382 /**
1383  * Determine whether a structure is packed.
1384  *
1385  * @see llvm::StructType::isPacked()
1386  */
1388 
1389 /**
1390  * Determine whether a structure is opaque.
1391  *
1392  * @see llvm::StructType::isOpaque()
1393  */
1395 
1396 /**
1397  * Determine whether a structure is literal.
1398  *
1399  * @see llvm::StructType::isLiteral()
1400  */
1402 
1403 /**
1404  * @}
1405  */
1406 
1407 /**
1408  * @defgroup LLVMCCoreTypeSequential Sequential Types
1409  *
1410  * Sequential types represents "arrays" of types. This is a super class
1411  * for array, vector, and pointer types.
1412  *
1413  * @{
1414  */
1415 
1416 /**
1417  * Obtain the element type of an array or vector type.
1418  *
1419  * This currently also works for pointer types, but this usage is deprecated.
1420  *
1421  * @see llvm::SequentialType::getElementType()
1422  */
1424 
1425 /**
1426  * Returns type's subtypes
1427  *
1428  * @see llvm::Type::subtypes()
1429  */
1430 void LLVMGetSubtypes(LLVMTypeRef Tp, LLVMTypeRef *Arr);
1431 
1432 /**
1433  * Return the number of types in the derived type.
1434  *
1435  * @see llvm::Type::getNumContainedTypes()
1436  */
1438 
1439 /**
1440  * Create a fixed size array type that refers to a specific type.
1441  *
1442  * The created type will exist in the context that its element type
1443  * exists in.
1444  *
1445  * @see llvm::ArrayType::get()
1446  */
1447 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
1448 
1449 /**
1450  * Obtain the length of an array type.
1451  *
1452  * This only works on types that represent arrays.
1453  *
1454  * @see llvm::ArrayType::getNumElements()
1455  */
1456 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
1457 
1458 /**
1459  * Create a pointer type that points to a defined type.
1460  *
1461  * The created type will exist in the context that its pointee type
1462  * exists in.
1463  *
1464  * @see llvm::PointerType::get()
1465  */
1466 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
1467 
1468 /**
1469  * Determine whether a pointer is opaque.
1470  *
1471  * True if this is an instance of an opaque PointerType.
1472  *
1473  * @see llvm::Type::isOpaquePointerTy()
1474  */
1476 
1477 /**
1478  * Create an opaque pointer type in a context.
1479  *
1480  * @see llvm::PointerType::get()
1481  */
1483 
1484 /**
1485  * Obtain the address space of a pointer type.
1486  *
1487  * This only works on types that represent pointers.
1488  *
1489  * @see llvm::PointerType::getAddressSpace()
1490  */
1492 
1493 /**
1494  * Create a vector type that contains a defined type and has a specific
1495  * number of elements.
1496  *
1497  * The created type will exist in the context thats its element type
1498  * exists in.
1499  *
1500  * @see llvm::VectorType::get()
1501  */
1502 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
1503 
1504 /**
1505  * Create a vector type that contains a defined type and has a scalable
1506  * number of elements.
1507  *
1508  * The created type will exist in the context thats its element type
1509  * exists in.
1510  *
1511  * @see llvm::ScalableVectorType::get()
1512  */
1514  unsigned ElementCount);
1515 
1516 /**
1517  * Obtain the (possibly scalable) number of elements in a vector type.
1518  *
1519  * This only works on types that represent vectors (fixed or scalable).
1520  *
1521  * @see llvm::VectorType::getNumElements()
1522  */
1523 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
1524 
1525 /**
1526  * @}
1527  */
1528 
1529 /**
1530  * @defgroup LLVMCCoreTypeOther Other Types
1531  *
1532  * @{
1533  */
1534 
1535 /**
1536  * Create a void type in a context.
1537  */
1539 
1540 /**
1541  * Create a label type in a context.
1542  */
1544 
1545 /**
1546  * Create a X86 MMX type in a context.
1547  */
1549 
1550 /**
1551  * Create a X86 AMX type in a context.
1552  */
1554 
1555 /**
1556  * Create a token type in a context.
1557  */
1559 
1560 /**
1561  * Create a metadata type in a context.
1562  */
1564 
1565 /**
1566  * These are similar to the above functions except they operate on the
1567  * global context.
1568  */
1573 
1574 /**
1575  * @}
1576  */
1577 
1578 /**
1579  * @}
1580  */
1581 
1582 /**
1583  * @defgroup LLVMCCoreValues Values
1584  *
1585  * The bulk of LLVM's object model consists of values, which comprise a very
1586  * rich type hierarchy.
1587  *
1588  * LLVMValueRef essentially represents llvm::Value. There is a rich
1589  * hierarchy of classes within this type. Depending on the instance
1590  * obtained, not all APIs are available.
1591  *
1592  * Callers can determine the type of an LLVMValueRef by calling the
1593  * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1594  * functions are defined by a macro, so it isn't obvious which are
1595  * available by looking at the Doxygen source code. Instead, look at the
1596  * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1597  * of value names given. These value names also correspond to classes in
1598  * the llvm::Value hierarchy.
1599  *
1600  * @{
1601  */
1602 
1603 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1604  macro(Argument) \
1605  macro(BasicBlock) \
1606  macro(InlineAsm) \
1607  macro(User) \
1608  macro(Constant) \
1609  macro(BlockAddress) \
1610  macro(ConstantAggregateZero) \
1611  macro(ConstantArray) \
1612  macro(ConstantDataSequential) \
1613  macro(ConstantDataArray) \
1614  macro(ConstantDataVector) \
1615  macro(ConstantExpr) \
1616  macro(ConstantFP) \
1617  macro(ConstantInt) \
1618  macro(ConstantPointerNull) \
1619  macro(ConstantStruct) \
1620  macro(ConstantTokenNone) \
1621  macro(ConstantVector) \
1622  macro(GlobalValue) \
1623  macro(GlobalAlias) \
1624  macro(GlobalObject) \
1625  macro(Function) \
1626  macro(GlobalVariable) \
1627  macro(GlobalIFunc) \
1628  macro(UndefValue) \
1629  macro(PoisonValue) \
1630  macro(Instruction) \
1631  macro(UnaryOperator) \
1632  macro(BinaryOperator) \
1633  macro(CallInst) \
1634  macro(IntrinsicInst) \
1635  macro(DbgInfoIntrinsic) \
1636  macro(DbgVariableIntrinsic) \
1637  macro(DbgDeclareInst) \
1638  macro(DbgLabelInst) \
1639  macro(MemIntrinsic) \
1640  macro(MemCpyInst) \
1641  macro(MemMoveInst) \
1642  macro(MemSetInst) \
1643  macro(CmpInst) \
1644  macro(FCmpInst) \
1645  macro(ICmpInst) \
1646  macro(ExtractElementInst) \
1647  macro(GetElementPtrInst) \
1648  macro(InsertElementInst) \
1649  macro(InsertValueInst) \
1650  macro(LandingPadInst) \
1651  macro(PHINode) \
1652  macro(SelectInst) \
1653  macro(ShuffleVectorInst) \
1654  macro(StoreInst) \
1655  macro(BranchInst) \
1656  macro(IndirectBrInst) \
1657  macro(InvokeInst) \
1658  macro(ReturnInst) \
1659  macro(SwitchInst) \
1660  macro(UnreachableInst) \
1661  macro(ResumeInst) \
1662  macro(CleanupReturnInst) \
1663  macro(CatchReturnInst) \
1664  macro(CatchSwitchInst) \
1665  macro(CallBrInst) \
1666  macro(FuncletPadInst) \
1667  macro(CatchPadInst) \
1668  macro(CleanupPadInst) \
1669  macro(UnaryInstruction) \
1670  macro(AllocaInst) \
1671  macro(CastInst) \
1672  macro(AddrSpaceCastInst) \
1673  macro(BitCastInst) \
1674  macro(FPExtInst) \
1675  macro(FPToSIInst) \
1676  macro(FPToUIInst) \
1677  macro(FPTruncInst) \
1678  macro(IntToPtrInst) \
1679  macro(PtrToIntInst) \
1680  macro(SExtInst) \
1681  macro(SIToFPInst) \
1682  macro(TruncInst) \
1683  macro(UIToFPInst) \
1684  macro(ZExtInst) \
1685  macro(ExtractValueInst) \
1686  macro(LoadInst) \
1687  macro(VAArgInst) \
1688  macro(FreezeInst) \
1689  macro(AtomicCmpXchgInst) \
1690  macro(AtomicRMWInst) \
1691  macro(FenceInst)
1692 
1693 /**
1694  * @defgroup LLVMCCoreValueGeneral General APIs
1695  *
1696  * Functions in this section work on all LLVMValueRef instances,
1697  * regardless of their sub-type. They correspond to functions available
1698  * on llvm::Value.
1699  *
1700  * @{
1701  */
1702 
1703 /**
1704  * Obtain the type of a value.
1705  *
1706  * @see llvm::Value::getType()
1707  */
1709 
1710 /**
1711  * Obtain the enumerated type of a Value instance.
1712  *
1713  * @see llvm::Value::getValueID()
1714  */
1716 
1717 /**
1718  * Obtain the string name of a value.
1719  *
1720  * @see llvm::Value::getName()
1721  */
1722 const char *LLVMGetValueName2(LLVMValueRef Val, size_t *Length);
1723 
1724 /**
1725  * Set the string name of a value.
1726  *
1727  * @see llvm::Value::setName()
1728  */
1729 void LLVMSetValueName2(LLVMValueRef Val, const char *Name, size_t NameLen);
1730 
1731 /**
1732  * Dump a representation of a value to stderr.
1733  *
1734  * @see llvm::Value::dump()
1735  */
1736 void LLVMDumpValue(LLVMValueRef Val);
1737 
1738 /**
1739  * Return a string representation of the value. Use
1740  * LLVMDisposeMessage to free the string.
1741  *
1742  * @see llvm::Value::print()
1743  */
1745 
1746 /**
1747  * Replace all uses of a value with another one.
1748  *
1749  * @see llvm::Value::replaceAllUsesWith()
1750  */
1751 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
1752 
1753 /**
1754  * Determine whether the specified value instance is constant.
1755  */
1757 
1758 /**
1759  * Determine whether a value instance is undefined.
1760  */
1762 
1763 /**
1764  * Determine whether a value instance is poisonous.
1765  */
1767 
1768 /**
1769  * Convert value instances between types.
1770  *
1771  * Internally, an LLVMValueRef is "pinned" to a specific type. This
1772  * series of functions allows you to cast an instance to a specific
1773  * type.
1774  *
1775  * If the cast is not valid for the specified type, NULL is returned.
1776  *
1777  * @see llvm::dyn_cast_or_null<>
1778  */
1779 #define LLVM_DECLARE_VALUE_CAST(name) \
1780  LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1782 
1785 
1786 /** Deprecated: Use LLVMGetValueName2 instead. */
1787 const char *LLVMGetValueName(LLVMValueRef Val);
1788 /** Deprecated: Use LLVMSetValueName2 instead. */
1789 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
1790 
1791 /**
1792  * @}
1793  */
1794 
1795 /**
1796  * @defgroup LLVMCCoreValueUses Usage
1797  *
1798  * This module defines functions that allow you to inspect the uses of a
1799  * LLVMValueRef.
1800  *
1801  * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1802  * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1803  * llvm::User and llvm::Value.
1804  *
1805  * @{
1806  */
1807 
1808 /**
1809  * Obtain the first use of a value.
1810  *
1811  * Uses are obtained in an iterator fashion. First, call this function
1812  * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1813  * on that instance and all subsequently obtained instances until
1814  * LLVMGetNextUse() returns NULL.
1815  *
1816  * @see llvm::Value::use_begin()
1817  */
1819 
1820 /**
1821  * Obtain the next use of a value.
1822  *
1823  * This effectively advances the iterator. It returns NULL if you are on
1824  * the final use and no more are available.
1825  */
1827 
1828 /**
1829  * Obtain the user value for a user.
1830  *
1831  * The returned value corresponds to a llvm::User type.
1832  *
1833  * @see llvm::Use::getUser()
1834  */
1836 
1837 /**
1838  * Obtain the value this use corresponds to.
1839  *
1840  * @see llvm::Use::get().
1841  */
1843 
1844 /**
1845  * @}
1846  */
1847 
1848 /**
1849  * @defgroup LLVMCCoreValueUser User value
1850  *
1851  * Function in this group pertain to LLVMValueRef instances that descent
1852  * from llvm::User. This includes constants, instructions, and
1853  * operators.
1854  *
1855  * @{
1856  */
1857 
1858 /**
1859  * Obtain an operand at a specific index in a llvm::User value.
1860  *
1861  * @see llvm::User::getOperand()
1862  */
1864 
1865 /**
1866  * Obtain the use of an operand at a specific index in a llvm::User value.
1867  *
1868  * @see llvm::User::getOperandUse()
1869  */
1871 
1872 /**
1873  * Set an operand at a specific index in a llvm::User value.
1874  *
1875  * @see llvm::User::setOperand()
1876  */
1877 void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
1878 
1879 /**
1880  * Obtain the number of operands in a llvm::User value.
1881  *
1882  * @see llvm::User::getNumOperands()
1883  */
1885 
1886 /**
1887  * @}
1888  */
1889 
1890 /**
1891  * @defgroup LLVMCCoreValueConstant Constants
1892  *
1893  * This section contains APIs for interacting with LLVMValueRef that
1894  * correspond to llvm::Constant instances.
1895  *
1896  * These functions will work for any LLVMValueRef in the llvm::Constant
1897  * class hierarchy.
1898  *
1899  * @{
1900  */
1901 
1902 /**
1903  * Obtain a constant value referring to the null instance of a type.
1904  *
1905  * @see llvm::Constant::getNullValue()
1906  */
1907 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
1908 
1909 /**
1910  * Obtain a constant value referring to the instance of a type
1911  * consisting of all ones.
1912  *
1913  * This is only valid for integer types.
1914  *
1915  * @see llvm::Constant::getAllOnesValue()
1916  */
1918 
1919 /**
1920  * Obtain a constant value referring to an undefined value of a type.
1921  *
1922  * @see llvm::UndefValue::get()
1923  */
1925 
1926 /**
1927  * Obtain a constant value referring to a poison value of a type.
1928  *
1929  * @see llvm::PoisonValue::get()
1930  */
1932 
1933 /**
1934  * Determine whether a value instance is null.
1935  *
1936  * @see llvm::Constant::isNullValue()
1937  */
1939 
1940 /**
1941  * Obtain a constant that is a constant pointer pointing to NULL for a
1942  * specified type.
1943  */
1945 
1946 /**
1947  * @defgroup LLVMCCoreValueConstantScalar Scalar constants
1948  *
1949  * Functions in this group model LLVMValueRef instances that correspond
1950  * to constants referring to scalar types.
1951  *
1952  * For integer types, the LLVMTypeRef parameter should correspond to a
1953  * llvm::IntegerType instance and the returned LLVMValueRef will
1954  * correspond to a llvm::ConstantInt.
1955  *
1956  * For floating point types, the LLVMTypeRef returned corresponds to a
1957  * llvm::ConstantFP.
1958  *
1959  * @{
1960  */
1961 
1962 /**
1963  * Obtain a constant value for an integer type.
1964  *
1965  * The returned value corresponds to a llvm::ConstantInt.
1966  *
1967  * @see llvm::ConstantInt::get()
1968  *
1969  * @param IntTy Integer type to obtain value of.
1970  * @param N The value the returned instance should refer to.
1971  * @param SignExtend Whether to sign extend the produced value.
1972  */
1973 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1974  LLVMBool SignExtend);
1975 
1976 /**
1977  * Obtain a constant value for an integer of arbitrary precision.
1978  *
1979  * @see llvm::ConstantInt::get()
1980  */
1982  unsigned NumWords,
1983  const uint64_t Words[]);
1984 
1985 /**
1986  * Obtain a constant value for an integer parsed from a string.
1987  *
1988  * A similar API, LLVMConstIntOfStringAndSize is also available. If the
1989  * string's length is available, it is preferred to call that function
1990  * instead.
1991  *
1992  * @see llvm::ConstantInt::get()
1993  */
1994 LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
1995  uint8_t Radix);
1996 
1997 /**
1998  * Obtain a constant value for an integer parsed from a string with
1999  * specified length.
2000  *
2001  * @see llvm::ConstantInt::get()
2002  */
2003 LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
2004  unsigned SLen, uint8_t Radix);
2005 
2006 /**
2007  * Obtain a constant value referring to a double floating point value.
2008  */
2009 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
2010 
2011 /**
2012  * Obtain a constant for a floating point value parsed from a string.
2013  *
2014  * A similar API, LLVMConstRealOfStringAndSize is also available. It
2015  * should be used if the input string's length is known.
2016  */
2017 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
2018 
2019 /**
2020  * Obtain a constant for a floating point value parsed from a string.
2021  */
2022 LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
2023  unsigned SLen);
2024 
2025 /**
2026  * Obtain the zero extended value for an integer constant value.
2027  *
2028  * @see llvm::ConstantInt::getZExtValue()
2029  */
2030 unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
2031 
2032 /**
2033  * Obtain the sign extended value for an integer constant value.
2034  *
2035  * @see llvm::ConstantInt::getSExtValue()
2036  */
2037 long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
2038 
2039 /**
2040  * Obtain the double value for an floating point constant value.
2041  * losesInfo indicates if some precision was lost in the conversion.
2042  *
2043  * @see llvm::ConstantFP::getDoubleValue
2044  */
2045 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
2046 
2047 /**
2048  * @}
2049  */
2050 
2051 /**
2052  * @defgroup LLVMCCoreValueConstantComposite Composite Constants
2053  *
2054  * Functions in this group operate on composite constants.
2055  *
2056  * @{
2057  */
2058 
2059 /**
2060  * Create a ConstantDataSequential and initialize it with a string.
2061  *
2062  * @see llvm::ConstantDataArray::getString()
2063  */
2065  unsigned Length, LLVMBool DontNullTerminate);
2066 
2067 /**
2068  * Create a ConstantDataSequential with string content in the global context.
2069  *
2070  * This is the same as LLVMConstStringInContext except it operates on the
2071  * global context.
2072  *
2073  * @see LLVMConstStringInContext()
2074  * @see llvm::ConstantDataArray::getString()
2075  */
2076 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
2077  LLVMBool DontNullTerminate);
2078 
2079 /**
2080  * Returns true if the specified constant is an array of i8.
2081  *
2082  * @see ConstantDataSequential::getAsString()
2083  */
2085 
2086 /**
2087  * Get the given constant data sequential as a string.
2088  *
2089  * @see ConstantDataSequential::getAsString()
2090  */
2091 const char *LLVMGetAsString(LLVMValueRef c, size_t *Length);
2092 
2093 /**
2094  * Create an anonymous ConstantStruct with the specified values.
2095  *
2096  * @see llvm::ConstantStruct::getAnon()
2097  */
2099  LLVMValueRef *ConstantVals,
2100  unsigned Count, LLVMBool Packed);
2101 
2102 /**
2103  * Create a ConstantStruct in the global Context.
2104  *
2105  * This is the same as LLVMConstStructInContext except it operates on the
2106  * global Context.
2107  *
2108  * @see LLVMConstStructInContext()
2109  */
2110 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
2111  LLVMBool Packed);
2112 
2113 /**
2114  * Create a ConstantArray from values.
2115  *
2116  * @see llvm::ConstantArray::get()
2117  */
2119  LLVMValueRef *ConstantVals, unsigned Length);
2120 
2121 /**
2122  * Create a non-anonymous ConstantStruct from values.
2123  *
2124  * @see llvm::ConstantStruct::get()
2125  */
2127  LLVMValueRef *ConstantVals,
2128  unsigned Count);
2129 
2130 /**
2131  * Get element of a constant aggregate (struct, array or vector) at the
2132  * specified index. Returns null if the index is out of range, or it's not
2133  * possible to determine the element (e.g., because the constant is a
2134  * constant expression.)
2135  *
2136  * @see llvm::Constant::getAggregateElement()
2137  */
2139 
2140 /**
2141  * Get an element at specified index as a constant.
2142  *
2143  * @see ConstantDataSequential::getElementAsConstant()
2144  */
2147  "Use LLVMGetAggregateElement instead");
2148 
2149 /**
2150  * Create a ConstantVector from values.
2151  *
2152  * @see llvm::ConstantVector::get()
2153  */
2154 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
2155 
2156 /**
2157  * @}
2158  */
2159 
2160 /**
2161  * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
2162  *
2163  * Functions in this group correspond to APIs on llvm::ConstantExpr.
2164  *
2165  * @see llvm::ConstantExpr.
2166  *
2167  * @{
2168  */
2176 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2177 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2178 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2179 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2180 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2181 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2182 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2183 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2184 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2185 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2186 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2187 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2189  LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2191  LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2192 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2193 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2194 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
2196  LLVMValueRef *ConstantIndices, unsigned NumIndices);
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 
2412 /**
2413  * Add a GlobalAlias with the given value type, address space and aliasee.
2414  *
2415  * @see llvm::GlobalAlias::create()
2416  */
2418  unsigned AddrSpace, LLVMValueRef Aliasee,
2419  const char *Name);
2420 
2421 /**
2422  * Obtain a GlobalAlias value from a Module by its name.
2423  *
2424  * The returned value corresponds to a llvm::GlobalAlias value.
2425  *
2426  * @see llvm::Module::getNamedAlias()
2427  */
2429  const char *Name, size_t NameLen);
2430 
2431 /**
2432  * Obtain an iterator to the first GlobalAlias in a Module.
2433  *
2434  * @see llvm::Module::alias_begin()
2435  */
2437 
2438 /**
2439  * Obtain an iterator to the last GlobalAlias in a Module.
2440  *
2441  * @see llvm::Module::alias_end()
2442  */
2444 
2445 /**
2446  * Advance a GlobalAlias iterator to the next GlobalAlias.
2447  *
2448  * Returns NULL if the iterator was already at the end and there are no more
2449  * global aliases.
2450  */
2452 
2453 /**
2454  * Decrement a GlobalAlias iterator to the previous GlobalAlias.
2455  *
2456  * Returns NULL if the iterator was already at the beginning and there are
2457  * no previous global aliases.
2458  */
2460 
2461 /**
2462  * Retrieve the target value of an alias.
2463  */
2465 
2466 /**
2467  * Set the target value of an alias.
2468  */
2470 
2471 /**
2472  * @}
2473  */
2474 
2475 /**
2476  * @defgroup LLVMCCoreValueFunction Function values
2477  *
2478  * Functions in this group operate on LLVMValueRef instances that
2479  * correspond to llvm::Function instances.
2480  *
2481  * @see llvm::Function
2482  *
2483  * @{
2484  */
2485 
2486 /**
2487  * Remove a function from its containing module and deletes it.
2488  *
2489  * @see llvm::Function::eraseFromParent()
2490  */
2492 
2493 /**
2494  * Check whether the given function has a personality function.
2495  *
2496  * @see llvm::Function::hasPersonalityFn()
2497  */
2499 
2500 /**
2501  * Obtain the personality function attached to the function.
2502  *
2503  * @see llvm::Function::getPersonalityFn()
2504  */
2506 
2507 /**
2508  * Set the personality function attached to the function.
2509  *
2510  * @see llvm::Function::setPersonalityFn()
2511  */
2512 void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
2513 
2514 /**
2515  * Obtain the intrinsic ID number which matches the given function name.
2516  *
2517  * @see llvm::Function::lookupIntrinsicID()
2518  */
2519 unsigned LLVMLookupIntrinsicID(const char *Name, size_t NameLen);
2520 
2521 /**
2522  * Obtain the ID number from a function instance.
2523  *
2524  * @see llvm::Function::getIntrinsicID()
2525  */
2526 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
2527 
2528 /**
2529  * Create or insert the declaration of an intrinsic. For overloaded intrinsics,
2530  * parameter types must be provided to uniquely identify an overload.
2531  *
2532  * @see llvm::Intrinsic::getDeclaration()
2533  */
2535  unsigned ID,
2536  LLVMTypeRef *ParamTypes,
2537  size_t ParamCount);
2538 
2539 /**
2540  * Retrieves the type of an intrinsic. For overloaded intrinsics, parameter
2541  * types must be provided to uniquely identify an overload.
2542  *
2543  * @see llvm::Intrinsic::getType()
2544  */
2546  LLVMTypeRef *ParamTypes, size_t ParamCount);
2547 
2548 /**
2549  * Retrieves the name of an intrinsic.
2550  *
2551  * @see llvm::Intrinsic::getName()
2552  */
2553 const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength);
2554 
2555 /** Deprecated: Use LLVMIntrinsicCopyOverloadedName2 instead. */
2556 const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,
2557  LLVMTypeRef *ParamTypes,
2558  size_t ParamCount,
2559  size_t *NameLength);
2560 
2561 /**
2562  * Copies the name of an overloaded intrinsic identified by a given list of
2563  * parameter types.
2564  *
2565  * Unlike LLVMIntrinsicGetName, the caller is responsible for freeing the
2566  * returned string.
2567  *
2568  * This version also supports unnamed types.
2569  *
2570  * @see llvm::Intrinsic::getName()
2571  */
2573  LLVMTypeRef *ParamTypes,
2574  size_t ParamCount,
2575  size_t *NameLength);
2576 
2577 /**
2578  * Obtain if the intrinsic identified by the given ID is overloaded.
2579  *
2580  * @see llvm::Intrinsic::isOverloaded()
2581  */
2583 
2584 /**
2585  * Obtain the calling function of a function.
2586  *
2587  * The returned value corresponds to the LLVMCallConv enumeration.
2588  *
2589  * @see llvm::Function::getCallingConv()
2590  */
2592 
2593 /**
2594  * Set the calling convention of a function.
2595  *
2596  * @see llvm::Function::setCallingConv()
2597  *
2598  * @param Fn Function to operate on
2599  * @param CC LLVMCallConv to set calling convention to
2600  */
2601 void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
2602 
2603 /**
2604  * Obtain the name of the garbage collector to use during code
2605  * generation.
2606  *
2607  * @see llvm::Function::getGC()
2608  */
2609 const char *LLVMGetGC(LLVMValueRef Fn);
2610 
2611 /**
2612  * Define the garbage collector to use during code generation.
2613  *
2614  * @see llvm::Function::setGC()
2615  */
2616 void LLVMSetGC(LLVMValueRef Fn, const char *Name);
2617 
2618 /**
2619  * Add an attribute to a function.
2620  *
2621  * @see llvm::Function::addAttribute()
2622  */
2629  LLVMAttributeIndex Idx,
2630  unsigned KindID);
2632  LLVMAttributeIndex Idx,
2633  const char *K, unsigned KLen);
2635  unsigned KindID);
2637  const char *K, unsigned KLen);
2638 
2639 /**
2640  * Add a target-dependent attribute to a function
2641  * @see llvm::AttrBuilder::addAttribute()
2642  */
2644  const char *V);
2645 
2646 /**
2647  * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
2648  *
2649  * Functions in this group relate to arguments/parameters on functions.
2650  *
2651  * Functions in this group expect LLVMValueRef instances that correspond
2652  * to llvm::Function instances.
2653  *
2654  * @{
2655  */
2656 
2657 /**
2658  * Obtain the number of parameters in a function.
2659  *
2660  * @see llvm::Function::arg_size()
2661  */
2662 unsigned LLVMCountParams(LLVMValueRef Fn);
2663 
2664 /**
2665  * Obtain the parameters in a function.
2666  *
2667  * The takes a pointer to a pre-allocated array of LLVMValueRef that is
2668  * at least LLVMCountParams() long. This array will be filled with
2669  * LLVMValueRef instances which correspond to the parameters the
2670  * function receives. Each LLVMValueRef corresponds to a llvm::Argument
2671  * instance.
2672  *
2673  * @see llvm::Function::arg_begin()
2674  */
2675 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
2676 
2677 /**
2678  * Obtain the parameter at the specified index.
2679  *
2680  * Parameters are indexed from 0.
2681  *
2682  * @see llvm::Function::arg_begin()
2683  */
2685 
2686 /**
2687  * Obtain the function to which this argument belongs.
2688  *
2689  * Unlike other functions in this group, this one takes an LLVMValueRef
2690  * that corresponds to a llvm::Attribute.
2691  *
2692  * The returned LLVMValueRef is the llvm::Function to which this
2693  * argument belongs.
2694  */
2696 
2697 /**
2698  * Obtain the first parameter to a function.
2699  *
2700  * @see llvm::Function::arg_begin()
2701  */
2703 
2704 /**
2705  * Obtain the last parameter to a function.
2706  *
2707  * @see llvm::Function::arg_end()
2708  */
2710 
2711 /**
2712  * Obtain the next parameter to a function.
2713  *
2714  * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
2715  * actually a wrapped iterator) and obtains the next parameter from the
2716  * underlying iterator.
2717  */
2719 
2720 /**
2721  * Obtain the previous parameter to a function.
2722  *
2723  * This is the opposite of LLVMGetNextParam().
2724  */
2726 
2727 /**
2728  * Set the alignment for a function parameter.
2729  *
2730  * @see llvm::Argument::addAttr()
2731  * @see llvm::AttrBuilder::addAlignmentAttr()
2732  */
2734 
2735 /**
2736  * @}
2737  */
2738 
2739 /**
2740  * @defgroup LLVMCCoreValueGlobalIFunc IFuncs
2741  *
2742  * Functions in this group relate to indirect functions.
2743  *
2744  * Functions in this group expect LLVMValueRef instances that correspond
2745  * to llvm::GlobalIFunc instances.
2746  *
2747  * @{
2748  */
2749 
2750 /**
2751  * Add a global indirect function to a module under a specified name.
2752  *
2753  * @see llvm::GlobalIFunc::create()
2754  */
2756  const char *Name, size_t NameLen,
2757  LLVMTypeRef Ty, unsigned AddrSpace,
2758  LLVMValueRef Resolver);
2759 
2760 /**
2761  * Obtain a GlobalIFunc value from a Module by its name.
2762  *
2763  * The returned value corresponds to a llvm::GlobalIFunc value.
2764  *
2765  * @see llvm::Module::getNamedIFunc()
2766  */
2768  const char *Name, size_t NameLen);
2769 
2770 /**
2771  * Obtain an iterator to the first GlobalIFunc in a Module.
2772  *
2773  * @see llvm::Module::ifunc_begin()
2774  */
2776 
2777 /**
2778  * Obtain an iterator to the last GlobalIFunc in a Module.
2779  *
2780  * @see llvm::Module::ifunc_end()
2781  */
2783 
2784 /**
2785  * Advance a GlobalIFunc iterator to the next GlobalIFunc.
2786  *
2787  * Returns NULL if the iterator was already at the end and there are no more
2788  * global aliases.
2789  */
2791 
2792 /**
2793  * Decrement a GlobalIFunc iterator to the previous GlobalIFunc.
2794  *
2795  * Returns NULL if the iterator was already at the beginning and there are
2796  * no previous global aliases.
2797  */
2799 
2800 /**
2801  * Retrieves the resolver function associated with this indirect function, or
2802  * NULL if it doesn't not exist.
2803  *
2804  * @see llvm::GlobalIFunc::getResolver()
2805  */
2807 
2808 /**
2809  * Sets the resolver function associated with this indirect function.
2810  *
2811  * @see llvm::GlobalIFunc::setResolver()
2812  */
2814 
2815 /**
2816  * Remove a global indirect function from its parent module and delete it.
2817  *
2818  * @see llvm::GlobalIFunc::eraseFromParent()
2819  */
2821 
2822 /**
2823  * Remove a global indirect function from its parent module.
2824  *
2825  * This unlinks the global indirect function from its containing module but
2826  * keeps it alive.
2827  *
2828  * @see llvm::GlobalIFunc::removeFromParent()
2829  */
2831 
2832 /**
2833  * @}
2834  */
2835 
2836 /**
2837  * @}
2838  */
2839 
2840 /**
2841  * @}
2842  */
2843 
2844 /**
2845  * @}
2846  */
2847 
2848 /**
2849  * @defgroup LLVMCCoreValueMetadata Metadata
2850  *
2851  * @{
2852  */
2853 
2854 /**
2855  * Create an MDString value from a given string value.
2856  *
2857  * The MDString value does not take ownership of the given string, it remains
2858  * the responsibility of the caller to free it.
2859  *
2860  * @see llvm::MDString::get()
2861  */
2863  size_t SLen);
2864 
2865 /**
2866  * Create an MDNode value with the given array of operands.
2867  *
2868  * @see llvm::MDNode::get()
2869  */
2871  size_t Count);
2872 
2873 /**
2874  * Obtain a Metadata as a Value.
2875  */
2877 
2878 /**
2879  * Obtain a Value as a Metadata.
2880  */
2882 
2883 /**
2884  * Obtain the underlying string from a MDString value.
2885  *
2886  * @param V Instance to obtain string from.
2887  * @param Length Memory address which will hold length of returned string.
2888  * @return String data in MDString.
2889  */
2890 const char *LLVMGetMDString(LLVMValueRef V, unsigned *Length);
2891 
2892 /**
2893  * Obtain the number of operands from an MDNode value.
2894  *
2895  * @param V MDNode to get number of operands from.
2896  * @return Number of operands of the MDNode.
2897  */
2899 
2900 /**
2901  * Obtain the given MDNode's operands.
2902  *
2903  * The passed LLVMValueRef pointer should point to enough memory to hold all of
2904  * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
2905  * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
2906  * MDNode's operands.
2907  *
2908  * @param V MDNode to get the operands from.
2909  * @param Dest Destination array for operands.
2910  */
2912 
2913 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2915  unsigned SLen);
2916 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2917 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2918 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2920  unsigned Count);
2921 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2922 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
2923 
2924 /**
2925  * @}
2926  */
2927 
2928 /**
2929  * @defgroup LLVMCCoreValueBasicBlock Basic Block
2930  *
2931  * A basic block represents a single entry single exit section of code.
2932  * Basic blocks contain a list of instructions which form the body of
2933  * the block.
2934  *
2935  * Basic blocks belong to functions. They have the type of label.
2936  *
2937  * Basic blocks are themselves values. However, the C API models them as
2938  * LLVMBasicBlockRef.
2939  *
2940  * @see llvm::BasicBlock
2941  *
2942  * @{
2943  */
2944 
2945 /**
2946  * Convert a basic block instance to a value type.
2947  */
2949 
2950 /**
2951  * Determine whether an LLVMValueRef is itself a basic block.
2952  */
2954 
2955 /**
2956  * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
2957  */
2959 
2960 /**
2961  * Obtain the string name of a basic block.
2962  */
2964 
2965 /**
2966  * Obtain the function to which a basic block belongs.
2967  *
2968  * @see llvm::BasicBlock::getParent()
2969  */
2971 
2972 /**
2973  * Obtain the terminator instruction for a basic block.
2974  *
2975  * If the basic block does not have a terminator (it is not well-formed
2976  * if it doesn't), then NULL is returned.
2977  *
2978  * The returned LLVMValueRef corresponds to an llvm::Instruction.
2979  *
2980  * @see llvm::BasicBlock::getTerminator()
2981  */
2983 
2984 /**
2985  * Obtain the number of basic blocks in a function.
2986  *
2987  * @param Fn Function value to operate on.
2988  */
2989 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
2990 
2991 /**
2992  * Obtain all of the basic blocks in a function.
2993  *
2994  * This operates on a function value. The BasicBlocks parameter is a
2995  * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
2996  * LLVMCountBasicBlocks() in length. This array is populated with
2997  * LLVMBasicBlockRef instances.
2998  */
2999 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
3000 
3001 /**
3002  * Obtain the first basic block in a function.
3003  *
3004  * The returned basic block can be used as an iterator. You will likely
3005  * eventually call into LLVMGetNextBasicBlock() with it.
3006  *
3007  * @see llvm::Function::begin()
3008  */
3010 
3011 /**
3012  * Obtain the last basic block in a function.
3013  *
3014  * @see llvm::Function::end()
3015  */
3017 
3018 /**
3019  * Advance a basic block iterator.
3020  */
3022 
3023 /**
3024  * Go backwards in a basic block iterator.
3025  */
3027 
3028 /**
3029  * Obtain the basic block that corresponds to the entry point of a
3030  * function.
3031  *
3032  * @see llvm::Function::getEntryBlock()
3033  */
3035 
3036 /**
3037  * Insert the given basic block after the insertion point of the given builder.
3038  *
3039  * The insertion point must be valid.
3040  *
3041  * @see llvm::Function::BasicBlockListType::insertAfter()
3042  */
3045 
3046 /**
3047  * Append the given basic block to the basic block list of the given function.
3048  *
3049  * @see llvm::Function::BasicBlockListType::push_back()
3050  */
3053 
3054 /**
3055  * Create a new basic block without inserting it into a function.
3056  *
3057  * @see llvm::BasicBlock::Create()
3058  */
3060  const char *Name);
3061 
3062 /**
3063  * Append a basic block to the end of a function.
3064  *
3065  * @see llvm::BasicBlock::Create()
3066  */
3068  LLVMValueRef Fn,
3069  const char *Name);
3070 
3071 /**
3072  * Append a basic block to the end of a function using the global
3073  * context.
3074  *
3075  * @see llvm::BasicBlock::Create()
3076  */
3078 
3079 /**
3080  * Insert a basic block in a function before another basic block.
3081  *
3082  * The function to add to is determined by the function of the
3083  * passed basic block.
3084  *
3085  * @see llvm::BasicBlock::Create()
3086  */
3089  const char *Name);
3090 
3091 /**
3092  * Insert a basic block in a function using the global context.
3093  *
3094  * @see llvm::BasicBlock::Create()
3095  */
3097  const char *Name);
3098 
3099 /**
3100  * Remove a basic block from a function and delete it.
3101  *
3102  * This deletes the basic block from its containing function and deletes
3103  * the basic block itself.
3104  *
3105  * @see llvm::BasicBlock::eraseFromParent()
3106  */
3108 
3109 /**
3110  * Remove a basic block from a function.
3111  *
3112  * This deletes the basic block from its containing function but keep
3113  * the basic block alive.
3114  *
3115  * @see llvm::BasicBlock::removeFromParent()
3116  */
3118 
3119 /**
3120  * Move a basic block to before another one.
3121  *
3122  * @see llvm::BasicBlock::moveBefore()
3123  */
3125 
3126 /**
3127  * Move a basic block to after another one.
3128  *
3129  * @see llvm::BasicBlock::moveAfter()
3130  */
3132 
3133 /**
3134  * Obtain the first instruction in a basic block.
3135  *
3136  * The returned LLVMValueRef corresponds to a llvm::Instruction
3137  * instance.
3138  */
3140 
3141 /**
3142  * Obtain the last instruction in a basic block.
3143  *
3144  * The returned LLVMValueRef corresponds to an LLVM:Instruction.
3145  */
3147 
3148 /**
3149  * @}
3150  */
3151 
3152 /**
3153  * @defgroup LLVMCCoreValueInstruction Instructions
3154  *
3155  * Functions in this group relate to the inspection and manipulation of
3156  * individual instructions.
3157  *
3158  * In the C++ API, an instruction is modeled by llvm::Instruction. This
3159  * class has a large number of descendents. llvm::Instruction is a
3160  * llvm::Value and in the C API, instructions are modeled by
3161  * LLVMValueRef.
3162  *
3163  * This group also contains sub-groups which operate on specific
3164  * llvm::Instruction types, e.g. llvm::CallInst.
3165  *
3166  * @{
3167  */
3168 
3169 /**
3170  * Determine whether an instruction has any metadata attached.
3171  */
3172 int LLVMHasMetadata(LLVMValueRef Val);
3173 
3174 /**
3175  * Return metadata associated with an instruction value.
3176  */
3177 LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
3178 
3179 /**
3180  * Set metadata associated with an instruction value.
3181  */
3182 void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
3183 
3184 /**
3185  * Returns the metadata associated with an instruction value, but filters out
3186  * all the debug locations.
3187  *
3188  * @see llvm::Instruction::getAllMetadataOtherThanDebugLoc()
3189  */
3192  size_t *NumEntries);
3193 
3194 /**
3195  * Obtain the basic block to which an instruction belongs.
3196  *
3197  * @see llvm::Instruction::getParent()
3198  */
3200 
3201 /**
3202  * Obtain the instruction that occurs after the one specified.
3203  *
3204  * The next instruction will be from the same basic block.
3205  *
3206  * If this is the last instruction in a basic block, NULL will be
3207  * returned.
3208  */
3210 
3211 /**
3212  * Obtain the instruction that occurred before this one.
3213  *
3214  * If the instruction is the first instruction in a basic block, NULL
3215  * will be returned.
3216  */
3218 
3219 /**
3220  * Remove an instruction.
3221  *
3222  * The instruction specified is removed from its containing building
3223  * block but is kept alive.
3224  *
3225  * @see llvm::Instruction::removeFromParent()
3226  */
3228 
3229 /**
3230  * Remove and delete an instruction.
3231  *
3232  * The instruction specified is removed from its containing building
3233  * block and then deleted.
3234  *
3235  * @see llvm::Instruction::eraseFromParent()
3236  */
3238 
3239 /**
3240  * Delete an instruction.
3241  *
3242  * The instruction specified is deleted. It must have previously been
3243  * removed from its containing building block.
3244  *
3245  * @see llvm::Value::deleteValue()
3246  */
3248 
3249 /**
3250  * Obtain the code opcode for an individual instruction.
3251  *
3252  * @see llvm::Instruction::getOpCode()
3253  */
3255 
3256 /**
3257  * Obtain the predicate of an instruction.
3258  *
3259  * This is only valid for instructions that correspond to llvm::ICmpInst
3260  * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
3261  *
3262  * @see llvm::ICmpInst::getPredicate()
3263  */
3265 
3266 /**
3267  * Obtain the float predicate of an instruction.
3268  *
3269  * This is only valid for instructions that correspond to llvm::FCmpInst
3270  * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
3271  *
3272  * @see llvm::FCmpInst::getPredicate()
3273  */
3275 
3276 /**
3277  * Create a copy of 'this' instruction that is identical in all ways
3278  * except the following:
3279  * * The instruction has no parent
3280  * * The instruction has no name
3281  *
3282  * @see llvm::Instruction::clone()
3283  */
3285 
3286 /**
3287  * Determine whether an instruction is a terminator. This routine is named to
3288  * be compatible with historical functions that did this by querying the
3289  * underlying C++ type.
3290  *
3291  * @see llvm::Instruction::isTerminator()
3292  */
3294 
3295 /**
3296  * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
3297  *
3298  * Functions in this group apply to instructions that refer to call
3299  * sites and invocations. These correspond to C++ types in the
3300  * llvm::CallInst class tree.
3301  *
3302  * @{
3303  */
3304 
3305 /**
3306  * Obtain the argument count for a call instruction.
3307  *
3308  * This expects an LLVMValueRef that corresponds to a llvm::CallInst,
3309  * llvm::InvokeInst, or llvm:FuncletPadInst.
3310  *
3311  * @see llvm::CallInst::getNumArgOperands()
3312  * @see llvm::InvokeInst::getNumArgOperands()
3313  * @see llvm::FuncletPadInst::getNumArgOperands()
3314  */
3315 unsigned LLVMGetNumArgOperands(LLVMValueRef Instr);
3316 
3317 /**
3318  * Set the calling convention for a call instruction.
3319  *
3320  * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3321  * llvm::InvokeInst.
3322  *
3323  * @see llvm::CallInst::setCallingConv()
3324  * @see llvm::InvokeInst::setCallingConv()
3325  */
3326 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
3327 
3328 /**
3329  * Obtain the calling convention for a call instruction.
3330  *
3331  * This is the opposite of LLVMSetInstructionCallConv(). Reads its
3332  * usage.
3333  *
3334  * @see LLVMSetInstructionCallConv()
3335  */
3337 
3339  unsigned Align);
3340 
3347  LLVMAttributeIndex Idx,
3348  unsigned KindID);
3350  LLVMAttributeIndex Idx,
3351  const char *K, unsigned KLen);
3353  unsigned KindID);
3355  const char *K, unsigned KLen);
3356 
3357 /**
3358  * Obtain the function type called by this instruction.
3359  *
3360  * @see llvm::CallBase::getFunctionType()
3361  */
3363 
3364 /**
3365  * Obtain the pointer to the function invoked by this instruction.
3366  *
3367  * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
3368  * llvm::InvokeInst.
3369  *
3370  * @see llvm::CallInst::getCalledOperand()
3371  * @see llvm::InvokeInst::getCalledOperand()
3372  */
3374 
3375 /**
3376  * Obtain whether a call instruction is a tail call.
3377  *
3378  * This only works on llvm::CallInst instructions.
3379  *
3380  * @see llvm::CallInst::isTailCall()
3381  */
3383 
3384 /**
3385  * Set whether a call instruction is a tail call.
3386  *
3387  * This only works on llvm::CallInst instructions.
3388  *
3389  * @see llvm::CallInst::setTailCall()
3390  */
3391 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
3392 
3393 /**
3394  * Return the normal destination basic block.
3395  *
3396  * This only works on llvm::InvokeInst instructions.
3397  *
3398  * @see llvm::InvokeInst::getNormalDest()
3399  */
3401 
3402 /**
3403  * Return the unwind destination basic block.
3404  *
3405  * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3406  * llvm::CatchSwitchInst instructions.
3407  *
3408  * @see llvm::InvokeInst::getUnwindDest()
3409  * @see llvm::CleanupReturnInst::getUnwindDest()
3410  * @see llvm::CatchSwitchInst::getUnwindDest()
3411  */
3413 
3414 /**
3415  * Set the normal destination basic block.
3416  *
3417  * This only works on llvm::InvokeInst instructions.
3418  *
3419  * @see llvm::InvokeInst::setNormalDest()
3420  */
3422 
3423 /**
3424  * Set the unwind destination basic block.
3425  *
3426  * Works on llvm::InvokeInst, llvm::CleanupReturnInst, and
3427  * llvm::CatchSwitchInst instructions.
3428  *
3429  * @see llvm::InvokeInst::setUnwindDest()
3430  * @see llvm::CleanupReturnInst::setUnwindDest()
3431  * @see llvm::CatchSwitchInst::setUnwindDest()
3432  */
3434 
3435 /**
3436  * @}
3437  */
3438 
3439 /**
3440  * @defgroup LLVMCCoreValueInstructionTerminator Terminators
3441  *
3442  * Functions in this group only apply to instructions for which
3443  * LLVMIsATerminatorInst returns true.
3444  *
3445  * @{
3446  */
3447 
3448 /**
3449  * Return the number of successors that this terminator has.
3450  *
3451  * @see llvm::Instruction::getNumSuccessors
3452  */
3454 
3455 /**
3456  * Return the specified successor.
3457  *
3458  * @see llvm::Instruction::getSuccessor
3459  */
3461 
3462 /**
3463  * Update the specified successor to point at the provided block.
3464  *
3465  * @see llvm::Instruction::setSuccessor
3466  */
3468 
3469 /**
3470  * Return if a branch is conditional.
3471  *
3472  * This only works on llvm::BranchInst instructions.
3473  *
3474  * @see llvm::BranchInst::isConditional
3475  */
3477 
3478 /**
3479  * Return the condition of a branch instruction.
3480  *
3481  * This only works on llvm::BranchInst instructions.
3482  *
3483  * @see llvm::BranchInst::getCondition
3484  */
3486 
3487 /**
3488  * Set the condition of a branch instruction.
3489  *
3490  * This only works on llvm::BranchInst instructions.
3491  *
3492  * @see llvm::BranchInst::setCondition
3493  */
3495 
3496 /**
3497  * Obtain the default destination basic block of a switch instruction.
3498  *
3499  * This only works on llvm::SwitchInst instructions.
3500  *
3501  * @see llvm::SwitchInst::getDefaultDest()
3502  */
3504 
3505 /**
3506  * @}
3507  */
3508 
3509 /**
3510  * @defgroup LLVMCCoreValueInstructionAlloca Allocas
3511  *
3512  * Functions in this group only apply to instructions that map to
3513  * llvm::AllocaInst instances.
3514  *
3515  * @{
3516  */
3517 
3518 /**
3519  * Obtain the type that is being allocated by the alloca instruction.
3520  */
3522 
3523 /**
3524  * @}
3525  */
3526 
3527 /**
3528  * @defgroup LLVMCCoreValueInstructionGetElementPointer GEPs
3529  *
3530  * Functions in this group only apply to instructions that map to
3531  * llvm::GetElementPtrInst instances.
3532  *
3533  * @{
3534  */
3535 
3536 /**
3537  * Check whether the given GEP operator is inbounds.
3538  */
3540 
3541 /**
3542  * Set the given GEP instruction to be inbounds or not.
3543  */
3544 void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds);
3545 
3546 /**
3547  * Get the source element type of the given GEP operator.
3548  */
3550 
3551 /**
3552  * @}
3553  */
3554 
3555 /**
3556  * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
3557  *
3558  * Functions in this group only apply to instructions that map to
3559  * llvm::PHINode instances.
3560  *
3561  * @{
3562  */
3563 
3564 /**
3565  * Add an incoming value to the end of a PHI list.
3566  */
3567 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
3568  LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
3569 
3570 /**
3571  * Obtain the number of incoming basic blocks to a PHI node.
3572  */
3573 unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
3574 
3575 /**
3576  * Obtain an incoming value to a PHI node as an LLVMValueRef.
3577  */
3579 
3580 /**
3581  * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
3582  */
3584 
3585 /**
3586  * @}
3587  */
3588 
3589 /**
3590  * @defgroup LLVMCCoreValueInstructionExtractValue ExtractValue
3591  * @defgroup LLVMCCoreValueInstructionInsertValue InsertValue
3592  *
3593  * Functions in this group only apply to instructions that map to
3594  * llvm::ExtractValue and llvm::InsertValue instances.
3595  *
3596  * @{
3597  */
3598 
3599 /**
3600  * Obtain the number of indices.
3601  * NB: This also works on GEP operators.
3602  */
3603 unsigned LLVMGetNumIndices(LLVMValueRef Inst);
3604 
3605 /**
3606  * Obtain the indices as an array.
3607  */
3608 const unsigned *LLVMGetIndices(LLVMValueRef Inst);
3609 
3610 /**
3611  * @}
3612  */
3613 
3614 /**
3615  * @}
3616  */
3617 
3618 /**
3619  * @}
3620  */
3621 
3622 /**
3623  * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
3624  *
3625  * An instruction builder represents a point within a basic block and is
3626  * the exclusive means of building instructions using the C interface.
3627  *
3628  * @{
3629  */
3630 
3634  LLVMValueRef Instr);
3641  const char *Name);
3643 
3644 /* Metadata */
3645 
3646 /**
3647  * Get location information used by debugging information.
3648  *
3649  * @see llvm::IRBuilder::getCurrentDebugLocation()
3650  */
3652 
3653 /**
3654  * Set location information used by debugging information.
3655  *
3656  * To clear the location metadata of the given instruction, pass NULL to \p Loc.
3657  *
3658  * @see llvm::IRBuilder::SetCurrentDebugLocation()
3659  */
3661 
3662 /**
3663  * Attempts to set the debug location for the given instruction using the
3664  * current debug location for the given builder. If the builder has no current
3665  * debug location, this function is a no-op.
3666  *
3667  * @deprecated LLVMSetInstDebugLocation is deprecated in favor of the more general
3668  * LLVMAddMetadataToInst.
3669  *
3670  * @see llvm::IRBuilder::SetInstDebugLocation()
3671  */
3673 
3674 /**
3675  * Adds the metadata registered with the given builder to the given instruction.
3676  *
3677  * @see llvm::IRBuilder::AddMetadataToInst()
3678  */
3680 
3681 /**
3682  * Get the dafult floating-point math metadata for a given builder.
3683  *
3684  * @see llvm::IRBuilder::getDefaultFPMathTag()
3685  */
3687 
3688 /**
3689  * Set the default floating-point math metadata for the given builder.
3690  *
3691  * To clear the metadata, pass NULL to \p FPMathTag.
3692  *
3693  * @see llvm::IRBuilder::setDefaultFPMathTag()
3694  */
3696  LLVMMetadataRef FPMathTag);
3697 
3698 /**
3699  * Deprecated: Passing the NULL location will crash.
3700  * Use LLVMGetCurrentDebugLocation2 instead.
3701  */
3703 /**
3704  * Deprecated: Returning the NULL location will crash.
3705  * Use LLVMGetCurrentDebugLocation2 instead.
3706  */
3708 
3709 /* Terminators */
3713  unsigned N);
3718  LLVMBasicBlockRef Else, unsigned NumCases);
3720  unsigned NumDests);
3722  LLVMValueRef *Args, unsigned NumArgs,
3724  const char *Name);
3726 
3727 /* Exception Handling */
3730  LLVMValueRef PersFn, unsigned NumClauses,
3731  const char *Name);
3737  LLVMValueRef *Args, unsigned NumArgs,
3738  const char *Name);
3740  LLVMValueRef *Args, unsigned NumArgs,
3741  const char *Name);
3743  LLVMBasicBlockRef UnwindBB,
3744  unsigned NumHandlers, const char *Name);
3745 
3746 /* Add a case to the switch instruction */
3747 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
3748  LLVMBasicBlockRef Dest);
3749 
3750 /* Add a destination to the indirectbr instruction */
3751 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
3752 
3753 /* Get the number of clauses on the landingpad instruction */
3754 unsigned LLVMGetNumClauses(LLVMValueRef LandingPad);
3755 
3756 /* Get the value of the clause at index Idx on the landingpad instruction */
3757 LLVMValueRef LLVMGetClause(LLVMValueRef LandingPad, unsigned Idx);
3758 
3759 /* Add a catch or filter clause to the landingpad instruction */
3760 void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
3761 
3762 /* Get the 'cleanup' flag in the landingpad instruction */
3763 LLVMBool LLVMIsCleanup(LLVMValueRef LandingPad);
3764 
3765 /* Set the 'cleanup' flag in the landingpad instruction */
3766 void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
3767 
3768 /* Add a destination to the catchswitch instruction */
3769 void LLVMAddHandler(LLVMValueRef CatchSwitch, LLVMBasicBlockRef Dest);
3770 
3771 /* Get the number of handlers on the catchswitch instruction */
3772 unsigned LLVMGetNumHandlers(LLVMValueRef CatchSwitch);
3773 
3774 /**
3775  * Obtain the basic blocks acting as handlers for a catchswitch instruction.
3776  *
3777  * The Handlers parameter should point to a pre-allocated array of
3778  * LLVMBasicBlockRefs at least LLVMGetNumHandlers() large. On return, the
3779  * first LLVMGetNumHandlers() entries in the array will be populated
3780  * with LLVMBasicBlockRef instances.
3781  *
3782  * @param CatchSwitch The catchswitch instruction to operate on.
3783  * @param Handlers Memory address of an array to be filled with basic blocks.
3784  */
3785 void LLVMGetHandlers(LLVMValueRef CatchSwitch, LLVMBasicBlockRef *Handlers);
3786 
3787 /* Funclets */
3788 
3789 /* Get the number of funcletpad arguments. */
3790 LLVMValueRef LLVMGetArgOperand(LLVMValueRef Funclet, unsigned i);
3791 
3792 /* Set a funcletpad argument at the given index. */
3793 void LLVMSetArgOperand(LLVMValueRef Funclet, unsigned i, LLVMValueRef value);
3794 
3795 /**
3796  * Get the parent catchswitch instruction of a catchpad instruction.
3797  *
3798  * This only works on llvm::CatchPadInst instructions.
3799  *
3800  * @see llvm::CatchPadInst::getCatchSwitch()
3801  */
3803 
3804 /**
3805  * Set the parent catchswitch instruction of a catchpad instruction.
3806  *
3807  * This only works on llvm::CatchPadInst instructions.
3808  *
3809  * @see llvm::CatchPadInst::setCatchSwitch()
3810  */
3811 void LLVMSetParentCatchSwitch(LLVMValueRef CatchPad, LLVMValueRef CatchSwitch);
3812 
3813 /* Arithmetic */
3815  const char *Name);
3817  const char *Name);
3819  const char *Name);
3821  const char *Name);
3823  const char *Name);
3825  const char *Name);
3827  const char *Name);
3829  const char *Name);
3831  const char *Name);
3833  const char *Name);
3835  const char *Name);
3837  const char *Name);
3839  const char *Name);
3841  const char *Name);
3843  const char *Name);
3845  const char *Name);
3847  const char *Name);
3849  const char *Name);
3851  const char *Name);
3853  const char *Name);
3855  const char *Name);
3857  const char *Name);
3859  const char *Name);
3861  const char *Name);
3863  const char *Name);
3865  const char *Name);
3868  const char *Name);
3871  const char *Name);
3873  const char *Name);
3876 
3877 /* Memory */
3880  LLVMValueRef Val, const char *Name);
3881 
3882 /**
3883  * Creates and inserts a memset to the specified pointer and the
3884  * specified value.
3885  *
3886  * @see llvm::IRRBuilder::CreateMemSet()
3887  */
3889  LLVMValueRef Val, LLVMValueRef Len,
3890  unsigned Align);
3891 /**
3892  * Creates and inserts a memcpy between the specified pointers.
3893  *
3894  * @see llvm::IRRBuilder::CreateMemCpy()
3895  */
3897  LLVMValueRef Dst, unsigned DstAlign,
3898  LLVMValueRef Src, unsigned SrcAlign,
3899  LLVMValueRef Size);
3900 /**
3901  * Creates and inserts a memmove between the specified pointers.
3902  *
3903  * @see llvm::IRRBuilder::CreateMemMove()
3904  */
3906  LLVMValueRef Dst, unsigned DstAlign,
3907  LLVMValueRef Src, unsigned SrcAlign,
3908  LLVMValueRef Size);
3909 
3912  LLVMValueRef Val, const char *Name);
3915  LLVMValueRef PointerVal, const char *Name);
3918  LLVMValueRef Pointer, LLVMValueRef *Indices,
3919  unsigned NumIndices, const char *Name);
3921  LLVMValueRef Pointer, LLVMValueRef *Indices,
3922  unsigned NumIndices, const char *Name);
3924  LLVMValueRef Pointer, unsigned Idx,
3925  const char *Name);
3927  const char *Name);
3929  const char *Name);
3930 LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
3931 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
3932 LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst);
3933 void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool IsWeak);
3935 void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering);
3937 void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst, LLVMAtomicRMWBinOp BinOp);
3938 
3939 /* Casts */
3941  LLVMTypeRef DestTy, const char *Name);
3943  LLVMTypeRef DestTy, const char *Name);
3945  LLVMTypeRef DestTy, const char *Name);
3947  LLVMTypeRef DestTy, const char *Name);
3949  LLVMTypeRef DestTy, const char *Name);
3951  LLVMTypeRef DestTy, const char *Name);
3953  LLVMTypeRef DestTy, const char *Name);
3955  LLVMTypeRef DestTy, const char *Name);
3957  LLVMTypeRef DestTy, const char *Name);
3959  LLVMTypeRef DestTy, const char *Name);
3961  LLVMTypeRef DestTy, const char *Name);
3963  LLVMTypeRef DestTy, const char *Name);
3965  LLVMTypeRef DestTy, const char *Name);
3967  LLVMTypeRef DestTy, const char *Name);
3969  LLVMTypeRef DestTy, const char *Name);
3971  LLVMTypeRef DestTy, const char *Name);
3973  LLVMTypeRef DestTy, const char *Name);
3975  LLVMTypeRef DestTy, const char *Name);
3977  LLVMTypeRef DestTy, LLVMBool IsSigned,
3978  const char *Name);
3980  LLVMTypeRef DestTy, const char *Name);
3981 
3982 /** Deprecated: This cast is always signed. Use LLVMBuildIntCast2 instead. */
3984  LLVMTypeRef DestTy, const char *Name);
3985 
3987  LLVMTypeRef DestTy, LLVMBool DestIsSigned);
3988 
3989 /* Comparisons */
3992  const char *Name);
3995  const char *Name);
3996 
3997 /* Miscellaneous instructions */
4000  LLVMValueRef *Args, unsigned NumArgs,
4001  const char *Name);
4004  const char *Name);
4006  const char *Name);
4008  LLVMValueRef Index, const char *Name);
4011  const char *Name);
4014  const char *Name);
4016  unsigned Index, const char *Name);
4018  LLVMValueRef EltVal, unsigned Index,
4019  const char *Name);
4021  const char *Name);
4022 
4024  const char *Name);
4026  const char *Name);
4029  const char *Name);
4031  LLVMBool singleThread, const char *Name);
4033  LLVMValueRef PTR, LLVMValueRef Val,
4034  LLVMAtomicOrdering ordering,
4035  LLVMBool singleThread);
4037  LLVMValueRef Cmp, LLVMValueRef New,
4038  LLVMAtomicOrdering SuccessOrdering,
4039  LLVMAtomicOrdering FailureOrdering,
4041 
4042 /**
4043  * Get the number of elements in the mask of a ShuffleVector instruction.
4044  */
4045 unsigned LLVMGetNumMaskElements(LLVMValueRef ShuffleVectorInst);
4046 
4047 /**
4048  * \returns a constant that specifies that the result of a \c ShuffleVectorInst
4049  * is undefined.
4050  */
4051 int LLVMGetUndefMaskElem(void);
4052 
4053 /**
4054  * Get the mask value at position Elt in the mask of a ShuffleVector
4055  * instruction.
4056  *
4057  * \Returns the result of \c LLVMGetUndefMaskElem() if the mask value is undef
4058  * at that position.
4059  */
4060 int LLVMGetMaskValue(LLVMValueRef ShuffleVectorInst, unsigned Elt);
4061 
4064 
4067  LLVMAtomicOrdering Ordering);
4070  LLVMAtomicOrdering Ordering);
4071 
4072 /**
4073  * @}
4074  */
4075 
4076 /**
4077  * @defgroup LLVMCCoreModuleProvider Module Providers
4078  *
4079  * @{
4080  */
4081 
4082 /**
4083  * Changes the type of M so it can be passed to FunctionPassManagers and the
4084  * JIT. They take ModuleProviders for historical reasons.
4085  */
4088 
4089 /**
4090  * Destroys the module M.
4091  */
4093 
4094 /**
4095  * @}
4096  */
4097 
4098 /**
4099  * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
4100  *
4101  * @{
4102  */
4103 
4105  LLVMMemoryBufferRef *OutMemBuf,
4106  char **OutMessage);
4108  char **OutMessage);
4110  size_t InputDataLength,
4111  const char *BufferName,
4112  LLVMBool RequiresNullTerminator);
4114  size_t InputDataLength,
4115  const char *BufferName);
4116 const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
4117 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
4119 
4120 /**
4121  * @}
4122  */
4123 
4124 /**
4125  * @defgroup LLVMCCorePassRegistry Pass Registry
4126  * @ingroup LLVMCCore
4127  *
4128  * @{
4129  */
4130 
4131 /** Return the global pass registry, for use with initialization functions.
4132  @see llvm::PassRegistry::getPassRegistry */
4134 
4135 /**
4136  * @}
4137  */
4138 
4139 /**
4140  * @defgroup LLVMCCorePassManagers Pass Managers
4141  * @ingroup LLVMCCore
4142  *
4143  * @{
4144  */
4145 
4146 /** Constructs a new whole-module pass pipeline. This type of pipeline is
4147  suitable for link-time optimization and whole-module transformations.
4148  @see llvm::PassManager::PassManager */
4150 
4151 /** Constructs a new function-by-function pass pipeline over the module
4152  provider. It does not take ownership of the module provider. This type of
4153  pipeline is suitable for code generation and JIT compilation tasks.
4154  @see llvm::FunctionPassManager::FunctionPassManager */
4156 
4157 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
4159 
4160 /** Initializes, executes on the provided module, and finalizes all of the
4161  passes scheduled in the pass manager. Returns 1 if any of the passes
4162  modified the module, 0 otherwise.
4163  @see llvm::PassManager::run(Module&) */
4165 
4166 /** Initializes all of the function passes scheduled in the function pass
4167  manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4168  @see llvm::FunctionPassManager::doInitialization */
4170 
4171 /** Executes all of the function passes scheduled in the function pass manager
4172  on the provided function. Returns 1 if any of the passes modified the
4173  function, false otherwise.
4174  @see llvm::FunctionPassManager::run(Function&) */
4176 
4177 /** Finalizes all of the function passes scheduled in the function pass
4178  manager. Returns 1 if any of the passes modified the module, 0 otherwise.
4179  @see llvm::FunctionPassManager::doFinalization */
4181 
4182 /** Frees the memory of a pass pipeline. For function pipelines, does not free
4183  the module provider.
4184  @see llvm::PassManagerBase::~PassManagerBase. */
4186 
4187 /**
4188  * @}
4189  */
4190 
4191 /**
4192  * @defgroup LLVMCCoreThreading Threading
4193  *
4194  * Handle the structures needed to make LLVM safe for multithreading.
4195  *
4196  * @{
4197  */
4198 
4199 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4200  time define LLVM_ENABLE_THREADS. This function always returns
4201  LLVMIsMultithreaded(). */
4203 
4204 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
4205  time define LLVM_ENABLE_THREADS. */
4206 void LLVMStopMultithreaded(void);
4207 
4208 /** Check whether LLVM is executing in thread-safe mode or not.
4209  @see llvm::llvm_is_multithreaded */
4211 
4212 /**
4213  * @}
4214  */
4215 
4216 /**
4217  * @}
4218  */
4219 
4220 /**
4221  * @}
4222  */
4223 
4225 
4226 #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:1444
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:659
LLVMGetDiagInfoSeverity
LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI)
Return an enum LLVMDiagnosticSeverity.
Definition: Core.cpp:232
LLVMIntEQ
@ LLVMIntEQ
equal
Definition: Core.h:291
LLVMBuildLShr
LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3374
LLVMSetCleanup
void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val)
Definition: Core.cpp:3230
LLVMBuildIsNotNull
LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3885
LLVMBuildPointerCast
LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3772
LLVMGetInitializer
LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar)
Definition: Core.cpp:2127
LLVMBuildNUWMul
LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3319
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
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:2067
LLVMBuildFSub
LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3304
LLVMConstantVectorValueKind
@ LLVMConstantVectorValueKind
Definition: Core.h:272
LLVMGetVolatile
LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst)
Definition: Core.cpp:3622
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:759
LLVMGetElementAsConstant
LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef C, unsigned idx)
Definition: Core.cpp:1454
LLVMMSP430INTRCallConv
@ LLVMMSP430INTRCallConv
Definition: Core.h:229
LLVMGetNextParam
LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg)
Obtain the next parameter to a function.
Definition: Core.cpp:2491
LLVMSetTailCall
void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall)
Set whether a call instruction is a tail call.
Definition: Core.cpp:2874
LLVMGhostLinkage
@ LLVMGhostLinkage
Obsolete.
Definition: Core.h:188
LLVMGetBasicBlockTerminator
LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB)
Obtain the terminator instruction for a basic block.
Definition: Core.cpp:2598
LLVMGetTypeByName2
LLVMTypeRef LLVMGetTypeByName2(LLVMContextRef C, const char *Name)
Obtain a Type from a context by its registered name.
Definition: Core.cpp:775
LLVMConstStringInContext
LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str, unsigned Length, LLVMBool DontNullTerminate)
Create a ConstantDataSequential and initialize it with a string.
Definition: Core.cpp:1435
LLVMGetOrdering
LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemoryAccessInst)
Definition: Core.cpp:3652
LLVMBuildBr
LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest)
Definition: Core.cpp:3114
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:2523
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:3927
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:831
LLVMGetNextGlobalAlias
LLVMValueRef LLVMGetNextGlobalAlias(LLVMValueRef GA)
Advance a GlobalAlias iterator to the next GlobalAlias.
Definition: Core.cpp:2233
LLVMSetPersonalityFn
void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn)
Set the personality function attached to the function.
Definition: Core.cpp:2313
LLVMConstLShr
LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1640
LLVMFP128TypeInContext
LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C)
Obtain a 128-bit floating point type (112-bit mantissa) from a context.
Definition: Core.cpp:643
LLVMGetGlobalContext
LLVMContextRef LLVMGetGlobalContext(void)
Obtain the global context instance.
Definition: Core.cpp:97
LLVMDisposePassManager
void LLVMDisposePassManager(LLVMPassManagerRef PM)
Frees the memory of a pass pipeline.
Definition: Core.cpp:4088
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:1060
LLVMBuildStore
LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr)
Definition: Core.cpp:3497
LLVMGetPersonalityFn
LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn)
Obtain the personality function attached to the function.
Definition: Core.cpp:2309
LLVMExternalLinkage
@ LLVMExternalLinkage
Externally visible function.
Definition: Core.h:172
LLVMGetNamedGlobal
LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name)
Definition: Core.cpp:2087
LLVMEraseGlobalIFunc
void LLVMEraseGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module and delete it.
Definition: Core.cpp:2568
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:1566
LLVMBuildCatchRet
LLVMValueRef LLVMBuildCatchRet(LLVMBuilderRef B, LLVMValueRef CatchPad, LLVMBasicBlockRef BB)
Definition: Core.cpp:3189
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:3823
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:1289
LLVMConstantAggregateZeroValueKind
@ LLVMConstantAggregateZeroValueKind
Definition: Core.h:275
LLVMCreateBuilderInContext
LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C)
Definition: Core.cpp:3008
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:3248
LLVMConstAShr
LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1645
LLVMSub
@ LLVMSub
Definition: Core.h:77
LLVMGetParams
void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params)
Obtain the parameters in a function.
Definition: Core.cpp:2460
LLVMConstICmp
LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate, LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1621
LLVMSetThreadLocal
void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal)
Definition: Core.cpp:2143
LLVMYieldCallback
void(* LLVMYieldCallback)(LLVMContextRef, void *)
Definition: Core.h:510
LLVMGetFirstGlobalIFunc
LLVMValueRef LLVMGetFirstGlobalIFunc(LLVMModuleRef M)
Obtain an iterator to the first GlobalIFunc in a Module.
Definition: Core.cpp:2528
LLVMFPToSI
@ LLVMFPToSI
Definition: Core.h:107
LLVMBuildZExtOrBitCast
LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3748
LLVMSetSuccessor
void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block)
Update the specified successor to point at the provided block.
Definition: Core.cpp:2916
LLVMGetAllocatedType
LLVMTypeRef LLVMGetAllocatedType(LLVMValueRef Alloca)
Obtain the type that is being allocated by the alloca instruction.
Definition: Core.cpp:2942
LLVMGeneralDynamicTLSModel
@ LLVMGeneralDynamicTLSModel
Definition: Core.h:329
LLVMAddCallSiteAttribute
void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Definition: Core.cpp:2816
LLVMAtomicRMWBinOpOr
@ LLVMAtomicRMWBinOpOr
OR a value and return the old one.
Definition: Core.h:368
LLVMConstSExt
LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1672
LLVMBuildGEP2
LLVMValueRef LLVMBuildGEP2(LLVMBuilderRef B, LLVMTypeRef Ty, LLVMValueRef Pointer, LLVMValueRef *Indices, unsigned NumIndices, const char *Name)
Definition: Core.cpp:3590
LLVMBuildFreeze
LLVMValueRef LLVMBuildFreeze(LLVMBuilderRef, LLVMValueRef Val, const char *Name)
Definition: Core.cpp:3875
LLVMConstIntGetSExtValue
long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal)
Obtain the sign extended value for an integer constant value.
Definition: Core.cpp:1412
LLVMFinalizeFunctionPassManager
LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM)
Finalizes all of the function passes scheduled in the function pass manager.
Definition: Core.cpp:4084
LLVMFloatType
LLVMTypeRef LLVMFloatType(void)
Definition: Core.cpp:662
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:4076
LLVMBuildIntCast2
LLVMValueRef LLVMBuildIntCast2(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, LLVMBool IsSigned, const char *Name)
Definition: Core.cpp:3777
LLVMGetIncomingValue
LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index)
Obtain an incoming value to a PHI node as an LLVMValueRef.
Definition: Core.cpp:2973
Types.h
LLVMCreateMessage
char * LLVMCreateMessage(const char *Message)
Definition: Core.cpp:77
LLVMAttributeIndex
unsigned LLVMAttributeIndex
Definition: Core.h:469
LLVMDisposeMemoryBuffer
void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf)
Definition: Core.cpp:4047
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:3399
LLVMConstIntCast
LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType, LLVMBool isSigned)
Definition: Core.cpp:1757
LLVMGetNumOperands
int LLVMGetNumOperands(LLVMValueRef Val)
Obtain the number of operands in a llvm::User value.
Definition: Core.cpp:1069
LLVMSetDataLayout
void LLVMSetDataLayout(LLVMModuleRef M, const char *DataLayoutStr)
Set the data layout for a module.
Definition: Core.cpp:297
LLVMSExt
@ LLVMSExt
Definition: Core.h:105
LLVMGetPreviousGlobalAlias
LLVMValueRef LLVMGetPreviousGlobalAlias(LLVMValueRef GA)
Decrement a GlobalAlias iterator to the previous GlobalAlias.
Definition: Core.cpp:2241
LLVMGetNextInstruction
LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst)
Obtain the instruction that occurs after the one specified.
Definition: Core.cpp:2727
LLVMAtomicRMWBinOp
LLVMAtomicRMWBinOp
Definition: Core.h:362
LLVMConstZExt
LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1677
LLVMInsertValue
@ LLVMInsertValue
Definition: Core.h:130
LLVMAddGlobal
LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name)
Definition: Core.cpp:2073
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:1359
LLVMConstNSWMul
LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1594
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:1083
LLVMGetCmpXchgFailureOrdering
LLVMAtomicOrdering LLVMGetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst)
Definition: Core.cpp:3966
LLVMCreateModuleProviderForExistingModule
LLVMModuleProviderRef LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M)
Changes the type of M so it can be passed to FunctionPassManagers and the JIT.
Definition: Core.cpp:3982
LLVMBuildPtrDiff2
LLVMValueRef LLVMBuildPtrDiff2(LLVMBuilderRef, LLVMTypeRef ElemTy, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3890
LLVMBlockAddress
LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB)
Definition: Core.cpp:1808
LLVMInsertIntoBuilderWithName
void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr, const char *Name)
Definition: Core.cpp:3045
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:2751
LLVMContextGetDiagnosticHandler
LLVMDiagnosticHandler LLVMContextGetDiagnosticHandler(LLVMContextRef C)
Get the diagnostic handler of this context.
Definition: Core.cpp:108
LLVMOpaqueModuleFlagEntry
Definition: Core.cpp:311
LLVMCountBasicBlocks
unsigned LLVMCountBasicBlocks(LLVMValueRef Fn)
Obtain the number of basic blocks in a function.
Definition: Core.cpp:2602
LLVMGetValueKind
LLVMValueKind LLVMGetValueKind(LLVMValueRef Val)
Obtain the enumerated type of a Value instance.
Definition: Core.cpp:869
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:2612
LLVMShl
@ LLVMShl
Definition: Core.h:89
LLVMConstExtractElement
LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant, LLVMValueRef IndexConstant)
Definition: Core.cpp:1776
LLVMGetGlobalParent
LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global)
Definition: Core.cpp:1814
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:1184
LLVMMDNodeInContext2
LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs, size_t Count)
Create an MDNode value with the given array of operands.
Definition: Core.cpp:1124
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:719
LLVMDisposeBuilder
void LLVMDisposeBuilder(LLVMBuilderRef Builder)
Definition: Core.cpp:3050
LLVMInlineAsmDialectATT
@ LLVMInlineAsmDialectATT
Definition: Core.h:402
LLVMGetFirstParam
LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn)
Obtain the first parameter to a function.
Definition: Core.cpp:2475
LLVMVoidTypeInContext
LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C)
Create a void type in a context.
Definition: Core.cpp:841
LLVMIsExternallyInitialized
LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar)
Definition: Core.cpp:2194
LLVMGetGlobalPassRegistry
LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void)
Return the global pass registry, for use with initialization functions.
Definition: Core.cpp:4053
LLVMCreateBasicBlockInContext
LLVMBasicBlockRef LLVMCreateBasicBlockInContext(LLVMContextRef C, const char *Name)
Create a new basic block without inserting it into a function.
Definition: Core.cpp:2648
LLVMBuildSub
LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3289
LLVMBuildSelect
LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If, LLVMValueRef Then, LLVMValueRef Else, const char *Name)
Definition: Core.cpp:3831
LLVMSetUnnamedAddr
void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr)
Deprecated: Use LLVMSetUnnamedAddress instead.
Definition: Core.cpp:1975
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:1238
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:2850
LLVMGetNextGlobal
LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2107
LLVMBuildICmp
LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3803
LLVMMemoryPhiValueKind
@ LLVMMemoryPhiValueKind
Definition: Core.h:262
LLVMGetSection
const char * LLVMGetSection(LLVMValueRef Global)
Definition: Core.cpp:1916
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:3482
LLVMValueAsBasicBlock
LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val)
Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
Definition: Core.cpp:2586
LLVMConstBitCast
LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1722
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:805
LLVMGetArrayLength
unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy)
Obtain the length of an array type.
Definition: Core.cpp:823
LLVMBuildAtomicCmpXchg
LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr, LLVMValueRef Cmp, LLVMValueRef New, LLVMAtomicOrdering SuccessOrdering, LLVMAtomicOrdering FailureOrdering, LLVMBool SingleThread)
Definition: Core.cpp:3908
LLVMConstFPToSI
LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType)
Definition: Core.cpp:1707
LLVMGetLastInstruction
LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB)
Obtain the last instruction in a basic block.
Definition: Core.cpp:2719
LLVMMDStringInContext
LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1129
LLVMConstStruct
LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count, LLVMBool Packed)
Create a ConstantStruct in the global Context.
Definition: Core.cpp:1482
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:1800
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:406
LLVMInsertElement
@ LLVMInsertElement
Definition: Core.h:127
LLVMZExt
@ LLVMZExt
Definition: Core.h:104
LLVMConstAdd
LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1555
LLVMGetPreviousFunction
LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn)
Decrement a Function iterator to the previous Function.
Definition: Core.cpp:2293
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:596
LLVMContextSetDiscardValueNames
void LLVMContextSetDiscardValueNames(LLVMContextRef C, LLVMBool Discard)
Set whether the given context discards all value names.
Definition: Core.cpp:128
LLVMDisposeMessage
void LLVMDisposeMessage(char *Message)
Definition: Core.cpp:81
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:1337
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:1416
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:668
LLVMGetFirstFunction
LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M)
Obtain an iterator to the first Function in a Module.
Definition: Core.cpp:2269
LLVMGetFirstUse
LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val)
Obtain the first use of a value.
Definition: Core.cpp:1011
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:386
LLVMAddFunction
LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name, LLVMTypeRef FunctionTy)
Add a function to a module under a specified name.
Definition: Core.cpp:2259
LLVMDisposeModuleFlagsMetadata
void LLVMDisposeModuleFlagsMetadata(LLVMModuleFlagEntry *Entries)
Destroys module flags metadata entries.
Definition: Core.cpp:374
LLVMBuildLoad2
LLVMValueRef LLVMBuildLoad2(LLVMBuilderRef, LLVMTypeRef Ty, LLVMValueRef PointerVal, const char *Name)
Definition: Core.cpp:3492
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:3067
LLVMCreateBuilder
LLVMBuilderRef LLVMCreateBuilder(void)
Definition: Core.cpp:3012
LLVMMDString
LLVMValueRef LLVMMDString(const char *Str, unsigned SLen)
Deprecated: Use LLVMMDStringInContext2 instead.
Definition: Core.cpp:1136
LLVMBuildShl
LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3369
LLVMSetCmpXchgFailureOrdering
void LLVMSetCmpXchgFailureOrdering(LLVMValueRef CmpXchgInst, LLVMAtomicOrdering Ordering)
Definition: Core.cpp:3971
LLVMBuilderGetDefaultFPMathTag
LLVMMetadataRef LLVMBuilderGetDefaultFPMathTag(LLVMBuilderRef Builder)
Get the dafult floating-point math metadata for a given builder.
Definition: Core.cpp:3095
LLVMSetDLLStorageClass
void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class)
Definition: Core.cpp:1941
LLVMConstantStructValueKind
@ LLVMConstantStructValueKind
Definition: Core.h:271
LLVMGetLastParam
LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn)
Obtain the last parameter to a function.
Definition: Core.cpp:2483
LLVMBuildPtrToInt
LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3728
LLVMAppendExistingBasicBlock
void LLVMAppendExistingBasicBlock(LLVMValueRef Fn, LLVMBasicBlockRef BB)
Append the given basic block to the basic block list of the given function.
Definition: Core.cpp:2662
LLVMOpaqueValueMetadataEntry
Definition: Core.cpp:953
LLVMGHCCallConv
@ LLVMGHCCallConv
Definition: Core.h:216
LLVMBuildInsertElement
LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef EltVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:3849
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:2047
LLVMBuildZExt
LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3688
LLVMGetInstructionCallConv
unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr)
Obtain the calling convention for a call instruction.
Definition: Core.cpp:2799
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:3222
LLVMSetValueName
void LLVMSetValueName(LLVMValueRef Val, const char *Name)
Deprecated: Use LLVMSetValueName2 instead.
Definition: Core.cpp:895
LLVMLabelTypeInContext
LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C)
Create a label type in a context.
Definition: Core.cpp:844
LLVMGetModuleInlineAsm
const char * LLVMGetModuleInlineAsm(LLVMModuleRef M, size_t *Len)
Get inline assembly for a module.
Definition: Core.cpp:465
LLVMSetIsInBounds
void LLVMSetIsInBounds(LLVMValueRef GEP, LLVMBool InBounds)
Set the given GEP instruction to be inbounds or not.
Definition: Core.cpp:2952
LLVMSetVolatile
void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile)
Definition: Core.cpp:3633
LLVMInsertBasicBlock
LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB, const char *Name)
Insert a basic block in a function using the global context.
Definition: Core.cpp:2684
LLVMRemoveGlobalIFunc
void LLVMRemoveGlobalIFunc(LLVMValueRef IFunc)
Remove a global indirect function from its parent module.
Definition: Core.cpp:2572
LLVMIsTailCall
LLVMBool LLVMIsTailCall(LLVMValueRef CallInst)
Obtain whether a call instruction is a tail call.
Definition: Core.cpp:2870
LLVMAddAttributeAtIndex
void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, LLVMAttributeRef A)
Add an attribute to a function.
Definition: Core.cpp:2404
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:1779
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:2689
LLVMIsConstantString
LLVMBool LLVMIsConstantString(LLVMValueRef c)
Returns true if the specified constant is an array of i8.
Definition: Core.cpp:1458
LLVMFAdd
@ LLVMFAdd
Definition: Core.h:76
LLVMGetStringAttributeKind
const char * LLVMGetStringAttributeKind(LLVMAttributeRef A, unsigned *Length)
Get the string attribute's kind.
Definition: Core.cpp:194
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:3673
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:2552
LLVMPrintValueToString
char * LLVMPrintValueToString(LLVMValueRef Val)
Return a string representation of the value.
Definition: Core.cpp:903
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:1369
LLVMBuildExtractElement
LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal, LLVMValueRef Index, const char *Name)
Definition: Core.cpp:3843
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:3677
LLVMIsAtomicSingleThread
LLVMBool LLVMIsAtomicSingleThread(LLVMValueRef AtomicInst)
Definition: Core.cpp:3935
LLVMConstIntOfArbitraryPrecision
LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy, unsigned NumWords, const uint64_t Words[])
Obtain a constant value for an integer of arbitrary precision.
Definition: Core.cpp:1374
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:2386
LLVMGetTarget
const char * LLVMGetTarget(LLVMModuleRef M)
Obtain the target triple for a module.
Definition: Core.cpp:302
LLVMConstantIntValueKind
@ LLVMConstantIntValueKind
Definition: Core.h:278
LLVMSetLinkage
void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage)
Definition: Core.cpp:1851
LLVMPointerTypeIsOpaque
LLVMBool LLVMPointerTypeIsOpaque(LLVMTypeRef Ty)
Determine whether a pointer is opaque.
Definition: Core.cpp:797
LLVMVAArg
@ LLVMVAArg
Definition: Core.h:125
LLVMGetICmpPredicate
LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst)
Obtain the predicate of an instruction.
Definition: Core.cpp:2755
LLVMInt128TypeInContext
LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C)
Definition: Core.cpp:593
LLVMGetLastGlobal
LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M)
Definition: Core.cpp:2099
LLVMTypeIsSized
LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty)
Whether the type has a known size.
Definition: Core.cpp:549
LLVMBuildFNeg
LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name)
Definition: Core.cpp:3420
LLVMBuildExactUDiv
LLVMValueRef LLVMBuildExactUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3334
LLVMConstOr
LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant)
Definition: Core.cpp:1611
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:3760
LLVMInt1TypeInContext
LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C)
Obtain an integer type from a context with specified bit width.
Definition: Core.cpp:578
LLVMBuildSExt
LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3693
LLVMCatchPad
@ LLVMCatchPad
Definition: Core.h:143
LLVMIntType
LLVMTypeRef LLVMIntType(unsigned NumBits)
Definition: Core.cpp:618
LLVMInt16TypeInContext
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C)
Definition: Core.cpp:584
LLVMIsAMDString
LLVMValueRef LLVMIsAMDString(LLVMValueRef Val)
Definition: Core.cpp:1003
LLVMGetNamedGlobalAlias
LLVMValueRef LLVMGetNamedGlobalAlias(LLVMModuleRef M, const char *Name, size_t NameLen)
Obtain a GlobalAlias value from a Module by its name.
Definition: Core.cpp:2212
LLVMFloatTypeInContext
LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C)
Obtain a 32-bit floating point type from a context.
Definition: Core.cpp:634
LLVMFPTrunc
@ LLVMFPTrunc
Definition: Core.h:110
LLVMGetMDKindIDInContext
unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char *Name, unsigned SLen)
Definition: Core.cpp:140
LLVMSetModuleInlineAsm
void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm)
Deprecated: Use LLVMSetModuleInlineAsm2 instead.
Definition: Core.cpp:457
LLVMGlobalGetValueType
LLVMTypeRef LLVMGlobalGetValueType(LLVMValueRef Global)
Returns the "value type" of a global value.
Definition: Core.cpp:1981
LLVMBuildSDiv
LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3339
LLVMAtomicRMWBinOpFMin
@ LLVMAtomicRMWBinOpFMin
Sets the value if it's smaller than the original using an floating point comparison and return the ol...
Definition: Core.h:389
LLVMICmp
@ LLVMICmp
Definition: Core.h:118
LLVMBuildFPToSI
LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3703
LLVMCreateFunctionPassManager
LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP)
Deprecated: Use LLVMCreateFunctionPassManagerForModule instead.
Definition: Core.cpp:4067
LLVMClearInsertionPosition
void LLVMClearInsertionPosition(LLVMBuilderRef Builder)
Definition: Core.cpp:3037
LLVMCountIncoming
unsigned LLVMCountIncoming(LLVMValueRef PhiNode)
Obtain the number of incoming basic blocks to a PHI node.
Definition: Core.cpp:2969
LLVMRealULT
@ LLVMRealULT
True if unordered or less than.
Definition: Core.h:316
LLVMBuildCast
LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val, LLVMTypeRef DestTy, const char *Name)
Definition: Core.cpp:3766
LLVMBuildFRem
LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3364
LLVMAShr
@ LLVMAShr
Definition: Core.h:91
LLVMPreserveAllCallConv
@ LLVMPreserveAllCallConv
Definition: Core.h:221
LLVMAMDGPUVSCallConv
@ LLVMAMDGPUVSCallConv
Definition: Core.h:245
LLVMSetGlobalConstant
void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant)
Definition: Core.cpp:2151
LLVMSetMetadata
void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node)
Set metadata associated with an instruction value.
Definition: Core.cpp:947
LLVMBuildNSWSub
LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS, const char *Name)
Definition: Core.cpp:3294
LLVMGetUndefMaskElem
int LLVMGetUndefMaskElem(void)
Definition: Core.cpp:3933
LLVMAddrSpaceCast
@ LLVMAddrSpaceCast
Definition: Core.h:115
LLVMFP128Type
LLVMTypeRef LLVMFP128Type(void)
Definition: Core.cpp:671
LLVMGetPreviousGlobal
LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar)
Definition: Core.cpp:2115
LLVMAMDGPUESCallConv
@ LLVMAMDGPUESCallConv
Definition: Core.h:254
LLVMLShr
@ LLVMLShr
Definition: Core.h:90
LLVMBuilderRef
struct LLVMOpaqueBuilder * LLVMBuilderRef
Represents an LLVM basic block builder.
Definition: Types.h:110