blob 9daa96eb (64947B) - Raw
1 //! We do this instead of @cImport because the self-hosted compiler is easier 2 //! to bootstrap if it does not depend on translate-c. 3 4 /// Do not compare directly to .True, use toBool() instead. 5 pub const Bool = enum(c_int) { 6 False, 7 True, 8 _, 9 10 pub fn fromBool(b: bool) Bool { 11 return @intToEnum(Bool, @boolToInt(b)); 12 } 13 14 pub fn toBool(b: Bool) bool { 15 return b != .False; 16 } 17 }; 18 pub const AttributeIndex = c_uint; 19 20 /// Make sure to use the *InContext functions instead of the global ones. 21 pub const Context = opaque { 22 pub const create = LLVMContextCreate; 23 extern fn LLVMContextCreate() *const Context; 24 25 pub const dispose = LLVMContextDispose; 26 extern fn LLVMContextDispose(C: *const Context) void; 27 28 pub const createEnumAttribute = LLVMCreateEnumAttribute; 29 extern fn LLVMCreateEnumAttribute(*const Context, KindID: c_uint, Val: u64) *const Attribute; 30 31 pub const createStringAttribute = LLVMCreateStringAttribute; 32 extern fn LLVMCreateStringAttribute(*const Context, Key: [*]const u8, Key_Len: c_uint, Value: [*]const u8, Value_Len: c_uint) *const Attribute; 33 34 pub const intType = LLVMIntTypeInContext; 35 extern fn LLVMIntTypeInContext(C: *const Context, NumBits: c_uint) *const Type; 36 37 pub const halfType = LLVMHalfTypeInContext; 38 extern fn LLVMHalfTypeInContext(C: *const Context) *const Type; 39 40 pub const floatType = LLVMFloatTypeInContext; 41 extern fn LLVMFloatTypeInContext(C: *const Context) *const Type; 42 43 pub const doubleType = LLVMDoubleTypeInContext; 44 extern fn LLVMDoubleTypeInContext(C: *const Context) *const Type; 45 46 pub const x86FP80Type = LLVMX86FP80TypeInContext; 47 extern fn LLVMX86FP80TypeInContext(C: *const Context) *const Type; 48 49 pub const fp128Type = LLVMFP128TypeInContext; 50 extern fn LLVMFP128TypeInContext(C: *const Context) *const Type; 51 52 pub const voidType = LLVMVoidTypeInContext; 53 extern fn LLVMVoidTypeInContext(C: *const Context) *const Type; 54 55 pub const structType = LLVMStructTypeInContext; 56 extern fn LLVMStructTypeInContext( 57 C: *const Context, 58 ElementTypes: [*]const *const Type, 59 ElementCount: c_uint, 60 Packed: Bool, 61 ) *const Type; 62 63 pub const structCreateNamed = LLVMStructCreateNamed; 64 extern fn LLVMStructCreateNamed(C: *const Context, Name: [*:0]const u8) *const Type; 65 66 pub const constString = LLVMConstStringInContext; 67 extern fn LLVMConstStringInContext(C: *const Context, Str: [*]const u8, Length: c_uint, DontNullTerminate: Bool) *const Value; 68 69 pub const constStruct = LLVMConstStructInContext; 70 extern fn LLVMConstStructInContext( 71 C: *const Context, 72 ConstantVals: [*]const *const Value, 73 Count: c_uint, 74 Packed: Bool, 75 ) *const Value; 76 77 pub const createBasicBlock = LLVMCreateBasicBlockInContext; 78 extern fn LLVMCreateBasicBlockInContext(C: *const Context, Name: [*:0]const u8) *const BasicBlock; 79 80 pub const appendBasicBlock = LLVMAppendBasicBlockInContext; 81 extern fn LLVMAppendBasicBlockInContext(C: *const Context, Fn: *const Value, Name: [*:0]const u8) *const BasicBlock; 82 83 pub const createBuilder = LLVMCreateBuilderInContext; 84 extern fn LLVMCreateBuilderInContext(C: *const Context) *const Builder; 85 }; 86 87 pub const Value = opaque { 88 pub const addAttributeAtIndex = LLVMAddAttributeAtIndex; 89 extern fn LLVMAddAttributeAtIndex(*const Value, Idx: AttributeIndex, A: *const Attribute) void; 90 91 pub const removeEnumAttributeAtIndex = LLVMRemoveEnumAttributeAtIndex; 92 extern fn LLVMRemoveEnumAttributeAtIndex(F: *const Value, Idx: AttributeIndex, KindID: c_uint) void; 93 94 pub const getFirstBasicBlock = LLVMGetFirstBasicBlock; 95 extern fn LLVMGetFirstBasicBlock(Fn: *const Value) ?*const BasicBlock; 96 97 pub const appendExistingBasicBlock = LLVMAppendExistingBasicBlock; 98 extern fn LLVMAppendExistingBasicBlock(Fn: *const Value, BB: *const BasicBlock) void; 99 100 pub const addIncoming = LLVMAddIncoming; 101 extern fn LLVMAddIncoming( 102 PhiNode: *const Value, 103 IncomingValues: [*]const *const Value, 104 IncomingBlocks: [*]const *const BasicBlock, 105 Count: c_uint, 106 ) void; 107 108 pub const getNextInstruction = LLVMGetNextInstruction; 109 extern fn LLVMGetNextInstruction(Inst: *const Value) ?*const Value; 110 111 pub const typeOf = LLVMTypeOf; 112 extern fn LLVMTypeOf(Val: *const Value) *const Type; 113 114 pub const setGlobalConstant = LLVMSetGlobalConstant; 115 extern fn LLVMSetGlobalConstant(GlobalVar: *const Value, IsConstant: Bool) void; 116 117 pub const setLinkage = LLVMSetLinkage; 118 extern fn LLVMSetLinkage(Global: *const Value, Linkage: Linkage) void; 119 120 pub const setVisibility = LLVMSetVisibility; 121 extern fn LLVMSetVisibility(Global: *const Value, Linkage: Visibility) void; 122 123 pub const setUnnamedAddr = LLVMSetUnnamedAddr; 124 extern fn LLVMSetUnnamedAddr(Global: *const Value, HasUnnamedAddr: Bool) void; 125 126 pub const setThreadLocalMode = LLVMSetThreadLocalMode; 127 extern fn LLVMSetThreadLocalMode(Global: *const Value, Mode: ThreadLocalMode) void; 128 129 pub const setSection = LLVMSetSection; 130 extern fn LLVMSetSection(Global: *const Value, Section: [*:0]const u8) void; 131 132 pub const deleteGlobal = LLVMDeleteGlobal; 133 extern fn LLVMDeleteGlobal(GlobalVar: *const Value) void; 134 135 pub const getNextGlobalAlias = LLVMGetNextGlobalAlias; 136 extern fn LLVMGetNextGlobalAlias(GA: *const Value) *const Value; 137 138 pub const getAliasee = LLVMAliasGetAliasee; 139 extern fn LLVMAliasGetAliasee(Alias: *const Value) *const Value; 140 141 pub const setAliasee = LLVMAliasSetAliasee; 142 extern fn LLVMAliasSetAliasee(Alias: *const Value, Aliasee: *const Value) void; 143 144 pub const constInBoundsGEP = LLVMConstInBoundsGEP; 145 extern fn LLVMConstInBoundsGEP( 146 ConstantVal: *const Value, 147 ConstantIndices: [*]const *const Value, 148 NumIndices: c_uint, 149 ) *const Value; 150 151 pub const constBitCast = LLVMConstBitCast; 152 extern fn LLVMConstBitCast(ConstantVal: *const Value, ToType: *const Type) *const Value; 153 154 pub const constIntToPtr = LLVMConstIntToPtr; 155 extern fn LLVMConstIntToPtr(ConstantVal: *const Value, ToType: *const Type) *const Value; 156 157 pub const constPtrToInt = LLVMConstPtrToInt; 158 extern fn LLVMConstPtrToInt(ConstantVal: *const Value, ToType: *const Type) *const Value; 159 160 pub const constShl = LLVMConstShl; 161 extern fn LLVMConstShl(LHSConstant: *const Value, RHSConstant: *const Value) *const Value; 162 163 pub const constOr = LLVMConstOr; 164 extern fn LLVMConstOr(LHSConstant: *const Value, RHSConstant: *const Value) *const Value; 165 166 pub const constZExt = LLVMConstZExt; 167 extern fn LLVMConstZExt(ConstantVal: *const Value, ToType: *const Type) *const Value; 168 169 pub const constZExtOrBitCast = LLVMConstZExtOrBitCast; 170 extern fn LLVMConstZExtOrBitCast(ConstantVal: *const Value, ToType: *const Type) *const Value; 171 172 pub const constNot = LLVMConstNot; 173 extern fn LLVMConstNot(ConstantVal: *const Value) *const Value; 174 175 pub const constAdd = LLVMConstAdd; 176 extern fn LLVMConstAdd(LHSConstant: *const Value, RHSConstant: *const Value) *const Value; 177 178 pub const setWeak = LLVMSetWeak; 179 extern fn LLVMSetWeak(CmpXchgInst: *const Value, IsWeak: Bool) void; 180 181 pub const setOrdering = LLVMSetOrdering; 182 extern fn LLVMSetOrdering(MemoryAccessInst: *const Value, Ordering: AtomicOrdering) void; 183 184 pub const setVolatile = LLVMSetVolatile; 185 extern fn LLVMSetVolatile(MemoryAccessInst: *const Value, IsVolatile: Bool) void; 186 187 pub const setAlignment = LLVMSetAlignment; 188 extern fn LLVMSetAlignment(V: *const Value, Bytes: c_uint) void; 189 190 pub const getFunctionCallConv = LLVMGetFunctionCallConv; 191 extern fn LLVMGetFunctionCallConv(Fn: *const Value) CallConv; 192 193 pub const setFunctionCallConv = LLVMSetFunctionCallConv; 194 extern fn LLVMSetFunctionCallConv(Fn: *const Value, CC: CallConv) void; 195 196 pub const fnSetSubprogram = ZigLLVMFnSetSubprogram; 197 extern fn ZigLLVMFnSetSubprogram(f: *const Value, subprogram: *DISubprogram) void; 198 199 pub const setValueName = LLVMSetValueName; 200 extern fn LLVMSetValueName(Val: *const Value, Name: [*:0]const u8) void; 201 202 pub const setValueName2 = LLVMSetValueName2; 203 extern fn LLVMSetValueName2(Val: *const Value, Name: [*]const u8, NameLen: usize) void; 204 205 pub const getValueName = LLVMGetValueName; 206 extern fn LLVMGetValueName(Val: *const Value) [*:0]const u8; 207 208 pub const takeName = ZigLLVMTakeName; 209 extern fn ZigLLVMTakeName(new_owner: *const Value, victim: *const Value) void; 210 211 pub const deleteFunction = LLVMDeleteFunction; 212 extern fn LLVMDeleteFunction(Fn: *const Value) void; 213 214 pub const addSretAttr = ZigLLVMAddSretAttr; 215 extern fn ZigLLVMAddSretAttr(fn_ref: *const Value, type_val: *const Type) void; 216 217 pub const setCallSret = ZigLLVMSetCallSret; 218 extern fn ZigLLVMSetCallSret(Call: *const Value, return_type: *const Type) void; 219 220 pub const getParam = LLVMGetParam; 221 extern fn LLVMGetParam(Fn: *const Value, Index: c_uint) *const Value; 222 223 pub const setInitializer = LLVMSetInitializer; 224 extern fn LLVMSetInitializer(GlobalVar: *const Value, ConstantVal: *const Value) void; 225 226 pub const addCase = LLVMAddCase; 227 extern fn LLVMAddCase(Switch: *const Value, OnVal: *const Value, Dest: *const BasicBlock) void; 228 229 pub inline fn isPoison(Val: *const Value) bool { 230 return LLVMIsPoison(Val).toBool(); 231 } 232 extern fn LLVMIsPoison(Val: *const Value) Bool; 233 234 pub const replaceAllUsesWith = LLVMReplaceAllUsesWith; 235 extern fn LLVMReplaceAllUsesWith(OldVal: *const Value, NewVal: *const Value) void; 236 237 pub const globalGetValueType = LLVMGlobalGetValueType; 238 extern fn LLVMGlobalGetValueType(Global: *const Value) *const Type; 239 240 pub const getLinkage = LLVMGetLinkage; 241 extern fn LLVMGetLinkage(Global: *const Value) Linkage; 242 243 pub const getUnnamedAddress = LLVMGetUnnamedAddress; 244 extern fn LLVMGetUnnamedAddress(Global: *const Value) Bool; 245 246 pub const getAlignment = LLVMGetAlignment; 247 extern fn LLVMGetAlignment(V: *const Value) c_uint; 248 249 pub const addFunctionAttr = ZigLLVMAddFunctionAttr; 250 extern fn ZigLLVMAddFunctionAttr(Fn: *const Value, attr_name: [*:0]const u8, attr_value: [*:0]const u8) void; 251 252 pub const addByValAttr = ZigLLVMAddByValAttr; 253 extern fn ZigLLVMAddByValAttr(Fn: *const Value, ArgNo: c_uint, type: *const Type) void; 254 }; 255 256 pub const Type = opaque { 257 pub const constNull = LLVMConstNull; 258 extern fn LLVMConstNull(Ty: *const Type) *const Value; 259 260 pub const constAllOnes = LLVMConstAllOnes; 261 extern fn LLVMConstAllOnes(Ty: *const Type) *const Value; 262 263 pub const constInt = LLVMConstInt; 264 extern fn LLVMConstInt(IntTy: *const Type, N: c_ulonglong, SignExtend: Bool) *const Value; 265 266 pub const constIntOfArbitraryPrecision = LLVMConstIntOfArbitraryPrecision; 267 extern fn LLVMConstIntOfArbitraryPrecision(IntTy: *const Type, NumWords: c_uint, Words: [*]const u64) *const Value; 268 269 pub const constReal = LLVMConstReal; 270 extern fn LLVMConstReal(RealTy: *const Type, N: f64) *const Value; 271 272 pub const constArray = LLVMConstArray; 273 extern fn LLVMConstArray(ElementTy: *const Type, ConstantVals: [*]const *const Value, Length: c_uint) *const Value; 274 275 pub const constNamedStruct = LLVMConstNamedStruct; 276 extern fn LLVMConstNamedStruct( 277 StructTy: *const Type, 278 ConstantVals: [*]const *const Value, 279 Count: c_uint, 280 ) *const Value; 281 282 pub const getUndef = LLVMGetUndef; 283 extern fn LLVMGetUndef(Ty: *const Type) *const Value; 284 285 pub const pointerType = LLVMPointerType; 286 extern fn LLVMPointerType(ElementType: *const Type, AddressSpace: c_uint) *const Type; 287 288 pub const arrayType = LLVMArrayType; 289 extern fn LLVMArrayType(ElementType: *const Type, ElementCount: c_uint) *const Type; 290 291 pub const vectorType = LLVMVectorType; 292 extern fn LLVMVectorType(ElementType: *const Type, ElementCount: c_uint) *const Type; 293 294 pub const structSetBody = LLVMStructSetBody; 295 extern fn LLVMStructSetBody( 296 StructTy: *const Type, 297 ElementTypes: [*]*const Type, 298 ElementCount: c_uint, 299 Packed: Bool, 300 ) void; 301 302 pub const structGetTypeAtIndex = LLVMStructGetTypeAtIndex; 303 extern fn LLVMStructGetTypeAtIndex(StructTy: *const Type, i: c_uint) *const Type; 304 305 pub const getTypeKind = LLVMGetTypeKind; 306 extern fn LLVMGetTypeKind(Ty: *const Type) TypeKind; 307 308 pub const getElementType = LLVMGetElementType; 309 extern fn LLVMGetElementType(Ty: *const Type) *const Type; 310 311 pub const countStructElementTypes = LLVMCountStructElementTypes; 312 extern fn LLVMCountStructElementTypes(StructTy: *const Type) c_uint; 313 314 pub const isOpaqueStruct = LLVMIsOpaqueStruct; 315 extern fn LLVMIsOpaqueStruct(StructTy: *const Type) Bool; 316 317 pub const isSized = LLVMTypeIsSized; 318 extern fn LLVMTypeIsSized(Ty: *const Type) Bool; 319 }; 320 321 pub const Module = opaque { 322 pub const createWithName = LLVMModuleCreateWithNameInContext; 323 extern fn LLVMModuleCreateWithNameInContext(ModuleID: [*:0]const u8, C: *const Context) *const Module; 324 325 pub const dispose = LLVMDisposeModule; 326 extern fn LLVMDisposeModule(*const Module) void; 327 328 pub const verify = LLVMVerifyModule; 329 extern fn LLVMVerifyModule(*const Module, Action: VerifierFailureAction, OutMessage: *[*:0]const u8) Bool; 330 331 pub const setModuleDataLayout = LLVMSetModuleDataLayout; 332 extern fn LLVMSetModuleDataLayout(*const Module, *const TargetData) void; 333 334 pub const setModulePICLevel = ZigLLVMSetModulePICLevel; 335 extern fn ZigLLVMSetModulePICLevel(module: *const Module) void; 336 337 pub const setModulePIELevel = ZigLLVMSetModulePIELevel; 338 extern fn ZigLLVMSetModulePIELevel(module: *const Module) void; 339 340 pub const setModuleCodeModel = ZigLLVMSetModuleCodeModel; 341 extern fn ZigLLVMSetModuleCodeModel(module: *const Module, code_model: CodeModel) void; 342 343 pub const addFunction = LLVMAddFunction; 344 extern fn LLVMAddFunction(*const Module, Name: [*:0]const u8, FunctionTy: *const Type) *const Value; 345 346 pub const addFunctionInAddressSpace = ZigLLVMAddFunctionInAddressSpace; 347 extern fn ZigLLVMAddFunctionInAddressSpace(*const Module, Name: [*:0]const u8, FunctionTy: *const Type, AddressSpace: c_uint) *const Value; 348 349 pub const getNamedFunction = LLVMGetNamedFunction; 350 extern fn LLVMGetNamedFunction(*const Module, Name: [*:0]const u8) ?*const Value; 351 352 pub const getIntrinsicDeclaration = LLVMGetIntrinsicDeclaration; 353 extern fn LLVMGetIntrinsicDeclaration(Mod: *const Module, ID: c_uint, ParamTypes: ?[*]const *const Type, ParamCount: usize) *const Value; 354 355 pub const printToString = LLVMPrintModuleToString; 356 extern fn LLVMPrintModuleToString(*const Module) [*:0]const u8; 357 358 pub const addGlobal = LLVMAddGlobal; 359 extern fn LLVMAddGlobal(M: *const Module, Ty: *const Type, Name: [*:0]const u8) *const Value; 360 361 pub const addGlobalInAddressSpace = LLVMAddGlobalInAddressSpace; 362 extern fn LLVMAddGlobalInAddressSpace(M: *const Module, Ty: *const Type, Name: [*:0]const u8, AddressSpace: c_uint) *const Value; 363 364 pub const getNamedGlobal = LLVMGetNamedGlobal; 365 extern fn LLVMGetNamedGlobal(M: *const Module, Name: [*:0]const u8) ?*const Value; 366 367 pub const dump = LLVMDumpModule; 368 extern fn LLVMDumpModule(M: *const Module) void; 369 370 pub const getFirstGlobalAlias = LLVMGetFirstGlobalAlias; 371 extern fn LLVMGetFirstGlobalAlias(M: *const Module) *const Value; 372 373 pub const getLastGlobalAlias = LLVMGetLastGlobalAlias; 374 extern fn LLVMGetLastGlobalAlias(M: *const Module) *const Value; 375 376 pub const addAlias = LLVMAddAlias2; 377 extern fn LLVMAddAlias2( 378 M: *const Module, 379 Ty: *const Type, 380 AddrSpace: c_uint, 381 Aliasee: *const Value, 382 Name: [*:0]const u8, 383 ) *const Value; 384 385 pub const getNamedGlobalAlias = LLVMGetNamedGlobalAlias; 386 extern fn LLVMGetNamedGlobalAlias( 387 M: *const Module, 388 /// Empirically, LLVM will call strlen() on `Name` and so it 389 /// must be both null terminated and also have `NameLen` set 390 /// to the size. 391 Name: [*:0]const u8, 392 NameLen: usize, 393 ) ?*const Value; 394 395 pub const setTarget = LLVMSetTarget; 396 extern fn LLVMSetTarget(M: *const Module, Triple: [*:0]const u8) void; 397 398 pub const addModuleDebugInfoFlag = ZigLLVMAddModuleDebugInfoFlag; 399 extern fn ZigLLVMAddModuleDebugInfoFlag(module: *const Module) void; 400 401 pub const addModuleCodeViewFlag = ZigLLVMAddModuleCodeViewFlag; 402 extern fn ZigLLVMAddModuleCodeViewFlag(module: *const Module) void; 403 404 pub const createDIBuilder = ZigLLVMCreateDIBuilder; 405 extern fn ZigLLVMCreateDIBuilder(module: *const Module, allow_unresolved: bool) *DIBuilder; 406 407 pub const setModuleInlineAsm2 = LLVMSetModuleInlineAsm2; 408 extern fn LLVMSetModuleInlineAsm2(M: *const Module, Asm: [*]const u8, Len: usize) void; 409 410 pub const printModuleToFile = LLVMPrintModuleToFile; 411 extern fn LLVMPrintModuleToFile(M: *const Module, Filename: [*:0]const u8, ErrorMessage: *[*:0]const u8) Bool; 412 }; 413 414 pub const lookupIntrinsicID = LLVMLookupIntrinsicID; 415 extern fn LLVMLookupIntrinsicID(Name: [*]const u8, NameLen: usize) c_uint; 416 417 pub const disposeMessage = LLVMDisposeMessage; 418 extern fn LLVMDisposeMessage(Message: [*:0]const u8) void; 419 420 pub const VerifierFailureAction = enum(c_int) { 421 AbortProcess, 422 PrintMessage, 423 ReturnStatus, 424 }; 425 426 pub const constNeg = LLVMConstNeg; 427 extern fn LLVMConstNeg(ConstantVal: *const Value) *const Value; 428 429 pub const constVector = LLVMConstVector; 430 extern fn LLVMConstVector( 431 ScalarConstantVals: [*]*const Value, 432 Size: c_uint, 433 ) *const Value; 434 435 pub const getEnumAttributeKindForName = LLVMGetEnumAttributeKindForName; 436 extern fn LLVMGetEnumAttributeKindForName(Name: [*]const u8, SLen: usize) c_uint; 437 438 pub const getInlineAsm = LLVMGetInlineAsm; 439 extern fn LLVMGetInlineAsm( 440 Ty: *const Type, 441 AsmString: [*]const u8, 442 AsmStringSize: usize, 443 Constraints: [*]const u8, 444 ConstraintsSize: usize, 445 HasSideEffects: Bool, 446 IsAlignStack: Bool, 447 Dialect: InlineAsmDialect, 448 CanThrow: Bool, 449 ) *const Value; 450 451 pub const functionType = LLVMFunctionType; 452 extern fn LLVMFunctionType( 453 ReturnType: *const Type, 454 ParamTypes: [*]const *const Type, 455 ParamCount: c_uint, 456 IsVarArg: Bool, 457 ) *const Type; 458 459 pub const InlineAsmDialect = enum(c_uint) { ATT, Intel }; 460 461 pub const Attribute = opaque {}; 462 463 pub const Builder = opaque { 464 pub const dispose = LLVMDisposeBuilder; 465 extern fn LLVMDisposeBuilder(Builder: *const Builder) void; 466 467 pub const positionBuilder = LLVMPositionBuilder; 468 extern fn LLVMPositionBuilder( 469 Builder: *const Builder, 470 Block: *const BasicBlock, 471 Instr: *const Value, 472 ) void; 473 474 pub const positionBuilderAtEnd = LLVMPositionBuilderAtEnd; 475 extern fn LLVMPositionBuilderAtEnd(Builder: *const Builder, Block: *const BasicBlock) void; 476 477 pub const getInsertBlock = LLVMGetInsertBlock; 478 extern fn LLVMGetInsertBlock(Builder: *const Builder) *const BasicBlock; 479 480 pub const buildZExt = LLVMBuildZExt; 481 extern fn LLVMBuildZExt( 482 *const Builder, 483 Value: *const Value, 484 DestTy: *const Type, 485 Name: [*:0]const u8, 486 ) *const Value; 487 488 pub const buildZExtOrBitCast = LLVMBuildZExtOrBitCast; 489 extern fn LLVMBuildZExtOrBitCast( 490 *const Builder, 491 Val: *const Value, 492 DestTy: *const Type, 493 Name: [*:0]const u8, 494 ) *const Value; 495 496 pub const buildSExt = LLVMBuildSExt; 497 extern fn LLVMBuildSExt( 498 *const Builder, 499 Val: *const Value, 500 DestTy: *const Type, 501 Name: [*:0]const u8, 502 ) *const Value; 503 504 pub const buildSExtOrBitCast = LLVMBuildSExtOrBitCast; 505 extern fn LLVMBuildSExtOrBitCast( 506 *const Builder, 507 Val: *const Value, 508 DestTy: *const Type, 509 Name: [*:0]const u8, 510 ) *const Value; 511 512 pub const buildCall = ZigLLVMBuildCall; 513 extern fn ZigLLVMBuildCall( 514 *const Builder, 515 Fn: *const Value, 516 Args: [*]const *const Value, 517 NumArgs: c_uint, 518 CC: CallConv, 519 attr: CallAttr, 520 Name: [*:0]const u8, 521 ) *const Value; 522 523 pub const buildRetVoid = LLVMBuildRetVoid; 524 extern fn LLVMBuildRetVoid(*const Builder) *const Value; 525 526 pub const buildRet = LLVMBuildRet; 527 extern fn LLVMBuildRet(*const Builder, V: *const Value) *const Value; 528 529 pub const buildUnreachable = LLVMBuildUnreachable; 530 extern fn LLVMBuildUnreachable(*const Builder) *const Value; 531 532 pub const buildAlloca = LLVMBuildAlloca; 533 extern fn LLVMBuildAlloca(*const Builder, Ty: *const Type, Name: [*:0]const u8) *const Value; 534 535 pub const buildStore = LLVMBuildStore; 536 extern fn LLVMBuildStore(*const Builder, Val: *const Value, Ptr: *const Value) *const Value; 537 538 pub const buildLoad = LLVMBuildLoad; 539 extern fn LLVMBuildLoad(*const Builder, PointerVal: *const Value, Name: [*:0]const u8) *const Value; 540 541 pub const buildNeg = LLVMBuildNeg; 542 extern fn LLVMBuildNeg(*const Builder, V: *const Value, Name: [*:0]const u8) *const Value; 543 544 pub const buildNot = LLVMBuildNot; 545 extern fn LLVMBuildNot(*const Builder, V: *const Value, Name: [*:0]const u8) *const Value; 546 547 pub const buildFAdd = LLVMBuildFAdd; 548 extern fn LLVMBuildFAdd(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 549 550 pub const buildAdd = LLVMBuildAdd; 551 extern fn LLVMBuildAdd(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 552 553 pub const buildNSWAdd = LLVMBuildNSWAdd; 554 extern fn LLVMBuildNSWAdd(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 555 556 pub const buildNUWAdd = LLVMBuildNUWAdd; 557 extern fn LLVMBuildNUWAdd(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 558 559 pub const buildSAddSat = ZigLLVMBuildSAddSat; 560 extern fn ZigLLVMBuildSAddSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 561 562 pub const buildUAddSat = ZigLLVMBuildUAddSat; 563 extern fn ZigLLVMBuildUAddSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 564 565 pub const buildFSub = LLVMBuildFSub; 566 extern fn LLVMBuildFSub(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 567 568 pub const buildFNeg = LLVMBuildFNeg; 569 extern fn LLVMBuildFNeg(*const Builder, V: *const Value, Name: [*:0]const u8) *const Value; 570 571 pub const buildSub = LLVMBuildSub; 572 extern fn LLVMBuildSub(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 573 574 pub const buildNSWSub = LLVMBuildNSWSub; 575 extern fn LLVMBuildNSWSub(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 576 577 pub const buildNUWSub = LLVMBuildNUWSub; 578 extern fn LLVMBuildNUWSub(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 579 580 pub const buildSSubSat = ZigLLVMBuildSSubSat; 581 extern fn ZigLLVMBuildSSubSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 582 583 pub const buildUSubSat = ZigLLVMBuildUSubSat; 584 extern fn ZigLLVMBuildUSubSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 585 586 pub const buildFMul = LLVMBuildFMul; 587 extern fn LLVMBuildFMul(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 588 589 pub const buildMul = LLVMBuildMul; 590 extern fn LLVMBuildMul(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 591 592 pub const buildNSWMul = LLVMBuildNSWMul; 593 extern fn LLVMBuildNSWMul(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 594 595 pub const buildNUWMul = LLVMBuildNUWMul; 596 extern fn LLVMBuildNUWMul(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 597 598 pub const buildSMulFixSat = ZigLLVMBuildSMulFixSat; 599 extern fn ZigLLVMBuildSMulFixSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 600 601 pub const buildUMulFixSat = ZigLLVMBuildUMulFixSat; 602 extern fn ZigLLVMBuildUMulFixSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 603 604 pub const buildUDiv = LLVMBuildUDiv; 605 extern fn LLVMBuildUDiv(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 606 607 pub const buildSDiv = LLVMBuildSDiv; 608 extern fn LLVMBuildSDiv(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 609 610 pub const buildFDiv = LLVMBuildFDiv; 611 extern fn LLVMBuildFDiv(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 612 613 pub const buildURem = LLVMBuildURem; 614 extern fn LLVMBuildURem(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 615 616 pub const buildSRem = LLVMBuildSRem; 617 extern fn LLVMBuildSRem(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 618 619 pub const buildFRem = LLVMBuildFRem; 620 extern fn LLVMBuildFRem(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 621 622 pub const buildAnd = LLVMBuildAnd; 623 extern fn LLVMBuildAnd(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 624 625 pub const buildLShr = LLVMBuildLShr; 626 extern fn LLVMBuildLShr(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 627 628 pub const buildAShr = LLVMBuildAShr; 629 extern fn LLVMBuildAShr(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 630 631 pub const buildLShrExact = ZigLLVMBuildLShrExact; 632 extern fn ZigLLVMBuildLShrExact(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 633 634 pub const buildAShrExact = ZigLLVMBuildAShrExact; 635 extern fn ZigLLVMBuildAShrExact(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 636 637 pub const buildShl = LLVMBuildShl; 638 extern fn LLVMBuildShl(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 639 640 pub const buildNUWShl = ZigLLVMBuildNUWShl; 641 extern fn ZigLLVMBuildNUWShl(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 642 643 pub const buildNSWShl = ZigLLVMBuildNSWShl; 644 extern fn ZigLLVMBuildNSWShl(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 645 646 pub const buildSShlSat = ZigLLVMBuildSShlSat; 647 extern fn ZigLLVMBuildSShlSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 648 649 pub const buildUShlSat = ZigLLVMBuildUShlSat; 650 extern fn ZigLLVMBuildUShlSat(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 651 652 pub const buildOr = LLVMBuildOr; 653 extern fn LLVMBuildOr(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 654 655 pub const buildXor = LLVMBuildXor; 656 extern fn LLVMBuildXor(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 657 658 pub const buildIntCast2 = LLVMBuildIntCast2; 659 extern fn LLVMBuildIntCast2(*const Builder, Val: *const Value, DestTy: *const Type, IsSigned: Bool, Name: [*:0]const u8) *const Value; 660 661 pub const buildBitCast = LLVMBuildBitCast; 662 extern fn LLVMBuildBitCast(*const Builder, Val: *const Value, DestTy: *const Type, Name: [*:0]const u8) *const Value; 663 664 pub const buildInBoundsGEP = LLVMBuildInBoundsGEP; 665 extern fn LLVMBuildInBoundsGEP( 666 B: *const Builder, 667 Pointer: *const Value, 668 Indices: [*]const *const Value, 669 NumIndices: c_uint, 670 Name: [*:0]const u8, 671 ) *const Value; 672 673 pub const buildInBoundsGEP2 = LLVMBuildInBoundsGEP2; 674 extern fn LLVMBuildInBoundsGEP2( 675 B: *const Builder, 676 Ty: *const Type, 677 Pointer: *const Value, 678 Indices: [*]const *const Value, 679 NumIndices: c_uint, 680 Name: [*:0]const u8, 681 ) *const Value; 682 683 pub const buildICmp = LLVMBuildICmp; 684 extern fn LLVMBuildICmp(*const Builder, Op: IntPredicate, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 685 686 pub const buildFCmp = LLVMBuildFCmp; 687 extern fn LLVMBuildFCmp(*const Builder, Op: RealPredicate, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 688 689 pub const buildBr = LLVMBuildBr; 690 extern fn LLVMBuildBr(*const Builder, Dest: *const BasicBlock) *const Value; 691 692 pub const buildCondBr = LLVMBuildCondBr; 693 extern fn LLVMBuildCondBr(*const Builder, If: *const Value, Then: *const BasicBlock, Else: *const BasicBlock) *const Value; 694 695 pub const buildSwitch = LLVMBuildSwitch; 696 extern fn LLVMBuildSwitch(*const Builder, V: *const Value, Else: *const BasicBlock, NumCases: c_uint) *const Value; 697 698 pub const buildPhi = LLVMBuildPhi; 699 extern fn LLVMBuildPhi(*const Builder, Ty: *const Type, Name: [*:0]const u8) *const Value; 700 701 pub const buildExtractValue = LLVMBuildExtractValue; 702 extern fn LLVMBuildExtractValue( 703 *const Builder, 704 AggVal: *const Value, 705 Index: c_uint, 706 Name: [*:0]const u8, 707 ) *const Value; 708 709 pub const buildExtractElement = LLVMBuildExtractElement; 710 extern fn LLVMBuildExtractElement( 711 *const Builder, 712 VecVal: *const Value, 713 Index: *const Value, 714 Name: [*:0]const u8, 715 ) *const Value; 716 717 pub const buildInsertElement = LLVMBuildInsertElement; 718 extern fn LLVMBuildInsertElement( 719 *const Builder, 720 VecVal: *const Value, 721 EltVal: *const Value, 722 Index: *const Value, 723 Name: [*:0]const u8, 724 ) *const Value; 725 726 pub const buildVectorSplat = LLVMBuildVectorSplat; 727 extern fn LLVMBuildVectorSplat( 728 *const Builder, 729 ElementCount: c_uint, 730 EltVal: *const Value, 731 Name: [*:0]const u8, 732 ) *const Value; 733 734 pub const buildPtrToInt = LLVMBuildPtrToInt; 735 extern fn LLVMBuildPtrToInt( 736 *const Builder, 737 Val: *const Value, 738 DestTy: *const Type, 739 Name: [*:0]const u8, 740 ) *const Value; 741 742 pub const buildIntToPtr = LLVMBuildIntToPtr; 743 extern fn LLVMBuildIntToPtr( 744 *const Builder, 745 Val: *const Value, 746 DestTy: *const Type, 747 Name: [*:0]const u8, 748 ) *const Value; 749 750 pub const buildStructGEP = LLVMBuildStructGEP; 751 extern fn LLVMBuildStructGEP( 752 B: *const Builder, 753 Pointer: *const Value, 754 Idx: c_uint, 755 Name: [*:0]const u8, 756 ) *const Value; 757 758 pub const buildTrunc = LLVMBuildTrunc; 759 extern fn LLVMBuildTrunc( 760 *const Builder, 761 Val: *const Value, 762 DestTy: *const Type, 763 Name: [*:0]const u8, 764 ) *const Value; 765 766 pub const buildInsertValue = LLVMBuildInsertValue; 767 extern fn LLVMBuildInsertValue( 768 *const Builder, 769 AggVal: *const Value, 770 EltVal: *const Value, 771 Index: c_uint, 772 Name: [*:0]const u8, 773 ) *const Value; 774 775 pub const buildAtomicCmpXchg = LLVMBuildAtomicCmpXchg; 776 extern fn LLVMBuildAtomicCmpXchg( 777 builder: *const Builder, 778 ptr: *const Value, 779 cmp: *const Value, 780 new_val: *const Value, 781 success_ordering: AtomicOrdering, 782 failure_ordering: AtomicOrdering, 783 is_single_threaded: Bool, 784 ) *const Value; 785 786 pub const buildSelect = LLVMBuildSelect; 787 extern fn LLVMBuildSelect( 788 *const Builder, 789 If: *const Value, 790 Then: *const Value, 791 Else: *const Value, 792 Name: [*:0]const u8, 793 ) *const Value; 794 795 pub const buildFence = LLVMBuildFence; 796 extern fn LLVMBuildFence( 797 B: *const Builder, 798 ordering: AtomicOrdering, 799 singleThread: Bool, 800 Name: [*:0]const u8, 801 ) *const Value; 802 803 pub const buildAtomicRmw = LLVMBuildAtomicRMW; 804 extern fn LLVMBuildAtomicRMW( 805 B: *const Builder, 806 op: AtomicRMWBinOp, 807 PTR: *const Value, 808 Val: *const Value, 809 ordering: AtomicOrdering, 810 singleThread: Bool, 811 ) *const Value; 812 813 pub const buildFPToUI = LLVMBuildFPToUI; 814 extern fn LLVMBuildFPToUI( 815 *const Builder, 816 Val: *const Value, 817 DestTy: *const Type, 818 Name: [*:0]const u8, 819 ) *const Value; 820 821 pub const buildFPToSI = LLVMBuildFPToSI; 822 extern fn LLVMBuildFPToSI( 823 *const Builder, 824 Val: *const Value, 825 DestTy: *const Type, 826 Name: [*:0]const u8, 827 ) *const Value; 828 829 pub const buildUIToFP = LLVMBuildUIToFP; 830 extern fn LLVMBuildUIToFP( 831 *const Builder, 832 Val: *const Value, 833 DestTy: *const Type, 834 Name: [*:0]const u8, 835 ) *const Value; 836 837 pub const buildSIToFP = LLVMBuildSIToFP; 838 extern fn LLVMBuildSIToFP( 839 *const Builder, 840 Val: *const Value, 841 DestTy: *const Type, 842 Name: [*:0]const u8, 843 ) *const Value; 844 845 pub const buildFPTrunc = LLVMBuildFPTrunc; 846 extern fn LLVMBuildFPTrunc( 847 *const Builder, 848 Val: *const Value, 849 DestTy: *const Type, 850 Name: [*:0]const u8, 851 ) *const Value; 852 853 pub const buildFPExt = LLVMBuildFPExt; 854 extern fn LLVMBuildFPExt( 855 *const Builder, 856 Val: *const Value, 857 DestTy: *const Type, 858 Name: [*:0]const u8, 859 ) *const Value; 860 861 pub const buildMemSet = ZigLLVMBuildMemSet; 862 extern fn ZigLLVMBuildMemSet( 863 B: *const Builder, 864 Ptr: *const Value, 865 Val: *const Value, 866 Len: *const Value, 867 Align: c_uint, 868 is_volatile: bool, 869 ) *const Value; 870 871 pub const buildMemCpy = ZigLLVMBuildMemCpy; 872 extern fn ZigLLVMBuildMemCpy( 873 B: *const Builder, 874 Dst: *const Value, 875 DstAlign: c_uint, 876 Src: *const Value, 877 SrcAlign: c_uint, 878 Size: *const Value, 879 is_volatile: bool, 880 ) *const Value; 881 882 pub const buildMaxNum = ZigLLVMBuildMaxNum; 883 extern fn ZigLLVMBuildMaxNum(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 884 885 pub const buildMinNum = ZigLLVMBuildMinNum; 886 extern fn ZigLLVMBuildMinNum(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 887 888 pub const buildUMax = ZigLLVMBuildUMax; 889 extern fn ZigLLVMBuildUMax(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 890 891 pub const buildUMin = ZigLLVMBuildUMin; 892 extern fn ZigLLVMBuildUMin(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 893 894 pub const buildSMax = ZigLLVMBuildSMax; 895 extern fn ZigLLVMBuildSMax(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 896 897 pub const buildSMin = ZigLLVMBuildSMin; 898 extern fn ZigLLVMBuildSMin(builder: *const Builder, LHS: *const Value, RHS: *const Value, name: [*:0]const u8) *const Value; 899 900 pub const buildExactUDiv = LLVMBuildExactUDiv; 901 extern fn LLVMBuildExactUDiv(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 902 903 pub const buildExactSDiv = LLVMBuildExactSDiv; 904 extern fn LLVMBuildExactSDiv(*const Builder, LHS: *const Value, RHS: *const Value, Name: [*:0]const u8) *const Value; 905 906 pub const setCurrentDebugLocation = ZigLLVMSetCurrentDebugLocation2; 907 extern fn ZigLLVMSetCurrentDebugLocation2(builder: *const Builder, line: c_uint, column: c_uint, scope: *DIScope, inlined_at: ?*DILocation) void; 908 909 pub const clearCurrentDebugLocation = ZigLLVMClearCurrentDebugLocation; 910 extern fn ZigLLVMClearCurrentDebugLocation(builder: *const Builder) void; 911 912 pub const getCurrentDebugLocation2 = LLVMGetCurrentDebugLocation2; 913 extern fn LLVMGetCurrentDebugLocation2(Builder: *const Builder) *Metadata; 914 915 pub const setCurrentDebugLocation2 = LLVMSetCurrentDebugLocation2; 916 extern fn LLVMSetCurrentDebugLocation2(Builder: *const Builder, Loc: *Metadata) void; 917 918 pub const buildShuffleVector = LLVMBuildShuffleVector; 919 extern fn LLVMBuildShuffleVector(*const Builder, V1: *const Value, V2: *const Value, Mask: *const Value, Name: [*:0]const u8) *const Value; 920 921 pub const buildAndReduce = ZigLLVMBuildAndReduce; 922 extern fn ZigLLVMBuildAndReduce(B: *const Builder, Val: *const Value) *const Value; 923 924 pub const buildOrReduce = ZigLLVMBuildOrReduce; 925 extern fn ZigLLVMBuildOrReduce(B: *const Builder, Val: *const Value) *const Value; 926 927 pub const buildXorReduce = ZigLLVMBuildXorReduce; 928 extern fn ZigLLVMBuildXorReduce(B: *const Builder, Val: *const Value) *const Value; 929 930 pub const buildIntMaxReduce = ZigLLVMBuildIntMaxReduce; 931 extern fn ZigLLVMBuildIntMaxReduce(B: *const Builder, Val: *const Value, is_signed: bool) *const Value; 932 933 pub const buildIntMinReduce = ZigLLVMBuildIntMinReduce; 934 extern fn ZigLLVMBuildIntMinReduce(B: *const Builder, Val: *const Value, is_signed: bool) *const Value; 935 936 pub const buildFPMaxReduce = ZigLLVMBuildFPMaxReduce; 937 extern fn ZigLLVMBuildFPMaxReduce(B: *const Builder, Val: *const Value) *const Value; 938 939 pub const buildFPMinReduce = ZigLLVMBuildFPMinReduce; 940 extern fn ZigLLVMBuildFPMinReduce(B: *const Builder, Val: *const Value) *const Value; 941 942 pub const buildAddReduce = ZigLLVMBuildAddReduce; 943 extern fn ZigLLVMBuildAddReduce(B: *const Builder, Val: *const Value) *const Value; 944 945 pub const buildMulReduce = ZigLLVMBuildMulReduce; 946 extern fn ZigLLVMBuildMulReduce(B: *const Builder, Val: *const Value) *const Value; 947 948 pub const buildFPAddReduce = ZigLLVMBuildFPAddReduce; 949 extern fn ZigLLVMBuildFPAddReduce(B: *const Builder, Acc: *const Value, Val: *const Value) *const Value; 950 951 pub const buildFPMulReduce = ZigLLVMBuildFPMulReduce; 952 extern fn ZigLLVMBuildFPMulReduce(B: *const Builder, Acc: *const Value, Val: *const Value) *const Value; 953 954 pub const setFastMath = ZigLLVMSetFastMath; 955 extern fn ZigLLVMSetFastMath(B: *const Builder, on_state: bool) void; 956 }; 957 958 pub const MDString = opaque { 959 pub const get = LLVMMDStringInContext2; 960 extern fn LLVMMDStringInContext2(C: *const Context, Str: [*]const u8, SLen: usize) *MDString; 961 }; 962 963 pub const DIScope = opaque { 964 pub const toNode = ZigLLVMScopeToNode; 965 extern fn ZigLLVMScopeToNode(scope: *DIScope) *DINode; 966 }; 967 968 pub const DINode = opaque {}; 969 pub const Metadata = opaque {}; 970 971 pub const IntPredicate = enum(c_uint) { 972 EQ = 32, 973 NE = 33, 974 UGT = 34, 975 UGE = 35, 976 ULT = 36, 977 ULE = 37, 978 SGT = 38, 979 SGE = 39, 980 SLT = 40, 981 SLE = 41, 982 }; 983 984 pub const RealPredicate = enum(c_uint) { 985 OEQ = 1, 986 OGT = 2, 987 OGE = 3, 988 OLT = 4, 989 OLE = 5, 990 ONE = 6, 991 ORD = 7, 992 UNO = 8, 993 UEQ = 9, 994 UGT = 10, 995 UGE = 11, 996 ULT = 12, 997 ULE = 13, 998 UNE = 14, 999 }; 1000 1001 pub const BasicBlock = opaque { 1002 pub const deleteBasicBlock = LLVMDeleteBasicBlock; 1003 extern fn LLVMDeleteBasicBlock(BB: *const BasicBlock) void; 1004 1005 pub const getFirstInstruction = LLVMGetFirstInstruction; 1006 extern fn LLVMGetFirstInstruction(BB: *const BasicBlock) ?*const Value; 1007 }; 1008 1009 pub const TargetMachine = opaque { 1010 pub const create = ZigLLVMCreateTargetMachine; 1011 extern fn ZigLLVMCreateTargetMachine( 1012 T: *const Target, 1013 Triple: [*:0]const u8, 1014 CPU: ?[*:0]const u8, 1015 Features: ?[*:0]const u8, 1016 Level: CodeGenOptLevel, 1017 Reloc: RelocMode, 1018 CodeModel: CodeModel, 1019 function_sections: bool, 1020 float_abi: ABIType, 1021 abi_name: ?[*:0]const u8, 1022 ) *const TargetMachine; 1023 1024 pub const dispose = LLVMDisposeTargetMachine; 1025 extern fn LLVMDisposeTargetMachine(T: *const TargetMachine) void; 1026 1027 pub const emitToFile = ZigLLVMTargetMachineEmitToFile; 1028 extern fn ZigLLVMTargetMachineEmitToFile( 1029 T: *const TargetMachine, 1030 M: *const Module, 1031 ErrorMessage: *[*:0]const u8, 1032 is_debug: bool, 1033 is_small: bool, 1034 time_report: bool, 1035 tsan: bool, 1036 lto: bool, 1037 asm_filename: ?[*:0]const u8, 1038 bin_filename: ?[*:0]const u8, 1039 llvm_ir_filename: ?[*:0]const u8, 1040 bitcode_filename: ?[*:0]const u8, 1041 ) bool; 1042 1043 pub const createTargetDataLayout = LLVMCreateTargetDataLayout; 1044 extern fn LLVMCreateTargetDataLayout(*const TargetMachine) *const TargetData; 1045 }; 1046 1047 pub const TargetData = opaque { 1048 pub const dispose = LLVMDisposeTargetData; 1049 extern fn LLVMDisposeTargetData(*const TargetData) void; 1050 1051 pub const abiAlignmentOfType = LLVMABIAlignmentOfType; 1052 extern fn LLVMABIAlignmentOfType(TD: *const TargetData, Ty: *const Type) c_uint; 1053 1054 pub const abiSizeOfType = LLVMABISizeOfType; 1055 extern fn LLVMABISizeOfType(TD: *const TargetData, Ty: *const Type) c_ulonglong; 1056 }; 1057 1058 pub const CodeModel = enum(c_int) { 1059 Default, 1060 JITDefault, 1061 Tiny, 1062 Small, 1063 Kernel, 1064 Medium, 1065 Large, 1066 }; 1067 1068 pub const CodeGenOptLevel = enum(c_int) { 1069 None, 1070 Less, 1071 Default, 1072 Aggressive, 1073 }; 1074 1075 pub const RelocMode = enum(c_int) { 1076 Default, 1077 Static, 1078 PIC, 1079 DynamicNoPIC, 1080 ROPI, 1081 RWPI, 1082 ROPI_RWPI, 1083 }; 1084 1085 pub const CodeGenFileType = enum(c_int) { 1086 AssemblyFile, 1087 ObjectFile, 1088 }; 1089 1090 pub const ABIType = enum(c_int) { 1091 /// Target-specific (either soft or hard depending on triple, etc). 1092 Default, 1093 /// Soft float. 1094 Soft, 1095 // Hard float. 1096 Hard, 1097 }; 1098 1099 pub const Target = opaque { 1100 pub const getFromTriple = LLVMGetTargetFromTriple; 1101 extern fn LLVMGetTargetFromTriple(Triple: [*:0]const u8, T: **const Target, ErrorMessage: *[*:0]const u8) Bool; 1102 }; 1103 1104 pub extern fn LLVMInitializeAArch64TargetInfo() void; 1105 pub extern fn LLVMInitializeAMDGPUTargetInfo() void; 1106 pub extern fn LLVMInitializeARMTargetInfo() void; 1107 pub extern fn LLVMInitializeAVRTargetInfo() void; 1108 pub extern fn LLVMInitializeBPFTargetInfo() void; 1109 pub extern fn LLVMInitializeHexagonTargetInfo() void; 1110 pub extern fn LLVMInitializeLanaiTargetInfo() void; 1111 pub extern fn LLVMInitializeMipsTargetInfo() void; 1112 pub extern fn LLVMInitializeMSP430TargetInfo() void; 1113 pub extern fn LLVMInitializeNVPTXTargetInfo() void; 1114 pub extern fn LLVMInitializePowerPCTargetInfo() void; 1115 pub extern fn LLVMInitializeRISCVTargetInfo() void; 1116 pub extern fn LLVMInitializeSparcTargetInfo() void; 1117 pub extern fn LLVMInitializeSystemZTargetInfo() void; 1118 pub extern fn LLVMInitializeWebAssemblyTargetInfo() void; 1119 pub extern fn LLVMInitializeX86TargetInfo() void; 1120 pub extern fn LLVMInitializeXCoreTargetInfo() void; 1121 pub extern fn LLVMInitializeM68kTargetInfo() void; 1122 pub extern fn LLVMInitializeCSKYTargetInfo() void; 1123 pub extern fn LLVMInitializeVETargetInfo() void; 1124 pub extern fn LLVMInitializeARCTargetInfo() void; 1125 1126 pub extern fn LLVMInitializeAArch64Target() void; 1127 pub extern fn LLVMInitializeAMDGPUTarget() void; 1128 pub extern fn LLVMInitializeARMTarget() void; 1129 pub extern fn LLVMInitializeAVRTarget() void; 1130 pub extern fn LLVMInitializeBPFTarget() void; 1131 pub extern fn LLVMInitializeHexagonTarget() void; 1132 pub extern fn LLVMInitializeLanaiTarget() void; 1133 pub extern fn LLVMInitializeMipsTarget() void; 1134 pub extern fn LLVMInitializeMSP430Target() void; 1135 pub extern fn LLVMInitializeNVPTXTarget() void; 1136 pub extern fn LLVMInitializePowerPCTarget() void; 1137 pub extern fn LLVMInitializeRISCVTarget() void; 1138 pub extern fn LLVMInitializeSparcTarget() void; 1139 pub extern fn LLVMInitializeSystemZTarget() void; 1140 pub extern fn LLVMInitializeWebAssemblyTarget() void; 1141 pub extern fn LLVMInitializeX86Target() void; 1142 pub extern fn LLVMInitializeXCoreTarget() void; 1143 pub extern fn LLVMInitializeM68kTarget() void; 1144 pub extern fn LLVMInitializeVETarget() void; 1145 pub extern fn LLVMInitializeCSKYTarget() void; 1146 pub extern fn LLVMInitializeARCTarget() void; 1147 1148 pub extern fn LLVMInitializeAArch64TargetMC() void; 1149 pub extern fn LLVMInitializeAMDGPUTargetMC() void; 1150 pub extern fn LLVMInitializeARMTargetMC() void; 1151 pub extern fn LLVMInitializeAVRTargetMC() void; 1152 pub extern fn LLVMInitializeBPFTargetMC() void; 1153 pub extern fn LLVMInitializeHexagonTargetMC() void; 1154 pub extern fn LLVMInitializeLanaiTargetMC() void; 1155 pub extern fn LLVMInitializeMipsTargetMC() void; 1156 pub extern fn LLVMInitializeMSP430TargetMC() void; 1157 pub extern fn LLVMInitializeNVPTXTargetMC() void; 1158 pub extern fn LLVMInitializePowerPCTargetMC() void; 1159 pub extern fn LLVMInitializeRISCVTargetMC() void; 1160 pub extern fn LLVMInitializeSparcTargetMC() void; 1161 pub extern fn LLVMInitializeSystemZTargetMC() void; 1162 pub extern fn LLVMInitializeWebAssemblyTargetMC() void; 1163 pub extern fn LLVMInitializeX86TargetMC() void; 1164 pub extern fn LLVMInitializeXCoreTargetMC() void; 1165 pub extern fn LLVMInitializeM68kTargetMC() void; 1166 pub extern fn LLVMInitializeCSKYTargetMC() void; 1167 pub extern fn LLVMInitializeVETargetMC() void; 1168 pub extern fn LLVMInitializeARCTargetMC() void; 1169 1170 pub extern fn LLVMInitializeAArch64AsmPrinter() void; 1171 pub extern fn LLVMInitializeAMDGPUAsmPrinter() void; 1172 pub extern fn LLVMInitializeARMAsmPrinter() void; 1173 pub extern fn LLVMInitializeAVRAsmPrinter() void; 1174 pub extern fn LLVMInitializeBPFAsmPrinter() void; 1175 pub extern fn LLVMInitializeHexagonAsmPrinter() void; 1176 pub extern fn LLVMInitializeLanaiAsmPrinter() void; 1177 pub extern fn LLVMInitializeMipsAsmPrinter() void; 1178 pub extern fn LLVMInitializeMSP430AsmPrinter() void; 1179 pub extern fn LLVMInitializeNVPTXAsmPrinter() void; 1180 pub extern fn LLVMInitializePowerPCAsmPrinter() void; 1181 pub extern fn LLVMInitializeRISCVAsmPrinter() void; 1182 pub extern fn LLVMInitializeSparcAsmPrinter() void; 1183 pub extern fn LLVMInitializeSystemZAsmPrinter() void; 1184 pub extern fn LLVMInitializeWebAssemblyAsmPrinter() void; 1185 pub extern fn LLVMInitializeX86AsmPrinter() void; 1186 pub extern fn LLVMInitializeXCoreAsmPrinter() void; 1187 pub extern fn LLVMInitializeM68kAsmPrinter() void; 1188 pub extern fn LLVMInitializeVEAsmPrinter() void; 1189 pub extern fn LLVMInitializeARCAsmPrinter() void; 1190 1191 pub extern fn LLVMInitializeAArch64AsmParser() void; 1192 pub extern fn LLVMInitializeAMDGPUAsmParser() void; 1193 pub extern fn LLVMInitializeARMAsmParser() void; 1194 pub extern fn LLVMInitializeAVRAsmParser() void; 1195 pub extern fn LLVMInitializeBPFAsmParser() void; 1196 pub extern fn LLVMInitializeHexagonAsmParser() void; 1197 pub extern fn LLVMInitializeLanaiAsmParser() void; 1198 pub extern fn LLVMInitializeMipsAsmParser() void; 1199 pub extern fn LLVMInitializeMSP430AsmParser() void; 1200 pub extern fn LLVMInitializePowerPCAsmParser() void; 1201 pub extern fn LLVMInitializeRISCVAsmParser() void; 1202 pub extern fn LLVMInitializeSparcAsmParser() void; 1203 pub extern fn LLVMInitializeSystemZAsmParser() void; 1204 pub extern fn LLVMInitializeWebAssemblyAsmParser() void; 1205 pub extern fn LLVMInitializeX86AsmParser() void; 1206 pub extern fn LLVMInitializeM68kAsmParser() void; 1207 pub extern fn LLVMInitializeCSKYAsmParser() void; 1208 pub extern fn LLVMInitializeVEAsmParser() void; 1209 1210 extern fn ZigLLDLinkCOFF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; 1211 extern fn ZigLLDLinkELF(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; 1212 extern fn ZigLLDLinkWasm(argc: c_int, argv: [*:null]const ?[*:0]const u8, can_exit_early: bool, disable_output: bool) bool; 1213 1214 pub const LinkCOFF = ZigLLDLinkCOFF; 1215 pub const LinkELF = ZigLLDLinkELF; 1216 pub const LinkWasm = ZigLLDLinkWasm; 1217 1218 pub const ObjectFormatType = enum(c_int) { 1219 Unknown, 1220 COFF, 1221 ELF, 1222 GOFF, 1223 MachO, 1224 Wasm, 1225 XCOFF, 1226 }; 1227 1228 pub const WriteArchive = ZigLLVMWriteArchive; 1229 extern fn ZigLLVMWriteArchive( 1230 archive_name: [*:0]const u8, 1231 file_names_ptr: [*]const [*:0]const u8, 1232 file_names_len: usize, 1233 os_type: OSType, 1234 ) bool; 1235 1236 pub const OSType = enum(c_int) { 1237 UnknownOS, 1238 Ananas, 1239 CloudABI, 1240 Darwin, 1241 DragonFly, 1242 FreeBSD, 1243 Fuchsia, 1244 IOS, 1245 KFreeBSD, 1246 Linux, 1247 Lv2, 1248 MacOSX, 1249 NetBSD, 1250 OpenBSD, 1251 Solaris, 1252 Win32, 1253 ZOS, 1254 Haiku, 1255 Minix, 1256 RTEMS, 1257 NaCl, 1258 AIX, 1259 CUDA, 1260 NVCL, 1261 AMDHSA, 1262 PS4, 1263 ELFIAMCU, 1264 TvOS, 1265 WatchOS, 1266 Mesa3D, 1267 Contiki, 1268 AMDPAL, 1269 HermitCore, 1270 Hurd, 1271 WASI, 1272 Emscripten, 1273 }; 1274 1275 pub const ArchType = enum(c_int) { 1276 UnknownArch, 1277 arm, 1278 armeb, 1279 aarch64, 1280 aarch64_be, 1281 aarch64_32, 1282 arc, 1283 avr, 1284 bpfel, 1285 bpfeb, 1286 csky, 1287 hexagon, 1288 m68k, 1289 mips, 1290 mipsel, 1291 mips64, 1292 mips64el, 1293 msp430, 1294 ppc, 1295 ppcle, 1296 ppc64, 1297 ppc64le, 1298 r600, 1299 amdgcn, 1300 riscv32, 1301 riscv64, 1302 sparc, 1303 sparcv9, 1304 sparcel, 1305 systemz, 1306 tce, 1307 tcele, 1308 thumb, 1309 thumbeb, 1310 x86, 1311 x86_64, 1312 xcore, 1313 nvptx, 1314 nvptx64, 1315 le32, 1316 le64, 1317 amdil, 1318 amdil64, 1319 hsail, 1320 hsail64, 1321 spir, 1322 spir64, 1323 kalimba, 1324 shave, 1325 lanai, 1326 wasm32, 1327 wasm64, 1328 renderscript32, 1329 renderscript64, 1330 ve, 1331 }; 1332 1333 pub const ParseCommandLineOptions = ZigLLVMParseCommandLineOptions; 1334 extern fn ZigLLVMParseCommandLineOptions(argc: usize, argv: [*]const [*:0]const u8) void; 1335 1336 pub const WriteImportLibrary = ZigLLVMWriteImportLibrary; 1337 extern fn ZigLLVMWriteImportLibrary( 1338 def_path: [*:0]const u8, 1339 arch: ArchType, 1340 output_lib_path: [*:0]const u8, 1341 kill_at: bool, 1342 ) bool; 1343 1344 pub const setCallElemTypeAttr = ZigLLVMSetCallElemTypeAttr; 1345 extern fn ZigLLVMSetCallElemTypeAttr(Call: *const Value, arg_index: usize, return_type: *const Type) void; 1346 1347 pub const Linkage = enum(c_uint) { 1348 External, 1349 AvailableExternally, 1350 LinkOnceAny, 1351 LinkOnceODR, 1352 LinkOnceODRAutoHide, 1353 WeakAny, 1354 WeakODR, 1355 Appending, 1356 Internal, 1357 Private, 1358 DLLImport, 1359 DLLExport, 1360 ExternalWeak, 1361 Ghost, 1362 Common, 1363 LinkerPrivate, 1364 LinkerPrivateWeak, 1365 }; 1366 1367 pub const Visibility = enum(c_uint) { 1368 Default, 1369 Hidden, 1370 Protected, 1371 }; 1372 1373 pub const ThreadLocalMode = enum(c_uint) { 1374 NotThreadLocal, 1375 GeneralDynamicTLSModel, 1376 LocalDynamicTLSModel, 1377 InitialExecTLSModel, 1378 LocalExecTLSModel, 1379 }; 1380 1381 pub const AtomicOrdering = enum(c_uint) { 1382 NotAtomic = 0, 1383 Unordered = 1, 1384 Monotonic = 2, 1385 Acquire = 4, 1386 Release = 5, 1387 AcquireRelease = 6, 1388 SequentiallyConsistent = 7, 1389 }; 1390 1391 pub const AtomicRMWBinOp = enum(c_int) { 1392 Xchg, 1393 Add, 1394 Sub, 1395 And, 1396 Nand, 1397 Or, 1398 Xor, 1399 Max, 1400 Min, 1401 UMax, 1402 UMin, 1403 FAdd, 1404 FSub, 1405 }; 1406 1407 pub const TypeKind = enum(c_int) { 1408 Void, 1409 Half, 1410 Float, 1411 Double, 1412 X86_FP80, 1413 FP128, 1414 PPC_FP128, 1415 Label, 1416 Integer, 1417 Function, 1418 Struct, 1419 Array, 1420 Pointer, 1421 Vector, 1422 Metadata, 1423 X86_MMX, 1424 Token, 1425 ScalableVector, 1426 BFloat, 1427 X86_AMX, 1428 }; 1429 1430 pub const CallConv = enum(c_uint) { 1431 C = 0, 1432 Fast = 8, 1433 Cold = 9, 1434 GHC = 10, 1435 HiPE = 11, 1436 WebKit_JS = 12, 1437 AnyReg = 13, 1438 PreserveMost = 14, 1439 PreserveAll = 15, 1440 Swift = 16, 1441 CXX_FAST_TLS = 17, 1442 1443 X86_StdCall = 64, 1444 X86_FastCall = 65, 1445 ARM_APCS = 66, 1446 ARM_AAPCS = 67, 1447 ARM_AAPCS_VFP = 68, 1448 MSP430_INTR = 69, 1449 X86_ThisCall = 70, 1450 PTX_Kernel = 71, 1451 PTX_Device = 72, 1452 SPIR_FUNC = 75, 1453 SPIR_KERNEL = 76, 1454 Intel_OCL_BI = 77, 1455 X86_64_SysV = 78, 1456 Win64 = 79, 1457 X86_VectorCall = 80, 1458 HHVM = 81, 1459 HHVM_C = 82, 1460 X86_INTR = 83, 1461 AVR_INTR = 84, 1462 AVR_SIGNAL = 85, 1463 AVR_BUILTIN = 86, 1464 AMDGPU_VS = 87, 1465 AMDGPU_GS = 88, 1466 AMDGPU_PS = 89, 1467 AMDGPU_CS = 90, 1468 AMDGPU_KERNEL = 91, 1469 X86_RegCall = 92, 1470 AMDGPU_HS = 93, 1471 MSP430_BUILTIN = 94, 1472 AMDGPU_LS = 95, 1473 AMDGPU_ES = 96, 1474 AArch64_VectorCall = 97, 1475 }; 1476 1477 pub const CallAttr = enum(c_int) { 1478 Auto, 1479 NeverTail, 1480 NeverInline, 1481 AlwaysTail, 1482 AlwaysInline, 1483 }; 1484 1485 pub const address_space = struct { 1486 pub const default: c_uint = 0; 1487 1488 // See llvm/lib/Target/X86/X86.h 1489 pub const x86_64 = x86; 1490 pub const x86 = struct { 1491 pub const gs: c_uint = 256; 1492 pub const fs: c_uint = 257; 1493 pub const ss: c_uint = 258; 1494 1495 pub const ptr32_sptr: c_uint = 270; 1496 pub const ptr32_uptr: c_uint = 271; 1497 pub const ptr64: c_uint = 272; 1498 }; 1499 1500 // See llvm/lib/Target/AVR/AVR.h 1501 pub const avr = struct { 1502 pub const data_memory: c_uint = 0; 1503 pub const program_memory: c_uint = 1; 1504 }; 1505 1506 // See llvm/lib/Target/NVPTX/NVPTX.h 1507 pub const nvptx = struct { 1508 pub const generic: c_uint = 0; 1509 pub const global: c_uint = 1; 1510 pub const constant: c_uint = 2; 1511 pub const shared: c_uint = 3; 1512 pub const param: c_uint = 4; 1513 pub const local: c_uint = 5; 1514 }; 1515 1516 // See llvm/lib/Target/AMDGPU/AMDGPU.h 1517 pub const amdgpu = struct { 1518 pub const flat: c_uint = 0; 1519 pub const global: c_uint = 1; 1520 pub const region: c_uint = 2; 1521 pub const local: c_uint = 3; 1522 pub const constant: c_uint = 4; 1523 pub const private: c_uint = 5; 1524 pub const constant_32bit: c_uint = 6; 1525 pub const buffer_fat_pointer: c_uint = 7; 1526 pub const param_d: c_uint = 6; 1527 pub const param_i: c_uint = 7; 1528 pub const constant_buffer_0: c_uint = 8; 1529 pub const constant_buffer_1: c_uint = 9; 1530 pub const constant_buffer_2: c_uint = 10; 1531 pub const constant_buffer_3: c_uint = 11; 1532 pub const constant_buffer_4: c_uint = 12; 1533 pub const constant_buffer_5: c_uint = 13; 1534 pub const constant_buffer_6: c_uint = 14; 1535 pub const constant_buffer_7: c_uint = 15; 1536 pub const constant_buffer_8: c_uint = 16; 1537 pub const constant_buffer_9: c_uint = 17; 1538 pub const constant_buffer_10: c_uint = 18; 1539 pub const constant_buffer_11: c_uint = 19; 1540 pub const constant_buffer_12: c_uint = 20; 1541 pub const constant_buffer_13: c_uint = 21; 1542 pub const constant_buffer_14: c_uint = 22; 1543 pub const constant_buffer_15: c_uint = 23; 1544 }; 1545 }; 1546 1547 pub const DIEnumerator = opaque {}; 1548 pub const DILocalVariable = opaque {}; 1549 pub const DILocation = opaque {}; 1550 1551 pub const DIGlobalVariable = opaque { 1552 pub const toNode = ZigLLVMGlobalVariableToNode; 1553 extern fn ZigLLVMGlobalVariableToNode(global_variable: *DIGlobalVariable) *DINode; 1554 1555 pub const replaceLinkageName = ZigLLVMGlobalVariableReplaceLinkageName; 1556 extern fn ZigLLVMGlobalVariableReplaceLinkageName(global_variable: *DIGlobalVariable, linkage_name: *MDString) void; 1557 }; 1558 pub const DIType = opaque { 1559 pub const toScope = ZigLLVMTypeToScope; 1560 extern fn ZigLLVMTypeToScope(ty: *DIType) *DIScope; 1561 1562 pub const toNode = ZigLLVMTypeToNode; 1563 extern fn ZigLLVMTypeToNode(ty: *DIType) *DINode; 1564 }; 1565 pub const DIFile = opaque { 1566 pub const toScope = ZigLLVMFileToScope; 1567 extern fn ZigLLVMFileToScope(difile: *DIFile) *DIScope; 1568 1569 pub const toNode = ZigLLVMFileToNode; 1570 extern fn ZigLLVMFileToNode(difile: *DIFile) *DINode; 1571 }; 1572 pub const DILexicalBlock = opaque { 1573 pub const toScope = ZigLLVMLexicalBlockToScope; 1574 extern fn ZigLLVMLexicalBlockToScope(lexical_block: *DILexicalBlock) *DIScope; 1575 1576 pub const toNode = ZigLLVMLexicalBlockToNode; 1577 extern fn ZigLLVMLexicalBlockToNode(lexical_block: *DILexicalBlock) *DINode; 1578 }; 1579 pub const DICompileUnit = opaque { 1580 pub const toScope = ZigLLVMCompileUnitToScope; 1581 extern fn ZigLLVMCompileUnitToScope(compile_unit: *DICompileUnit) *DIScope; 1582 1583 pub const toNode = ZigLLVMCompileUnitToNode; 1584 extern fn ZigLLVMCompileUnitToNode(compile_unit: *DICompileUnit) *DINode; 1585 }; 1586 pub const DISubprogram = opaque { 1587 pub const toScope = ZigLLVMSubprogramToScope; 1588 extern fn ZigLLVMSubprogramToScope(subprogram: *DISubprogram) *DIScope; 1589 1590 pub const toNode = ZigLLVMSubprogramToNode; 1591 extern fn ZigLLVMSubprogramToNode(subprogram: *DISubprogram) *DINode; 1592 1593 pub const replaceLinkageName = ZigLLVMSubprogramReplaceLinkageName; 1594 extern fn ZigLLVMSubprogramReplaceLinkageName(subprogram: *DISubprogram, linkage_name: *MDString) void; 1595 }; 1596 1597 pub const getDebugLoc = ZigLLVMGetDebugLoc2; 1598 extern fn ZigLLVMGetDebugLoc2(line: c_uint, col: c_uint, scope: *DIScope, inlined_at: ?*DILocation) *DILocation; 1599 1600 pub const DIBuilder = opaque { 1601 pub const dispose = ZigLLVMDisposeDIBuilder; 1602 extern fn ZigLLVMDisposeDIBuilder(dib: *DIBuilder) void; 1603 1604 pub const finalize = ZigLLVMDIBuilderFinalize; 1605 extern fn ZigLLVMDIBuilderFinalize(dib: *DIBuilder) void; 1606 1607 pub const createPointerType = ZigLLVMCreateDebugPointerType; 1608 extern fn ZigLLVMCreateDebugPointerType( 1609 dib: *DIBuilder, 1610 pointee_type: *DIType, 1611 size_in_bits: u64, 1612 align_in_bits: u64, 1613 name: [*:0]const u8, 1614 ) *DIType; 1615 1616 pub const createBasicType = ZigLLVMCreateDebugBasicType; 1617 extern fn ZigLLVMCreateDebugBasicType( 1618 dib: *DIBuilder, 1619 name: [*:0]const u8, 1620 size_in_bits: u64, 1621 encoding: c_uint, 1622 ) *DIType; 1623 1624 pub const createArrayType = ZigLLVMCreateDebugArrayType; 1625 extern fn ZigLLVMCreateDebugArrayType( 1626 dib: *DIBuilder, 1627 size_in_bits: u64, 1628 align_in_bits: u64, 1629 elem_type: *DIType, 1630 elem_count: c_int, 1631 ) *DIType; 1632 1633 pub const createEnumerator = ZigLLVMCreateDebugEnumerator; 1634 extern fn ZigLLVMCreateDebugEnumerator( 1635 dib: *DIBuilder, 1636 name: [*:0]const u8, 1637 val: i64, 1638 ) *DIEnumerator; 1639 1640 pub const createEnumerationType = ZigLLVMCreateDebugEnumerationType; 1641 extern fn ZigLLVMCreateDebugEnumerationType( 1642 dib: *DIBuilder, 1643 scope: *DIScope, 1644 name: [*:0]const u8, 1645 file: *DIFile, 1646 line_number: c_uint, 1647 size_in_bits: u64, 1648 align_in_bits: u64, 1649 enumerator_array: [*]const *DIEnumerator, 1650 enumerator_array_len: c_int, 1651 underlying_type: *DIType, 1652 unique_id: [*:0]const u8, 1653 ) *DIType; 1654 1655 pub const createStructType = ZigLLVMCreateDebugStructType; 1656 extern fn ZigLLVMCreateDebugStructType( 1657 dib: *DIBuilder, 1658 scope: *DIScope, 1659 name: [*:0]const u8, 1660 file: ?*DIFile, 1661 line_number: c_uint, 1662 size_in_bits: u64, 1663 align_in_bits: u64, 1664 flags: c_uint, 1665 derived_from: ?*DIType, 1666 types_array: [*]const *DIType, 1667 types_array_len: c_int, 1668 run_time_lang: c_uint, 1669 vtable_holder: ?*DIType, 1670 unique_id: [*:0]const u8, 1671 ) *DIType; 1672 1673 pub const createUnionType = ZigLLVMCreateDebugUnionType; 1674 extern fn ZigLLVMCreateDebugUnionType( 1675 dib: *DIBuilder, 1676 scope: *DIScope, 1677 name: [*:0]const u8, 1678 file: ?*DIFile, 1679 line_number: c_uint, 1680 size_in_bits: u64, 1681 align_in_bits: u64, 1682 flags: c_uint, 1683 types_array: [*]const *DIType, 1684 types_array_len: c_int, 1685 run_time_lang: c_uint, 1686 unique_id: [*:0]const u8, 1687 ) *DIType; 1688 1689 pub const createMemberType = ZigLLVMCreateDebugMemberType; 1690 extern fn ZigLLVMCreateDebugMemberType( 1691 dib: *DIBuilder, 1692 scope: *DIScope, 1693 name: [*:0]const u8, 1694 file: ?*DIFile, 1695 line: c_uint, 1696 size_in_bits: u64, 1697 align_in_bits: u64, 1698 offset_in_bits: u64, 1699 flags: c_uint, 1700 ty: *DIType, 1701 ) *DIType; 1702 1703 pub const createReplaceableCompositeType = ZigLLVMCreateReplaceableCompositeType; 1704 extern fn ZigLLVMCreateReplaceableCompositeType( 1705 dib: *DIBuilder, 1706 tag: c_uint, 1707 name: [*:0]const u8, 1708 scope: *DIScope, 1709 file: ?*DIFile, 1710 line: c_uint, 1711 ) *DIType; 1712 1713 pub const createForwardDeclType = ZigLLVMCreateDebugForwardDeclType; 1714 extern fn ZigLLVMCreateDebugForwardDeclType( 1715 dib: *DIBuilder, 1716 tag: c_uint, 1717 name: [*:0]const u8, 1718 scope: *DIScope, 1719 file: *DIFile, 1720 line: c_uint, 1721 ) *DIType; 1722 1723 pub const replaceTemporary = ZigLLVMReplaceTemporary; 1724 extern fn ZigLLVMReplaceTemporary(dib: *DIBuilder, ty: *DIType, replacement: *DIType) void; 1725 1726 pub const replaceDebugArrays = ZigLLVMReplaceDebugArrays; 1727 extern fn ZigLLVMReplaceDebugArrays( 1728 dib: *DIBuilder, 1729 ty: *DIType, 1730 types_array: [*]const *DIType, 1731 types_array_len: c_int, 1732 ) void; 1733 1734 pub const createSubroutineType = ZigLLVMCreateSubroutineType; 1735 extern fn ZigLLVMCreateSubroutineType( 1736 dib: *DIBuilder, 1737 types_array: [*]const *DIType, 1738 types_array_len: c_int, 1739 flags: c_uint, 1740 ) *DIType; 1741 1742 pub const createAutoVariable = ZigLLVMCreateAutoVariable; 1743 extern fn ZigLLVMCreateAutoVariable( 1744 dib: *DIBuilder, 1745 scope: *DIScope, 1746 name: [*:0]const u8, 1747 file: *DIFile, 1748 line_no: c_uint, 1749 ty: *DIType, 1750 always_preserve: bool, 1751 flags: c_uint, 1752 ) *DILocalVariable; 1753 1754 pub const createGlobalVariable = ZigLLVMCreateGlobalVariable; 1755 extern fn ZigLLVMCreateGlobalVariable( 1756 dib: *DIBuilder, 1757 scope: *DIScope, 1758 name: [*:0]const u8, 1759 linkage_name: [*:0]const u8, 1760 file: *DIFile, 1761 line_no: c_uint, 1762 di_type: *DIType, 1763 is_local_to_unit: bool, 1764 ) *DIGlobalVariable; 1765 1766 pub const createParameterVariable = ZigLLVMCreateParameterVariable; 1767 extern fn ZigLLVMCreateParameterVariable( 1768 dib: *DIBuilder, 1769 scope: *DIScope, 1770 name: [*:0]const u8, 1771 file: *DIFile, 1772 line_no: c_uint, 1773 ty: *DIType, 1774 always_preserve: bool, 1775 flags: c_uint, 1776 arg_no: c_uint, 1777 ) *DILocalVariable; 1778 1779 pub const createLexicalBlock = ZigLLVMCreateLexicalBlock; 1780 extern fn ZigLLVMCreateLexicalBlock( 1781 dib: *DIBuilder, 1782 scope: *DIScope, 1783 file: *DIFile, 1784 line: c_uint, 1785 col: c_uint, 1786 ) *DILexicalBlock; 1787 1788 pub const createCompileUnit = ZigLLVMCreateCompileUnit; 1789 extern fn ZigLLVMCreateCompileUnit( 1790 dib: *DIBuilder, 1791 lang: c_uint, 1792 difile: *DIFile, 1793 producer: [*:0]const u8, 1794 is_optimized: bool, 1795 flags: [*:0]const u8, 1796 runtime_version: c_uint, 1797 split_name: [*:0]const u8, 1798 dwo_id: u64, 1799 emit_debug_info: bool, 1800 ) *DICompileUnit; 1801 1802 pub const createFile = ZigLLVMCreateFile; 1803 extern fn ZigLLVMCreateFile( 1804 dib: *DIBuilder, 1805 filename: [*:0]const u8, 1806 directory: [*:0]const u8, 1807 ) *DIFile; 1808 1809 pub const createFunction = ZigLLVMCreateFunction; 1810 extern fn ZigLLVMCreateFunction( 1811 dib: *DIBuilder, 1812 scope: *DIScope, 1813 name: [*:0]const u8, 1814 linkage_name: [*:0]const u8, 1815 file: *DIFile, 1816 lineno: c_uint, 1817 fn_di_type: *DIType, 1818 is_local_to_unit: bool, 1819 is_definition: bool, 1820 scope_line: c_uint, 1821 flags: c_uint, 1822 is_optimized: bool, 1823 decl_subprogram: ?*DISubprogram, 1824 ) *DISubprogram; 1825 1826 pub const createVectorType = ZigLLVMDIBuilderCreateVectorType; 1827 extern fn ZigLLVMDIBuilderCreateVectorType( 1828 dib: *DIBuilder, 1829 SizeInBits: u64, 1830 AlignInBits: u32, 1831 Ty: *DIType, 1832 elem_count: u32, 1833 ) *DIType; 1834 1835 pub const insertDeclareAtEnd = ZigLLVMInsertDeclareAtEnd; 1836 extern fn ZigLLVMInsertDeclareAtEnd( 1837 dib: *DIBuilder, 1838 storage: *const Value, 1839 var_info: *DILocalVariable, 1840 debug_loc: *DILocation, 1841 basic_block_ref: *const BasicBlock, 1842 ) *const Value; 1843 1844 pub const insertDeclare = ZigLLVMInsertDeclare; 1845 extern fn ZigLLVMInsertDeclare( 1846 dib: *DIBuilder, 1847 storage: *const Value, 1848 var_info: *DILocalVariable, 1849 debug_loc: *DILocation, 1850 insert_before_instr: *const Value, 1851 ) *const Value; 1852 1853 pub const insertDbgValueIntrinsicAtEnd = ZigLLVMInsertDbgValueIntrinsicAtEnd; 1854 extern fn ZigLLVMInsertDbgValueIntrinsicAtEnd( 1855 dib: *DIBuilder, 1856 val: *const Value, 1857 var_info: *DILocalVariable, 1858 debug_loc: *DILocation, 1859 basic_block_ref: *const BasicBlock, 1860 ) *const Value; 1861 }; 1862 1863 pub const DIFlags = opaque { 1864 pub const Zero = 0; 1865 pub const Private = 1; 1866 pub const Protected = 2; 1867 pub const Public = 3; 1868 1869 pub const FwdDecl = 1 << 2; 1870 pub const AppleBlock = 1 << 3; 1871 pub const BlockByrefStruct = 1 << 4; 1872 pub const Virtual = 1 << 5; 1873 pub const Artificial = 1 << 6; 1874 pub const Explicit = 1 << 7; 1875 pub const Prototyped = 1 << 8; 1876 pub const ObjcClassComplete = 1 << 9; 1877 pub const ObjectPointer = 1 << 10; 1878 pub const Vector = 1 << 11; 1879 pub const StaticMember = 1 << 12; 1880 pub const LValueReference = 1 << 13; 1881 pub const RValueReference = 1 << 14; 1882 pub const Reserved = 1 << 15; 1883 1884 pub const SingleInheritance = 1 << 16; 1885 pub const MultipleInheritance = 2 << 16; 1886 pub const VirtualInheritance = 3 << 16; 1887 1888 pub const IntroducedVirtual = 1 << 18; 1889 pub const BitField = 1 << 19; 1890 pub const NoReturn = 1 << 20; 1891 pub const TypePassByValue = 1 << 22; 1892 pub const TypePassByReference = 1 << 23; 1893 pub const EnumClass = 1 << 24; 1894 pub const Thunk = 1 << 25; 1895 pub const NonTrivial = 1 << 26; 1896 pub const BigEndian = 1 << 27; 1897 pub const LittleEndian = 1 << 28; 1898 pub const AllCallsDescribed = 1 << 29; 1899 };