1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // FIXME: Rename 'DIGlobalVariable' to 'DIGlobalVariableExpression'
12 // once support for LLVM 3.9 is dropped.
14 // This method was changed in this LLVM patch:
15 // https://reviews.llvm.org/D26769
17 use debuginfo::{DIBuilderRef, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
18 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
19 DIGlobalVariable, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
20 DINameSpace, DIFlags};
22 use libc::{c_uint, c_int, size_t, c_char};
23 use libc::{c_longlong, c_ulonglong, c_void};
27 pub type Opcode = u32;
28 pub type Bool = c_uint;
30 pub const True: Bool = 1 as Bool;
31 pub const False: Bool = 0 as Bool;
33 #[derive(Copy, Clone, PartialEq)]
35 pub enum LLVMRustResult {
39 // Consts for the LLVM CallConv type, pre-cast to usize.
41 /// LLVM CallingConv::ID. Should we wrap this?
42 #[derive(Copy, Clone, PartialEq, Debug)]
48 X86StdcallCallConv = 64,
49 X86FastcallCallConv = 65,
50 ArmAapcsCallConv = 67,
61 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
65 AvailableExternallyLinkage = 1,
66 LinkOnceAnyLinkage = 2,
67 LinkOnceODRLinkage = 3,
73 ExternalWeakLinkage = 9,
78 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
86 /// LLVMDiagnosticSeverity
87 #[derive(Copy, Clone, Debug)]
89 pub enum DiagnosticSeverity {
96 /// LLVMDLLStorageClass
97 #[derive(Copy, Clone)]
99 pub enum DLLStorageClass {
101 DllImport = 1, // Function to be imported from DLL.
102 DllExport = 2, // Function to be accessible from DLL.
105 /// Matches LLVMRustAttribute in rustllvm.h
106 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
107 /// though it is not ABI compatible (since it's a C++ enum)
109 #[derive(Copy, Clone, Debug)]
124 OptimizeForSize = 13,
132 SanitizeAddress = 21,
137 #[derive(Copy, Clone)]
139 pub enum IntPredicate {
152 /// LLVMRealPredicate
153 #[derive(Copy, Clone)]
155 pub enum RealPredicate {
156 RealPredicateFalse = 0,
171 RealPredicateTrue = 15,
175 #[derive(Copy, Clone, PartialEq, Debug)]
197 /// LLVMAtomicRmwBinOp
198 #[derive(Copy, Clone)]
200 pub enum AtomicRmwBinOp {
214 /// LLVMAtomicOrdering
215 #[derive(Copy, Clone)]
217 pub enum AtomicOrdering {
221 // Consume = 3, // Not specified yet.
225 SequentiallyConsistent = 7,
228 /// LLVMRustSynchronizationScope
229 #[derive(Copy, Clone)]
231 pub enum SynchronizationScope {
238 #[derive(Copy, Clone)]
247 #[derive(Copy, Clone)]
249 pub enum MetadataType {
256 MD_invariant_load = 6,
260 MD_mem_parallel_loop_access = 10,
264 /// LLVMRustAsmDialect
265 #[derive(Copy, Clone)]
267 pub enum AsmDialect {
273 /// LLVMRustCodeGenOptLevel
274 #[derive(Copy, Clone, PartialEq)]
276 pub enum CodeGenOptLevel {
285 #[derive(Copy, Clone, PartialEq)]
297 /// LLVMRustCodeModel
298 #[derive(Copy, Clone)]
310 /// LLVMRustDiagnosticKind
311 #[derive(Copy, Clone)]
313 pub enum DiagnosticKind {
317 DebugMetadataVersion,
320 OptimizationRemarkMissed,
321 OptimizationRemarkAnalysis,
322 OptimizationRemarkAnalysisFPCommute,
323 OptimizationRemarkAnalysisAliasing,
324 OptimizationRemarkOther,
328 /// LLVMRustArchiveKind
329 #[derive(Copy, Clone)]
331 pub enum ArchiveKind {
340 #[derive(Copy, Clone, PartialEq, Debug)]
348 /// LLVMRustThinLTOData
349 pub enum ThinLTOData {}
351 /// LLVMRustThinLTOBuffer
352 pub enum ThinLTOBuffer {}
354 /// LLVMRustThinLTOModule
356 pub struct ThinLTOModule {
357 pub identifier: *const c_char,
362 /// LLVMThreadLocalMode
363 #[derive(Copy, Clone)]
365 pub enum ThreadLocalMode {
373 // Opaque pointer types
374 #[allow(missing_copy_implementations)]
375 pub enum Module_opaque {}
376 pub type ModuleRef = *mut Module_opaque;
377 #[allow(missing_copy_implementations)]
378 pub enum Context_opaque {}
379 pub type ContextRef = *mut Context_opaque;
380 #[allow(missing_copy_implementations)]
381 pub enum Type_opaque {}
382 pub type TypeRef = *mut Type_opaque;
383 #[allow(missing_copy_implementations)]
384 pub enum Value_opaque {}
385 pub type ValueRef = *mut Value_opaque;
386 #[allow(missing_copy_implementations)]
387 pub enum Metadata_opaque {}
388 pub type MetadataRef = *mut Metadata_opaque;
389 #[allow(missing_copy_implementations)]
390 pub enum BasicBlock_opaque {}
391 pub type BasicBlockRef = *mut BasicBlock_opaque;
392 #[allow(missing_copy_implementations)]
393 pub enum Builder_opaque {}
394 pub type BuilderRef = *mut Builder_opaque;
395 #[allow(missing_copy_implementations)]
396 pub enum ExecutionEngine_opaque {}
397 pub type ExecutionEngineRef = *mut ExecutionEngine_opaque;
398 #[allow(missing_copy_implementations)]
399 pub enum MemoryBuffer_opaque {}
400 pub type MemoryBufferRef = *mut MemoryBuffer_opaque;
401 #[allow(missing_copy_implementations)]
402 pub enum PassManager_opaque {}
403 pub type PassManagerRef = *mut PassManager_opaque;
404 #[allow(missing_copy_implementations)]
405 pub enum PassManagerBuilder_opaque {}
406 pub type PassManagerBuilderRef = *mut PassManagerBuilder_opaque;
407 #[allow(missing_copy_implementations)]
408 pub enum Use_opaque {}
409 pub type UseRef = *mut Use_opaque;
410 #[allow(missing_copy_implementations)]
411 pub enum TargetData_opaque {}
412 pub type TargetDataRef = *mut TargetData_opaque;
413 #[allow(missing_copy_implementations)]
414 pub enum ObjectFile_opaque {}
415 pub type ObjectFileRef = *mut ObjectFile_opaque;
416 #[allow(missing_copy_implementations)]
417 pub enum SectionIterator_opaque {}
418 pub type SectionIteratorRef = *mut SectionIterator_opaque;
419 #[allow(missing_copy_implementations)]
420 pub enum Pass_opaque {}
421 pub type PassRef = *mut Pass_opaque;
422 #[allow(missing_copy_implementations)]
423 pub enum TargetMachine_opaque {}
424 pub type TargetMachineRef = *mut TargetMachine_opaque;
425 pub enum Archive_opaque {}
426 pub type ArchiveRef = *mut Archive_opaque;
427 pub enum ArchiveIterator_opaque {}
428 pub type ArchiveIteratorRef = *mut ArchiveIterator_opaque;
429 pub enum ArchiveChild_opaque {}
430 pub type ArchiveChildRef = *mut ArchiveChild_opaque;
431 #[allow(missing_copy_implementations)]
432 pub enum Twine_opaque {}
433 pub type TwineRef = *mut Twine_opaque;
434 #[allow(missing_copy_implementations)]
435 pub enum DiagnosticInfo_opaque {}
436 pub type DiagnosticInfoRef = *mut DiagnosticInfo_opaque;
437 #[allow(missing_copy_implementations)]
438 pub enum DebugLoc_opaque {}
439 pub type DebugLocRef = *mut DebugLoc_opaque;
440 #[allow(missing_copy_implementations)]
441 pub enum SMDiagnostic_opaque {}
442 pub type SMDiagnosticRef = *mut SMDiagnostic_opaque;
443 #[allow(missing_copy_implementations)]
444 pub enum RustArchiveMember_opaque {}
445 pub type RustArchiveMemberRef = *mut RustArchiveMember_opaque;
446 #[allow(missing_copy_implementations)]
447 pub enum OperandBundleDef_opaque {}
448 pub type OperandBundleDefRef = *mut OperandBundleDef_opaque;
450 pub type DiagnosticHandler = unsafe extern "C" fn(DiagnosticInfoRef, *mut c_void);
451 pub type InlineAsmDiagHandler = unsafe extern "C" fn(SMDiagnosticRef, *const c_void, c_uint);
455 use super::MetadataRef;
457 #[allow(missing_copy_implementations)]
458 pub enum DIBuilder_opaque {}
459 pub type DIBuilderRef = *mut DIBuilder_opaque;
461 pub type DIDescriptor = MetadataRef;
462 pub type DIScope = DIDescriptor;
463 pub type DILocation = DIDescriptor;
464 pub type DIFile = DIScope;
465 pub type DILexicalBlock = DIScope;
466 pub type DISubprogram = DIScope;
467 pub type DINameSpace = DIScope;
468 pub type DIType = DIDescriptor;
469 pub type DIBasicType = DIType;
470 pub type DIDerivedType = DIType;
471 pub type DICompositeType = DIDerivedType;
472 pub type DIVariable = DIDescriptor;
473 pub type DIGlobalVariable = DIDescriptor;
474 pub type DIArray = DIDescriptor;
475 pub type DISubrange = DIDescriptor;
476 pub type DIEnumerator = DIDescriptor;
477 pub type DITemplateTypeParameter = DIDescriptor;
479 // These values **must** match with LLVMRustDIFlags!!
483 pub struct DIFlags: ::libc::uint32_t {
485 const FlagPrivate = 1;
486 const FlagProtected = 2;
487 const FlagPublic = 3;
488 const FlagFwdDecl = (1 << 2);
489 const FlagAppleBlock = (1 << 3);
490 const FlagBlockByrefStruct = (1 << 4);
491 const FlagVirtual = (1 << 5);
492 const FlagArtificial = (1 << 6);
493 const FlagExplicit = (1 << 7);
494 const FlagPrototyped = (1 << 8);
495 const FlagObjcClassComplete = (1 << 9);
496 const FlagObjectPointer = (1 << 10);
497 const FlagVector = (1 << 11);
498 const FlagStaticMember = (1 << 12);
499 const FlagLValueReference = (1 << 13);
500 const FlagRValueReference = (1 << 14);
501 const FlagMainSubprogram = (1 << 21);
506 pub enum ModuleBuffer {}
508 // Link to our native llvm bindings (things that we need to use the C++ api
509 // for) and because llvm is written in C++ we need to link against libstdc++
511 // You'll probably notice that there is an omission of all LLVM libraries
512 // from this location. This is because the set of LLVM libraries that we
513 // link to is mostly defined by LLVM, and the `llvm-config` tool is used to
514 // figure out the exact set of libraries. To do this, the build system
515 // generates an llvmdeps.rs file next to this one which will be
516 // automatically updated whenever LLVM is updated to include an up-to-date
517 // set of the libraries we need to link to LLVM for.
518 #[link(name = "rustllvm", kind = "static")] // not quite true but good enough
520 // Create and destroy contexts.
521 pub fn LLVMContextCreate() -> ContextRef;
522 pub fn LLVMContextDispose(C: ContextRef);
523 pub fn LLVMGetMDKindIDInContext(C: ContextRef, Name: *const c_char, SLen: c_uint) -> c_uint;
525 // Create and destroy modules.
526 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: ContextRef) -> ModuleRef;
527 pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
528 pub fn LLVMCloneModule(M: ModuleRef) -> ModuleRef;
529 pub fn LLVMDisposeModule(M: ModuleRef);
531 /// Data layout. See Module::getDataLayout.
532 pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
533 pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
535 /// See Module::dump.
536 pub fn LLVMDumpModule(M: ModuleRef);
538 /// See Module::setModuleInlineAsm.
539 pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
540 pub fn LLVMRustAppendModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
542 /// See llvm::LLVMTypeKind::getTypeID.
543 pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;
545 /// See llvm::Value::getContext
546 pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;
548 // Operations on integer types
549 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
550 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
551 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
552 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
553 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
554 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) -> TypeRef;
556 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
558 // Operations on real types
559 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
560 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
562 // Operations on function types
563 pub fn LLVMFunctionType(ReturnType: TypeRef,
564 ParamTypes: *const TypeRef,
568 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
569 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
570 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *mut TypeRef);
572 // Operations on struct types
573 pub fn LLVMStructTypeInContext(C: ContextRef,
574 ElementTypes: *const TypeRef,
575 ElementCount: c_uint,
578 pub fn LLVMCountStructElementTypes(StructTy: TypeRef) -> c_uint;
579 pub fn LLVMGetStructElementTypes(StructTy: TypeRef, Dest: *mut TypeRef);
580 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
582 // Operations on array, pointer, and vector types (sequence types)
583 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
584 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint) -> TypeRef;
585 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint) -> TypeRef;
587 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
588 pub fn LLVMGetArrayLength(ArrayTy: TypeRef) -> c_uint;
589 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
591 // Operations on other types
592 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
593 pub fn LLVMRustMetadataTypeInContext(C: ContextRef) -> TypeRef;
595 // Operations on all values
596 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
597 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
598 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
599 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
600 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
602 // Operations on Uses
603 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
604 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
605 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
607 // Operations on Users
608 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
610 // Operations on constants of any type
611 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
612 pub fn LLVMConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
613 pub fn LLVMConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
614 // only for isize/vector
615 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
616 pub fn LLVMIsNull(Val: ValueRef) -> Bool;
617 pub fn LLVMIsUndef(Val: ValueRef) -> Bool;
619 // Operations on metadata
620 pub fn LLVMMDStringInContext(C: ContextRef, Str: *const c_char, SLen: c_uint) -> ValueRef;
621 pub fn LLVMMDNodeInContext(C: ContextRef, Vals: *const ValueRef, Count: c_uint) -> ValueRef;
622 pub fn LLVMAddNamedMetadataOperand(M: ModuleRef, Name: *const c_char, Val: ValueRef);
624 // Operations on scalar constants
625 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef;
626 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: TypeRef, Wn: c_uint, Ws: *const u64) -> ValueRef;
627 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
628 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
629 pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
630 high: *mut u64, low: *mut u64) -> bool;
633 // Operations on composite constants
634 pub fn LLVMConstStringInContext(C: ContextRef,
637 DontNullTerminate: Bool)
639 pub fn LLVMConstStructInContext(C: ContextRef,
640 ConstantVals: *const ValueRef,
645 pub fn LLVMConstArray(ElementTy: TypeRef,
646 ConstantVals: *const ValueRef,
649 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint) -> ValueRef;
651 // Constant expressions
652 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
653 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
654 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
655 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
656 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
657 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
658 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
659 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
660 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
661 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
662 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
663 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
664 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
665 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
666 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
667 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
668 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
669 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
670 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
671 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
672 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
673 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
674 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
675 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
676 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
677 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
678 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
679 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
680 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
681 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
682 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
683 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
684 pub fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef, isSigned: Bool) -> ValueRef;
685 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
686 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
687 IdxList: *const c_uint,
690 pub fn LLVMConstInlineAsm(Ty: TypeRef,
691 AsmString: *const c_char,
692 Constraints: *const c_char,
693 HasSideEffects: Bool,
698 // Operations on global variables, functions, and aliases (globals)
699 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
700 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
701 pub fn LLVMRustGetLinkage(Global: ValueRef) -> Linkage;
702 pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
703 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
704 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
705 pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
706 pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
707 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
708 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
709 pub fn LLVMSetDLLStorageClass(V: ValueRef, C: DLLStorageClass);
712 // Operations on global variables
713 pub fn LLVMIsAGlobalVariable(GlobalVar: ValueRef) -> ValueRef;
714 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
715 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
716 pub fn LLVMRustGetOrInsertGlobal(M: ModuleRef, Name: *const c_char, T: TypeRef) -> ValueRef;
717 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
718 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
719 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
720 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
721 pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
722 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
723 pub fn LLVMSetThreadLocalMode(GlobalVar: ValueRef, Mode: ThreadLocalMode);
724 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
725 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
726 pub fn LLVMRustGetNamedValue(M: ModuleRef, Name: *const c_char) -> ValueRef;
727 pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
729 // Operations on functions
730 pub fn LLVMAddFunction(M: ModuleRef, Name: *const c_char, FunctionTy: TypeRef) -> ValueRef;
731 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
732 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
733 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
734 pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
738 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
739 pub fn LLVMRustAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: u64);
740 pub fn LLVMRustAddFunctionAttribute(Fn: ValueRef, index: c_uint, attr: Attribute);
741 pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
744 Value: *const c_char);
745 pub fn LLVMRustRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: Attribute);
747 // Operations on parameters
748 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
749 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
751 // Operations on basic blocks
752 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
753 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
754 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
758 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
760 // Operations on instructions
761 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
762 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
763 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
764 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
766 // Operations on call sites
767 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
768 pub fn LLVMRustAddCallSiteAttribute(Instr: ValueRef, index: c_uint, attr: Attribute);
769 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u64);
771 // Operations on load/store instructions (only)
772 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
774 // Operations on phi nodes
775 pub fn LLVMAddIncoming(PhiNode: ValueRef,
776 IncomingValues: *const ValueRef,
777 IncomingBlocks: *const BasicBlockRef,
780 // Instruction builders
781 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
782 pub fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef, Instr: ValueRef);
783 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
784 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, Block: BasicBlockRef);
785 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
786 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
789 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
790 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
791 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
794 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
795 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
796 pub fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *const ValueRef, N: c_uint) -> ValueRef;
797 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
798 pub fn LLVMBuildCondBr(B: BuilderRef,
803 pub fn LLVMBuildSwitch(B: BuilderRef,
808 pub fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: c_uint) -> ValueRef;
809 pub fn LLVMRustBuildInvoke(B: BuilderRef,
811 Args: *const ValueRef,
814 Catch: BasicBlockRef,
815 Bundle: OperandBundleDefRef,
818 pub fn LLVMRustBuildLandingPad(B: BuilderRef,
825 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
826 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
828 pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
831 Args: *const ValueRef,
834 pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
835 CleanupPad: ValueRef,
836 UnwindBB: BasicBlockRef)
838 pub fn LLVMRustBuildCatchPad(B: BuilderRef,
841 Args: *const ValueRef,
844 pub fn LLVMRustBuildCatchRet(B: BuilderRef, Pad: ValueRef, BB: BasicBlockRef) -> ValueRef;
845 pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
851 pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
852 pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
854 // Add a case to the switch instruction
855 pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
857 // Add a clause to the landing pad instruction
858 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
860 // Set the cleanup on a landing pad instruction
861 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
864 pub fn LLVMBuildAdd(B: BuilderRef,
869 pub fn LLVMBuildNSWAdd(B: BuilderRef,
874 pub fn LLVMBuildNUWAdd(B: BuilderRef,
879 pub fn LLVMBuildFAdd(B: BuilderRef,
884 pub fn LLVMBuildSub(B: BuilderRef,
889 pub fn LLVMBuildNSWSub(B: BuilderRef,
894 pub fn LLVMBuildNUWSub(B: BuilderRef,
899 pub fn LLVMBuildFSub(B: BuilderRef,
904 pub fn LLVMBuildMul(B: BuilderRef,
909 pub fn LLVMBuildNSWMul(B: BuilderRef,
914 pub fn LLVMBuildNUWMul(B: BuilderRef,
919 pub fn LLVMBuildFMul(B: BuilderRef,
924 pub fn LLVMBuildUDiv(B: BuilderRef,
929 pub fn LLVMBuildSDiv(B: BuilderRef,
934 pub fn LLVMBuildExactSDiv(B: BuilderRef,
939 pub fn LLVMBuildFDiv(B: BuilderRef,
944 pub fn LLVMBuildURem(B: BuilderRef,
949 pub fn LLVMBuildSRem(B: BuilderRef,
954 pub fn LLVMBuildFRem(B: BuilderRef,
959 pub fn LLVMBuildShl(B: BuilderRef,
964 pub fn LLVMBuildLShr(B: BuilderRef,
969 pub fn LLVMBuildAShr(B: BuilderRef,
974 pub fn LLVMBuildAnd(B: BuilderRef,
979 pub fn LLVMBuildOr(B: BuilderRef,
984 pub fn LLVMBuildXor(B: BuilderRef,
989 pub fn LLVMBuildBinOp(B: BuilderRef,
995 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
996 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
997 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
998 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
999 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
1000 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: ValueRef);
1003 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1004 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
1005 pub fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *const c_char) -> ValueRef;
1007 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) -> ValueRef;
1009 pub fn LLVMBuildGEP(B: BuilderRef,
1011 Indices: *const ValueRef,
1013 Name: *const c_char)
1015 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
1017 Indices: *const ValueRef,
1019 Name: *const c_char)
1021 pub fn LLVMBuildStructGEP(B: BuilderRef,
1024 Name: *const c_char)
1026 pub fn LLVMBuildGlobalString(B: BuilderRef,
1028 Name: *const c_char)
1030 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1032 Name: *const c_char)
1036 pub fn LLVMBuildTrunc(B: BuilderRef,
1039 Name: *const c_char)
1041 pub fn LLVMBuildZExt(B: BuilderRef,
1044 Name: *const c_char)
1046 pub fn LLVMBuildSExt(B: BuilderRef,
1049 Name: *const c_char)
1051 pub fn LLVMBuildFPToUI(B: BuilderRef,
1054 Name: *const c_char)
1056 pub fn LLVMBuildFPToSI(B: BuilderRef,
1059 Name: *const c_char)
1061 pub fn LLVMBuildUIToFP(B: BuilderRef,
1064 Name: *const c_char)
1066 pub fn LLVMBuildSIToFP(B: BuilderRef,
1069 Name: *const c_char)
1071 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1074 Name: *const c_char)
1076 pub fn LLVMBuildFPExt(B: BuilderRef,
1079 Name: *const c_char)
1081 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1084 Name: *const c_char)
1086 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1089 Name: *const c_char)
1091 pub fn LLVMBuildBitCast(B: BuilderRef,
1094 Name: *const c_char)
1096 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1099 Name: *const c_char)
1101 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1104 Name: *const c_char)
1106 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1109 Name: *const c_char)
1111 pub fn LLVMBuildCast(B: BuilderRef,
1115 Name: *const c_char)
1117 pub fn LLVMBuildPointerCast(B: BuilderRef,
1120 Name: *const c_char)
1122 pub fn LLVMRustBuildIntCast(B: BuilderRef,
1127 pub fn LLVMBuildFPCast(B: BuilderRef,
1130 Name: *const c_char)
1134 pub fn LLVMBuildICmp(B: BuilderRef,
1138 Name: *const c_char)
1140 pub fn LLVMBuildFCmp(B: BuilderRef,
1144 Name: *const c_char)
1147 // Miscellaneous instructions
1148 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1149 pub fn LLVMRustBuildCall(B: BuilderRef,
1151 Args: *const ValueRef,
1153 Bundle: OperandBundleDefRef,
1154 Name: *const c_char)
1156 pub fn LLVMBuildSelect(B: BuilderRef,
1160 Name: *const c_char)
1162 pub fn LLVMBuildVAArg(B: BuilderRef,
1165 Name: *const c_char)
1167 pub fn LLVMBuildExtractElement(B: BuilderRef,
1170 Name: *const c_char)
1172 pub fn LLVMBuildInsertElement(B: BuilderRef,
1176 Name: *const c_char)
1178 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1182 Name: *const c_char)
1184 pub fn LLVMBuildExtractValue(B: BuilderRef,
1187 Name: *const c_char)
1189 pub fn LLVMBuildInsertValue(B: BuilderRef,
1193 Name: *const c_char)
1196 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1197 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1198 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1201 Name: *const c_char)
1204 // Atomic Operations
1205 pub fn LLVMRustBuildAtomicLoad(B: BuilderRef,
1206 PointerVal: ValueRef,
1207 Name: *const c_char,
1208 Order: AtomicOrdering,
1212 pub fn LLVMRustBuildAtomicStore(B: BuilderRef,
1215 Order: AtomicOrdering,
1219 pub fn LLVMRustBuildAtomicCmpXchg(B: BuilderRef,
1223 Order: AtomicOrdering,
1224 FailureOrder: AtomicOrdering,
1228 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1232 Order: AtomicOrdering,
1233 SingleThreaded: Bool)
1236 pub fn LLVMRustBuildAtomicFence(B: BuilderRef,
1237 Order: AtomicOrdering,
1238 Scope: SynchronizationScope);
1241 // Selected entries from the downcasts.
1242 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1243 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1245 /// Writes a module to the specified path. Returns 0 on success.
1246 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1248 /// Creates target data from a target layout string.
1249 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1250 /// Number of bytes clobbered when doing a Store to *T.
1251 pub fn LLVMSizeOfTypeInBits(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1253 /// Distance between successive elements in an array of T. Includes ABI padding.
1254 pub fn LLVMABISizeOfType(TD: TargetDataRef, Ty: TypeRef) -> c_ulonglong;
1256 /// Returns the preferred alignment of a type.
1257 pub fn LLVMPreferredAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1258 /// Returns the minimum alignment of a type.
1259 pub fn LLVMABIAlignmentOfType(TD: TargetDataRef, Ty: TypeRef) -> c_uint;
1261 /// Computes the byte offset of the indexed struct element for a
1263 pub fn LLVMOffsetOfElement(TD: TargetDataRef,
1268 /// Disposes target data.
1269 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1271 /// Creates a pass manager.
1272 pub fn LLVMCreatePassManager() -> PassManagerRef;
1274 /// Creates a function-by-function pass manager
1275 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) -> PassManagerRef;
1277 /// Disposes a pass manager.
1278 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1280 /// Runs a pass manager on a module.
1281 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1283 pub fn LLVMInitializePasses();
1285 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1286 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1287 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, Value: Bool);
1288 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef, Value: Bool);
1289 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: PassManagerBuilderRef,
1291 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: PassManagerBuilderRef,
1292 PM: PassManagerRef);
1294 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: PassManagerBuilderRef,
1295 PM: PassManagerRef);
1296 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: PassManagerBuilderRef,
1300 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1301 PMB: PassManagerBuilderRef,
1302 PM: PassManagerRef) -> bool;
1304 // Stuff that's in rustllvm/ because it's not upstream yet.
1306 /// Opens an object file.
1307 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1308 /// Closes an object file.
1309 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1311 /// Enumerates the sections in an object file.
1312 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1313 /// Destroys a section iterator.
1314 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1315 /// Returns true if the section iterator is at the end of the section
1317 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, SI: SectionIteratorRef) -> Bool;
1318 /// Moves the section iterator to point to the next section.
1319 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1320 /// Returns the current section size.
1321 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1322 /// Returns the current section contents as a string buffer.
1323 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1325 /// Reads the given file and returns it as a memory buffer. Use
1326 /// LLVMDisposeMemoryBuffer() to get rid of it.
1327 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char) -> MemoryBufferRef;
1329 pub fn LLVMStartMultithreaded() -> Bool;
1331 /// Returns a string describing the last error caused by an LLVMRust* call.
1332 pub fn LLVMRustGetLastError() -> *const c_char;
1334 /// Print the pass timings since static dtors aren't picking them up.
1335 pub fn LLVMRustPrintPassTimings();
1337 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1339 pub fn LLVMStructSetBody(StructTy: TypeRef,
1340 ElementTypes: *const TypeRef,
1341 ElementCount: c_uint,
1344 pub fn LLVMConstNamedStruct(S: TypeRef,
1345 ConstantVals: *const ValueRef,
1349 /// Enables LLVM debug output.
1350 pub fn LLVMRustSetDebug(Enabled: c_int);
1352 /// Prepares inline assembly.
1353 pub fn LLVMRustInlineAsm(Ty: TypeRef,
1354 AsmString: *const c_char,
1355 Constraints: *const c_char,
1358 Dialect: AsmDialect)
1361 pub fn LLVMRustDebugMetadataVersion() -> u32;
1362 pub fn LLVMRustVersionMajor() -> u32;
1363 pub fn LLVMRustVersionMinor() -> u32;
1365 pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, value: u32);
1367 pub fn LLVMRustMetadataAsValue(C: ContextRef, MD: MetadataRef) -> ValueRef;
1369 pub fn LLVMRustDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1371 pub fn LLVMRustDIBuilderDispose(Builder: DIBuilderRef);
1373 pub fn LLVMRustDIBuilderFinalize(Builder: DIBuilderRef);
1375 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1378 Producer: *const c_char,
1380 Flags: *const c_char,
1382 SplitName: *const c_char)
1385 pub fn LLVMRustDIBuilderCreateFile(Builder: DIBuilderRef,
1386 Filename: *const c_char,
1387 Directory: *const c_char)
1390 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1392 ParameterTypes: DIArray)
1395 pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef,
1396 Scope: DIDescriptor,
1397 Name: *const c_char,
1398 LinkageName: *const c_char,
1402 isLocalToUnit: bool,
1412 pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef,
1413 Name: *const c_char,
1419 pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef,
1423 Name: *const c_char)
1426 pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef,
1427 Scope: DIDescriptor,
1428 Name: *const c_char,
1434 DerivedFrom: DIType,
1436 RunTimeLang: c_uint,
1437 VTableHolder: DIType,
1438 UniqueId: *const c_char)
1441 pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef,
1442 Scope: DIDescriptor,
1443 Name: *const c_char,
1453 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1460 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: DIBuilderRef,
1465 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1467 Name: *const c_char,
1468 LinkageName: *const c_char,
1472 isLocalToUnit: bool,
1476 -> DIGlobalVariable;
1478 pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef,
1480 Scope: DIDescriptor,
1481 Name: *const c_char,
1485 AlwaysPreserve: bool,
1491 pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef,
1495 Subscripts: DIArray)
1498 pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef,
1502 Subscripts: DIArray)
1505 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1510 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1511 Ptr: *const DIDescriptor,
1515 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1517 VarInfo: DIVariable,
1518 AddrOps: *const i64,
1519 AddrOpsCount: c_uint,
1521 InsertAtEnd: BasicBlockRef)
1524 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1525 Name: *const c_char,
1529 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1531 Name: *const c_char,
1540 pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef,
1542 Name: *const c_char,
1549 RunTimeLang: c_uint,
1550 UniqueId: *const c_char)
1553 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1555 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1557 Name: *const c_char,
1562 -> DITemplateTypeParameter;
1565 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1567 Name: *const c_char,
1571 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1572 CompositeType: DIType,
1573 TypeArray: DIArray);
1576 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: ContextRef,
1580 InlinedAt: MetadataRef)
1582 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1583 pub fn LLVMRustDIBuilderCreateOpPlus() -> i64;
1585 pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef);
1586 pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1588 pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1590 pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
1591 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;
1592 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef);
1594 pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
1596 pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
1597 pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
1599 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1601 Features: *const c_char,
1604 Level: CodeGenOptLevel,
1606 PositionIndependentExecutable: bool,
1607 FunctionSections: bool,
1609 -> TargetMachineRef;
1610 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1611 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: ModuleRef);
1612 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1614 DisableSimplifyLibCalls: bool);
1615 pub fn LLVMRustConfigurePassManagerBuilder(PMB: PassManagerBuilderRef,
1616 OptLevel: CodeGenOptLevel,
1617 MergeFunctions: bool,
1619 LoopVectorize: bool);
1620 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef,
1622 DisableSimplifyLibCalls: bool);
1623 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1624 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1627 Output: *const c_char,
1630 pub fn LLVMRustPrintModule(PM: PassManagerRef,
1632 Output: *const c_char,
1633 Demangle: extern fn(*const c_char,
1637 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1638 pub fn LLVMRustPrintPasses();
1639 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1640 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
1641 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1642 pub fn LLVMRustLinkInParsedExternalBitcode(M: ModuleRef, M: ModuleRef) -> bool;
1643 pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
1644 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1646 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1647 pub fn LLVMRustArchiveIteratorNew(AR: ArchiveRef) -> ArchiveIteratorRef;
1648 pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
1649 pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1650 pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1651 pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
1652 pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
1653 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1655 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
1657 pub fn LLVMRustWriteTwineToString(T: TwineRef, s: RustStringRef);
1659 pub fn LLVMContextSetDiagnosticHandler(C: ContextRef,
1660 Handler: DiagnosticHandler,
1661 DiagnosticContext: *mut c_void);
1663 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: DiagnosticInfoRef,
1664 pass_name_out: RustStringRef,
1665 function_out: *mut ValueRef,
1666 loc_line_out: *mut c_uint,
1667 loc_column_out: *mut c_uint,
1668 loc_filename_out: RustStringRef,
1669 message_out: RustStringRef);
1670 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: DiagnosticInfoRef,
1671 cookie_out: *mut c_uint,
1672 message_out: *mut TwineRef,
1673 instruction_out: *mut ValueRef);
1675 pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
1676 pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
1678 pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1680 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
1681 H: InlineAsmDiagHandler,
1684 pub fn LLVMRustWriteSMDiagnosticToString(d: SMDiagnosticRef, s: RustStringRef);
1686 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1688 Members: *const RustArchiveMemberRef,
1692 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1693 Name: *const c_char,
1694 Child: ArchiveChildRef)
1695 -> RustArchiveMemberRef;
1696 pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
1698 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef, TM: TargetMachineRef);
1699 pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
1701 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1702 Inputs: *const ValueRef,
1704 -> OperandBundleDefRef;
1705 pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
1707 pub fn LLVMRustPositionBuilderAtStart(B: BuilderRef, BB: BasicBlockRef);
1709 pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char);
1710 pub fn LLVMRustUnsetComdat(V: ValueRef);
1711 pub fn LLVMRustSetModulePIELevel(M: ModuleRef);
1712 pub fn LLVMRustModuleBufferCreate(M: ModuleRef) -> *mut ModuleBuffer;
1713 pub fn LLVMRustModuleBufferPtr(p: *const ModuleBuffer) -> *const u8;
1714 pub fn LLVMRustModuleBufferLen(p: *const ModuleBuffer) -> usize;
1715 pub fn LLVMRustModuleBufferFree(p: *mut ModuleBuffer);
1716 pub fn LLVMRustModuleCost(M: ModuleRef) -> u64;
1718 pub fn LLVMRustThinLTOAvailable() -> bool;
1719 pub fn LLVMRustWriteThinBitcodeToFile(PMR: PassManagerRef,
1721 BC: *const c_char) -> bool;
1722 pub fn LLVMRustThinLTOBufferCreate(M: ModuleRef) -> *mut ThinLTOBuffer;
1723 pub fn LLVMRustThinLTOBufferFree(M: *mut ThinLTOBuffer);
1724 pub fn LLVMRustThinLTOBufferPtr(M: *const ThinLTOBuffer) -> *const c_char;
1725 pub fn LLVMRustThinLTOBufferLen(M: *const ThinLTOBuffer) -> size_t;
1726 pub fn LLVMRustCreateThinLTOData(
1727 Modules: *const ThinLTOModule,
1729 PreservedSymbols: *const *const c_char,
1730 PreservedSymbolsLen: c_uint,
1731 ) -> *mut ThinLTOData;
1732 pub fn LLVMRustPrepareThinLTORename(
1733 Data: *const ThinLTOData,
1736 pub fn LLVMRustPrepareThinLTOResolveWeak(
1737 Data: *const ThinLTOData,
1740 pub fn LLVMRustPrepareThinLTOInternalize(
1741 Data: *const ThinLTOData,
1744 pub fn LLVMRustPrepareThinLTOImport(
1745 Data: *const ThinLTOData,
1748 pub fn LLVMRustFreeThinLTOData(Data: *mut ThinLTOData);
1749 pub fn LLVMRustParseBitcodeForThinLTO(
1750 Context: ContextRef,
1753 Identifier: *const c_char,
1755 pub fn LLVMGetModuleIdentifier(M: ModuleRef, size: *mut usize) -> *const c_char;