1 /*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
3 |* The LLVM Compiler Infrastructure *|
5 |* This file is distributed under the University of Illinois Open Source *|
6 |* License. See LICENSE.TXT for details. *|
8 |*===----------------------------------------------------------------------===*|
10 |* This header declares the C interface to libLLVMCore.a, which implements *|
11 |* the LLVM intermediate representation. *|
13 \*===----------------------------------------------------------------------===*/
18 #include "llvm-c/Support.h"
25 * @defgroup LLVMC LLVM-C: C interface to LLVM
27 * This module exposes parts of the LLVM library as a C API.
33 * @defgroup LLVMCTransforms Transforms
37 * @defgroup LLVMCCore Core
39 * This modules provide an interface to libLLVMCore, which implements
40 * the LLVM intermediate representation as well as other related types
43 * LLVM uses a polymorphic type hierarchy which C cannot represent, therefore
44 * parameters must be passed as base types. Despite the declared types, most
45 * of the functions provided operate only on branches of the type hierarchy.
46 * The declared parameter names are descriptive and specify which type is
47 * required. Additionally, each type hierarchy is documented along with the
48 * functions that operate upon it. For more detail, refer to LLVM's C++ code.
49 * If in doubt, refer to Core.cpp, which performs parameter downcasts in the
50 * form unwrap<RequiredType>(Param).
52 * Many exotic languages can interoperate with C code but have a harder time
53 * with C++ due to name mangling. So in addition to C, this interface enables
54 * tools written in such languages.
60 * @defgroup LLVMCCoreTypes Types and Enumerations
68 * The top-level container for all LLVM global data. See the LLVMContext class.
70 typedef struct LLVMOpaqueContext *LLVMContextRef;
73 * The top-level container for all other LLVM Intermediate Representation (IR)
78 typedef struct LLVMOpaqueModule *LLVMModuleRef;
81 * Each value in the LLVM IR has a type, an LLVMTypeRef.
85 typedef struct LLVMOpaqueType *LLVMTypeRef;
88 * Represents an individual value in LLVM IR.
90 * This models llvm::Value.
92 typedef struct LLVMOpaqueValue *LLVMValueRef;
95 * Represents a basic block of instructions in LLVM IR.
97 * This models llvm::BasicBlock.
99 typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
102 * Represents an LLVM basic block builder.
104 * This models llvm::IRBuilder.
106 typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
109 * Interface used to provide a module to JIT or interpreter.
110 * This is now just a synonym for llvm::Module, but we have to keep using the
111 * different type to keep binary compatibility.
113 typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
115 /** @see llvm::PassManagerBase */
116 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
118 /** @see llvm::PassRegistry */
119 typedef struct LLVMOpaquePassRegistry *LLVMPassRegistryRef;
122 * Used to get the users and usees of a Value.
125 typedef struct LLVMOpaqueUse *LLVMUseRef;
129 * @see llvm::DiagnosticInfo
131 typedef struct LLVMOpaqueDiagnosticInfo *LLVMDiagnosticInfoRef;
134 LLVMZExtAttribute = 1<<0,
135 LLVMSExtAttribute = 1<<1,
136 LLVMNoReturnAttribute = 1<<2,
137 LLVMInRegAttribute = 1<<3,
138 LLVMStructRetAttribute = 1<<4,
139 LLVMNoUnwindAttribute = 1<<5,
140 LLVMNoAliasAttribute = 1<<6,
141 LLVMByValAttribute = 1<<7,
142 LLVMNestAttribute = 1<<8,
143 LLVMReadNoneAttribute = 1<<9,
144 LLVMReadOnlyAttribute = 1<<10,
145 LLVMNoInlineAttribute = 1<<11,
146 LLVMAlwaysInlineAttribute = 1<<12,
147 LLVMOptimizeForSizeAttribute = 1<<13,
148 LLVMStackProtectAttribute = 1<<14,
149 LLVMStackProtectReqAttribute = 1<<15,
150 LLVMAlignment = 31<<16,
151 LLVMNoCaptureAttribute = 1<<21,
152 LLVMNoRedZoneAttribute = 1<<22,
153 LLVMNoImplicitFloatAttribute = 1<<23,
154 LLVMNakedAttribute = 1<<24,
155 LLVMInlineHintAttribute = 1<<25,
156 LLVMStackAlignment = 7<<26,
157 LLVMReturnsTwice = 1 << 29,
158 LLVMUWTable = 1 << 30,
159 LLVMNonLazyBind = 1 << 31
161 /* FIXME: These attributes are currently not included in the C API as
162 a temporary measure until the API/ABI impact to the C API is understood
163 and the path forward agreed upon.
164 LLVMSanitizeAddressAttribute = 1ULL << 32,
165 LLVMStackProtectStrongAttribute = 1ULL<<35,
166 LLVMColdAttribute = 1ULL << 40,
167 LLVMOptimizeNoneAttribute = 1ULL << 42,
168 LLVMInAllocaAttribute = 1ULL << 43,
169 LLVMNonNullAttribute = 1ULL << 44,
170 LLVMJumpTableAttribute = 1ULL << 45,
171 LLVMConvergentAttribute = 1ULL << 46,
172 LLVMSafeStackAttribute = 1ULL << 47,
177 /* Terminator Instructions */
183 /* removed 6 due to API changes */
186 /* Standard Binary Operators */
200 /* Logical Operators */
208 /* Memory Operators */
212 LLVMGetElementPtr = 29,
227 LLVMAddrSpaceCast = 60,
229 /* Other Operators */
238 LLVMExtractElement = 50,
239 LLVMInsertElement = 51,
240 LLVMShuffleVector = 52,
241 LLVMExtractValue = 53,
242 LLVMInsertValue = 54,
244 /* Atomic operators */
246 LLVMAtomicCmpXchg = 56,
249 /* Exception Handling Operators */
256 LLVMVoidTypeKind, /**< type with no size */
257 LLVMHalfTypeKind, /**< 16 bit floating point type */
258 LLVMFloatTypeKind, /**< 32 bit floating point type */
259 LLVMDoubleTypeKind, /**< 64 bit floating point type */
260 LLVMX86_FP80TypeKind, /**< 80 bit floating point type (X87) */
261 LLVMFP128TypeKind, /**< 128 bit floating point type (112-bit mantissa)*/
262 LLVMPPC_FP128TypeKind, /**< 128 bit floating point type (two 64-bits) */
263 LLVMLabelTypeKind, /**< Labels */
264 LLVMIntegerTypeKind, /**< Arbitrary bit width integers */
265 LLVMFunctionTypeKind, /**< Functions */
266 LLVMStructTypeKind, /**< Structures */
267 LLVMArrayTypeKind, /**< Arrays */
268 LLVMPointerTypeKind, /**< Pointers */
269 LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
270 LLVMMetadataTypeKind, /**< Metadata */
271 LLVMX86_MMXTypeKind /**< X86 MMX */
275 LLVMExternalLinkage, /**< Externally visible function */
276 LLVMAvailableExternallyLinkage,
277 LLVMLinkOnceAnyLinkage, /**< Keep one copy of function when linking (inline)*/
278 LLVMLinkOnceODRLinkage, /**< Same, but only replaced by something
280 LLVMLinkOnceODRAutoHideLinkage, /**< Obsolete */
281 LLVMWeakAnyLinkage, /**< Keep one copy of function when linking (weak) */
282 LLVMWeakODRLinkage, /**< Same, but only replaced by something
284 LLVMAppendingLinkage, /**< Special purpose, only applies to global arrays */
285 LLVMInternalLinkage, /**< Rename collisions when linking (static
287 LLVMPrivateLinkage, /**< Like Internal, but omit from symbol table */
288 LLVMDLLImportLinkage, /**< Obsolete */
289 LLVMDLLExportLinkage, /**< Obsolete */
290 LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
291 LLVMGhostLinkage, /**< Obsolete */
292 LLVMCommonLinkage, /**< Tentative definitions */
293 LLVMLinkerPrivateLinkage, /**< Like Private, but linker removes. */
294 LLVMLinkerPrivateWeakLinkage /**< Like LinkerPrivate, but is weak. */
298 LLVMDefaultVisibility, /**< The GV is visible */
299 LLVMHiddenVisibility, /**< The GV is hidden */
300 LLVMProtectedVisibility /**< The GV is protected */
304 LLVMDefaultStorageClass = 0,
305 LLVMDLLImportStorageClass = 1, /**< Function to be imported from DLL. */
306 LLVMDLLExportStorageClass = 2 /**< Function to be accessible from DLL. */
307 } LLVMDLLStorageClass;
311 LLVMFastCallConv = 8,
312 LLVMColdCallConv = 9,
313 LLVMWebKitJSCallConv = 12,
314 LLVMAnyRegCallConv = 13,
315 LLVMX86StdcallCallConv = 64,
316 LLVMX86FastcallCallConv = 65
320 LLVMIntEQ = 32, /**< equal */
321 LLVMIntNE, /**< not equal */
322 LLVMIntUGT, /**< unsigned greater than */
323 LLVMIntUGE, /**< unsigned greater or equal */
324 LLVMIntULT, /**< unsigned less than */
325 LLVMIntULE, /**< unsigned less or equal */
326 LLVMIntSGT, /**< signed greater than */
327 LLVMIntSGE, /**< signed greater or equal */
328 LLVMIntSLT, /**< signed less than */
329 LLVMIntSLE /**< signed less or equal */
333 LLVMRealPredicateFalse, /**< Always false (always folded) */
334 LLVMRealOEQ, /**< True if ordered and equal */
335 LLVMRealOGT, /**< True if ordered and greater than */
336 LLVMRealOGE, /**< True if ordered and greater than or equal */
337 LLVMRealOLT, /**< True if ordered and less than */
338 LLVMRealOLE, /**< True if ordered and less than or equal */
339 LLVMRealONE, /**< True if ordered and operands are unequal */
340 LLVMRealORD, /**< True if ordered (no nans) */
341 LLVMRealUNO, /**< True if unordered: isnan(X) | isnan(Y) */
342 LLVMRealUEQ, /**< True if unordered or equal */
343 LLVMRealUGT, /**< True if unordered or greater than */
344 LLVMRealUGE, /**< True if unordered, greater than, or equal */
345 LLVMRealULT, /**< True if unordered or less than */
346 LLVMRealULE, /**< True if unordered, less than, or equal */
347 LLVMRealUNE, /**< True if unordered or not equal */
348 LLVMRealPredicateTrue /**< Always true (always folded) */
352 LLVMLandingPadCatch, /**< A catch clause */
353 LLVMLandingPadFilter /**< A filter clause */
354 } LLVMLandingPadClauseTy;
357 LLVMNotThreadLocal = 0,
358 LLVMGeneralDynamicTLSModel,
359 LLVMLocalDynamicTLSModel,
360 LLVMInitialExecTLSModel,
361 LLVMLocalExecTLSModel
362 } LLVMThreadLocalMode;
365 LLVMAtomicOrderingNotAtomic = 0, /**< A load or store which is not atomic */
366 LLVMAtomicOrderingUnordered = 1, /**< Lowest level of atomicity, guarantees
367 somewhat sane results, lock free. */
368 LLVMAtomicOrderingMonotonic = 2, /**< guarantees that if you take all the
369 operations affecting a specific address,
370 a consistent ordering exists */
371 LLVMAtomicOrderingAcquire = 4, /**< Acquire provides a barrier of the sort
372 necessary to acquire a lock to access other
373 memory with normal loads and stores. */
374 LLVMAtomicOrderingRelease = 5, /**< Release is similar to Acquire, but with
375 a barrier of the sort necessary to release
377 LLVMAtomicOrderingAcquireRelease = 6, /**< provides both an Acquire and a
378 Release barrier (for fences and
379 operations which both read and write
381 LLVMAtomicOrderingSequentiallyConsistent = 7 /**< provides Acquire semantics
382 for loads and Release
383 semantics for stores.
384 Additionally, it guarantees
385 that a total ordering exists
387 SequentiallyConsistent
389 } LLVMAtomicOrdering;
392 LLVMAtomicRMWBinOpXchg, /**< Set the new value and return the one old */
393 LLVMAtomicRMWBinOpAdd, /**< Add a value and return the old one */
394 LLVMAtomicRMWBinOpSub, /**< Subtract a value and return the old one */
395 LLVMAtomicRMWBinOpAnd, /**< And a value and return the old one */
396 LLVMAtomicRMWBinOpNand, /**< Not-And a value and return the old one */
397 LLVMAtomicRMWBinOpOr, /**< OR a value and return the old one */
398 LLVMAtomicRMWBinOpXor, /**< Xor a value and return the old one */
399 LLVMAtomicRMWBinOpMax, /**< Sets the value if it's greater than the
400 original using a signed comparison and return
402 LLVMAtomicRMWBinOpMin, /**< Sets the value if it's Smaller than the
403 original using a signed comparison and return
405 LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the
406 original using an unsigned comparison and return
408 LLVMAtomicRMWBinOpUMin /**< Sets the value if it's greater than the
409 original using an unsigned comparison and return
411 } LLVMAtomicRMWBinOp;
418 } LLVMDiagnosticSeverity;
424 void LLVMInitializeCore(LLVMPassRegistryRef R);
426 /** Deallocate and destroy all ManagedStatic variables.
427 @see llvm::llvm_shutdown
428 @see ManagedStatic */
429 void LLVMShutdown(void);
432 /*===-- Error handling ----------------------------------------------------===*/
434 char *LLVMCreateMessage(const char *Message);
435 void LLVMDisposeMessage(char *Message);
437 typedef void (*LLVMFatalErrorHandler)(const char *Reason);
440 * Install a fatal error handler. By default, if LLVM detects a fatal error, it
441 * will call exit(1). This may not be appropriate in many contexts. For example,
442 * doing exit(1) will bypass many crash reporting/tracing system tools. This
443 * function allows you to install a callback that will be invoked prior to the
446 void LLVMInstallFatalErrorHandler(LLVMFatalErrorHandler Handler);
449 * Reset the fatal error handler. This resets LLVM's fatal error handling
450 * behavior to the default.
452 void LLVMResetFatalErrorHandler(void);
455 * Enable LLVM's built-in stack trace code. This intercepts the OS's crash
456 * signals and prints which component of LLVM you were in at the time if the
459 void LLVMEnablePrettyStackTrace(void);
462 * @defgroup LLVMCCoreContext Contexts
464 * Contexts are execution states for the core LLVM IR system.
466 * Most types are tied to a context instance. Multiple contexts can
467 * exist simultaneously. A single context is not thread safe. However,
468 * different contexts can execute on different threads simultaneously.
473 typedef void (*LLVMDiagnosticHandler)(LLVMDiagnosticInfoRef, void *);
474 typedef void (*LLVMYieldCallback)(LLVMContextRef, void *);
477 * Create a new context.
479 * Every call to this function should be paired with a call to
480 * LLVMContextDispose() or the context will leak memory.
482 LLVMContextRef LLVMContextCreate(void);
485 * Obtain the global context instance.
487 LLVMContextRef LLVMGetGlobalContext(void);
490 * Set the diagnostic handler for this context.
492 void LLVMContextSetDiagnosticHandler(LLVMContextRef C,
493 LLVMDiagnosticHandler Handler,
494 void *DiagnosticContext);
497 * Set the yield callback function for this context.
499 * @see LLVMContext::setYieldCallback()
501 void LLVMContextSetYieldCallback(LLVMContextRef C, LLVMYieldCallback Callback,
505 * Destroy a context instance.
507 * This should be called for every call to LLVMContextCreate() or memory
510 void LLVMContextDispose(LLVMContextRef C);
513 * Return a string representation of the DiagnosticInfo. Use
514 * LLVMDisposeMessage to free the string.
516 * @see DiagnosticInfo::print()
518 char *LLVMGetDiagInfoDescription(LLVMDiagnosticInfoRef DI);
521 * Return an enum LLVMDiagnosticSeverity.
523 * @see DiagnosticInfo::getSeverity()
525 LLVMDiagnosticSeverity LLVMGetDiagInfoSeverity(LLVMDiagnosticInfoRef DI);
527 unsigned LLVMGetMDKindIDInContext(LLVMContextRef C, const char* Name,
529 unsigned LLVMGetMDKindID(const char* Name, unsigned SLen);
536 * @defgroup LLVMCCoreModule Modules
538 * Modules represent the top-level structure in an LLVM program. An LLVM
539 * module is effectively a translation unit or a collection of
540 * translation units merged together.
546 * Create a new, empty module in the global context.
548 * This is equivalent to calling LLVMModuleCreateWithNameInContext with
549 * LLVMGetGlobalContext() as the context parameter.
551 * Every invocation should be paired with LLVMDisposeModule() or memory
554 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
557 * Create a new, empty module in a specific context.
559 * Every invocation should be paired with LLVMDisposeModule() or memory
562 LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
565 * Return an exact copy of the specified module.
567 LLVMModuleRef LLVMCloneModule(LLVMModuleRef M);
570 * Destroy a module instance.
572 * This must be called for every created module or memory will be
575 void LLVMDisposeModule(LLVMModuleRef M);
578 * Obtain the data layout for a module.
580 * @see Module::getDataLayout()
582 const char *LLVMGetDataLayout(LLVMModuleRef M);
585 * Set the data layout for a module.
587 * @see Module::setDataLayout()
589 void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple);
592 * Obtain the target triple for a module.
594 * @see Module::getTargetTriple()
596 const char *LLVMGetTarget(LLVMModuleRef M);
599 * Set the target triple for a module.
601 * @see Module::setTargetTriple()
603 void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
606 * Dump a representation of a module to stderr.
608 * @see Module::dump()
610 void LLVMDumpModule(LLVMModuleRef M);
613 * Print a representation of a module to a file. The ErrorMessage needs to be
614 * disposed with LLVMDisposeMessage. Returns 0 on success, 1 otherwise.
616 * @see Module::print()
618 LLVMBool LLVMPrintModuleToFile(LLVMModuleRef M, const char *Filename,
619 char **ErrorMessage);
622 * Return a string representation of the module. Use
623 * LLVMDisposeMessage to free the string.
625 * @see Module::print()
627 char *LLVMPrintModuleToString(LLVMModuleRef M);
630 * Set inline assembly for a module.
632 * @see Module::setModuleInlineAsm()
634 void LLVMSetModuleInlineAsm(LLVMModuleRef M, const char *Asm);
637 * Obtain the context to which this module is associated.
639 * @see Module::getContext()
641 LLVMContextRef LLVMGetModuleContext(LLVMModuleRef M);
644 * Obtain a Type from a module by its registered name.
646 LLVMTypeRef LLVMGetTypeByName(LLVMModuleRef M, const char *Name);
649 * Obtain the number of operands for named metadata in a module.
651 * @see llvm::Module::getNamedMetadata()
653 unsigned LLVMGetNamedMetadataNumOperands(LLVMModuleRef M, const char* name);
656 * Obtain the named metadata operands for a module.
658 * The passed LLVMValueRef pointer should refer to an array of
659 * LLVMValueRef at least LLVMGetNamedMetadataNumOperands long. This
660 * array will be populated with the LLVMValueRef instances. Each
661 * instance corresponds to a llvm::MDNode.
663 * @see llvm::Module::getNamedMetadata()
664 * @see llvm::MDNode::getOperand()
666 void LLVMGetNamedMetadataOperands(LLVMModuleRef M, const char* name, LLVMValueRef *Dest);
669 * Add an operand to named metadata.
671 * @see llvm::Module::getNamedMetadata()
672 * @see llvm::MDNode::addOperand()
674 void LLVMAddNamedMetadataOperand(LLVMModuleRef M, const char* name,
678 * Add a function to a module under a specified name.
680 * @see llvm::Function::Create()
682 LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
683 LLVMTypeRef FunctionTy);
686 * Obtain a Function value from a Module by its name.
688 * The returned value corresponds to a llvm::Function value.
690 * @see llvm::Module::getFunction()
692 LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
695 * Obtain an iterator to the first Function in a Module.
697 * @see llvm::Module::begin()
699 LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M);
702 * Obtain an iterator to the last Function in a Module.
704 * @see llvm::Module::end()
706 LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M);
709 * Advance a Function iterator to the next Function.
711 * Returns NULL if the iterator was already at the end and there are no more
714 LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn);
717 * Decrement a Function iterator to the previous Function.
719 * Returns NULL if the iterator was already at the beginning and there are
720 * no previous functions.
722 LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn);
729 * @defgroup LLVMCCoreType Types
731 * Types represent the type of a value.
733 * Types are associated with a context instance. The context internally
734 * deduplicates types so there is only 1 instance of a specific type
735 * alive at a time. In other words, a unique type is shared among all
736 * consumers within a context.
738 * A Type in the C API corresponds to llvm::Type.
740 * Types have the following hierarchy:
758 * Obtain the enumerated type of a Type instance.
760 * @see llvm::Type:getTypeID()
762 LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
765 * Whether the type has a known size.
767 * Things that don't have a size are abstract types, labels, and void.a
769 * @see llvm::Type::isSized()
771 LLVMBool LLVMTypeIsSized(LLVMTypeRef Ty);
774 * Obtain the context to which this type instance is associated.
776 * @see llvm::Type::getContext()
778 LLVMContextRef LLVMGetTypeContext(LLVMTypeRef Ty);
781 * Dump a representation of a type to stderr.
783 * @see llvm::Type::dump()
785 void LLVMDumpType(LLVMTypeRef Val);
788 * Return a string representation of the type. Use
789 * LLVMDisposeMessage to free the string.
791 * @see llvm::Type::print()
793 char *LLVMPrintTypeToString(LLVMTypeRef Val);
796 * @defgroup LLVMCCoreTypeInt Integer Types
798 * Functions in this section operate on integer types.
804 * Obtain an integer type from a context with specified bit width.
806 LLVMTypeRef LLVMInt1TypeInContext(LLVMContextRef C);
807 LLVMTypeRef LLVMInt8TypeInContext(LLVMContextRef C);
808 LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
809 LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
810 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
811 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
814 * Obtain an integer type from the global context with a specified bit
817 LLVMTypeRef LLVMInt1Type(void);
818 LLVMTypeRef LLVMInt8Type(void);
819 LLVMTypeRef LLVMInt16Type(void);
820 LLVMTypeRef LLVMInt32Type(void);
821 LLVMTypeRef LLVMInt64Type(void);
822 LLVMTypeRef LLVMIntType(unsigned NumBits);
823 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
830 * @defgroup LLVMCCoreTypeFloat Floating Point Types
836 * Obtain a 16-bit floating point type from a context.
838 LLVMTypeRef LLVMHalfTypeInContext(LLVMContextRef C);
841 * Obtain a 32-bit floating point type from a context.
843 LLVMTypeRef LLVMFloatTypeInContext(LLVMContextRef C);
846 * Obtain a 64-bit floating point type from a context.
848 LLVMTypeRef LLVMDoubleTypeInContext(LLVMContextRef C);
851 * Obtain a 80-bit floating point type (X87) from a context.
853 LLVMTypeRef LLVMX86FP80TypeInContext(LLVMContextRef C);
856 * Obtain a 128-bit floating point type (112-bit mantissa) from a
859 LLVMTypeRef LLVMFP128TypeInContext(LLVMContextRef C);
862 * Obtain a 128-bit floating point type (two 64-bits) from a context.
864 LLVMTypeRef LLVMPPCFP128TypeInContext(LLVMContextRef C);
867 * Obtain a floating point type from the global context.
869 * These map to the functions in this group of the same name.
871 LLVMTypeRef LLVMHalfType(void);
872 LLVMTypeRef LLVMFloatType(void);
873 LLVMTypeRef LLVMDoubleType(void);
874 LLVMTypeRef LLVMX86FP80Type(void);
875 LLVMTypeRef LLVMFP128Type(void);
876 LLVMTypeRef LLVMPPCFP128Type(void);
883 * @defgroup LLVMCCoreTypeFunction Function Types
889 * Obtain a function type consisting of a specified signature.
891 * The function is defined as a tuple of a return Type, a list of
892 * parameter types, and whether the function is variadic.
894 LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
895 LLVMTypeRef *ParamTypes, unsigned ParamCount,
899 * Returns whether a function type is variadic.
901 LLVMBool LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
904 * Obtain the Type this function Type returns.
906 LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
909 * Obtain the number of parameters this function accepts.
911 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
914 * Obtain the types of a function's parameters.
916 * The Dest parameter should point to a pre-allocated array of
917 * LLVMTypeRef at least LLVMCountParamTypes() large. On return, the
918 * first LLVMCountParamTypes() entries in the array will be populated
919 * with LLVMTypeRef instances.
921 * @param FunctionTy The function type to operate on.
922 * @param Dest Memory address of an array to be filled with result.
924 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
931 * @defgroup LLVMCCoreTypeStruct Structure Types
933 * These functions relate to LLVMTypeRef instances.
935 * @see llvm::StructType
941 * Create a new structure type in a context.
943 * A structure is specified by a list of inner elements/types and
944 * whether these can be packed together.
946 * @see llvm::StructType::create()
948 LLVMTypeRef LLVMStructTypeInContext(LLVMContextRef C, LLVMTypeRef *ElementTypes,
949 unsigned ElementCount, LLVMBool Packed);
952 * Create a new structure type in the global context.
954 * @see llvm::StructType::create()
956 LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
960 * Create an empty structure in a context having a specified name.
962 * @see llvm::StructType::create()
964 LLVMTypeRef LLVMStructCreateNamed(LLVMContextRef C, const char *Name);
967 * Obtain the name of a structure.
969 * @see llvm::StructType::getName()
971 const char *LLVMGetStructName(LLVMTypeRef Ty);
974 * Set the contents of a structure type.
976 * @see llvm::StructType::setBody()
978 void LLVMStructSetBody(LLVMTypeRef StructTy, LLVMTypeRef *ElementTypes,
979 unsigned ElementCount, LLVMBool Packed);
982 * Get the number of elements defined inside the structure.
984 * @see llvm::StructType::getNumElements()
986 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
989 * Get the elements within a structure.
991 * The function is passed the address of a pre-allocated array of
992 * LLVMTypeRef at least LLVMCountStructElementTypes() long. After
993 * invocation, this array will be populated with the structure's
994 * elements. The objects in the destination array will have a lifetime
995 * of the structure type itself, which is the lifetime of the context it
998 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
1001 * Get the type of the element at a given index in the structure.
1003 * @see llvm::StructType::getTypeAtIndex()
1005 LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i);
1008 * Determine whether a structure is packed.
1010 * @see llvm::StructType::isPacked()
1012 LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy);
1015 * Determine whether a structure is opaque.
1017 * @see llvm::StructType::isOpaque()
1019 LLVMBool LLVMIsOpaqueStruct(LLVMTypeRef StructTy);
1027 * @defgroup LLVMCCoreTypeSequential Sequential Types
1029 * Sequential types represents "arrays" of types. This is a super class
1030 * for array, vector, and pointer types.
1036 * Obtain the type of elements within a sequential type.
1038 * This works on array, vector, and pointer types.
1040 * @see llvm::SequentialType::getElementType()
1042 LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty);
1045 * Create a fixed size array type that refers to a specific type.
1047 * The created type will exist in the context that its element type
1050 * @see llvm::ArrayType::get()
1052 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
1055 * Obtain the length of an array type.
1057 * This only works on types that represent arrays.
1059 * @see llvm::ArrayType::getNumElements()
1061 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
1064 * Create a pointer type that points to a defined type.
1066 * The created type will exist in the context that its pointee type
1069 * @see llvm::PointerType::get()
1071 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
1074 * Obtain the address space of a pointer type.
1076 * This only works on types that represent pointers.
1078 * @see llvm::PointerType::getAddressSpace()
1080 unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
1083 * Create a vector type that contains a defined type and has a specific
1084 * number of elements.
1086 * The created type will exist in the context thats its element type
1089 * @see llvm::VectorType::get()
1091 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
1094 * Obtain the number of elements in a vector type.
1096 * This only works on types that represent vectors.
1098 * @see llvm::VectorType::getNumElements()
1100 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
1107 * @defgroup LLVMCCoreTypeOther Other Types
1113 * Create a void type in a context.
1115 LLVMTypeRef LLVMVoidTypeInContext(LLVMContextRef C);
1118 * Create a label type in a context.
1120 LLVMTypeRef LLVMLabelTypeInContext(LLVMContextRef C);
1123 * Create a X86 MMX type in a context.
1125 LLVMTypeRef LLVMX86MMXTypeInContext(LLVMContextRef C);
1128 * These are similar to the above functions except they operate on the
1131 LLVMTypeRef LLVMVoidType(void);
1132 LLVMTypeRef LLVMLabelType(void);
1133 LLVMTypeRef LLVMX86MMXType(void);
1144 * @defgroup LLVMCCoreValues Values
1146 * The bulk of LLVM's object model consists of values, which comprise a very
1147 * rich type hierarchy.
1149 * LLVMValueRef essentially represents llvm::Value. There is a rich
1150 * hierarchy of classes within this type. Depending on the instance
1151 * obtained, not all APIs are available.
1153 * Callers can determine the type of an LLVMValueRef by calling the
1154 * LLVMIsA* family of functions (e.g. LLVMIsAArgument()). These
1155 * functions are defined by a macro, so it isn't obvious which are
1156 * available by looking at the Doxygen source code. Instead, look at the
1157 * source definition of LLVM_FOR_EACH_VALUE_SUBCLASS and note the list
1158 * of value names given. These value names also correspond to classes in
1159 * the llvm::Value hierarchy.
1164 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
1170 macro(BlockAddress) \
1171 macro(ConstantAggregateZero) \
1172 macro(ConstantArray) \
1173 macro(ConstantDataSequential) \
1174 macro(ConstantDataArray) \
1175 macro(ConstantDataVector) \
1176 macro(ConstantExpr) \
1178 macro(ConstantInt) \
1179 macro(ConstantPointerNull) \
1180 macro(ConstantStruct) \
1181 macro(ConstantVector) \
1182 macro(GlobalValue) \
1183 macro(GlobalAlias) \
1184 macro(GlobalObject) \
1186 macro(GlobalVariable) \
1188 macro(Instruction) \
1189 macro(BinaryOperator) \
1191 macro(IntrinsicInst) \
1192 macro(DbgInfoIntrinsic) \
1193 macro(DbgDeclareInst) \
1194 macro(MemIntrinsic) \
1196 macro(MemMoveInst) \
1201 macro(ExtractElementInst) \
1202 macro(GetElementPtrInst) \
1203 macro(InsertElementInst) \
1204 macro(InsertValueInst) \
1205 macro(LandingPadInst) \
1208 macro(ShuffleVectorInst) \
1210 macro(TerminatorInst) \
1212 macro(IndirectBrInst) \
1216 macro(UnreachableInst) \
1218 macro(UnaryInstruction) \
1221 macro(AddrSpaceCastInst) \
1222 macro(BitCastInst) \
1226 macro(FPTruncInst) \
1227 macro(IntToPtrInst) \
1228 macro(PtrToIntInst) \
1234 macro(ExtractValueInst) \
1239 * @defgroup LLVMCCoreValueGeneral General APIs
1241 * Functions in this section work on all LLVMValueRef instances,
1242 * regardless of their sub-type. They correspond to functions available
1249 * Obtain the type of a value.
1251 * @see llvm::Value::getType()
1253 LLVMTypeRef LLVMTypeOf(LLVMValueRef Val);
1256 * Obtain the string name of a value.
1258 * @see llvm::Value::getName()
1260 const char *LLVMGetValueName(LLVMValueRef Val);
1263 * Set the string name of a value.
1265 * @see llvm::Value::setName()
1267 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
1270 * Dump a representation of a value to stderr.
1272 * @see llvm::Value::dump()
1274 void LLVMDumpValue(LLVMValueRef Val);
1277 * Return a string representation of the value. Use
1278 * LLVMDisposeMessage to free the string.
1280 * @see llvm::Value::print()
1282 char *LLVMPrintValueToString(LLVMValueRef Val);
1285 * Replace all uses of a value with another one.
1287 * @see llvm::Value::replaceAllUsesWith()
1289 void LLVMReplaceAllUsesWith(LLVMValueRef OldVal, LLVMValueRef NewVal);
1292 * Determine whether the specified constant instance is constant.
1294 LLVMBool LLVMIsConstant(LLVMValueRef Val);
1297 * Determine whether a value instance is undefined.
1299 LLVMBool LLVMIsUndef(LLVMValueRef Val);
1302 * Convert value instances between types.
1304 * Internally, an LLVMValueRef is "pinned" to a specific type. This
1305 * series of functions allows you to cast an instance to a specific
1308 * If the cast is not valid for the specified type, NULL is returned.
1310 * @see llvm::dyn_cast_or_null<>
1312 #define LLVM_DECLARE_VALUE_CAST(name) \
1313 LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
1314 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
1316 LLVMValueRef LLVMIsAMDNode(LLVMValueRef Val);
1317 LLVMValueRef LLVMIsAMDString(LLVMValueRef Val);
1324 * @defgroup LLVMCCoreValueUses Usage
1326 * This module defines functions that allow you to inspect the uses of a
1329 * It is possible to obtain an LLVMUseRef for any LLVMValueRef instance.
1330 * Each LLVMUseRef (which corresponds to a llvm::Use instance) holds a
1331 * llvm::User and llvm::Value.
1337 * Obtain the first use of a value.
1339 * Uses are obtained in an iterator fashion. First, call this function
1340 * to obtain a reference to the first use. Then, call LLVMGetNextUse()
1341 * on that instance and all subsequently obtained instances until
1342 * LLVMGetNextUse() returns NULL.
1344 * @see llvm::Value::use_begin()
1346 LLVMUseRef LLVMGetFirstUse(LLVMValueRef Val);
1349 * Obtain the next use of a value.
1351 * This effectively advances the iterator. It returns NULL if you are on
1352 * the final use and no more are available.
1354 LLVMUseRef LLVMGetNextUse(LLVMUseRef U);
1357 * Obtain the user value for a user.
1359 * The returned value corresponds to a llvm::User type.
1361 * @see llvm::Use::getUser()
1363 LLVMValueRef LLVMGetUser(LLVMUseRef U);
1366 * Obtain the value this use corresponds to.
1368 * @see llvm::Use::get().
1370 LLVMValueRef LLVMGetUsedValue(LLVMUseRef U);
1377 * @defgroup LLVMCCoreValueUser User value
1379 * Function in this group pertain to LLVMValueRef instances that descent
1380 * from llvm::User. This includes constants, instructions, and
1387 * Obtain an operand at a specific index in a llvm::User value.
1389 * @see llvm::User::getOperand()
1391 LLVMValueRef LLVMGetOperand(LLVMValueRef Val, unsigned Index);
1394 * Obtain the use of an operand at a specific index in a llvm::User value.
1396 * @see llvm::User::getOperandUse()
1398 LLVMUseRef LLVMGetOperandUse(LLVMValueRef Val, unsigned Index);
1401 * Set an operand at a specific index in a llvm::User value.
1403 * @see llvm::User::setOperand()
1405 void LLVMSetOperand(LLVMValueRef User, unsigned Index, LLVMValueRef Val);
1408 * Obtain the number of operands in a llvm::User value.
1410 * @see llvm::User::getNumOperands()
1412 int LLVMGetNumOperands(LLVMValueRef Val);
1419 * @defgroup LLVMCCoreValueConstant Constants
1421 * This section contains APIs for interacting with LLVMValueRef that
1422 * correspond to llvm::Constant instances.
1424 * These functions will work for any LLVMValueRef in the llvm::Constant
1431 * Obtain a constant value referring to the null instance of a type.
1433 * @see llvm::Constant::getNullValue()
1435 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
1438 * Obtain a constant value referring to the instance of a type
1439 * consisting of all ones.
1441 * This is only valid for integer types.
1443 * @see llvm::Constant::getAllOnesValue()
1445 LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty);
1448 * Obtain a constant value referring to an undefined value of a type.
1450 * @see llvm::UndefValue::get()
1452 LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
1455 * Determine whether a value instance is null.
1457 * @see llvm::Constant::isNullValue()
1459 LLVMBool LLVMIsNull(LLVMValueRef Val);
1462 * Obtain a constant that is a constant pointer pointing to NULL for a
1465 LLVMValueRef LLVMConstPointerNull(LLVMTypeRef Ty);
1468 * @defgroup LLVMCCoreValueConstantScalar Scalar constants
1470 * Functions in this group model LLVMValueRef instances that correspond
1471 * to constants referring to scalar types.
1473 * For integer types, the LLVMTypeRef parameter should correspond to a
1474 * llvm::IntegerType instance and the returned LLVMValueRef will
1475 * correspond to a llvm::ConstantInt.
1477 * For floating point types, the LLVMTypeRef returned corresponds to a
1484 * Obtain a constant value for an integer type.
1486 * The returned value corresponds to a llvm::ConstantInt.
1488 * @see llvm::ConstantInt::get()
1490 * @param IntTy Integer type to obtain value of.
1491 * @param N The value the returned instance should refer to.
1492 * @param SignExtend Whether to sign extend the produced value.
1494 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
1495 LLVMBool SignExtend);
1498 * Obtain a constant value for an integer of arbitrary precision.
1500 * @see llvm::ConstantInt::get()
1502 LLVMValueRef LLVMConstIntOfArbitraryPrecision(LLVMTypeRef IntTy,
1504 const uint64_t Words[]);
1507 * Obtain a constant value for an integer parsed from a string.
1509 * A similar API, LLVMConstIntOfStringAndSize is also available. If the
1510 * string's length is available, it is preferred to call that function
1513 * @see llvm::ConstantInt::get()
1515 LLVMValueRef LLVMConstIntOfString(LLVMTypeRef IntTy, const char *Text,
1519 * Obtain a constant value for an integer parsed from a string with
1522 * @see llvm::ConstantInt::get()
1524 LLVMValueRef LLVMConstIntOfStringAndSize(LLVMTypeRef IntTy, const char *Text,
1525 unsigned SLen, uint8_t Radix);
1528 * Obtain a constant value referring to a double floating point value.
1530 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
1533 * Obtain a constant for a floating point value parsed from a string.
1535 * A similar API, LLVMConstRealOfStringAndSize is also available. It
1536 * should be used if the input string's length is known.
1538 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
1541 * Obtain a constant for a floating point value parsed from a string.
1543 LLVMValueRef LLVMConstRealOfStringAndSize(LLVMTypeRef RealTy, const char *Text,
1547 * Obtain the zero extended value for an integer constant value.
1549 * @see llvm::ConstantInt::getZExtValue()
1551 unsigned long long LLVMConstIntGetZExtValue(LLVMValueRef ConstantVal);
1554 * Obtain the sign extended value for an integer constant value.
1556 * @see llvm::ConstantInt::getSExtValue()
1558 long long LLVMConstIntGetSExtValue(LLVMValueRef ConstantVal);
1561 * Obtain the double value for an floating point constant value.
1562 * losesInfo indicates if some precision was lost in the conversion.
1564 * @see llvm::ConstantFP::getDoubleValue
1566 double LLVMConstRealGetDouble(LLVMValueRef ConstantVal, LLVMBool *losesInfo);
1573 * @defgroup LLVMCCoreValueConstantComposite Composite Constants
1575 * Functions in this group operate on composite constants.
1581 * Create a ConstantDataSequential and initialize it with a string.
1583 * @see llvm::ConstantDataArray::getString()
1585 LLVMValueRef LLVMConstStringInContext(LLVMContextRef C, const char *Str,
1586 unsigned Length, LLVMBool DontNullTerminate);
1589 * Create a ConstantDataSequential with string content in the global context.
1591 * This is the same as LLVMConstStringInContext except it operates on the
1594 * @see LLVMConstStringInContext()
1595 * @see llvm::ConstantDataArray::getString()
1597 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
1598 LLVMBool DontNullTerminate);
1601 * Returns true if the specified constant is an array of i8.
1603 * @see ConstantDataSequential::getAsString()
1605 LLVMBool LLVMIsConstantString(LLVMValueRef c);
1608 * Get the given constant data sequential as a string.
1610 * @see ConstantDataSequential::getAsString()
1612 const char *LLVMGetAsString(LLVMValueRef c, size_t* out);
1615 * Create an anonymous ConstantStruct with the specified values.
1617 * @see llvm::ConstantStruct::getAnon()
1619 LLVMValueRef LLVMConstStructInContext(LLVMContextRef C,
1620 LLVMValueRef *ConstantVals,
1621 unsigned Count, LLVMBool Packed);
1624 * Create a ConstantStruct in the global Context.
1626 * This is the same as LLVMConstStructInContext except it operates on the
1629 * @see LLVMConstStructInContext()
1631 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
1635 * Create a ConstantArray from values.
1637 * @see llvm::ConstantArray::get()
1639 LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
1640 LLVMValueRef *ConstantVals, unsigned Length);
1643 * Create a non-anonymous ConstantStruct from values.
1645 * @see llvm::ConstantStruct::get()
1647 LLVMValueRef LLVMConstNamedStruct(LLVMTypeRef StructTy,
1648 LLVMValueRef *ConstantVals,
1652 * Get an element at specified index as a constant.
1654 * @see ConstantDataSequential::getElementAsConstant()
1656 LLVMValueRef LLVMGetElementAsConstant(LLVMValueRef c, unsigned idx);
1659 * Create a ConstantVector from values.
1661 * @see llvm::ConstantVector::get()
1663 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
1670 * @defgroup LLVMCCoreValueConstantExpressions Constant Expressions
1672 * Functions in this group correspond to APIs on llvm::ConstantExpr.
1674 * @see llvm::ConstantExpr.
1678 LLVMOpcode LLVMGetConstOpcode(LLVMValueRef ConstantVal);
1679 LLVMValueRef LLVMAlignOf(LLVMTypeRef Ty);
1680 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
1681 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
1682 LLVMValueRef LLVMConstNSWNeg(LLVMValueRef ConstantVal);
1683 LLVMValueRef LLVMConstNUWNeg(LLVMValueRef ConstantVal);
1684 LLVMValueRef LLVMConstFNeg(LLVMValueRef ConstantVal);
1685 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
1686 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1687 LLVMValueRef LLVMConstNSWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1688 LLVMValueRef LLVMConstNUWAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1689 LLVMValueRef LLVMConstFAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1690 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1691 LLVMValueRef LLVMConstNSWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1692 LLVMValueRef LLVMConstNUWSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1693 LLVMValueRef LLVMConstFSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1694 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1695 LLVMValueRef LLVMConstNSWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1696 LLVMValueRef LLVMConstNUWMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1697 LLVMValueRef LLVMConstFMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1698 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1699 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1700 LLVMValueRef LLVMConstExactSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1701 LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1702 LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1703 LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1704 LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1705 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1706 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1707 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1708 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
1709 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1710 LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,
1711 LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1712 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1713 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1714 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
1715 LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal,
1716 LLVMValueRef *ConstantIndices, unsigned NumIndices);
1717 LLVMValueRef LLVMConstInBoundsGEP(LLVMValueRef ConstantVal,
1718 LLVMValueRef *ConstantIndices,
1719 unsigned NumIndices);
1720 LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1721 LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1722 LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1723 LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1724 LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1725 LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1726 LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1727 LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1728 LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1729 LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1730 LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1731 LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1732 LLVMValueRef LLVMConstAddrSpaceCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1733 LLVMValueRef LLVMConstZExtOrBitCast(LLVMValueRef ConstantVal,
1734 LLVMTypeRef ToType);
1735 LLVMValueRef LLVMConstSExtOrBitCast(LLVMValueRef ConstantVal,
1736 LLVMTypeRef ToType);
1737 LLVMValueRef LLVMConstTruncOrBitCast(LLVMValueRef ConstantVal,
1738 LLVMTypeRef ToType);
1739 LLVMValueRef LLVMConstPointerCast(LLVMValueRef ConstantVal,
1740 LLVMTypeRef ToType);
1741 LLVMValueRef LLVMConstIntCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType,
1743 LLVMValueRef LLVMConstFPCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
1744 LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
1745 LLVMValueRef ConstantIfTrue,
1746 LLVMValueRef ConstantIfFalse);
1747 LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant,
1748 LLVMValueRef IndexConstant);
1749 LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
1750 LLVMValueRef ElementValueConstant,
1751 LLVMValueRef IndexConstant);
1752 LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
1753 LLVMValueRef VectorBConstant,
1754 LLVMValueRef MaskConstant);
1755 LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
1757 LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
1758 LLVMValueRef ElementValueConstant,
1759 unsigned *IdxList, unsigned NumIdx);
1760 LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty,
1761 const char *AsmString, const char *Constraints,
1762 LLVMBool HasSideEffects, LLVMBool IsAlignStack);
1763 LLVMValueRef LLVMBlockAddress(LLVMValueRef F, LLVMBasicBlockRef BB);
1770 * @defgroup LLVMCCoreValueConstantGlobals Global Values
1772 * This group contains functions that operate on global values. Functions in
1773 * this group relate to functions in the llvm::GlobalValue class tree.
1775 * @see llvm::GlobalValue
1780 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
1781 LLVMBool LLVMIsDeclaration(LLVMValueRef Global);
1782 LLVMLinkage LLVMGetLinkage(LLVMValueRef Global);
1783 void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
1784 const char *LLVMGetSection(LLVMValueRef Global);
1785 void LLVMSetSection(LLVMValueRef Global, const char *Section);
1786 LLVMVisibility LLVMGetVisibility(LLVMValueRef Global);
1787 void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
1788 LLVMDLLStorageClass LLVMGetDLLStorageClass(LLVMValueRef Global);
1789 void LLVMSetDLLStorageClass(LLVMValueRef Global, LLVMDLLStorageClass Class);
1790 LLVMBool LLVMHasUnnamedAddr(LLVMValueRef Global);
1791 void LLVMSetUnnamedAddr(LLVMValueRef Global, LLVMBool HasUnnamedAddr);
1794 * @defgroup LLVMCCoreValueWithAlignment Values with alignment
1796 * Functions in this group only apply to values with alignment, i.e.
1797 * global variables, load and store instructions.
1801 * Obtain the preferred alignment of the value.
1802 * @see llvm::AllocaInst::getAlignment()
1803 * @see llvm::LoadInst::getAlignment()
1804 * @see llvm::StoreInst::getAlignment()
1805 * @see llvm::GlobalValue::getAlignment()
1807 unsigned LLVMGetAlignment(LLVMValueRef V);
1810 * Set the preferred alignment of the value.
1811 * @see llvm::AllocaInst::setAlignment()
1812 * @see llvm::LoadInst::setAlignment()
1813 * @see llvm::StoreInst::setAlignment()
1814 * @see llvm::GlobalValue::setAlignment()
1816 void LLVMSetAlignment(LLVMValueRef V, unsigned Bytes);
1823 * @defgroup LLVMCoreValueConstantGlobalVariable Global Variables
1825 * This group contains functions that operate on global variable values.
1827 * @see llvm::GlobalVariable
1831 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name);
1832 LLVMValueRef LLVMAddGlobalInAddressSpace(LLVMModuleRef M, LLVMTypeRef Ty,
1834 unsigned AddressSpace);
1835 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
1836 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
1837 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
1838 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
1839 LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
1840 void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
1841 LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
1842 void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
1843 LLVMBool LLVMIsThreadLocal(LLVMValueRef GlobalVar);
1844 void LLVMSetThreadLocal(LLVMValueRef GlobalVar, LLVMBool IsThreadLocal);
1845 LLVMBool LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
1846 void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, LLVMBool IsConstant);
1847 LLVMThreadLocalMode LLVMGetThreadLocalMode(LLVMValueRef GlobalVar);
1848 void LLVMSetThreadLocalMode(LLVMValueRef GlobalVar, LLVMThreadLocalMode Mode);
1849 LLVMBool LLVMIsExternallyInitialized(LLVMValueRef GlobalVar);
1850 void LLVMSetExternallyInitialized(LLVMValueRef GlobalVar, LLVMBool IsExtInit);
1857 * @defgroup LLVMCoreValueConstantGlobalAlias Global Aliases
1859 * This group contains function that operate on global alias values.
1861 * @see llvm::GlobalAlias
1865 LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
1873 * @defgroup LLVMCCoreValueFunction Function values
1875 * Functions in this group operate on LLVMValueRef instances that
1876 * correspond to llvm::Function instances.
1878 * @see llvm::Function
1884 * Remove a function from its containing module and deletes it.
1886 * @see llvm::Function::eraseFromParent()
1888 void LLVMDeleteFunction(LLVMValueRef Fn);
1891 * Obtain the personality function attached to the function.
1893 * @see llvm::Function::getPersonalityFn()
1895 LLVMValueRef LLVMGetPersonalityFn(LLVMValueRef Fn);
1898 * Set the personality function attached to the function.
1900 * @see llvm::Function::setPersonalityFn()
1902 void LLVMSetPersonalityFn(LLVMValueRef Fn, LLVMValueRef PersonalityFn);
1905 * Obtain the ID number from a function instance.
1907 * @see llvm::Function::getIntrinsicID()
1909 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
1912 * Obtain the calling function of a function.
1914 * The returned value corresponds to the LLVMCallConv enumeration.
1916 * @see llvm::Function::getCallingConv()
1918 unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
1921 * Set the calling convention of a function.
1923 * @see llvm::Function::setCallingConv()
1925 * @param Fn Function to operate on
1926 * @param CC LLVMCallConv to set calling convention to
1928 void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
1931 * Obtain the name of the garbage collector to use during code
1934 * @see llvm::Function::getGC()
1936 const char *LLVMGetGC(LLVMValueRef Fn);
1939 * Define the garbage collector to use during code generation.
1941 * @see llvm::Function::setGC()
1943 void LLVMSetGC(LLVMValueRef Fn, const char *Name);
1946 * Add an attribute to a function.
1948 * @see llvm::Function::addAttribute()
1950 void LLVMAddFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
1953 * Add a target-dependent attribute to a fuction
1954 * @see llvm::AttrBuilder::addAttribute()
1956 void LLVMAddTargetDependentFunctionAttr(LLVMValueRef Fn, const char *A,
1960 * Obtain an attribute from a function.
1962 * @see llvm::Function::getAttributes()
1964 LLVMAttribute LLVMGetFunctionAttr(LLVMValueRef Fn);
1967 * Remove an attribute from a function.
1969 void LLVMRemoveFunctionAttr(LLVMValueRef Fn, LLVMAttribute PA);
1972 * @defgroup LLVMCCoreValueFunctionParameters Function Parameters
1974 * Functions in this group relate to arguments/parameters on functions.
1976 * Functions in this group expect LLVMValueRef instances that correspond
1977 * to llvm::Function instances.
1983 * Obtain the number of parameters in a function.
1985 * @see llvm::Function::arg_size()
1987 unsigned LLVMCountParams(LLVMValueRef Fn);
1990 * Obtain the parameters in a function.
1992 * The takes a pointer to a pre-allocated array of LLVMValueRef that is
1993 * at least LLVMCountParams() long. This array will be filled with
1994 * LLVMValueRef instances which correspond to the parameters the
1995 * function receives. Each LLVMValueRef corresponds to a llvm::Argument
1998 * @see llvm::Function::arg_begin()
2000 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
2003 * Obtain the parameter at the specified index.
2005 * Parameters are indexed from 0.
2007 * @see llvm::Function::arg_begin()
2009 LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
2012 * Obtain the function to which this argument belongs.
2014 * Unlike other functions in this group, this one takes an LLVMValueRef
2015 * that corresponds to a llvm::Attribute.
2017 * The returned LLVMValueRef is the llvm::Function to which this
2020 LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst);
2023 * Obtain the first parameter to a function.
2025 * @see llvm::Function::arg_begin()
2027 LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn);
2030 * Obtain the last parameter to a function.
2032 * @see llvm::Function::arg_end()
2034 LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
2037 * Obtain the next parameter to a function.
2039 * This takes an LLVMValueRef obtained from LLVMGetFirstParam() (which is
2040 * actually a wrapped iterator) and obtains the next parameter from the
2041 * underlying iterator.
2043 LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
2046 * Obtain the previous parameter to a function.
2048 * This is the opposite of LLVMGetNextParam().
2050 LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
2053 * Add an attribute to a function argument.
2055 * @see llvm::Argument::addAttr()
2057 void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA);
2060 * Remove an attribute from a function argument.
2062 * @see llvm::Argument::removeAttr()
2064 void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA);
2067 * Get an attribute from a function argument.
2069 LLVMAttribute LLVMGetAttribute(LLVMValueRef Arg);
2072 * Set the alignment for a function parameter.
2074 * @see llvm::Argument::addAttr()
2075 * @see llvm::AttrBuilder::addAlignmentAttr()
2077 void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
2096 * @defgroup LLVMCCoreValueMetadata Metadata
2102 * Obtain a MDString value from a context.
2104 * The returned instance corresponds to the llvm::MDString class.
2106 * The instance is specified by string data of a specified length. The
2107 * string content is copied, so the backing memory can be freed after
2108 * this function returns.
2110 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
2114 * Obtain a MDString value from the global context.
2116 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2119 * Obtain a MDNode value from a context.
2121 * The returned value corresponds to the llvm::MDNode class.
2123 LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
2127 * Obtain a MDNode value from the global context.
2129 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
2132 * Obtain the underlying string from a MDString value.
2134 * @param V Instance to obtain string from.
2135 * @param Len Memory address which will hold length of returned string.
2136 * @return String data in MDString.
2138 const char *LLVMGetMDString(LLVMValueRef V, unsigned* Len);
2141 * Obtain the number of operands from an MDNode value.
2143 * @param V MDNode to get number of operands from.
2144 * @return Number of operands of the MDNode.
2146 unsigned LLVMGetMDNodeNumOperands(LLVMValueRef V);
2149 * Obtain the given MDNode's operands.
2151 * The passed LLVMValueRef pointer should point to enough memory to hold all of
2152 * the operands of the given MDNode (see LLVMGetMDNodeNumOperands) as
2153 * LLVMValueRefs. This memory will be populated with the LLVMValueRefs of the
2154 * MDNode's operands.
2156 * @param V MDNode to get the operands from.
2157 * @param Dest Destination array for operands.
2159 void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
2166 * @defgroup LLVMCCoreValueBasicBlock Basic Block
2168 * A basic block represents a single entry single exit section of code.
2169 * Basic blocks contain a list of instructions which form the body of
2172 * Basic blocks belong to functions. They have the type of label.
2174 * Basic blocks are themselves values. However, the C API models them as
2175 * LLVMBasicBlockRef.
2177 * @see llvm::BasicBlock
2183 * Convert a basic block instance to a value type.
2185 LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
2188 * Determine whether an LLVMValueRef is itself a basic block.
2190 LLVMBool LLVMValueIsBasicBlock(LLVMValueRef Val);
2193 * Convert an LLVMValueRef to an LLVMBasicBlockRef instance.
2195 LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
2198 * Obtain the function to which a basic block belongs.
2200 * @see llvm::BasicBlock::getParent()
2202 LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
2205 * Obtain the terminator instruction for a basic block.
2207 * If the basic block does not have a terminator (it is not well-formed
2208 * if it doesn't), then NULL is returned.
2210 * The returned LLVMValueRef corresponds to a llvm::TerminatorInst.
2212 * @see llvm::BasicBlock::getTerminator()
2214 LLVMValueRef LLVMGetBasicBlockTerminator(LLVMBasicBlockRef BB);
2217 * Obtain the number of basic blocks in a function.
2219 * @param Fn Function value to operate on.
2221 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
2224 * Obtain all of the basic blocks in a function.
2226 * This operates on a function value. The BasicBlocks parameter is a
2227 * pointer to a pre-allocated array of LLVMBasicBlockRef of at least
2228 * LLVMCountBasicBlocks() in length. This array is populated with
2229 * LLVMBasicBlockRef instances.
2231 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
2234 * Obtain the first basic block in a function.
2236 * The returned basic block can be used as an iterator. You will likely
2237 * eventually call into LLVMGetNextBasicBlock() with it.
2239 * @see llvm::Function::begin()
2241 LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn);
2244 * Obtain the last basic block in a function.
2246 * @see llvm::Function::end()
2248 LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn);
2251 * Advance a basic block iterator.
2253 LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB);
2256 * Go backwards in a basic block iterator.
2258 LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
2261 * Obtain the basic block that corresponds to the entry point of a
2264 * @see llvm::Function::getEntryBlock()
2266 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
2269 * Append a basic block to the end of a function.
2271 * @see llvm::BasicBlock::Create()
2273 LLVMBasicBlockRef LLVMAppendBasicBlockInContext(LLVMContextRef C,
2278 * Append a basic block to the end of a function using the global
2281 * @see llvm::BasicBlock::Create()
2283 LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);
2286 * Insert a basic block in a function before another basic block.
2288 * The function to add to is determined by the function of the
2289 * passed basic block.
2291 * @see llvm::BasicBlock::Create()
2293 LLVMBasicBlockRef LLVMInsertBasicBlockInContext(LLVMContextRef C,
2294 LLVMBasicBlockRef BB,
2298 * Insert a basic block in a function using the global context.
2300 * @see llvm::BasicBlock::Create()
2302 LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB,
2306 * Remove a basic block from a function and delete it.
2308 * This deletes the basic block from its containing function and deletes
2309 * the basic block itself.
2311 * @see llvm::BasicBlock::eraseFromParent()
2313 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
2316 * Remove a basic block from a function.
2318 * This deletes the basic block from its containing function but keep
2319 * the basic block alive.
2321 * @see llvm::BasicBlock::removeFromParent()
2323 void LLVMRemoveBasicBlockFromParent(LLVMBasicBlockRef BB);
2326 * Move a basic block to before another one.
2328 * @see llvm::BasicBlock::moveBefore()
2330 void LLVMMoveBasicBlockBefore(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
2333 * Move a basic block to after another one.
2335 * @see llvm::BasicBlock::moveAfter()
2337 void LLVMMoveBasicBlockAfter(LLVMBasicBlockRef BB, LLVMBasicBlockRef MovePos);
2340 * Obtain the first instruction in a basic block.
2342 * The returned LLVMValueRef corresponds to a llvm::Instruction
2345 LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB);
2348 * Obtain the last instruction in a basic block.
2350 * The returned LLVMValueRef corresponds to an LLVM:Instruction.
2352 LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB);
2359 * @defgroup LLVMCCoreValueInstruction Instructions
2361 * Functions in this group relate to the inspection and manipulation of
2362 * individual instructions.
2364 * In the C++ API, an instruction is modeled by llvm::Instruction. This
2365 * class has a large number of descendents. llvm::Instruction is a
2366 * llvm::Value and in the C API, instructions are modeled by
2369 * This group also contains sub-groups which operate on specific
2370 * llvm::Instruction types, e.g. llvm::CallInst.
2376 * Determine whether an instruction has any metadata attached.
2378 int LLVMHasMetadata(LLVMValueRef Val);
2381 * Return metadata associated with an instruction value.
2383 LLVMValueRef LLVMGetMetadata(LLVMValueRef Val, unsigned KindID);
2386 * Set metadata associated with an instruction value.
2388 void LLVMSetMetadata(LLVMValueRef Val, unsigned KindID, LLVMValueRef Node);
2391 * Obtain the basic block to which an instruction belongs.
2393 * @see llvm::Instruction::getParent()
2395 LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
2398 * Obtain the instruction that occurs after the one specified.
2400 * The next instruction will be from the same basic block.
2402 * If this is the last instruction in a basic block, NULL will be
2405 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
2408 * Obtain the instruction that occurred before this one.
2410 * If the instruction is the first instruction in a basic block, NULL
2413 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
2416 * Remove and delete an instruction.
2418 * The instruction specified is removed from its containing building
2419 * block and then deleted.
2421 * @see llvm::Instruction::eraseFromParent()
2423 void LLVMInstructionEraseFromParent(LLVMValueRef Inst);
2426 * Obtain the code opcode for an individual instruction.
2428 * @see llvm::Instruction::getOpCode()
2430 LLVMOpcode LLVMGetInstructionOpcode(LLVMValueRef Inst);
2433 * Obtain the predicate of an instruction.
2435 * This is only valid for instructions that correspond to llvm::ICmpInst
2436 * or llvm::ConstantExpr whose opcode is llvm::Instruction::ICmp.
2438 * @see llvm::ICmpInst::getPredicate()
2440 LLVMIntPredicate LLVMGetICmpPredicate(LLVMValueRef Inst);
2443 * Obtain the float predicate of an instruction.
2445 * This is only valid for instructions that correspond to llvm::FCmpInst
2446 * or llvm::ConstantExpr whose opcode is llvm::Instruction::FCmp.
2448 * @see llvm::FCmpInst::getPredicate()
2450 LLVMRealPredicate LLVMGetFCmpPredicate(LLVMValueRef Inst);
2453 * Create a copy of 'this' instruction that is identical in all ways
2454 * except the following:
2455 * * The instruction has no parent
2456 * * The instruction has no name
2458 * @see llvm::Instruction::clone()
2460 LLVMValueRef LLVMInstructionClone(LLVMValueRef Inst);
2463 * @defgroup LLVMCCoreValueInstructionCall Call Sites and Invocations
2465 * Functions in this group apply to instructions that refer to call
2466 * sites and invocations. These correspond to C++ types in the
2467 * llvm::CallInst class tree.
2473 * Set the calling convention for a call instruction.
2475 * This expects an LLVMValueRef that corresponds to a llvm::CallInst or
2478 * @see llvm::CallInst::setCallingConv()
2479 * @see llvm::InvokeInst::setCallingConv()
2481 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
2484 * Obtain the calling convention for a call instruction.
2486 * This is the opposite of LLVMSetInstructionCallConv(). Reads its
2489 * @see LLVMSetInstructionCallConv()
2491 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
2494 void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute);
2495 void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index,
2497 void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index,
2501 * Obtain whether a call instruction is a tail call.
2503 * This only works on llvm::CallInst instructions.
2505 * @see llvm::CallInst::isTailCall()
2507 LLVMBool LLVMIsTailCall(LLVMValueRef CallInst);
2510 * Set whether a call instruction is a tail call.
2512 * This only works on llvm::CallInst instructions.
2514 * @see llvm::CallInst::setTailCall()
2516 void LLVMSetTailCall(LLVMValueRef CallInst, LLVMBool IsTailCall);
2523 * @defgroup LLVMCCoreValueInstructionTerminator Terminators
2525 * Functions in this group only apply to instructions that map to
2526 * llvm::TerminatorInst instances.
2532 * Return the number of successors that this terminator has.
2534 * @see llvm::TerminatorInst::getNumSuccessors
2536 unsigned LLVMGetNumSuccessors(LLVMValueRef Term);
2539 * Return the specified successor.
2541 * @see llvm::TerminatorInst::getSuccessor
2543 LLVMBasicBlockRef LLVMGetSuccessor(LLVMValueRef Term, unsigned i);
2546 * Update the specified successor to point at the provided block.
2548 * @see llvm::TerminatorInst::setSuccessor
2550 void LLVMSetSuccessor(LLVMValueRef Term, unsigned i, LLVMBasicBlockRef block);
2553 * Return if a branch is conditional.
2555 * This only works on llvm::BranchInst instructions.
2557 * @see llvm::BranchInst::isConditional
2559 LLVMBool LLVMIsConditional(LLVMValueRef Branch);
2562 * Return the condition of a branch instruction.
2564 * This only works on llvm::BranchInst instructions.
2566 * @see llvm::BranchInst::getCondition
2568 LLVMValueRef LLVMGetCondition(LLVMValueRef Branch);
2571 * Set the condition of a branch instruction.
2573 * This only works on llvm::BranchInst instructions.
2575 * @see llvm::BranchInst::setCondition
2577 void LLVMSetCondition(LLVMValueRef Branch, LLVMValueRef Cond);
2580 * Obtain the default destination basic block of a switch instruction.
2582 * This only works on llvm::SwitchInst instructions.
2584 * @see llvm::SwitchInst::getDefaultDest()
2586 LLVMBasicBlockRef LLVMGetSwitchDefaultDest(LLVMValueRef SwitchInstr);
2593 * @defgroup LLVMCCoreValueInstructionPHINode PHI Nodes
2595 * Functions in this group only apply to instructions that map to
2596 * llvm::PHINode instances.
2602 * Add an incoming value to the end of a PHI list.
2604 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
2605 LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
2608 * Obtain the number of incoming basic blocks to a PHI node.
2610 unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
2613 * Obtain an incoming value to a PHI node as an LLVMValueRef.
2615 LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index);
2618 * Obtain an incoming value to a PHI node as an LLVMBasicBlockRef.
2620 LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
2635 * @defgroup LLVMCCoreInstructionBuilder Instruction Builders
2637 * An instruction builder represents a point within a basic block and is
2638 * the exclusive means of building instructions using the C interface.
2643 LLVMBuilderRef LLVMCreateBuilderInContext(LLVMContextRef C);
2644 LLVMBuilderRef LLVMCreateBuilder(void);
2645 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
2646 LLVMValueRef Instr);
2647 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
2648 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block);
2649 LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder);
2650 void LLVMClearInsertionPosition(LLVMBuilderRef Builder);
2651 void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr);
2652 void LLVMInsertIntoBuilderWithName(LLVMBuilderRef Builder, LLVMValueRef Instr,
2654 void LLVMDisposeBuilder(LLVMBuilderRef Builder);
2657 void LLVMSetCurrentDebugLocation(LLVMBuilderRef Builder, LLVMValueRef L);
2658 LLVMValueRef LLVMGetCurrentDebugLocation(LLVMBuilderRef Builder);
2659 void LLVMSetInstDebugLocation(LLVMBuilderRef Builder, LLVMValueRef Inst);
2662 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
2663 LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
2664 LLVMValueRef LLVMBuildAggregateRet(LLVMBuilderRef, LLVMValueRef *RetVals,
2666 LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest);
2667 LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If,
2668 LLVMBasicBlockRef Then, LLVMBasicBlockRef Else);
2669 LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
2670 LLVMBasicBlockRef Else, unsigned NumCases);
2671 LLVMValueRef LLVMBuildIndirectBr(LLVMBuilderRef B, LLVMValueRef Addr,
2673 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
2674 LLVMValueRef *Args, unsigned NumArgs,
2675 LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
2677 LLVMValueRef LLVMBuildLandingPad(LLVMBuilderRef B, LLVMTypeRef Ty,
2678 unsigned NumClauses, const char *Name);
2679 LLVMValueRef LLVMBuildResume(LLVMBuilderRef B, LLVMValueRef Exn);
2680 LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
2682 /* Add a case to the switch instruction */
2683 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
2684 LLVMBasicBlockRef Dest);
2686 /* Add a destination to the indirectbr instruction */
2687 void LLVMAddDestination(LLVMValueRef IndirectBr, LLVMBasicBlockRef Dest);
2689 /* Add a catch or filter clause to the landingpad instruction */
2690 void LLVMAddClause(LLVMValueRef LandingPad, LLVMValueRef ClauseVal);
2692 /* Set the 'cleanup' flag in the landingpad instruction */
2693 void LLVMSetCleanup(LLVMValueRef LandingPad, LLVMBool Val);
2696 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2698 LLVMValueRef LLVMBuildNSWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2700 LLVMValueRef LLVMBuildNUWAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2702 LLVMValueRef LLVMBuildFAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2704 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2706 LLVMValueRef LLVMBuildNSWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2708 LLVMValueRef LLVMBuildNUWSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2710 LLVMValueRef LLVMBuildFSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2712 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2714 LLVMValueRef LLVMBuildNSWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2716 LLVMValueRef LLVMBuildNUWMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2718 LLVMValueRef LLVMBuildFMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2720 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2722 LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2724 LLVMValueRef LLVMBuildExactSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2726 LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2728 LLVMValueRef LLVMBuildURem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2730 LLVMValueRef LLVMBuildSRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2732 LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2734 LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2736 LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2738 LLVMValueRef LLVMBuildAShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2740 LLVMValueRef LLVMBuildAnd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2742 LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2744 LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
2746 LLVMValueRef LLVMBuildBinOp(LLVMBuilderRef B, LLVMOpcode Op,
2747 LLVMValueRef LHS, LLVMValueRef RHS,
2749 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2750 LLVMValueRef LLVMBuildNSWNeg(LLVMBuilderRef B, LLVMValueRef V,
2752 LLVMValueRef LLVMBuildNUWNeg(LLVMBuilderRef B, LLVMValueRef V,
2754 LLVMValueRef LLVMBuildFNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2755 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
2758 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2759 LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
2760 LLVMValueRef Val, const char *Name);
2761 LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2762 LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
2763 LLVMValueRef Val, const char *Name);
2764 LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
2765 LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
2767 LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr);
2768 LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2769 LLVMValueRef *Indices, unsigned NumIndices,
2771 LLVMValueRef LLVMBuildInBoundsGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2772 LLVMValueRef *Indices, unsigned NumIndices,
2774 LLVMValueRef LLVMBuildStructGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
2775 unsigned Idx, const char *Name);
2776 LLVMValueRef LLVMBuildGlobalString(LLVMBuilderRef B, const char *Str,
2778 LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B, const char *Str,
2780 LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst);
2781 void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile);
2784 LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val,
2785 LLVMTypeRef DestTy, const char *Name);
2786 LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val,
2787 LLVMTypeRef DestTy, const char *Name);
2788 LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val,
2789 LLVMTypeRef DestTy, const char *Name);
2790 LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val,
2791 LLVMTypeRef DestTy, const char *Name);
2792 LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val,
2793 LLVMTypeRef DestTy, const char *Name);
2794 LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef, LLVMValueRef Val,
2795 LLVMTypeRef DestTy, const char *Name);
2796 LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef, LLVMValueRef Val,
2797 LLVMTypeRef DestTy, const char *Name);
2798 LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef, LLVMValueRef Val,
2799 LLVMTypeRef DestTy, const char *Name);
2800 LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef, LLVMValueRef Val,
2801 LLVMTypeRef DestTy, const char *Name);
2802 LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val,
2803 LLVMTypeRef DestTy, const char *Name);
2804 LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef, LLVMValueRef Val,
2805 LLVMTypeRef DestTy, const char *Name);
2806 LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef, LLVMValueRef Val,
2807 LLVMTypeRef DestTy, const char *Name);
2808 LLVMValueRef LLVMBuildAddrSpaceCast(LLVMBuilderRef, LLVMValueRef Val,
2809 LLVMTypeRef DestTy, const char *Name);
2810 LLVMValueRef LLVMBuildZExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2811 LLVMTypeRef DestTy, const char *Name);
2812 LLVMValueRef LLVMBuildSExtOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2813 LLVMTypeRef DestTy, const char *Name);
2814 LLVMValueRef LLVMBuildTruncOrBitCast(LLVMBuilderRef, LLVMValueRef Val,
2815 LLVMTypeRef DestTy, const char *Name);
2816 LLVMValueRef LLVMBuildCast(LLVMBuilderRef B, LLVMOpcode Op, LLVMValueRef Val,
2817 LLVMTypeRef DestTy, const char *Name);
2818 LLVMValueRef LLVMBuildPointerCast(LLVMBuilderRef, LLVMValueRef Val,
2819 LLVMTypeRef DestTy, const char *Name);
2820 LLVMValueRef LLVMBuildIntCast(LLVMBuilderRef, LLVMValueRef Val, /*Signed cast!*/
2821 LLVMTypeRef DestTy, const char *Name);
2822 LLVMValueRef LLVMBuildFPCast(LLVMBuilderRef, LLVMValueRef Val,
2823 LLVMTypeRef DestTy, const char *Name);
2826 LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op,
2827 LLVMValueRef LHS, LLVMValueRef RHS,
2829 LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
2830 LLVMValueRef LHS, LLVMValueRef RHS,
2833 /* Miscellaneous instructions */
2834 LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
2835 LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn,
2836 LLVMValueRef *Args, unsigned NumArgs,
2838 LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If,
2839 LLVMValueRef Then, LLVMValueRef Else,
2841 LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef, LLVMValueRef List, LLVMTypeRef Ty,
2843 LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal,
2844 LLVMValueRef Index, const char *Name);
2845 LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal,
2846 LLVMValueRef EltVal, LLVMValueRef Index,
2848 LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1,
2849 LLVMValueRef V2, LLVMValueRef Mask,
2851 LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef, LLVMValueRef AggVal,
2852 unsigned Index, const char *Name);
2853 LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef, LLVMValueRef AggVal,
2854 LLVMValueRef EltVal, unsigned Index,
2857 LLVMValueRef LLVMBuildIsNull(LLVMBuilderRef, LLVMValueRef Val,
2859 LLVMValueRef LLVMBuildIsNotNull(LLVMBuilderRef, LLVMValueRef Val,
2861 LLVMValueRef LLVMBuildPtrDiff(LLVMBuilderRef, LLVMValueRef LHS,
2862 LLVMValueRef RHS, const char *Name);
2863 LLVMValueRef LLVMBuildFence(LLVMBuilderRef B, LLVMAtomicOrdering ordering,
2864 LLVMBool singleThread, const char *Name);
2865 LLVMValueRef LLVMBuildAtomicRMW(LLVMBuilderRef B, LLVMAtomicRMWBinOp op,
2866 LLVMValueRef PTR, LLVMValueRef Val,
2867 LLVMAtomicOrdering ordering,
2868 LLVMBool singleThread);
2875 * @defgroup LLVMCCoreModuleProvider Module Providers
2881 * Changes the type of M so it can be passed to FunctionPassManagers and the
2882 * JIT. They take ModuleProviders for historical reasons.
2884 LLVMModuleProviderRef
2885 LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
2888 * Destroys the module M.
2890 void LLVMDisposeModuleProvider(LLVMModuleProviderRef M);
2897 * @defgroup LLVMCCoreMemoryBuffers Memory Buffers
2902 LLVMBool LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
2903 LLVMMemoryBufferRef *OutMemBuf,
2905 LLVMBool LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
2907 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRange(const char *InputData,
2908 size_t InputDataLength,
2909 const char *BufferName,
2910 LLVMBool RequiresNullTerminator);
2911 LLVMMemoryBufferRef LLVMCreateMemoryBufferWithMemoryRangeCopy(const char *InputData,
2912 size_t InputDataLength,
2913 const char *BufferName);
2914 const char *LLVMGetBufferStart(LLVMMemoryBufferRef MemBuf);
2915 size_t LLVMGetBufferSize(LLVMMemoryBufferRef MemBuf);
2916 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
2923 * @defgroup LLVMCCorePassRegistry Pass Registry
2928 /** Return the global pass registry, for use with initialization functions.
2929 @see llvm::PassRegistry::getPassRegistry */
2930 LLVMPassRegistryRef LLVMGetGlobalPassRegistry(void);
2937 * @defgroup LLVMCCorePassManagers Pass Managers
2942 /** Constructs a new whole-module pass pipeline. This type of pipeline is
2943 suitable for link-time optimization and whole-module transformations.
2944 @see llvm::PassManager::PassManager */
2945 LLVMPassManagerRef LLVMCreatePassManager(void);
2947 /** Constructs a new function-by-function pass pipeline over the module
2948 provider. It does not take ownership of the module provider. This type of
2949 pipeline is suitable for code generation and JIT compilation tasks.
2950 @see llvm::FunctionPassManager::FunctionPassManager */
2951 LLVMPassManagerRef LLVMCreateFunctionPassManagerForModule(LLVMModuleRef M);
2953 /** Deprecated: Use LLVMCreateFunctionPassManagerForModule instead. */
2954 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
2956 /** Initializes, executes on the provided module, and finalizes all of the
2957 passes scheduled in the pass manager. Returns 1 if any of the passes
2958 modified the module, 0 otherwise.
2959 @see llvm::PassManager::run(Module&) */
2960 LLVMBool LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M);
2962 /** Initializes all of the function passes scheduled in the function pass
2963 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
2964 @see llvm::FunctionPassManager::doInitialization */
2965 LLVMBool LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM);
2967 /** Executes all of the function passes scheduled in the function pass manager
2968 on the provided function. Returns 1 if any of the passes modified the
2969 function, false otherwise.
2970 @see llvm::FunctionPassManager::run(Function&) */
2971 LLVMBool LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F);
2973 /** Finalizes all of the function passes scheduled in in the function pass
2974 manager. Returns 1 if any of the passes modified the module, 0 otherwise.
2975 @see llvm::FunctionPassManager::doFinalization */
2976 LLVMBool LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM);
2978 /** Frees the memory of a pass pipeline. For function pipelines, does not free
2979 the module provider.
2980 @see llvm::PassManagerBase::~PassManagerBase. */
2981 void LLVMDisposePassManager(LLVMPassManagerRef PM);
2988 * @defgroup LLVMCCoreThreading Threading
2990 * Handle the structures needed to make LLVM safe for multithreading.
2995 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
2996 time define LLVM_ENABLE_THREADS. This function always returns
2997 LLVMIsMultithreaded(). */
2998 LLVMBool LLVMStartMultithreaded(void);
3000 /** Deprecated: Multi-threading can only be enabled/disabled with the compile
3001 time define LLVM_ENABLE_THREADS. */
3002 void LLVMStopMultithreaded(void);
3004 /** Check whether LLVM is executing in thread-safe mode or not.
3005 @see llvm::llvm_is_multithreaded */
3006 LLVMBool LLVMIsMultithreaded(void);
3022 #endif /* !defined(__cplusplus) */
3024 #endif /* !defined(LLVM_C_CORE_H) */