Add dyn_cast_or_null bindings for some additional classes missed in r61252.
[oota-llvm.git] / include / llvm-c / Core.h
1 /*===-- llvm-c/Core.h - Core Library C Interface ------------------*- C -*-===*\
2 |*                                                                            *|
3 |*                     The LLVM Compiler Infrastructure                       *|
4 |*                                                                            *|
5 |* This file is distributed under the University of Illinois Open Source      *|
6 |* License. See LICENSE.TXT for details.                                      *|
7 |*                                                                            *|
8 |*===----------------------------------------------------------------------===*|
9 |*                                                                            *|
10 |* This header declares the C interface to libLLVMCore.a, which implements    *|
11 |* the LLVM intermediate representation.                                      *|
12 |*                                                                            *|
13 |* LLVM uses a polymorphic type hierarchy which C cannot represent, therefore *|
14 |* parameters must be passed as base types. Despite the declared types, most  *|
15 |* of the functions provided operate only on branches of the type hierarchy.  *|
16 |* The declared parameter names are descriptive and specify which type is     *|
17 |* required. Additionally, each type hierarchy is documented along with the   *|
18 |* functions that operate upon it. For more detail, refer to LLVM's C++ code. *|
19 |* If in doubt, refer to Core.cpp, which performs paramter downcasts in the   *|
20 |* form unwrap<RequiredType>(Param).                                          *|
21 |*                                                                            *|
22 |* Many exotic languages can interoperate with C code but have a harder time  *|
23 |* with C++ due to name mangling. So in addition to C, this interface enables *|
24 |* tools written in such languages.                                           *|
25 |*                                                                            *|
26 |* When included into a C++ source file, also declares 'wrap' and 'unwrap'    *|
27 |* helpers to perform opaque reference<-->pointer conversions. These helpers  *|
28 |* are shorter and more tightly typed than writing the casts by hand when     *|
29 |* authoring bindings. In assert builds, they will do runtime type checking.  *|
30 |*                                                                            *|
31 \*===----------------------------------------------------------------------===*/
32
33 #ifndef LLVM_C_CORE_H
34 #define LLVM_C_CORE_H
35
36 #ifdef __cplusplus
37
38 /* Need these includes to support the LLVM 'cast' template for the C++ 'wrap' 
39    and 'unwrap' conversion functions. */
40 #include "llvm/Module.h"
41 #include "llvm/Support/IRBuilder.h"
42
43 extern "C" {
44 #endif
45
46
47 /* Opaque types. */
48
49 /**
50  * The top-level container for all other LLVM Intermediate Representation (IR)
51  * objects. See the llvm::Module class.
52  */
53 typedef struct LLVMOpaqueModule *LLVMModuleRef;
54
55 /**
56  * Each value in the LLVM IR has a type, an LLVMTypeRef. See the llvm::Type
57  * class.
58  */
59 typedef struct LLVMOpaqueType *LLVMTypeRef;
60
61 /**
62  * When building recursive types using LLVMRefineType, LLVMTypeRef values may
63  * become invalid; use LLVMTypeHandleRef to resolve this problem. See the
64  * llvm::AbstractTypeHolder class.
65  */
66 typedef struct LLVMOpaqueTypeHandle *LLVMTypeHandleRef;
67
68 typedef struct LLVMOpaqueValue *LLVMValueRef;
69 typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
70 typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
71
72 /* Used to provide a module to JIT or interpreter.
73  * See the llvm::ModuleProvider class.
74  */
75 typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
76
77 /* Used to provide a module to JIT or interpreter.
78  * See the llvm::MemoryBuffer class.
79  */
80 typedef struct LLVMOpaqueMemoryBuffer *LLVMMemoryBufferRef;
81
82 /** See the llvm::PassManagerBase class. */
83 typedef struct LLVMOpaquePassManager *LLVMPassManagerRef;
84
85 typedef enum {
86     LLVMZExtAttribute       = 1<<0,
87     LLVMSExtAttribute       = 1<<1,
88     LLVMNoReturnAttribute   = 1<<2,
89     LLVMInRegAttribute      = 1<<3,
90     LLVMStructRetAttribute  = 1<<4,
91     LLVMNoUnwindAttribute   = 1<<5,
92     LLVMNoAliasAttribute    = 1<<6,
93     LLVMByValAttribute      = 1<<7,
94     LLVMNestAttribute       = 1<<8,
95     LLVMReadNoneAttribute   = 1<<9,
96     LLVMReadOnlyAttribute   = 1<<10
97 } LLVMAttribute;
98
99 typedef enum {
100   LLVMVoidTypeKind,        /**< type with no size */
101   LLVMFloatTypeKind,       /**< 32 bit floating point type */
102   LLVMDoubleTypeKind,      /**< 64 bit floating point type */
103   LLVMX86_FP80TypeKind,    /**< 80 bit floating point type (X87) */
104   LLVMFP128TypeKind,       /**< 128 bit floating point type (112-bit mantissa)*/
105   LLVMPPC_FP128TypeKind,   /**< 128 bit floating point type (two 64-bits) */
106   LLVMLabelTypeKind,       /**< Labels */
107   LLVMIntegerTypeKind,     /**< Arbitrary bit width integers */
108   LLVMFunctionTypeKind,    /**< Functions */
109   LLVMStructTypeKind,      /**< Structures */
110   LLVMArrayTypeKind,       /**< Arrays */
111   LLVMPointerTypeKind,     /**< Pointers */
112   LLVMOpaqueTypeKind,      /**< Opaque: type with unknown structure */
113   LLVMVectorTypeKind       /**< SIMD 'packed' format, or other vector type */
114 } LLVMTypeKind;
115
116 typedef enum {
117   LLVMExternalLinkage,    /**< Externally visible function */
118   LLVMLinkOnceLinkage,    /**< Keep one copy of function when linking (inline)*/
119   LLVMWeakLinkage,        /**< Keep one copy of function when linking (weak) */
120   LLVMAppendingLinkage,   /**< Special purpose, only applies to global arrays */
121   LLVMInternalLinkage,    /**< Rename collisions when linking (static
122                                functions) */
123   LLVMDLLImportLinkage,   /**< Function to be imported from DLL */
124   LLVMDLLExportLinkage,   /**< Function to be accessible from DLL */
125   LLVMExternalWeakLinkage,/**< ExternalWeak linkage description */
126   LLVMGhostLinkage        /**< Stand-in functions for streaming fns from
127                                bitcode */
128 } LLVMLinkage;
129
130 typedef enum {
131   LLVMDefaultVisibility,  /**< The GV is visible */
132   LLVMHiddenVisibility,   /**< The GV is hidden */
133   LLVMProtectedVisibility /**< The GV is protected */
134 } LLVMVisibility;
135
136 typedef enum {
137   LLVMCCallConv           = 0,
138   LLVMFastCallConv        = 8,
139   LLVMColdCallConv        = 9,
140   LLVMX86StdcallCallConv  = 64,
141   LLVMX86FastcallCallConv = 65
142 } LLVMCallConv;
143
144 typedef enum {
145   LLVMIntEQ = 32, /**< equal */
146   LLVMIntNE,      /**< not equal */
147   LLVMIntUGT,     /**< unsigned greater than */
148   LLVMIntUGE,     /**< unsigned greater or equal */
149   LLVMIntULT,     /**< unsigned less than */
150   LLVMIntULE,     /**< unsigned less or equal */
151   LLVMIntSGT,     /**< signed greater than */
152   LLVMIntSGE,     /**< signed greater or equal */
153   LLVMIntSLT,     /**< signed less than */
154   LLVMIntSLE      /**< signed less or equal */
155 } LLVMIntPredicate;
156
157 typedef enum {
158   LLVMRealPredicateFalse, /**< Always false (always folded) */
159   LLVMRealOEQ,            /**< True if ordered and equal */
160   LLVMRealOGT,            /**< True if ordered and greater than */
161   LLVMRealOGE,            /**< True if ordered and greater than or equal */
162   LLVMRealOLT,            /**< True if ordered and less than */
163   LLVMRealOLE,            /**< True if ordered and less than or equal */
164   LLVMRealONE,            /**< True if ordered and operands are unequal */
165   LLVMRealORD,            /**< True if ordered (no nans) */
166   LLVMRealUNO,            /**< True if unordered: isnan(X) | isnan(Y) */
167   LLVMRealUEQ,            /**< True if unordered or equal */
168   LLVMRealUGT,            /**< True if unordered or greater than */
169   LLVMRealUGE,            /**< True if unordered, greater than, or equal */
170   LLVMRealULT,            /**< True if unordered or less than */
171   LLVMRealULE,            /**< True if unordered, less than, or equal */
172   LLVMRealUNE,            /**< True if unordered or not equal */
173   LLVMRealPredicateTrue   /**< Always true (always folded) */
174 } LLVMRealPredicate;
175
176
177 /*===-- Error handling ----------------------------------------------------===*/
178
179 void LLVMDisposeMessage(char *Message);
180
181
182 /*===-- Modules -----------------------------------------------------------===*/
183
184 /* Create and destroy modules. */ 
185 /** See llvm::Module::Module. */
186 LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
187
188 /** See llvm::Module::~Module. */
189 void LLVMDisposeModule(LLVMModuleRef M);
190
191 /** Data layout. See Module::getDataLayout. */
192 const char *LLVMGetDataLayout(LLVMModuleRef M);
193 void LLVMSetDataLayout(LLVMModuleRef M, const char *Triple);
194
195 /** Target triple. See Module::getTargetTriple. */
196 const char *LLVMGetTarget(LLVMModuleRef M);
197 void LLVMSetTarget(LLVMModuleRef M, const char *Triple);
198
199 /** See Module::addTypeName. */
200 int LLVMAddTypeName(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty);
201 void LLVMDeleteTypeName(LLVMModuleRef M, const char *Name);
202
203 /** See Module::dump. */
204 void LLVMDumpModule(LLVMModuleRef M);
205
206
207 /*===-- Types -------------------------------------------------------------===*/
208
209 /* LLVM types conform to the following hierarchy:
210  * 
211  *   types:
212  *     integer type
213  *     real type
214  *     function type
215  *     sequence types:
216  *       array type
217  *       pointer type
218  *       vector type
219  *     void type
220  *     label type
221  *     opaque type
222  */
223
224 /** See llvm::LLVMTypeKind::getTypeID. */
225 LLVMTypeKind LLVMGetTypeKind(LLVMTypeRef Ty);
226
227 /* Operations on integer types */
228 LLVMTypeRef LLVMInt1Type(void);
229 LLVMTypeRef LLVMInt8Type(void);
230 LLVMTypeRef LLVMInt16Type(void);
231 LLVMTypeRef LLVMInt32Type(void);
232 LLVMTypeRef LLVMInt64Type(void);
233 LLVMTypeRef LLVMIntType(unsigned NumBits);
234 unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
235
236 /* Operations on real types */
237 LLVMTypeRef LLVMFloatType(void);
238 LLVMTypeRef LLVMDoubleType(void);
239 LLVMTypeRef LLVMX86FP80Type(void);
240 LLVMTypeRef LLVMFP128Type(void);
241 LLVMTypeRef LLVMPPCFP128Type(void);
242
243 /* Operations on function types */
244 LLVMTypeRef LLVMFunctionType(LLVMTypeRef ReturnType,
245                              LLVMTypeRef *ParamTypes, unsigned ParamCount,
246                              int IsVarArg);
247 int LLVMIsFunctionVarArg(LLVMTypeRef FunctionTy);
248 LLVMTypeRef LLVMGetReturnType(LLVMTypeRef FunctionTy);
249 unsigned LLVMCountParamTypes(LLVMTypeRef FunctionTy);
250 void LLVMGetParamTypes(LLVMTypeRef FunctionTy, LLVMTypeRef *Dest);
251
252 /* Operations on struct types */
253 LLVMTypeRef LLVMStructType(LLVMTypeRef *ElementTypes, unsigned ElementCount,
254                            int Packed);
255 unsigned LLVMCountStructElementTypes(LLVMTypeRef StructTy);
256 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
257 int LLVMIsPackedStruct(LLVMTypeRef StructTy);
258
259 /* Operations on array, pointer, and vector types (sequence types) */
260 LLVMTypeRef LLVMArrayType(LLVMTypeRef ElementType, unsigned ElementCount);
261 LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType, unsigned AddressSpace);
262 LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType, unsigned ElementCount);
263
264 LLVMTypeRef LLVMGetElementType(LLVMTypeRef Ty);
265 unsigned LLVMGetArrayLength(LLVMTypeRef ArrayTy);
266 unsigned LLVMGetPointerAddressSpace(LLVMTypeRef PointerTy);
267 unsigned LLVMGetVectorSize(LLVMTypeRef VectorTy);
268
269 /* Operations on other types */
270 LLVMTypeRef LLVMVoidType(void);
271 LLVMTypeRef LLVMLabelType(void);
272 LLVMTypeRef LLVMOpaqueType(void);
273
274 /* Operations on type handles */
275 LLVMTypeHandleRef LLVMCreateTypeHandle(LLVMTypeRef PotentiallyAbstractTy);
276 void LLVMRefineType(LLVMTypeRef AbstractTy, LLVMTypeRef ConcreteTy);
277 LLVMTypeRef LLVMResolveTypeHandle(LLVMTypeHandleRef TypeHandle);
278 void LLVMDisposeTypeHandle(LLVMTypeHandleRef TypeHandle);
279
280
281 /*===-- Values ------------------------------------------------------------===*/
282
283 /* The bulk of LLVM's object model consists of values, which comprise a very
284  * rich type hierarchy.
285  */
286
287 #define LLVM_FOR_EACH_VALUE_SUBCLASS(macro) \
288   macro(Argument)                           \
289   macro(BasicBlock)                         \
290   macro(InlineAsm)                          \
291   macro(User)                               \
292     macro(Constant)                         \
293       macro(ConstantAggregateZero)          \
294       macro(ConstantArray)                  \
295       macro(ConstantExpr)                   \
296       macro(ConstantFP)                     \
297       macro(ConstantInt)                    \
298       macro(ConstantPointerNull)            \
299       macro(ConstantStruct)                 \
300       macro(ConstantVector)                 \
301       macro(GlobalValue)                    \
302         macro(Function)                     \
303         macro(GlobalAlias)                  \
304         macro(GlobalVariable)               \
305       macro(UndefValue)                     \
306     macro(Instruction)                      \
307       macro(BinaryOperator)                 \
308       macro(CallInst)                       \
309         macro(IntrinsicInst)                \
310           macro(DbgInfoIntrinsic)           \
311             macro(DbgDeclareInst)           \
312             macro(DbgFuncStartInst)         \
313             macro(DbgRegionEndInst)         \
314             macro(DbgRegionStartInst)       \
315             macro(DbgStopPointInst)         \
316           macro(EHSelectorInst)             \
317           macro(MemIntrinsic)               \
318             macro(MemCpyInst)               \
319             macro(MemMoveInst)              \
320             macro(MemSetInst)               \
321       macro(CmpInst)                        \
322       macro(FCmpInst)                       \
323       macro(ICmpInst)                       \
324       macro(VFCmpInst)                      \
325       macro(VICmpInst)                      \
326       macro(ExtractElementInst)             \
327       macro(GetElementPtrInst)              \
328       macro(InsertElementInst)              \
329       macro(InsertValueInst)                \
330       macro(PHINode)                        \
331       macro(SelectInst)                     \
332       macro(ShuffleVectorInst)              \
333       macro(StoreInst)                      \
334       macro(TerminatorInst)                 \
335         macro(BranchInst)                   \
336         macro(InvokeInst)                   \
337         macro(ReturnInst)                   \
338         macro(SwitchInst)                   \
339         macro(UnreachableInst)              \
340         macro(UnwindInst)                   \
341     macro(UnaryInstruction)                 \
342       macro(AllocationInst)                 \
343         macro(AllocaInst)                   \
344         macro(MallocInst)                   \
345       macro(CastInst)                       \
346         macro(BitCastInst)                  \
347         macro(FPExtInst)                    \
348         macro(FPToSIInst)                   \
349         macro(FPToUIInst)                   \
350         macro(FPTruncInst)                  \
351         macro(IntToPtrInst)                 \
352         macro(PtrToIntInst)                 \
353         macro(SExtInst)                     \
354         macro(SIToFPInst)                   \
355         macro(TruncInst)                    \
356         macro(UIToFPInst)                   \
357         macro(ZExtInst)                     \
358       macro(ExtractValueInst)               \
359       macro(FreeInst)                       \
360       macro(LoadInst)                       \
361       macro(VAArgInst)
362
363 /* Operations on all values */
364 LLVMTypeRef LLVMTypeOf(LLVMValueRef Val);
365 const char *LLVMGetValueName(LLVMValueRef Val);
366 void LLVMSetValueName(LLVMValueRef Val, const char *Name);
367 void LLVMDumpValue(LLVMValueRef Val);
368
369 /* Conversion functions. Return the input value if it is an instance of the
370    specified class, otherwise NULL. See llvm::dyn_cast_or_null<>. */
371 #define LLVM_DECLARE_VALUE_CAST(name) \
372   LLVMValueRef LLVMIsA##name(LLVMValueRef Val);
373 LLVM_FOR_EACH_VALUE_SUBCLASS(LLVM_DECLARE_VALUE_CAST)
374
375 /* Operations on constants of any type */
376 LLVMValueRef LLVMConstNull(LLVMTypeRef Ty); /* all zeroes */
377 LLVMValueRef LLVMConstAllOnes(LLVMTypeRef Ty); /* only for int/vector */
378 LLVMValueRef LLVMGetUndef(LLVMTypeRef Ty);
379 int LLVMIsConstant(LLVMValueRef Val);
380 int LLVMIsNull(LLVMValueRef Val);
381 int LLVMIsUndef(LLVMValueRef Val);
382
383 /* Operations on scalar constants */
384 LLVMValueRef LLVMConstInt(LLVMTypeRef IntTy, unsigned long long N,
385                           int SignExtend);
386 LLVMValueRef LLVMConstReal(LLVMTypeRef RealTy, double N);
387 LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text);
388
389 /* Operations on composite constants */
390 LLVMValueRef LLVMConstString(const char *Str, unsigned Length,
391                              int DontNullTerminate);
392 LLVMValueRef LLVMConstArray(LLVMTypeRef ElementTy,
393                             LLVMValueRef *ConstantVals, unsigned Length);
394 LLVMValueRef LLVMConstStruct(LLVMValueRef *ConstantVals, unsigned Count,
395                              int packed);
396 LLVMValueRef LLVMConstVector(LLVMValueRef *ScalarConstantVals, unsigned Size);
397
398 /* Constant expressions */
399 LLVMValueRef LLVMSizeOf(LLVMTypeRef Ty);
400 LLVMValueRef LLVMConstNeg(LLVMValueRef ConstantVal);
401 LLVMValueRef LLVMConstNot(LLVMValueRef ConstantVal);
402 LLVMValueRef LLVMConstAdd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
403 LLVMValueRef LLVMConstSub(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
404 LLVMValueRef LLVMConstMul(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
405 LLVMValueRef LLVMConstUDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
406 LLVMValueRef LLVMConstSDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
407 LLVMValueRef LLVMConstFDiv(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
408 LLVMValueRef LLVMConstURem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
409 LLVMValueRef LLVMConstSRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
410 LLVMValueRef LLVMConstFRem(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
411 LLVMValueRef LLVMConstAnd(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
412 LLVMValueRef LLVMConstOr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
413 LLVMValueRef LLVMConstXor(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
414 LLVMValueRef LLVMConstICmp(LLVMIntPredicate Predicate,
415                            LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
416 LLVMValueRef LLVMConstFCmp(LLVMRealPredicate Predicate,
417                            LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
418 LLVMValueRef LLVMConstShl(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
419 LLVMValueRef LLVMConstLShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
420 LLVMValueRef LLVMConstAShr(LLVMValueRef LHSConstant, LLVMValueRef RHSConstant);
421 LLVMValueRef LLVMConstGEP(LLVMValueRef ConstantVal,
422                           LLVMValueRef *ConstantIndices, unsigned NumIndices);
423 LLVMValueRef LLVMConstTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
424 LLVMValueRef LLVMConstSExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
425 LLVMValueRef LLVMConstZExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
426 LLVMValueRef LLVMConstFPTrunc(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
427 LLVMValueRef LLVMConstFPExt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
428 LLVMValueRef LLVMConstUIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
429 LLVMValueRef LLVMConstSIToFP(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
430 LLVMValueRef LLVMConstFPToUI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
431 LLVMValueRef LLVMConstFPToSI(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
432 LLVMValueRef LLVMConstPtrToInt(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
433 LLVMValueRef LLVMConstIntToPtr(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
434 LLVMValueRef LLVMConstBitCast(LLVMValueRef ConstantVal, LLVMTypeRef ToType);
435 LLVMValueRef LLVMConstSelect(LLVMValueRef ConstantCondition,
436                              LLVMValueRef ConstantIfTrue,
437                              LLVMValueRef ConstantIfFalse);
438 LLVMValueRef LLVMConstExtractElement(LLVMValueRef VectorConstant,
439                                      LLVMValueRef IndexConstant);
440 LLVMValueRef LLVMConstInsertElement(LLVMValueRef VectorConstant,
441                                     LLVMValueRef ElementValueConstant,
442                                     LLVMValueRef IndexConstant);
443 LLVMValueRef LLVMConstShuffleVector(LLVMValueRef VectorAConstant,
444                                     LLVMValueRef VectorBConstant,
445                                     LLVMValueRef MaskConstant);
446 LLVMValueRef LLVMConstExtractValue(LLVMValueRef AggConstant, unsigned *IdxList,
447                                    unsigned NumIdx);
448 LLVMValueRef LLVMConstInsertValue(LLVMValueRef AggConstant,
449                                   LLVMValueRef ElementValueConstant,
450                                   unsigned *IdxList, unsigned NumIdx);
451 LLVMValueRef LLVMConstInlineAsm(LLVMTypeRef Ty, 
452                                 const char *AsmString, const char *Constraints,
453                                 int HasSideEffects);
454
455 /* Operations on global variables, functions, and aliases (globals) */
456 LLVMModuleRef LLVMGetGlobalParent(LLVMValueRef Global);
457 int LLVMIsDeclaration(LLVMValueRef Global);
458 LLVMLinkage LLVMGetLinkage(LLVMValueRef Global);
459 void LLVMSetLinkage(LLVMValueRef Global, LLVMLinkage Linkage);
460 const char *LLVMGetSection(LLVMValueRef Global);
461 void LLVMSetSection(LLVMValueRef Global, const char *Section);
462 LLVMVisibility LLVMGetVisibility(LLVMValueRef Global);
463 void LLVMSetVisibility(LLVMValueRef Global, LLVMVisibility Viz);
464 unsigned LLVMGetAlignment(LLVMValueRef Global);
465 void LLVMSetAlignment(LLVMValueRef Global, unsigned Bytes);
466
467 /* Operations on global variables */
468 LLVMValueRef LLVMAddGlobal(LLVMModuleRef M, LLVMTypeRef Ty, const char *Name);
469 LLVMValueRef LLVMGetNamedGlobal(LLVMModuleRef M, const char *Name);
470 LLVMValueRef LLVMGetFirstGlobal(LLVMModuleRef M);
471 LLVMValueRef LLVMGetLastGlobal(LLVMModuleRef M);
472 LLVMValueRef LLVMGetNextGlobal(LLVMValueRef GlobalVar);
473 LLVMValueRef LLVMGetPreviousGlobal(LLVMValueRef GlobalVar);
474 void LLVMDeleteGlobal(LLVMValueRef GlobalVar);
475 LLVMValueRef LLVMGetInitializer(LLVMValueRef GlobalVar);
476 void LLVMSetInitializer(LLVMValueRef GlobalVar, LLVMValueRef ConstantVal);
477 int LLVMIsThreadLocal(LLVMValueRef GlobalVar);
478 void LLVMSetThreadLocal(LLVMValueRef GlobalVar, int IsThreadLocal);
479 int LLVMIsGlobalConstant(LLVMValueRef GlobalVar);
480 void LLVMSetGlobalConstant(LLVMValueRef GlobalVar, int IsConstant);
481
482 /* Operations on aliases */
483 LLVMValueRef LLVMAddAlias(LLVMModuleRef M, LLVMTypeRef Ty, LLVMValueRef Aliasee,
484                           const char *Name);
485
486 /* Operations on functions */
487 LLVMValueRef LLVMAddFunction(LLVMModuleRef M, const char *Name,
488                              LLVMTypeRef FunctionTy);
489 LLVMValueRef LLVMGetNamedFunction(LLVMModuleRef M, const char *Name);
490 LLVMValueRef LLVMGetFirstFunction(LLVMModuleRef M);
491 LLVMValueRef LLVMGetLastFunction(LLVMModuleRef M);
492 LLVMValueRef LLVMGetNextFunction(LLVMValueRef Fn);
493 LLVMValueRef LLVMGetPreviousFunction(LLVMValueRef Fn);
494 void LLVMDeleteFunction(LLVMValueRef Fn);
495 unsigned LLVMGetIntrinsicID(LLVMValueRef Fn);
496 unsigned LLVMGetFunctionCallConv(LLVMValueRef Fn);
497 void LLVMSetFunctionCallConv(LLVMValueRef Fn, unsigned CC);
498 const char *LLVMGetGC(LLVMValueRef Fn);
499 void LLVMSetGC(LLVMValueRef Fn, const char *Name);
500
501 /* Operations on parameters */
502 unsigned LLVMCountParams(LLVMValueRef Fn);
503 void LLVMGetParams(LLVMValueRef Fn, LLVMValueRef *Params);
504 LLVMValueRef LLVMGetParam(LLVMValueRef Fn, unsigned Index);
505 LLVMValueRef LLVMGetParamParent(LLVMValueRef Inst);
506 LLVMValueRef LLVMGetFirstParam(LLVMValueRef Fn);
507 LLVMValueRef LLVMGetLastParam(LLVMValueRef Fn);
508 LLVMValueRef LLVMGetNextParam(LLVMValueRef Arg);
509 LLVMValueRef LLVMGetPreviousParam(LLVMValueRef Arg);
510 void LLVMAddAttribute(LLVMValueRef Arg, LLVMAttribute PA);
511 void LLVMRemoveAttribute(LLVMValueRef Arg, LLVMAttribute PA);
512 void LLVMSetParamAlignment(LLVMValueRef Arg, unsigned align);
513
514 /* Operations on basic blocks */
515 LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef BB);
516 int LLVMValueIsBasicBlock(LLVMValueRef Val);
517 LLVMBasicBlockRef LLVMValueAsBasicBlock(LLVMValueRef Val);
518 LLVMValueRef LLVMGetBasicBlockParent(LLVMBasicBlockRef BB);
519 unsigned LLVMCountBasicBlocks(LLVMValueRef Fn);
520 void LLVMGetBasicBlocks(LLVMValueRef Fn, LLVMBasicBlockRef *BasicBlocks);
521 LLVMBasicBlockRef LLVMGetFirstBasicBlock(LLVMValueRef Fn);
522 LLVMBasicBlockRef LLVMGetLastBasicBlock(LLVMValueRef Fn);
523 LLVMBasicBlockRef LLVMGetNextBasicBlock(LLVMBasicBlockRef BB);
524 LLVMBasicBlockRef LLVMGetPreviousBasicBlock(LLVMBasicBlockRef BB);
525 LLVMBasicBlockRef LLVMGetEntryBasicBlock(LLVMValueRef Fn);
526 LLVMBasicBlockRef LLVMAppendBasicBlock(LLVMValueRef Fn, const char *Name);
527 LLVMBasicBlockRef LLVMInsertBasicBlock(LLVMBasicBlockRef InsertBeforeBB,
528                                        const char *Name);
529 void LLVMDeleteBasicBlock(LLVMBasicBlockRef BB);
530
531 /* Operations on instructions */
532 LLVMBasicBlockRef LLVMGetInstructionParent(LLVMValueRef Inst);
533 LLVMValueRef LLVMGetFirstInstruction(LLVMBasicBlockRef BB);
534 LLVMValueRef LLVMGetLastInstruction(LLVMBasicBlockRef BB);
535 LLVMValueRef LLVMGetNextInstruction(LLVMValueRef Inst);
536 LLVMValueRef LLVMGetPreviousInstruction(LLVMValueRef Inst);
537
538 /* Operations on call sites */
539 void LLVMSetInstructionCallConv(LLVMValueRef Instr, unsigned CC);
540 unsigned LLVMGetInstructionCallConv(LLVMValueRef Instr);
541 void LLVMAddInstrAttribute(LLVMValueRef Instr, unsigned index, LLVMAttribute);
542 void LLVMRemoveInstrAttribute(LLVMValueRef Instr, unsigned index, 
543                               LLVMAttribute);
544 void LLVMSetInstrParamAlignment(LLVMValueRef Instr, unsigned index, 
545                                 unsigned align);
546
547 /* Operations on call instructions (only) */
548 int LLVMIsTailCall(LLVMValueRef CallInst);
549 void LLVMSetTailCall(LLVMValueRef CallInst, int IsTailCall);
550
551 /* Operations on phi nodes */
552 void LLVMAddIncoming(LLVMValueRef PhiNode, LLVMValueRef *IncomingValues,
553                      LLVMBasicBlockRef *IncomingBlocks, unsigned Count);
554 unsigned LLVMCountIncoming(LLVMValueRef PhiNode);
555 LLVMValueRef LLVMGetIncomingValue(LLVMValueRef PhiNode, unsigned Index);
556 LLVMBasicBlockRef LLVMGetIncomingBlock(LLVMValueRef PhiNode, unsigned Index);
557
558 /*===-- Instruction builders ----------------------------------------------===*/
559
560 /* An instruction builder represents a point within a basic block, and is the
561  * exclusive means of building instructions using the C interface.
562  */
563
564 LLVMBuilderRef LLVMCreateBuilder(void);
565 void LLVMPositionBuilder(LLVMBuilderRef Builder, LLVMBasicBlockRef Block,
566                          LLVMValueRef Instr);
567 void LLVMPositionBuilderBefore(LLVMBuilderRef Builder, LLVMValueRef Instr);
568 void LLVMPositionBuilderAtEnd(LLVMBuilderRef Builder, LLVMBasicBlockRef Block);
569 LLVMBasicBlockRef LLVMGetInsertBlock(LLVMBuilderRef Builder);
570 void LLVMClearInsertionPosition(LLVMBuilderRef Builder);
571 void LLVMInsertIntoBuilder(LLVMBuilderRef Builder, LLVMValueRef Instr);
572 void LLVMDisposeBuilder(LLVMBuilderRef Builder);
573
574 /* Terminators */
575 LLVMValueRef LLVMBuildRetVoid(LLVMBuilderRef);
576 LLVMValueRef LLVMBuildRet(LLVMBuilderRef, LLVMValueRef V);
577 LLVMValueRef LLVMBuildBr(LLVMBuilderRef, LLVMBasicBlockRef Dest);
578 LLVMValueRef LLVMBuildCondBr(LLVMBuilderRef, LLVMValueRef If,
579                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Else);
580 LLVMValueRef LLVMBuildSwitch(LLVMBuilderRef, LLVMValueRef V,
581                              LLVMBasicBlockRef Else, unsigned NumCases);
582 LLVMValueRef LLVMBuildInvoke(LLVMBuilderRef, LLVMValueRef Fn,
583                              LLVMValueRef *Args, unsigned NumArgs,
584                              LLVMBasicBlockRef Then, LLVMBasicBlockRef Catch,
585                              const char *Name);
586 LLVMValueRef LLVMBuildUnwind(LLVMBuilderRef);
587 LLVMValueRef LLVMBuildUnreachable(LLVMBuilderRef);
588
589 /* Add a case to the switch instruction */
590 void LLVMAddCase(LLVMValueRef Switch, LLVMValueRef OnVal,
591                  LLVMBasicBlockRef Dest);
592
593 /* Arithmetic */
594 LLVMValueRef LLVMBuildAdd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
595                           const char *Name);
596 LLVMValueRef LLVMBuildSub(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
597                           const char *Name);
598 LLVMValueRef LLVMBuildMul(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
599                           const char *Name);
600 LLVMValueRef LLVMBuildUDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
601                            const char *Name);
602 LLVMValueRef LLVMBuildSDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
603                            const char *Name);
604 LLVMValueRef LLVMBuildFDiv(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
605                            const char *Name);
606 LLVMValueRef LLVMBuildURem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
607                            const char *Name);
608 LLVMValueRef LLVMBuildSRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
609                            const char *Name);
610 LLVMValueRef LLVMBuildFRem(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
611                            const char *Name);
612 LLVMValueRef LLVMBuildShl(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
613                            const char *Name);
614 LLVMValueRef LLVMBuildLShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
615                            const char *Name);
616 LLVMValueRef LLVMBuildAShr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
617                            const char *Name);
618 LLVMValueRef LLVMBuildAnd(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
619                           const char *Name);
620 LLVMValueRef LLVMBuildOr(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
621                           const char *Name);
622 LLVMValueRef LLVMBuildXor(LLVMBuilderRef, LLVMValueRef LHS, LLVMValueRef RHS,
623                           const char *Name);
624 LLVMValueRef LLVMBuildNeg(LLVMBuilderRef, LLVMValueRef V, const char *Name);
625 LLVMValueRef LLVMBuildNot(LLVMBuilderRef, LLVMValueRef V, const char *Name);
626
627 /* Memory */
628 LLVMValueRef LLVMBuildMalloc(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
629 LLVMValueRef LLVMBuildArrayMalloc(LLVMBuilderRef, LLVMTypeRef Ty,
630                                   LLVMValueRef Val, const char *Name);
631 LLVMValueRef LLVMBuildAlloca(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
632 LLVMValueRef LLVMBuildArrayAlloca(LLVMBuilderRef, LLVMTypeRef Ty,
633                                   LLVMValueRef Val, const char *Name);
634 LLVMValueRef LLVMBuildFree(LLVMBuilderRef, LLVMValueRef PointerVal);
635 LLVMValueRef LLVMBuildLoad(LLVMBuilderRef, LLVMValueRef PointerVal,
636                            const char *Name);
637 LLVMValueRef LLVMBuildStore(LLVMBuilderRef, LLVMValueRef Val, LLVMValueRef Ptr);
638 LLVMValueRef LLVMBuildGEP(LLVMBuilderRef B, LLVMValueRef Pointer,
639                           LLVMValueRef *Indices, unsigned NumIndices,
640                           const char *Name);
641
642 /* Casts */
643 LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val,
644                             LLVMTypeRef DestTy, const char *Name);
645 LLVMValueRef LLVMBuildZExt(LLVMBuilderRef, LLVMValueRef Val,
646                            LLVMTypeRef DestTy, const char *Name);
647 LLVMValueRef LLVMBuildSExt(LLVMBuilderRef, LLVMValueRef Val,
648                            LLVMTypeRef DestTy, const char *Name);
649 LLVMValueRef LLVMBuildFPToUI(LLVMBuilderRef, LLVMValueRef Val,
650                              LLVMTypeRef DestTy, const char *Name);
651 LLVMValueRef LLVMBuildFPToSI(LLVMBuilderRef, LLVMValueRef Val,
652                              LLVMTypeRef DestTy, const char *Name);
653 LLVMValueRef LLVMBuildUIToFP(LLVMBuilderRef, LLVMValueRef Val,
654                              LLVMTypeRef DestTy, const char *Name);
655 LLVMValueRef LLVMBuildSIToFP(LLVMBuilderRef, LLVMValueRef Val,
656                              LLVMTypeRef DestTy, const char *Name);
657 LLVMValueRef LLVMBuildFPTrunc(LLVMBuilderRef, LLVMValueRef Val,
658                               LLVMTypeRef DestTy, const char *Name);
659 LLVMValueRef LLVMBuildFPExt(LLVMBuilderRef, LLVMValueRef Val,
660                             LLVMTypeRef DestTy, const char *Name);
661 LLVMValueRef LLVMBuildPtrToInt(LLVMBuilderRef, LLVMValueRef Val,
662                                LLVMTypeRef DestTy, const char *Name);
663 LLVMValueRef LLVMBuildIntToPtr(LLVMBuilderRef, LLVMValueRef Val,
664                                LLVMTypeRef DestTy, const char *Name);
665 LLVMValueRef LLVMBuildBitCast(LLVMBuilderRef, LLVMValueRef Val,
666                               LLVMTypeRef DestTy, const char *Name);
667
668 /* Comparisons */
669 LLVMValueRef LLVMBuildICmp(LLVMBuilderRef, LLVMIntPredicate Op,
670                            LLVMValueRef LHS, LLVMValueRef RHS,
671                            const char *Name);
672 LLVMValueRef LLVMBuildFCmp(LLVMBuilderRef, LLVMRealPredicate Op,
673                            LLVMValueRef LHS, LLVMValueRef RHS,
674                            const char *Name);
675
676 /* Miscellaneous instructions */
677 LLVMValueRef LLVMBuildPhi(LLVMBuilderRef, LLVMTypeRef Ty, const char *Name);
678 LLVMValueRef LLVMBuildCall(LLVMBuilderRef, LLVMValueRef Fn,
679                            LLVMValueRef *Args, unsigned NumArgs,
680                            const char *Name);
681 LLVMValueRef LLVMBuildSelect(LLVMBuilderRef, LLVMValueRef If,
682                              LLVMValueRef Then, LLVMValueRef Else,
683                              const char *Name);
684 LLVMValueRef LLVMBuildVAArg(LLVMBuilderRef, LLVMValueRef List, LLVMTypeRef Ty,
685                             const char *Name);
686 LLVMValueRef LLVMBuildExtractElement(LLVMBuilderRef, LLVMValueRef VecVal,
687                                      LLVMValueRef Index, const char *Name);
688 LLVMValueRef LLVMBuildInsertElement(LLVMBuilderRef, LLVMValueRef VecVal,
689                                     LLVMValueRef EltVal, LLVMValueRef Index,
690                                     const char *Name);
691 LLVMValueRef LLVMBuildShuffleVector(LLVMBuilderRef, LLVMValueRef V1,
692                                     LLVMValueRef V2, LLVMValueRef Mask,
693                                     const char *Name);
694 LLVMValueRef LLVMBuildExtractValue(LLVMBuilderRef, LLVMValueRef AggVal,
695                                    unsigned Index, const char *Name);
696 LLVMValueRef LLVMBuildInsertValue(LLVMBuilderRef, LLVMValueRef AggVal,
697                                   LLVMValueRef EltVal, unsigned Index,
698                                   const char *Name);
699
700
701 /*===-- Module providers --------------------------------------------------===*/
702
703 /* Encapsulates the module M in a module provider, taking ownership of the
704  * module.
705  * See the constructor llvm::ExistingModuleProvider::ExistingModuleProvider.
706  */
707 LLVMModuleProviderRef
708 LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
709
710 /* Destroys the module provider MP as well as the contained module.
711  * See the destructor llvm::ModuleProvider::~ModuleProvider.
712  */
713 void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP);
714
715
716 /*===-- Memory buffers ----------------------------------------------------===*/
717
718 int LLVMCreateMemoryBufferWithContentsOfFile(const char *Path,
719                                              LLVMMemoryBufferRef *OutMemBuf,
720                                              char **OutMessage);
721 int LLVMCreateMemoryBufferWithSTDIN(LLVMMemoryBufferRef *OutMemBuf,
722                                     char **OutMessage);
723 void LLVMDisposeMemoryBuffer(LLVMMemoryBufferRef MemBuf);
724
725
726 /*===-- Pass Managers -----------------------------------------------------===*/
727
728 /** Constructs a new whole-module pass pipeline. This type of pipeline is
729     suitable for link-time optimization and whole-module transformations.
730     See llvm::PassManager::PassManager. */
731 LLVMPassManagerRef LLVMCreatePassManager(void);
732
733 /** Constructs a new function-by-function pass pipeline over the module
734     provider. It does not take ownership of the module provider. This type of
735     pipeline is suitable for code generation and JIT compilation tasks.
736     See llvm::FunctionPassManager::FunctionPassManager. */
737 LLVMPassManagerRef LLVMCreateFunctionPassManager(LLVMModuleProviderRef MP);
738
739 /** Initializes, executes on the provided module, and finalizes all of the
740     passes scheduled in the pass manager. Returns 1 if any of the passes
741     modified the module, 0 otherwise. See llvm::PassManager::run(Module&). */
742 int LLVMRunPassManager(LLVMPassManagerRef PM, LLVMModuleRef M);
743
744 /** Initializes all of the function passes scheduled in the function pass
745     manager. Returns 1 if any of the passes modified the module, 0 otherwise.
746     See llvm::FunctionPassManager::doInitialization. */
747 int LLVMInitializeFunctionPassManager(LLVMPassManagerRef FPM);
748
749 /** Executes all of the function passes scheduled in the function pass manager
750     on the provided function. Returns 1 if any of the passes modified the
751     function, false otherwise.
752     See llvm::FunctionPassManager::run(Function&). */
753 int LLVMRunFunctionPassManager(LLVMPassManagerRef FPM, LLVMValueRef F);
754
755 /** Finalizes all of the function passes scheduled in in the function pass
756     manager. Returns 1 if any of the passes modified the module, 0 otherwise.
757     See llvm::FunctionPassManager::doFinalization. */
758 int LLVMFinalizeFunctionPassManager(LLVMPassManagerRef FPM);
759
760 /** Frees the memory of a pass pipeline. For function pipelines, does not free
761     the module provider.
762     See llvm::PassManagerBase::~PassManagerBase. */
763 void LLVMDisposePassManager(LLVMPassManagerRef PM);
764
765
766 #ifdef __cplusplus
767 }
768
769 namespace llvm {
770   class ModuleProvider;
771   class MemoryBuffer;
772   class PassManagerBase;
773   
774   #define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)   \
775     inline ty *unwrap(ref P) {                          \
776       return reinterpret_cast<ty*>(P);                  \
777     }                                                   \
778                                                         \
779     inline ref wrap(const ty *P) {                      \
780       return reinterpret_cast<ref>(const_cast<ty*>(P)); \
781     }
782   
783   #define DEFINE_ISA_CONVERSION_FUNCTIONS(ty, ref)  \
784     DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)         \
785                                                         \
786     template<typename T>                                \
787     inline T *unwrap(ref P) {                           \
788       return cast<T>(unwrap(P));                        \
789     }
790   
791   #define DEFINE_STDCXX_CONVERSION_FUNCTIONS(ty, ref)   \
792     DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)         \
793                                                         \
794     template<typename T>                                \
795     inline T *unwrap(ref P) {                           \
796       T *Q = dynamic_cast<T*>(unwrap(P));               \
797       assert(Q && "Invalid cast!");                     \
798       return Q;                                         \
799     }
800   
801   DEFINE_ISA_CONVERSION_FUNCTIONS   (Type,               LLVMTypeRef          )
802   DEFINE_ISA_CONVERSION_FUNCTIONS   (Value,              LLVMValueRef         )
803   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module,             LLVMModuleRef        )
804   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(BasicBlock,         LLVMBasicBlockRef    )
805   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(IRBuilder<>,        LLVMBuilderRef       )
806   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(PATypeHolder,       LLVMTypeHandleRef    )
807   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ModuleProvider,     LLVMModuleProviderRef)
808   DEFINE_SIMPLE_CONVERSION_FUNCTIONS(MemoryBuffer,       LLVMMemoryBufferRef  )
809   DEFINE_STDCXX_CONVERSION_FUNCTIONS(PassManagerBase,    LLVMPassManagerRef   )
810   
811   #undef DEFINE_STDCXX_CONVERSION_FUNCTIONS
812   #undef DEFINE_ISA_CONVERSION_FUNCTIONS
813   #undef DEFINE_SIMPLE_CONVERSION_FUNCTIONS
814   
815   /* Specialized opaque type conversions.
816    */
817   inline Type **unwrap(LLVMTypeRef* Tys) {
818     return reinterpret_cast<Type**>(Tys);
819   }
820   
821   inline LLVMTypeRef *wrap(const Type **Tys) {
822     return reinterpret_cast<LLVMTypeRef*>(const_cast<Type**>(Tys));
823   }
824   
825   /* Specialized opaque value conversions.
826    */ 
827   inline Value **unwrap(LLVMValueRef *Vals) {
828     return reinterpret_cast<Value**>(Vals);
829   }
830   
831   template<typename T>
832   inline T **unwrap(LLVMValueRef *Vals, unsigned Length) {
833     #if DEBUG
834     for (LLVMValueRef *I = Vals, E = Vals + Length; I != E; ++I)
835       cast<T>(*I);
836     #endif
837     return reinterpret_cast<T**>(Vals);
838   }
839   
840   inline LLVMValueRef *wrap(const Value **Vals) {
841     return reinterpret_cast<LLVMValueRef*>(const_cast<Value**>(Vals));
842   }
843 }
844
845 #endif /* !defined(__cplusplus) */
846
847 #endif /* !defined(LLVM_C_CORE_H) */