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