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