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 // This annotation is primarily needed for MSVC where attributes like
509 // dllimport/dllexport are applied and need to be correct for everything to
510 // link successfully. The #[link] annotation here says "these symbols are
511 // included statically" which means that they're all exported with dllexport
512 // and from the rustc_llvm dynamic library. Otherwise the rustc_trans dynamic
513 // library would not be able to access these symbols.
514 #[link(name = "rustllvm", kind = "static")]
516 // Create and destroy contexts.
517 pub fn LLVMContextCreate() -> ContextRef;
518 pub fn LLVMContextDispose(C: ContextRef);
519 pub fn LLVMGetMDKindIDInContext(C: ContextRef, Name: *const c_char, SLen: c_uint) -> c_uint;
521 // Create and destroy modules.
522 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: ContextRef) -> ModuleRef;
523 pub fn LLVMGetModuleContext(M: ModuleRef) -> ContextRef;
524 pub fn LLVMCloneModule(M: ModuleRef) -> ModuleRef;
525 pub fn LLVMDisposeModule(M: ModuleRef);
527 /// Data layout. See Module::getDataLayout.
528 pub fn LLVMGetDataLayout(M: ModuleRef) -> *const c_char;
529 pub fn LLVMSetDataLayout(M: ModuleRef, Triple: *const c_char);
531 /// See Module::dump.
532 pub fn LLVMDumpModule(M: ModuleRef);
534 /// See Module::setModuleInlineAsm.
535 pub fn LLVMSetModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
536 pub fn LLVMRustAppendModuleInlineAsm(M: ModuleRef, Asm: *const c_char);
538 /// See llvm::LLVMTypeKind::getTypeID.
539 pub fn LLVMRustGetTypeKind(Ty: TypeRef) -> TypeKind;
541 /// See llvm::Value::getContext
542 pub fn LLVMRustGetValueContext(V: ValueRef) -> ContextRef;
544 // Operations on integer types
545 pub fn LLVMInt1TypeInContext(C: ContextRef) -> TypeRef;
546 pub fn LLVMInt8TypeInContext(C: ContextRef) -> TypeRef;
547 pub fn LLVMInt16TypeInContext(C: ContextRef) -> TypeRef;
548 pub fn LLVMInt32TypeInContext(C: ContextRef) -> TypeRef;
549 pub fn LLVMInt64TypeInContext(C: ContextRef) -> TypeRef;
550 pub fn LLVMIntTypeInContext(C: ContextRef, NumBits: c_uint) -> TypeRef;
552 pub fn LLVMGetIntTypeWidth(IntegerTy: TypeRef) -> c_uint;
554 // Operations on real types
555 pub fn LLVMFloatTypeInContext(C: ContextRef) -> TypeRef;
556 pub fn LLVMDoubleTypeInContext(C: ContextRef) -> TypeRef;
558 // Operations on function types
559 pub fn LLVMFunctionType(ReturnType: TypeRef,
560 ParamTypes: *const TypeRef,
564 pub fn LLVMGetReturnType(FunctionTy: TypeRef) -> TypeRef;
565 pub fn LLVMCountParamTypes(FunctionTy: TypeRef) -> c_uint;
566 pub fn LLVMGetParamTypes(FunctionTy: TypeRef, Dest: *mut TypeRef);
568 // Operations on struct types
569 pub fn LLVMStructTypeInContext(C: ContextRef,
570 ElementTypes: *const TypeRef,
571 ElementCount: c_uint,
574 pub fn LLVMIsPackedStruct(StructTy: TypeRef) -> Bool;
576 // Operations on array, pointer, and vector types (sequence types)
577 pub fn LLVMRustArrayType(ElementType: TypeRef, ElementCount: u64) -> TypeRef;
578 pub fn LLVMPointerType(ElementType: TypeRef, AddressSpace: c_uint) -> TypeRef;
579 pub fn LLVMVectorType(ElementType: TypeRef, ElementCount: c_uint) -> TypeRef;
581 pub fn LLVMGetElementType(Ty: TypeRef) -> TypeRef;
582 pub fn LLVMGetVectorSize(VectorTy: TypeRef) -> c_uint;
584 // Operations on other types
585 pub fn LLVMVoidTypeInContext(C: ContextRef) -> TypeRef;
586 pub fn LLVMX86MMXTypeInContext(C: ContextRef) -> TypeRef;
587 pub fn LLVMRustMetadataTypeInContext(C: ContextRef) -> TypeRef;
589 // Operations on all values
590 pub fn LLVMTypeOf(Val: ValueRef) -> TypeRef;
591 pub fn LLVMGetValueName(Val: ValueRef) -> *const c_char;
592 pub fn LLVMSetValueName(Val: ValueRef, Name: *const c_char);
593 pub fn LLVMReplaceAllUsesWith(OldVal: ValueRef, NewVal: ValueRef);
594 pub fn LLVMSetMetadata(Val: ValueRef, KindID: c_uint, Node: ValueRef);
596 // Operations on Uses
597 pub fn LLVMGetFirstUse(Val: ValueRef) -> UseRef;
598 pub fn LLVMGetNextUse(U: UseRef) -> UseRef;
599 pub fn LLVMGetUser(U: UseRef) -> ValueRef;
601 // Operations on Users
602 pub fn LLVMGetOperand(Val: ValueRef, Index: c_uint) -> ValueRef;
604 // Operations on constants of any type
605 pub fn LLVMConstNull(Ty: TypeRef) -> ValueRef;
606 pub fn LLVMConstICmp(Pred: IntPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
607 pub fn LLVMConstFCmp(Pred: RealPredicate, V1: ValueRef, V2: ValueRef) -> ValueRef;
608 pub fn LLVMGetUndef(Ty: TypeRef) -> ValueRef;
610 // Operations on metadata
611 pub fn LLVMMDStringInContext(C: ContextRef, Str: *const c_char, SLen: c_uint) -> ValueRef;
612 pub fn LLVMMDNodeInContext(C: ContextRef, Vals: *const ValueRef, Count: c_uint) -> ValueRef;
613 pub fn LLVMAddNamedMetadataOperand(M: ModuleRef, Name: *const c_char, Val: ValueRef);
615 // Operations on scalar constants
616 pub fn LLVMConstInt(IntTy: TypeRef, N: c_ulonglong, SignExtend: Bool) -> ValueRef;
617 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: TypeRef, Wn: c_uint, Ws: *const u64) -> ValueRef;
618 pub fn LLVMConstIntGetZExtValue(ConstantVal: ValueRef) -> c_ulonglong;
619 pub fn LLVMConstIntGetSExtValue(ConstantVal: ValueRef) -> c_longlong;
620 pub fn LLVMRustConstInt128Get(ConstantVal: ValueRef, SExt: bool,
621 high: *mut u64, low: *mut u64) -> bool;
624 // Operations on composite constants
625 pub fn LLVMConstStringInContext(C: ContextRef,
628 DontNullTerminate: Bool)
630 pub fn LLVMConstStructInContext(C: ContextRef,
631 ConstantVals: *const ValueRef,
636 pub fn LLVMConstArray(ElementTy: TypeRef,
637 ConstantVals: *const ValueRef,
640 pub fn LLVMConstVector(ScalarConstantVals: *const ValueRef, Size: c_uint) -> ValueRef;
642 // Constant expressions
643 pub fn LLVMSizeOf(Ty: TypeRef) -> ValueRef;
644 pub fn LLVMConstNeg(ConstantVal: ValueRef) -> ValueRef;
645 pub fn LLVMConstFNeg(ConstantVal: ValueRef) -> ValueRef;
646 pub fn LLVMConstNot(ConstantVal: ValueRef) -> ValueRef;
647 pub fn LLVMConstAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
648 pub fn LLVMConstFAdd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
649 pub fn LLVMConstSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
650 pub fn LLVMConstFSub(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
651 pub fn LLVMConstMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
652 pub fn LLVMConstFMul(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
653 pub fn LLVMConstUDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
654 pub fn LLVMConstSDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
655 pub fn LLVMConstFDiv(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
656 pub fn LLVMConstURem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
657 pub fn LLVMConstSRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
658 pub fn LLVMConstFRem(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
659 pub fn LLVMConstAnd(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
660 pub fn LLVMConstOr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
661 pub fn LLVMConstXor(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
662 pub fn LLVMConstShl(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
663 pub fn LLVMConstLShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
664 pub fn LLVMConstAShr(LHSConstant: ValueRef, RHSConstant: ValueRef) -> ValueRef;
665 pub fn LLVMConstTrunc(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
666 pub fn LLVMConstZExt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
667 pub fn LLVMConstUIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
668 pub fn LLVMConstSIToFP(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
669 pub fn LLVMConstFPToUI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
670 pub fn LLVMConstFPToSI(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
671 pub fn LLVMConstPtrToInt(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
672 pub fn LLVMConstIntToPtr(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
673 pub fn LLVMConstBitCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
674 pub fn LLVMConstPointerCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
675 pub fn LLVMConstIntCast(ConstantVal: ValueRef, ToType: TypeRef, isSigned: Bool) -> ValueRef;
676 pub fn LLVMConstFPCast(ConstantVal: ValueRef, ToType: TypeRef) -> ValueRef;
677 pub fn LLVMConstExtractValue(AggConstant: ValueRef,
678 IdxList: *const c_uint,
681 pub fn LLVMConstInlineAsm(Ty: TypeRef,
682 AsmString: *const c_char,
683 Constraints: *const c_char,
684 HasSideEffects: Bool,
689 // Operations on global variables, functions, and aliases (globals)
690 pub fn LLVMGetGlobalParent(Global: ValueRef) -> ModuleRef;
691 pub fn LLVMIsDeclaration(Global: ValueRef) -> Bool;
692 pub fn LLVMRustGetLinkage(Global: ValueRef) -> Linkage;
693 pub fn LLVMRustSetLinkage(Global: ValueRef, RustLinkage: Linkage);
694 pub fn LLVMGetSection(Global: ValueRef) -> *const c_char;
695 pub fn LLVMSetSection(Global: ValueRef, Section: *const c_char);
696 pub fn LLVMRustGetVisibility(Global: ValueRef) -> Visibility;
697 pub fn LLVMRustSetVisibility(Global: ValueRef, Viz: Visibility);
698 pub fn LLVMGetAlignment(Global: ValueRef) -> c_uint;
699 pub fn LLVMSetAlignment(Global: ValueRef, Bytes: c_uint);
700 pub fn LLVMSetDLLStorageClass(V: ValueRef, C: DLLStorageClass);
703 // Operations on global variables
704 pub fn LLVMIsAGlobalVariable(GlobalVar: ValueRef) -> ValueRef;
705 pub fn LLVMAddGlobal(M: ModuleRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
706 pub fn LLVMGetNamedGlobal(M: ModuleRef, Name: *const c_char) -> ValueRef;
707 pub fn LLVMRustGetOrInsertGlobal(M: ModuleRef, Name: *const c_char, T: TypeRef) -> ValueRef;
708 pub fn LLVMGetFirstGlobal(M: ModuleRef) -> ValueRef;
709 pub fn LLVMGetNextGlobal(GlobalVar: ValueRef) -> ValueRef;
710 pub fn LLVMDeleteGlobal(GlobalVar: ValueRef);
711 pub fn LLVMGetInitializer(GlobalVar: ValueRef) -> ValueRef;
712 pub fn LLVMSetInitializer(GlobalVar: ValueRef, ConstantVal: ValueRef);
713 pub fn LLVMSetThreadLocal(GlobalVar: ValueRef, IsThreadLocal: Bool);
714 pub fn LLVMSetThreadLocalMode(GlobalVar: ValueRef, Mode: ThreadLocalMode);
715 pub fn LLVMIsGlobalConstant(GlobalVar: ValueRef) -> Bool;
716 pub fn LLVMSetGlobalConstant(GlobalVar: ValueRef, IsConstant: Bool);
717 pub fn LLVMRustGetNamedValue(M: ModuleRef, Name: *const c_char) -> ValueRef;
718 pub fn LLVMSetTailCall(CallInst: ValueRef, IsTailCall: Bool);
720 // Operations on functions
721 pub fn LLVMAddFunction(M: ModuleRef, Name: *const c_char, FunctionTy: TypeRef) -> ValueRef;
722 pub fn LLVMGetNamedFunction(M: ModuleRef, Name: *const c_char) -> ValueRef;
723 pub fn LLVMGetFirstFunction(M: ModuleRef) -> ValueRef;
724 pub fn LLVMGetNextFunction(Fn: ValueRef) -> ValueRef;
725 pub fn LLVMRustGetOrInsertFunction(M: ModuleRef,
729 pub fn LLVMSetFunctionCallConv(Fn: ValueRef, CC: c_uint);
730 pub fn LLVMRustAddAlignmentAttr(Fn: ValueRef, index: c_uint, bytes: u32);
731 pub fn LLVMRustAddDereferenceableAttr(Fn: ValueRef, index: c_uint, bytes: u64);
732 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: ValueRef, index: c_uint, bytes: u64);
733 pub fn LLVMRustAddFunctionAttribute(Fn: ValueRef, index: c_uint, attr: Attribute);
734 pub fn LLVMRustAddFunctionAttrStringValue(Fn: ValueRef,
737 Value: *const c_char);
738 pub fn LLVMRustRemoveFunctionAttributes(Fn: ValueRef, index: c_uint, attr: Attribute);
740 // Operations on parameters
741 pub fn LLVMCountParams(Fn: ValueRef) -> c_uint;
742 pub fn LLVMGetParam(Fn: ValueRef, Index: c_uint) -> ValueRef;
744 // Operations on basic blocks
745 pub fn LLVMBasicBlockAsValue(BB: BasicBlockRef) -> ValueRef;
746 pub fn LLVMGetBasicBlockParent(BB: BasicBlockRef) -> ValueRef;
747 pub fn LLVMAppendBasicBlockInContext(C: ContextRef,
751 pub fn LLVMDeleteBasicBlock(BB: BasicBlockRef);
753 // Operations on instructions
754 pub fn LLVMGetInstructionParent(Inst: ValueRef) -> BasicBlockRef;
755 pub fn LLVMGetFirstBasicBlock(Fn: ValueRef) -> BasicBlockRef;
756 pub fn LLVMGetFirstInstruction(BB: BasicBlockRef) -> ValueRef;
757 pub fn LLVMInstructionEraseFromParent(Inst: ValueRef);
759 // Operations on call sites
760 pub fn LLVMSetInstructionCallConv(Instr: ValueRef, CC: c_uint);
761 pub fn LLVMRustAddCallSiteAttribute(Instr: ValueRef, index: c_uint, attr: Attribute);
762 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u32);
763 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: ValueRef, index: c_uint, bytes: u64);
764 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: ValueRef,
768 // Operations on load/store instructions (only)
769 pub fn LLVMSetVolatile(MemoryAccessInst: ValueRef, volatile: Bool);
771 // Operations on phi nodes
772 pub fn LLVMAddIncoming(PhiNode: ValueRef,
773 IncomingValues: *const ValueRef,
774 IncomingBlocks: *const BasicBlockRef,
777 // Instruction builders
778 pub fn LLVMCreateBuilderInContext(C: ContextRef) -> BuilderRef;
779 pub fn LLVMPositionBuilder(Builder: BuilderRef, Block: BasicBlockRef, Instr: ValueRef);
780 pub fn LLVMPositionBuilderBefore(Builder: BuilderRef, Instr: ValueRef);
781 pub fn LLVMPositionBuilderAtEnd(Builder: BuilderRef, Block: BasicBlockRef);
782 pub fn LLVMGetInsertBlock(Builder: BuilderRef) -> BasicBlockRef;
783 pub fn LLVMDisposeBuilder(Builder: BuilderRef);
786 pub fn LLVMSetCurrentDebugLocation(Builder: BuilderRef, L: ValueRef);
787 pub fn LLVMGetCurrentDebugLocation(Builder: BuilderRef) -> ValueRef;
788 pub fn LLVMSetInstDebugLocation(Builder: BuilderRef, Inst: ValueRef);
791 pub fn LLVMBuildRetVoid(B: BuilderRef) -> ValueRef;
792 pub fn LLVMBuildRet(B: BuilderRef, V: ValueRef) -> ValueRef;
793 pub fn LLVMBuildAggregateRet(B: BuilderRef, RetVals: *const ValueRef, N: c_uint) -> ValueRef;
794 pub fn LLVMBuildBr(B: BuilderRef, Dest: BasicBlockRef) -> ValueRef;
795 pub fn LLVMBuildCondBr(B: BuilderRef,
800 pub fn LLVMBuildSwitch(B: BuilderRef,
805 pub fn LLVMBuildIndirectBr(B: BuilderRef, Addr: ValueRef, NumDests: c_uint) -> ValueRef;
806 pub fn LLVMRustBuildInvoke(B: BuilderRef,
808 Args: *const ValueRef,
811 Catch: BasicBlockRef,
812 Bundle: OperandBundleDefRef,
815 pub fn LLVMRustBuildLandingPad(B: BuilderRef,
822 pub fn LLVMBuildResume(B: BuilderRef, Exn: ValueRef) -> ValueRef;
823 pub fn LLVMBuildUnreachable(B: BuilderRef) -> ValueRef;
825 pub fn LLVMRustBuildCleanupPad(B: BuilderRef,
828 Args: *const ValueRef,
831 pub fn LLVMRustBuildCleanupRet(B: BuilderRef,
832 CleanupPad: ValueRef,
833 UnwindBB: BasicBlockRef)
835 pub fn LLVMRustBuildCatchPad(B: BuilderRef,
838 Args: *const ValueRef,
841 pub fn LLVMRustBuildCatchRet(B: BuilderRef, Pad: ValueRef, BB: BasicBlockRef) -> ValueRef;
842 pub fn LLVMRustBuildCatchSwitch(Builder: BuilderRef,
848 pub fn LLVMRustAddHandler(CatchSwitch: ValueRef, Handler: BasicBlockRef);
849 pub fn LLVMSetPersonalityFn(Func: ValueRef, Pers: ValueRef);
851 // Add a case to the switch instruction
852 pub fn LLVMAddCase(Switch: ValueRef, OnVal: ValueRef, Dest: BasicBlockRef);
854 // Add a clause to the landing pad instruction
855 pub fn LLVMAddClause(LandingPad: ValueRef, ClauseVal: ValueRef);
857 // Set the cleanup on a landing pad instruction
858 pub fn LLVMSetCleanup(LandingPad: ValueRef, Val: Bool);
861 pub fn LLVMBuildAdd(B: BuilderRef,
866 pub fn LLVMBuildNSWAdd(B: BuilderRef,
871 pub fn LLVMBuildNUWAdd(B: BuilderRef,
876 pub fn LLVMBuildFAdd(B: BuilderRef,
881 pub fn LLVMBuildSub(B: BuilderRef,
886 pub fn LLVMBuildNSWSub(B: BuilderRef,
891 pub fn LLVMBuildNUWSub(B: BuilderRef,
896 pub fn LLVMBuildFSub(B: BuilderRef,
901 pub fn LLVMBuildMul(B: BuilderRef,
906 pub fn LLVMBuildNSWMul(B: BuilderRef,
911 pub fn LLVMBuildNUWMul(B: BuilderRef,
916 pub fn LLVMBuildFMul(B: BuilderRef,
921 pub fn LLVMBuildUDiv(B: BuilderRef,
926 pub fn LLVMBuildSDiv(B: BuilderRef,
931 pub fn LLVMBuildExactSDiv(B: BuilderRef,
936 pub fn LLVMBuildFDiv(B: BuilderRef,
941 pub fn LLVMBuildURem(B: BuilderRef,
946 pub fn LLVMBuildSRem(B: BuilderRef,
951 pub fn LLVMBuildFRem(B: BuilderRef,
956 pub fn LLVMBuildShl(B: BuilderRef,
961 pub fn LLVMBuildLShr(B: BuilderRef,
966 pub fn LLVMBuildAShr(B: BuilderRef,
971 pub fn LLVMBuildAnd(B: BuilderRef,
976 pub fn LLVMBuildOr(B: BuilderRef,
981 pub fn LLVMBuildXor(B: BuilderRef,
986 pub fn LLVMBuildBinOp(B: BuilderRef,
992 pub fn LLVMBuildNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
993 pub fn LLVMBuildNSWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
994 pub fn LLVMBuildNUWNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
995 pub fn LLVMBuildFNeg(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
996 pub fn LLVMBuildNot(B: BuilderRef, V: ValueRef, Name: *const c_char) -> ValueRef;
997 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: ValueRef);
1000 pub fn LLVMBuildAlloca(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1001 pub fn LLVMBuildFree(B: BuilderRef, PointerVal: ValueRef) -> ValueRef;
1002 pub fn LLVMBuildLoad(B: BuilderRef, PointerVal: ValueRef, Name: *const c_char) -> ValueRef;
1004 pub fn LLVMBuildStore(B: BuilderRef, Val: ValueRef, Ptr: ValueRef) -> ValueRef;
1006 pub fn LLVMBuildGEP(B: BuilderRef,
1008 Indices: *const ValueRef,
1010 Name: *const c_char)
1012 pub fn LLVMBuildInBoundsGEP(B: BuilderRef,
1014 Indices: *const ValueRef,
1016 Name: *const c_char)
1018 pub fn LLVMBuildStructGEP(B: BuilderRef,
1021 Name: *const c_char)
1023 pub fn LLVMBuildGlobalString(B: BuilderRef,
1025 Name: *const c_char)
1027 pub fn LLVMBuildGlobalStringPtr(B: BuilderRef,
1029 Name: *const c_char)
1033 pub fn LLVMBuildTrunc(B: BuilderRef,
1036 Name: *const c_char)
1038 pub fn LLVMBuildZExt(B: BuilderRef,
1041 Name: *const c_char)
1043 pub fn LLVMBuildSExt(B: BuilderRef,
1046 Name: *const c_char)
1048 pub fn LLVMBuildFPToUI(B: BuilderRef,
1051 Name: *const c_char)
1053 pub fn LLVMBuildFPToSI(B: BuilderRef,
1056 Name: *const c_char)
1058 pub fn LLVMBuildUIToFP(B: BuilderRef,
1061 Name: *const c_char)
1063 pub fn LLVMBuildSIToFP(B: BuilderRef,
1066 Name: *const c_char)
1068 pub fn LLVMBuildFPTrunc(B: BuilderRef,
1071 Name: *const c_char)
1073 pub fn LLVMBuildFPExt(B: BuilderRef,
1076 Name: *const c_char)
1078 pub fn LLVMBuildPtrToInt(B: BuilderRef,
1081 Name: *const c_char)
1083 pub fn LLVMBuildIntToPtr(B: BuilderRef,
1086 Name: *const c_char)
1088 pub fn LLVMBuildBitCast(B: BuilderRef,
1091 Name: *const c_char)
1093 pub fn LLVMBuildZExtOrBitCast(B: BuilderRef,
1096 Name: *const c_char)
1098 pub fn LLVMBuildSExtOrBitCast(B: BuilderRef,
1101 Name: *const c_char)
1103 pub fn LLVMBuildTruncOrBitCast(B: BuilderRef,
1106 Name: *const c_char)
1108 pub fn LLVMBuildCast(B: BuilderRef,
1112 Name: *const c_char)
1114 pub fn LLVMBuildPointerCast(B: BuilderRef,
1117 Name: *const c_char)
1119 pub fn LLVMRustBuildIntCast(B: BuilderRef,
1124 pub fn LLVMBuildFPCast(B: BuilderRef,
1127 Name: *const c_char)
1131 pub fn LLVMBuildICmp(B: BuilderRef,
1135 Name: *const c_char)
1137 pub fn LLVMBuildFCmp(B: BuilderRef,
1141 Name: *const c_char)
1144 // Miscellaneous instructions
1145 pub fn LLVMBuildPhi(B: BuilderRef, Ty: TypeRef, Name: *const c_char) -> ValueRef;
1146 pub fn LLVMRustBuildCall(B: BuilderRef,
1148 Args: *const ValueRef,
1150 Bundle: OperandBundleDefRef,
1151 Name: *const c_char)
1153 pub fn LLVMBuildSelect(B: BuilderRef,
1157 Name: *const c_char)
1159 pub fn LLVMBuildVAArg(B: BuilderRef,
1162 Name: *const c_char)
1164 pub fn LLVMBuildExtractElement(B: BuilderRef,
1167 Name: *const c_char)
1169 pub fn LLVMBuildInsertElement(B: BuilderRef,
1173 Name: *const c_char)
1175 pub fn LLVMBuildShuffleVector(B: BuilderRef,
1179 Name: *const c_char)
1181 pub fn LLVMBuildExtractValue(B: BuilderRef,
1184 Name: *const c_char)
1186 pub fn LLVMBuildInsertValue(B: BuilderRef,
1190 Name: *const c_char)
1193 pub fn LLVMBuildIsNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1194 pub fn LLVMBuildIsNotNull(B: BuilderRef, Val: ValueRef, Name: *const c_char) -> ValueRef;
1195 pub fn LLVMBuildPtrDiff(B: BuilderRef,
1198 Name: *const c_char)
1201 // Atomic Operations
1202 pub fn LLVMRustBuildAtomicLoad(B: BuilderRef,
1203 PointerVal: ValueRef,
1204 Name: *const c_char,
1205 Order: AtomicOrdering)
1208 pub fn LLVMRustBuildAtomicStore(B: BuilderRef,
1211 Order: AtomicOrdering)
1214 pub fn LLVMRustBuildAtomicCmpXchg(B: BuilderRef,
1218 Order: AtomicOrdering,
1219 FailureOrder: AtomicOrdering,
1223 pub fn LLVMBuildAtomicRMW(B: BuilderRef,
1227 Order: AtomicOrdering,
1228 SingleThreaded: Bool)
1231 pub fn LLVMRustBuildAtomicFence(B: BuilderRef,
1232 Order: AtomicOrdering,
1233 Scope: SynchronizationScope);
1236 // Selected entries from the downcasts.
1237 pub fn LLVMIsATerminatorInst(Inst: ValueRef) -> ValueRef;
1238 pub fn LLVMIsAStoreInst(Inst: ValueRef) -> ValueRef;
1240 /// Writes a module to the specified path. Returns 0 on success.
1241 pub fn LLVMWriteBitcodeToFile(M: ModuleRef, Path: *const c_char) -> c_int;
1243 /// Creates target data from a target layout string.
1244 pub fn LLVMCreateTargetData(StringRep: *const c_char) -> TargetDataRef;
1246 /// Disposes target data.
1247 pub fn LLVMDisposeTargetData(TD: TargetDataRef);
1249 /// Creates a pass manager.
1250 pub fn LLVMCreatePassManager() -> PassManagerRef;
1252 /// Creates a function-by-function pass manager
1253 pub fn LLVMCreateFunctionPassManagerForModule(M: ModuleRef) -> PassManagerRef;
1255 /// Disposes a pass manager.
1256 pub fn LLVMDisposePassManager(PM: PassManagerRef);
1258 /// Runs a pass manager on a module.
1259 pub fn LLVMRunPassManager(PM: PassManagerRef, M: ModuleRef) -> Bool;
1261 pub fn LLVMInitializePasses();
1263 pub fn LLVMPassManagerBuilderCreate() -> PassManagerBuilderRef;
1264 pub fn LLVMPassManagerBuilderDispose(PMB: PassManagerBuilderRef);
1265 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: PassManagerBuilderRef, Value: Bool);
1266 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: PassManagerBuilderRef, Value: Bool);
1267 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: PassManagerBuilderRef,
1269 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: PassManagerBuilderRef,
1270 PM: PassManagerRef);
1272 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: PassManagerBuilderRef,
1273 PM: PassManagerRef);
1274 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: PassManagerBuilderRef,
1278 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1279 PMB: PassManagerBuilderRef,
1280 PM: PassManagerRef) -> bool;
1282 // Stuff that's in rustllvm/ because it's not upstream yet.
1284 /// Opens an object file.
1285 pub fn LLVMCreateObjectFile(MemBuf: MemoryBufferRef) -> ObjectFileRef;
1286 /// Closes an object file.
1287 pub fn LLVMDisposeObjectFile(ObjFile: ObjectFileRef);
1289 /// Enumerates the sections in an object file.
1290 pub fn LLVMGetSections(ObjFile: ObjectFileRef) -> SectionIteratorRef;
1291 /// Destroys a section iterator.
1292 pub fn LLVMDisposeSectionIterator(SI: SectionIteratorRef);
1293 /// Returns true if the section iterator is at the end of the section
1295 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: ObjectFileRef, SI: SectionIteratorRef) -> Bool;
1296 /// Moves the section iterator to point to the next section.
1297 pub fn LLVMMoveToNextSection(SI: SectionIteratorRef);
1298 /// Returns the current section size.
1299 pub fn LLVMGetSectionSize(SI: SectionIteratorRef) -> c_ulonglong;
1300 /// Returns the current section contents as a string buffer.
1301 pub fn LLVMGetSectionContents(SI: SectionIteratorRef) -> *const c_char;
1303 /// Reads the given file and returns it as a memory buffer. Use
1304 /// LLVMDisposeMemoryBuffer() to get rid of it.
1305 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(Path: *const c_char) -> MemoryBufferRef;
1307 pub fn LLVMStartMultithreaded() -> Bool;
1309 /// Returns a string describing the last error caused by an LLVMRust* call.
1310 pub fn LLVMRustGetLastError() -> *const c_char;
1312 /// Print the pass timings since static dtors aren't picking them up.
1313 pub fn LLVMRustPrintPassTimings();
1315 pub fn LLVMStructCreateNamed(C: ContextRef, Name: *const c_char) -> TypeRef;
1317 pub fn LLVMStructSetBody(StructTy: TypeRef,
1318 ElementTypes: *const TypeRef,
1319 ElementCount: c_uint,
1322 /// Enables LLVM debug output.
1323 pub fn LLVMRustSetDebug(Enabled: c_int);
1325 /// Prepares inline assembly.
1326 pub fn LLVMRustInlineAsm(Ty: TypeRef,
1327 AsmString: *const c_char,
1328 Constraints: *const c_char,
1331 Dialect: AsmDialect)
1334 pub fn LLVMRustDebugMetadataVersion() -> u32;
1335 pub fn LLVMRustVersionMajor() -> u32;
1336 pub fn LLVMRustVersionMinor() -> u32;
1338 pub fn LLVMRustAddModuleFlag(M: ModuleRef, name: *const c_char, value: u32);
1340 pub fn LLVMRustMetadataAsValue(C: ContextRef, MD: MetadataRef) -> ValueRef;
1342 pub fn LLVMRustDIBuilderCreate(M: ModuleRef) -> DIBuilderRef;
1344 pub fn LLVMRustDIBuilderDispose(Builder: DIBuilderRef);
1346 pub fn LLVMRustDIBuilderFinalize(Builder: DIBuilderRef);
1348 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
1351 Producer: *const c_char,
1353 Flags: *const c_char,
1355 SplitName: *const c_char)
1358 pub fn LLVMRustDIBuilderCreateFile(Builder: DIBuilderRef,
1359 Filename: *const c_char,
1360 Directory: *const c_char)
1363 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: DIBuilderRef,
1365 ParameterTypes: DIArray)
1368 pub fn LLVMRustDIBuilderCreateFunction(Builder: DIBuilderRef,
1369 Scope: DIDescriptor,
1370 Name: *const c_char,
1371 LinkageName: *const c_char,
1375 isLocalToUnit: bool,
1385 pub fn LLVMRustDIBuilderCreateBasicType(Builder: DIBuilderRef,
1386 Name: *const c_char,
1392 pub fn LLVMRustDIBuilderCreatePointerType(Builder: DIBuilderRef,
1396 Name: *const c_char)
1399 pub fn LLVMRustDIBuilderCreateStructType(Builder: DIBuilderRef,
1400 Scope: DIDescriptor,
1401 Name: *const c_char,
1407 DerivedFrom: DIType,
1409 RunTimeLang: c_uint,
1410 VTableHolder: DIType,
1411 UniqueId: *const c_char)
1414 pub fn LLVMRustDIBuilderCreateMemberType(Builder: DIBuilderRef,
1415 Scope: DIDescriptor,
1416 Name: *const c_char,
1426 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: DIBuilderRef,
1433 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: DIBuilderRef,
1438 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: DIBuilderRef,
1440 Name: *const c_char,
1441 LinkageName: *const c_char,
1445 isLocalToUnit: bool,
1449 -> DIGlobalVariable;
1451 pub fn LLVMRustDIBuilderCreateVariable(Builder: DIBuilderRef,
1453 Scope: DIDescriptor,
1454 Name: *const c_char,
1458 AlwaysPreserve: bool,
1464 pub fn LLVMRustDIBuilderCreateArrayType(Builder: DIBuilderRef,
1468 Subscripts: DIArray)
1471 pub fn LLVMRustDIBuilderCreateVectorType(Builder: DIBuilderRef,
1475 Subscripts: DIArray)
1478 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: DIBuilderRef,
1483 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: DIBuilderRef,
1484 Ptr: *const DIDescriptor,
1488 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: DIBuilderRef,
1490 VarInfo: DIVariable,
1491 AddrOps: *const i64,
1492 AddrOpsCount: c_uint,
1494 InsertAtEnd: BasicBlockRef)
1497 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: DIBuilderRef,
1498 Name: *const c_char,
1502 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: DIBuilderRef,
1504 Name: *const c_char,
1513 pub fn LLVMRustDIBuilderCreateUnionType(Builder: DIBuilderRef,
1515 Name: *const c_char,
1522 RunTimeLang: c_uint,
1523 UniqueId: *const c_char)
1526 pub fn LLVMSetUnnamedAddr(GlobalVar: ValueRef, UnnamedAddr: Bool);
1528 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: DIBuilderRef,
1530 Name: *const c_char,
1535 -> DITemplateTypeParameter;
1538 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: DIBuilderRef,
1540 Name: *const c_char,
1544 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: DIBuilderRef,
1545 CompositeType: DIType,
1546 TypeArray: DIArray);
1549 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: ContextRef,
1553 InlinedAt: MetadataRef)
1555 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1556 pub fn LLVMRustDIBuilderCreateOpPlus() -> i64;
1558 pub fn LLVMRustWriteTypeToString(Type: TypeRef, s: RustStringRef);
1559 pub fn LLVMRustWriteValueToString(value_ref: ValueRef, s: RustStringRef);
1561 pub fn LLVMIsAConstantInt(value_ref: ValueRef) -> ValueRef;
1563 pub fn LLVMRustPassKind(Pass: PassRef) -> PassKind;
1564 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> PassRef;
1565 pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: PassRef);
1567 pub fn LLVMRustHasFeature(T: TargetMachineRef, s: *const c_char) -> bool;
1569 pub fn LLVMRustPrintTargetCPUs(T: TargetMachineRef);
1570 pub fn LLVMRustPrintTargetFeatures(T: TargetMachineRef);
1572 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1574 Features: *const c_char,
1577 Level: CodeGenOptLevel,
1579 PositionIndependentExecutable: bool,
1580 FunctionSections: bool,
1582 TrapUnreachable: bool,
1584 -> TargetMachineRef;
1585 pub fn LLVMRustDisposeTargetMachine(T: TargetMachineRef);
1586 pub fn LLVMRustAddAnalysisPasses(T: TargetMachineRef, PM: PassManagerRef, M: ModuleRef);
1587 pub fn LLVMRustAddBuilderLibraryInfo(PMB: PassManagerBuilderRef,
1589 DisableSimplifyLibCalls: bool);
1590 pub fn LLVMRustConfigurePassManagerBuilder(PMB: PassManagerBuilderRef,
1591 OptLevel: CodeGenOptLevel,
1592 MergeFunctions: bool,
1594 LoopVectorize: bool);
1595 pub fn LLVMRustAddLibraryInfo(PM: PassManagerRef,
1597 DisableSimplifyLibCalls: bool);
1598 pub fn LLVMRustRunFunctionPassManager(PM: PassManagerRef, M: ModuleRef);
1599 pub fn LLVMRustWriteOutputFile(T: TargetMachineRef,
1602 Output: *const c_char,
1605 pub fn LLVMRustPrintModule(PM: PassManagerRef,
1607 Output: *const c_char,
1608 Demangle: extern fn(*const c_char,
1612 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1613 pub fn LLVMRustPrintPasses();
1614 pub fn LLVMRustSetNormalizedTarget(M: ModuleRef, triple: *const c_char);
1615 pub fn LLVMRustAddAlwaysInlinePass(P: PassManagerBuilderRef, AddLifetimes: bool);
1616 pub fn LLVMRustLinkInExternalBitcode(M: ModuleRef, bc: *const c_char, len: size_t) -> bool;
1617 pub fn LLVMRustLinkInParsedExternalBitcode(M: ModuleRef, M: ModuleRef) -> bool;
1618 pub fn LLVMRustRunRestrictionPass(M: ModuleRef, syms: *const *const c_char, len: size_t);
1619 pub fn LLVMRustMarkAllFunctionsNounwind(M: ModuleRef);
1621 pub fn LLVMRustOpenArchive(path: *const c_char) -> ArchiveRef;
1622 pub fn LLVMRustArchiveIteratorNew(AR: ArchiveRef) -> ArchiveIteratorRef;
1623 pub fn LLVMRustArchiveIteratorNext(AIR: ArchiveIteratorRef) -> ArchiveChildRef;
1624 pub fn LLVMRustArchiveChildName(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1625 pub fn LLVMRustArchiveChildData(ACR: ArchiveChildRef, size: *mut size_t) -> *const c_char;
1626 pub fn LLVMRustArchiveChildFree(ACR: ArchiveChildRef);
1627 pub fn LLVMRustArchiveIteratorFree(AIR: ArchiveIteratorRef);
1628 pub fn LLVMRustDestroyArchive(AR: ArchiveRef);
1630 pub fn LLVMRustGetSectionName(SI: SectionIteratorRef, data: *mut *const c_char) -> size_t;
1632 pub fn LLVMRustWriteTwineToString(T: TwineRef, s: RustStringRef);
1634 pub fn LLVMContextSetDiagnosticHandler(C: ContextRef,
1635 Handler: DiagnosticHandler,
1636 DiagnosticContext: *mut c_void);
1638 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: DiagnosticInfoRef,
1639 pass_name_out: RustStringRef,
1640 function_out: *mut ValueRef,
1641 loc_line_out: *mut c_uint,
1642 loc_column_out: *mut c_uint,
1643 loc_filename_out: RustStringRef,
1644 message_out: RustStringRef);
1645 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: DiagnosticInfoRef,
1646 cookie_out: *mut c_uint,
1647 message_out: *mut TwineRef,
1648 instruction_out: *mut ValueRef);
1650 pub fn LLVMRustWriteDiagnosticInfoToString(DI: DiagnosticInfoRef, s: RustStringRef);
1651 pub fn LLVMRustGetDiagInfoKind(DI: DiagnosticInfoRef) -> DiagnosticKind;
1653 pub fn LLVMRustWriteDebugLocToString(C: ContextRef, DL: DebugLocRef, s: RustStringRef);
1655 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: ContextRef,
1656 H: InlineAsmDiagHandler,
1659 pub fn LLVMRustWriteSMDiagnosticToString(d: SMDiagnosticRef, s: RustStringRef);
1661 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1663 Members: *const RustArchiveMemberRef,
1667 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1668 Name: *const c_char,
1669 Child: ArchiveChildRef)
1670 -> RustArchiveMemberRef;
1671 pub fn LLVMRustArchiveMemberFree(Member: RustArchiveMemberRef);
1673 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: ModuleRef, TM: TargetMachineRef);
1674 pub fn LLVMRustGetModuleDataLayout(M: ModuleRef) -> TargetDataRef;
1676 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1677 Inputs: *const ValueRef,
1679 -> OperandBundleDefRef;
1680 pub fn LLVMRustFreeOperandBundleDef(Bundle: OperandBundleDefRef);
1682 pub fn LLVMRustPositionBuilderAtStart(B: BuilderRef, BB: BasicBlockRef);
1684 pub fn LLVMRustSetComdat(M: ModuleRef, V: ValueRef, Name: *const c_char);
1685 pub fn LLVMRustUnsetComdat(V: ValueRef);
1686 pub fn LLVMRustSetModulePIELevel(M: ModuleRef);
1687 pub fn LLVMRustModuleBufferCreate(M: ModuleRef) -> *mut ModuleBuffer;
1688 pub fn LLVMRustModuleBufferPtr(p: *const ModuleBuffer) -> *const u8;
1689 pub fn LLVMRustModuleBufferLen(p: *const ModuleBuffer) -> usize;
1690 pub fn LLVMRustModuleBufferFree(p: *mut ModuleBuffer);
1691 pub fn LLVMRustModuleCost(M: ModuleRef) -> u64;
1693 pub fn LLVMRustThinLTOAvailable() -> bool;
1694 pub fn LLVMRustWriteThinBitcodeToFile(PMR: PassManagerRef,
1696 BC: *const c_char) -> bool;
1697 pub fn LLVMRustThinLTOBufferCreate(M: ModuleRef) -> *mut ThinLTOBuffer;
1698 pub fn LLVMRustThinLTOBufferFree(M: *mut ThinLTOBuffer);
1699 pub fn LLVMRustThinLTOBufferPtr(M: *const ThinLTOBuffer) -> *const c_char;
1700 pub fn LLVMRustThinLTOBufferLen(M: *const ThinLTOBuffer) -> size_t;
1701 pub fn LLVMRustCreateThinLTOData(
1702 Modules: *const ThinLTOModule,
1704 PreservedSymbols: *const *const c_char,
1705 PreservedSymbolsLen: c_uint,
1706 ) -> *mut ThinLTOData;
1707 pub fn LLVMRustPrepareThinLTORename(
1708 Data: *const ThinLTOData,
1711 pub fn LLVMRustPrepareThinLTOResolveWeak(
1712 Data: *const ThinLTOData,
1715 pub fn LLVMRustPrepareThinLTOInternalize(
1716 Data: *const ThinLTOData,
1719 pub fn LLVMRustPrepareThinLTOImport(
1720 Data: *const ThinLTOData,
1723 pub fn LLVMRustFreeThinLTOData(Data: *mut ThinLTOData);
1724 pub fn LLVMRustParseBitcodeForThinLTO(
1725 Context: ContextRef,
1728 Identifier: *const c_char,
1730 pub fn LLVMGetModuleIdentifier(M: ModuleRef, size: *mut usize) -> *const c_char;
1731 pub fn LLVMRustThinLTOGetDICompileUnit(M: ModuleRef,
1732 CU1: *mut *mut c_void,
1733 CU2: *mut *mut c_void);
1734 pub fn LLVMRustThinLTOPatchDICompileUnit(M: ModuleRef, CU: *mut c_void);
1735 pub fn LLVMRustThinLTORemoveAvailableExternally(M: ModuleRef);