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