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 use super::debuginfo::{
12 DIBuilder, DIDescriptor, DIFile, DILexicalBlock, DISubprogram, DIType,
13 DIBasicType, DIDerivedType, DICompositeType, DIScope, DIVariable,
14 DIGlobalVariableExpression, DIArray, DISubrange, DITemplateTypeParameter, DIEnumerator,
18 use libc::{c_uint, c_int, size_t, c_char};
19 use libc::{c_ulonglong, c_void};
21 use std::marker::PhantomData;
24 use super::RustString;
26 pub type Bool = c_uint;
28 pub const True: Bool = 1 as Bool;
29 pub const False: Bool = 0 as Bool;
31 #[derive(Copy, Clone, PartialEq)]
33 #[allow(dead_code)] // Variants constructed by C++.
34 pub enum LLVMRustResult {
38 // Consts for the LLVM CallConv type, pre-cast to usize.
40 /// LLVM CallingConv::ID. Should we wrap this?
41 #[derive(Copy, Clone, PartialEq, Debug)]
47 X86StdcallCallConv = 64,
48 X86FastcallCallConv = 65,
49 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 /// LLVMDLLStorageClass
87 #[derive(Copy, Clone)]
89 pub enum DLLStorageClass {
92 DllImport = 1, // Function to be imported from DLL.
94 DllExport = 2, // Function to be accessible from DLL.
97 /// Matches LLVMRustAttribute in rustllvm.h
98 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
99 /// though it is not ABI compatible (since it's a C++ enum)
101 #[derive(Copy, Clone, Debug)]
116 OptimizeForSize = 13,
124 SanitizeAddress = 21,
130 #[derive(Copy, Clone)]
132 pub enum IntPredicate {
146 pub fn from_generic(intpre: traits::IntPredicate) -> Self {
148 traits::IntPredicate::IntEQ => IntPredicate::IntEQ,
149 traits::IntPredicate::IntNE => IntPredicate::IntNE,
150 traits::IntPredicate::IntUGT => IntPredicate::IntUGT,
151 traits::IntPredicate::IntUGE => IntPredicate::IntUGE,
152 traits::IntPredicate::IntULT => IntPredicate::IntULT,
153 traits::IntPredicate::IntULE => IntPredicate::IntULE,
154 traits::IntPredicate::IntSGT => IntPredicate::IntSGT,
155 traits::IntPredicate::IntSGE => IntPredicate::IntSGE,
156 traits::IntPredicate::IntSLT => IntPredicate::IntSLT,
157 traits::IntPredicate::IntSLE => IntPredicate::IntSLE,
162 /// LLVMRealPredicate
163 #[derive(Copy, Clone)]
165 pub enum RealPredicate {
166 RealPredicateFalse = 0,
181 RealPredicateTrue = 15,
185 pub fn from_generic(realpred: traits::RealPredicate) -> Self {
187 traits::RealPredicate::RealPredicateFalse => RealPredicate::RealPredicateFalse,
188 traits::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
189 traits::RealPredicate::RealOGT => RealPredicate::RealOGT,
190 traits::RealPredicate::RealOGE => RealPredicate::RealOGE,
191 traits::RealPredicate::RealOLT => RealPredicate::RealOLT,
192 traits::RealPredicate::RealOLE => RealPredicate::RealOLE,
193 traits::RealPredicate::RealONE => RealPredicate::RealONE,
194 traits::RealPredicate::RealORD => RealPredicate::RealORD,
195 traits::RealPredicate::RealUNO => RealPredicate::RealUNO,
196 traits::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
197 traits::RealPredicate::RealUGT => RealPredicate::RealUGT,
198 traits::RealPredicate::RealUGE => RealPredicate::RealUGE,
199 traits::RealPredicate::RealULT => RealPredicate::RealULT,
200 traits::RealPredicate::RealULE => RealPredicate::RealULE,
201 traits::RealPredicate::RealUNE => RealPredicate::RealUNE,
202 traits::RealPredicate::RealPredicateTrue => RealPredicate::RealPredicateTrue
208 #[derive(Copy, Clone, PartialEq, Debug)]
230 /// LLVMAtomicRmwBinOp
231 #[derive(Copy, Clone)]
233 pub enum AtomicRmwBinOp {
247 impl AtomicRmwBinOp {
248 pub fn from_generic(op : traits::AtomicRmwBinOp) -> Self {
250 traits::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
251 traits::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
252 traits::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
253 traits::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
254 traits::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
255 traits::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
256 traits::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
257 traits::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
258 traits::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
259 traits::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
260 traits::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin
265 /// LLVMAtomicOrdering
266 #[derive(Copy, Clone)]
268 pub enum AtomicOrdering {
273 // Consume = 3, // Not specified yet.
277 SequentiallyConsistent = 7,
280 /// LLVMRustSynchronizationScope
281 #[derive(Copy, Clone)]
283 pub enum SynchronizationScope {
284 // FIXME: figure out if this variant is needed at all.
292 #[derive(Copy, Clone)]
295 // FIXME: figure out if this variant is needed at all.
303 #[derive(Copy, Clone)]
305 pub enum MetadataType {
312 MD_invariant_load = 6,
316 MD_mem_parallel_loop_access = 10,
320 /// LLVMRustAsmDialect
321 #[derive(Copy, Clone)]
323 pub enum AsmDialect {
324 // FIXME: figure out if this variant is needed at all.
331 /// LLVMRustCodeGenOptLevel
332 #[derive(Copy, Clone, PartialEq)]
334 pub enum CodeGenOptLevel {
335 // FIXME: figure out if this variant is needed at all.
345 #[derive(Copy, Clone, PartialEq)]
357 /// LLVMRustCodeModel
358 #[derive(Copy, Clone)]
361 // FIXME: figure out if this variant is needed at all.
371 /// LLVMRustDiagnosticKind
372 #[derive(Copy, Clone)]
374 #[allow(dead_code)] // Variants constructed by C++.
375 pub enum DiagnosticKind {
379 DebugMetadataVersion,
382 OptimizationRemarkMissed,
383 OptimizationRemarkAnalysis,
384 OptimizationRemarkAnalysisFPCommute,
385 OptimizationRemarkAnalysisAliasing,
386 OptimizationRemarkOther,
392 /// LLVMRustArchiveKind
393 #[derive(Copy, Clone)]
395 pub enum ArchiveKind {
396 // FIXME: figure out if this variant is needed at all.
405 #[derive(Copy, Clone, PartialEq, Debug)]
407 #[allow(dead_code)] // Variants constructed by C++.
414 /// LLVMRustThinLTOData
415 extern { pub type ThinLTOData; }
417 /// LLVMRustThinLTOBuffer
418 extern { pub type ThinLTOBuffer; }
420 // LLVMRustModuleNameCallback
421 pub type ThinLTOModuleNameCallback =
422 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
424 /// LLVMRustThinLTOModule
426 pub struct ThinLTOModule {
427 pub identifier: *const c_char,
432 /// LLVMThreadLocalMode
433 #[derive(Copy, Clone)]
435 pub enum ThreadLocalMode {
443 extern { type Opaque; }
445 struct InvariantOpaque<'a> {
446 _marker: PhantomData<&'a mut &'a ()>,
450 // Opaque pointer types
451 extern { pub type Module; }
452 extern { pub type Context; }
453 extern { pub type Type; }
454 extern { pub type Value; }
455 extern { pub type Metadata; }
456 extern { pub type BasicBlock; }
458 pub struct Builder<'a>(InvariantOpaque<'a>);
459 extern { pub type MemoryBuffer; }
461 pub struct PassManager<'a>(InvariantOpaque<'a>);
462 extern { pub type PassManagerBuilder; }
463 extern { pub type ObjectFile; }
465 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
466 extern { pub type Pass; }
467 extern { pub type TargetMachine; }
468 extern { pub type Archive; }
470 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
472 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
473 extern { pub type Twine; }
474 extern { pub type DiagnosticInfo; }
475 extern { pub type SMDiagnostic; }
477 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
479 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
481 pub struct Linker<'a>(InvariantOpaque<'a>);
483 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
484 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
488 use super::{InvariantOpaque, Metadata};
491 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
493 pub type DIDescriptor = Metadata;
494 pub type DIScope = DIDescriptor;
495 pub type DIFile = DIScope;
496 pub type DILexicalBlock = DIScope;
497 pub type DISubprogram = DIScope;
498 pub type DINameSpace = DIScope;
499 pub type DIType = DIDescriptor;
500 pub type DIBasicType = DIType;
501 pub type DIDerivedType = DIType;
502 pub type DICompositeType = DIDerivedType;
503 pub type DIVariable = DIDescriptor;
504 pub type DIGlobalVariableExpression = DIDescriptor;
505 pub type DIArray = DIDescriptor;
506 pub type DISubrange = DIDescriptor;
507 pub type DIEnumerator = DIDescriptor;
508 pub type DITemplateTypeParameter = DIDescriptor;
510 // These values **must** match with LLVMRustDIFlags!!
514 pub struct DIFlags: ::libc::uint32_t {
516 const FlagPrivate = 1;
517 const FlagProtected = 2;
518 const FlagPublic = 3;
519 const FlagFwdDecl = (1 << 2);
520 const FlagAppleBlock = (1 << 3);
521 const FlagBlockByrefStruct = (1 << 4);
522 const FlagVirtual = (1 << 5);
523 const FlagArtificial = (1 << 6);
524 const FlagExplicit = (1 << 7);
525 const FlagPrototyped = (1 << 8);
526 const FlagObjcClassComplete = (1 << 9);
527 const FlagObjectPointer = (1 << 10);
528 const FlagVector = (1 << 11);
529 const FlagStaticMember = (1 << 12);
530 const FlagLValueReference = (1 << 13);
531 const FlagRValueReference = (1 << 14);
532 const FlagExternalTypeRef = (1 << 15);
533 const FlagIntroducedVirtual = (1 << 18);
534 const FlagBitField = (1 << 19);
535 const FlagNoReturn = (1 << 20);
536 const FlagMainSubprogram = (1 << 21);
541 extern { pub type ModuleBuffer; }
544 pub fn LLVMRustInstallFatalErrorHandler();
546 // Create and destroy contexts.
547 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
548 pub fn LLVMContextDispose(C: &'static mut Context);
549 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
552 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
553 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
554 pub fn LLVMCloneModule(M: &Module) -> &Module;
556 /// Data layout. See Module::getDataLayout.
557 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
558 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
560 /// See Module::setModuleInlineAsm.
561 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
562 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
564 /// See llvm::LLVMTypeKind::getTypeID.
565 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
567 // Operations on integer types
568 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
569 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
570 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
571 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
572 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
573 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
575 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
577 // Operations on real types
578 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
579 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
581 // Operations on function types
582 pub fn LLVMFunctionType(ReturnType: &'a Type,
583 ParamTypes: *const &'a Type,
587 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
588 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
590 // Operations on struct types
591 pub fn LLVMStructTypeInContext(C: &'a Context,
592 ElementTypes: *const &'a Type,
593 ElementCount: c_uint,
597 // Operations on array, pointer, and vector types (sequence types)
598 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
599 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
600 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
602 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
603 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
605 // Operations on other types
606 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
607 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
608 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
610 // Operations on all values
611 pub fn LLVMTypeOf(Val: &Value) -> &Type;
612 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
613 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
614 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
615 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
617 // Operations on constants of any type
618 pub fn LLVMConstNull(Ty: &Type) -> &Value;
619 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
621 // Operations on metadata
622 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
623 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
624 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
626 // Operations on scalar constants
627 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
628 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
629 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
630 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
631 high: &mut u64, low: &mut u64) -> bool;
632 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
635 // Operations on composite constants
636 pub fn LLVMConstStringInContext(C: &Context,
639 DontNullTerminate: Bool)
641 pub fn LLVMConstStructInContext(C: &'a Context,
642 ConstantVals: *const &'a Value,
647 pub fn LLVMConstArray(ElementTy: &'a Type,
648 ConstantVals: *const &'a Value,
651 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
653 // Constant expressions
654 pub fn LLVMConstInBoundsGEP(
655 ConstantVal: &'a Value,
656 ConstantIndices: *const &'a Value,
659 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
660 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
661 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
662 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
663 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
664 pub fn LLVMConstExtractValue(AggConstant: &Value,
665 IdxList: *const c_uint,
669 // Operations on global variables, functions, and aliases (globals)
670 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
671 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
672 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
673 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
674 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
675 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
676 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
677 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
678 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
681 // Operations on global variables
682 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
683 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
684 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
685 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
686 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
687 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
688 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
689 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
690 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
691 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
692 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
693 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
694 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
695 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
696 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
697 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
699 // Operations on functions
700 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
702 FunctionTy: &'a Type)
704 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
705 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
706 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
707 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
708 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
709 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
712 Value: *const c_char);
713 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
715 // Operations on parameters
716 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
717 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
719 // Operations on basic blocks
720 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
721 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
725 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
727 // Operations on instructions
728 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
730 // Operations on call sites
731 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
732 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
733 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
734 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
735 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
739 // Operations on load/store instructions (only)
740 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
742 // Operations on phi nodes
743 pub fn LLVMAddIncoming(PhiNode: &'a Value,
744 IncomingValues: *const &'a Value,
745 IncomingBlocks: *const &'a BasicBlock,
748 // Instruction builders
749 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
750 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
751 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
752 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
755 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
756 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
757 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
760 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
761 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
762 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
763 pub fn LLVMBuildCondBr(B: &Builder<'a>,
765 Then: &'a BasicBlock,
766 Else: &'a BasicBlock)
768 pub fn LLVMBuildSwitch(B: &Builder<'a>,
770 Else: &'a BasicBlock,
773 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
775 Args: *const &'a Value,
777 Then: &'a BasicBlock,
778 Catch: &'a BasicBlock,
779 Bundle: Option<&OperandBundleDef<'a>>,
782 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
788 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
789 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
791 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
792 ParentPad: Option<&'a Value>,
794 Args: *const &'a Value,
796 -> Option<&'a Value>;
797 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
798 CleanupPad: &'a Value,
799 UnwindBB: Option<&'a BasicBlock>)
800 -> Option<&'a Value>;
801 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
802 ParentPad: &'a Value,
804 Args: *const &'a Value,
806 -> Option<&'a Value>;
807 pub fn LLVMRustBuildCatchRet(
811 ) -> Option<&'a Value>;
812 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
813 ParentPad: Option<&'a Value>,
814 BB: Option<&'a BasicBlock>,
817 -> Option<&'a Value>;
818 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
819 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
821 // Add a case to the switch instruction
822 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
824 // Add a clause to the landing pad instruction
825 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
827 // Set the cleanup on a landing pad instruction
828 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
831 pub fn LLVMBuildAdd(B: &Builder<'a>,
836 pub fn LLVMBuildFAdd(B: &Builder<'a>,
841 pub fn LLVMBuildSub(B: &Builder<'a>,
846 pub fn LLVMBuildFSub(B: &Builder<'a>,
851 pub fn LLVMBuildMul(B: &Builder<'a>,
856 pub fn LLVMBuildFMul(B: &Builder<'a>,
861 pub fn LLVMBuildUDiv(B: &Builder<'a>,
866 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
871 pub fn LLVMBuildSDiv(B: &Builder<'a>,
876 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
881 pub fn LLVMBuildFDiv(B: &Builder<'a>,
886 pub fn LLVMBuildURem(B: &Builder<'a>,
891 pub fn LLVMBuildSRem(B: &Builder<'a>,
896 pub fn LLVMBuildFRem(B: &Builder<'a>,
901 pub fn LLVMBuildShl(B: &Builder<'a>,
906 pub fn LLVMBuildLShr(B: &Builder<'a>,
911 pub fn LLVMBuildAShr(B: &Builder<'a>,
916 pub fn LLVMBuildAnd(B: &Builder<'a>,
921 pub fn LLVMBuildOr(B: &Builder<'a>,
926 pub fn LLVMBuildXor(B: &Builder<'a>,
931 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
932 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
933 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
934 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
937 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
938 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
943 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
945 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
947 pub fn LLVMBuildGEP(B: &Builder<'a>,
949 Indices: *const &'a Value,
953 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
955 Indices: *const &'a Value,
959 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
966 pub fn LLVMBuildTrunc(B: &Builder<'a>,
971 pub fn LLVMBuildZExt(B: &Builder<'a>,
976 pub fn LLVMBuildSExt(B: &Builder<'a>,
981 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
986 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
991 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
996 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
1001 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
1004 Name: *const c_char)
1006 pub fn LLVMBuildFPExt(B: &Builder<'a>,
1009 Name: *const c_char)
1011 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
1014 Name: *const c_char)
1016 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
1019 Name: *const c_char)
1021 pub fn LLVMBuildBitCast(B: &Builder<'a>,
1024 Name: *const c_char)
1026 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
1029 Name: *const c_char)
1031 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
1038 pub fn LLVMBuildICmp(B: &Builder<'a>,
1042 Name: *const c_char)
1044 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1048 Name: *const c_char)
1051 // Miscellaneous instructions
1052 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1053 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1055 Args: *const &'a Value,
1057 Bundle: Option<&OperandBundleDef<'a>>,
1058 Name: *const c_char)
1060 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1068 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1076 pub fn LLVMBuildSelect(B: &Builder<'a>,
1080 Name: *const c_char)
1082 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1085 Name: *const c_char)
1087 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1090 Name: *const c_char)
1092 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1096 Name: *const c_char)
1098 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1102 Name: *const c_char)
1104 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1107 Name: *const c_char)
1109 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1113 Name: *const c_char)
1116 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1120 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1124 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1127 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1130 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1133 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1136 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1139 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1143 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1147 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1151 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1156 pub fn LLVMRustBuildMinNum(
1160 ) -> Option<&'a Value>;
1161 pub fn LLVMRustBuildMaxNum(
1165 ) -> Option<&'a Value>;
1167 // Atomic Operations
1168 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1169 PointerVal: &'a Value,
1170 Name: *const c_char,
1171 Order: AtomicOrdering)
1174 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1177 Order: AtomicOrdering)
1180 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1184 Order: AtomicOrdering,
1185 FailureOrder: AtomicOrdering,
1189 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1193 Order: AtomicOrdering,
1194 SingleThreaded: Bool)
1197 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1198 Order: AtomicOrdering,
1199 Scope: SynchronizationScope);
1201 /// Writes a module to the specified path. Returns 0 on success.
1202 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1204 /// Creates a pass manager.
1205 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1207 /// Creates a function-by-function pass manager
1208 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1210 /// Disposes a pass manager.
1211 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1213 /// Runs a pass manager on a module.
1214 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1216 pub fn LLVMInitializePasses();
1218 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1219 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1220 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1221 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1222 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1224 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1227 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1229 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1233 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1234 PMB: &PassManagerBuilder,
1237 // Stuff that's in rustllvm/ because it's not upstream yet.
1239 /// Opens an object file.
1240 pub fn LLVMCreateObjectFile(
1241 MemBuf: &'static mut MemoryBuffer,
1242 ) -> Option<&'static mut ObjectFile>;
1243 /// Closes an object file.
1244 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1246 /// Enumerates the sections in an object file.
1247 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1248 /// Destroys a section iterator.
1249 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1250 /// Returns true if the section iterator is at the end of the section
1252 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1253 /// Moves the section iterator to point to the next section.
1254 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1255 /// Returns the current section size.
1256 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1257 /// Returns the current section contents as a string buffer.
1258 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1260 /// Reads the given file and returns it as a memory buffer. Use
1261 /// LLVMDisposeMemoryBuffer() to get rid of it.
1262 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1263 Path: *const c_char,
1264 ) -> Option<&'static mut MemoryBuffer>;
1266 pub fn LLVMStartMultithreaded() -> Bool;
1268 /// Returns a string describing the last error caused by an LLVMRust* call.
1269 pub fn LLVMRustGetLastError() -> *const c_char;
1271 /// Print the pass timings since static dtors aren't picking them up.
1272 pub fn LLVMRustPrintPassTimings();
1274 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1276 pub fn LLVMStructSetBody(StructTy: &'a Type,
1277 ElementTypes: *const &'a Type,
1278 ElementCount: c_uint,
1281 /// Prepares inline assembly.
1282 pub fn LLVMRustInlineAsm(Ty: &Type,
1283 AsmString: *const c_char,
1284 Constraints: *const c_char,
1287 Dialect: AsmDialect)
1289 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1290 Constraints: *const c_char)
1293 pub fn LLVMRustDebugMetadataVersion() -> u32;
1294 pub fn LLVMRustVersionMajor() -> u32;
1295 pub fn LLVMRustVersionMinor() -> u32;
1297 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1299 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1301 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1303 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1305 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1307 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1310 Producer: *const c_char,
1312 Flags: *const c_char,
1314 SplitName: *const c_char)
1315 -> &'a DIDescriptor;
1317 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1318 Filename: *const c_char,
1319 Directory: *const c_char)
1322 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1324 ParameterTypes: &'a DIArray)
1325 -> &'a DICompositeType;
1327 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1328 Scope: &'a DIDescriptor,
1329 Name: *const c_char,
1330 LinkageName: *const c_char,
1334 isLocalToUnit: bool,
1340 TParam: &'a DIArray,
1341 Decl: Option<&'a DIDescriptor>)
1342 -> &'a DISubprogram;
1344 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1345 Name: *const c_char,
1351 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1352 PointeeTy: &'a DIType,
1355 Name: *const c_char)
1356 -> &'a DIDerivedType;
1358 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1359 Scope: Option<&'a DIDescriptor>,
1360 Name: *const c_char,
1366 DerivedFrom: Option<&'a DIType>,
1367 Elements: &'a DIArray,
1368 RunTimeLang: c_uint,
1369 VTableHolder: Option<&'a DIType>,
1370 UniqueId: *const c_char)
1371 -> &'a DICompositeType;
1373 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1374 Scope: &'a DIDescriptor,
1375 Name: *const c_char,
1383 -> &'a DIDerivedType;
1385 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1387 Name: *const c_char,
1393 Discriminant: Option<&'a Value>,
1398 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1403 -> &'a DILexicalBlock;
1405 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1408 -> &'a DILexicalBlock;
1410 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1411 Context: Option<&'a DIScope>,
1412 Name: *const c_char,
1413 LinkageName: *const c_char,
1417 isLocalToUnit: bool,
1419 Decl: Option<&'a DIDescriptor>,
1421 -> &'a DIGlobalVariableExpression;
1423 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1425 Scope: &'a DIDescriptor,
1426 Name: *const c_char,
1430 AlwaysPreserve: bool,
1436 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1440 Subscripts: &'a DIArray)
1443 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1448 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1449 Ptr: *const Option<&'a DIDescriptor>,
1453 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1455 VarInfo: &'a DIVariable,
1456 AddrOps: *const i64,
1457 AddrOpsCount: c_uint,
1459 InsertAtEnd: &'a BasicBlock)
1462 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1463 Name: *const c_char,
1465 -> &'a DIEnumerator;
1467 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1469 Name: *const c_char,
1474 Elements: &'a DIArray,
1475 ClassType: &'a DIType,
1479 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1481 Name: *const c_char,
1487 Elements: Option<&'a DIArray>,
1488 RunTimeLang: c_uint,
1489 UniqueId: *const c_char)
1492 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1494 Name: *const c_char,
1500 Discriminator: Option<&'a DIDerivedType>,
1501 Elements: &'a DIArray,
1502 UniqueId: *const c_char)
1503 -> &'a DIDerivedType;
1505 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1507 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1508 Scope: Option<&'a DIScope>,
1509 Name: *const c_char,
1514 -> &'a DITemplateTypeParameter;
1517 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1518 Scope: Option<&'a DIScope>,
1519 Name: *const c_char,
1524 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1525 CompositeType: &'a DIType,
1526 TypeArray: &'a DIArray);
1529 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1533 InlinedAt: Option<&'a Metadata>)
1535 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1536 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1539 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1541 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1542 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1546 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1547 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1549 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1550 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1551 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1553 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1555 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1556 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1558 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1559 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1561 Features: *const c_char,
1564 Level: CodeGenOptLevel,
1566 PositionIndependentExecutable: bool,
1567 FunctionSections: bool,
1569 TrapUnreachable: bool,
1572 EmitStackSizeSection: bool)
1573 -> Option<&'static mut TargetMachine>;
1574 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1575 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1576 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1578 DisableSimplifyLibCalls: bool);
1579 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1580 OptLevel: CodeGenOptLevel,
1581 MergeFunctions: bool,
1583 LoopVectorize: bool,
1584 PrepareForThinLTO: bool,
1585 PGOGenPath: *const c_char,
1586 PGOUsePath: *const c_char);
1587 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1589 DisableSimplifyLibCalls: bool);
1590 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1591 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1592 PM: &PassManager<'a>,
1594 Output: *const c_char,
1597 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1599 Output: *const c_char,
1600 Demangle: extern fn(*const c_char,
1604 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1605 pub fn LLVMRustPrintPasses();
1606 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1607 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1608 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1609 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1611 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1612 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1613 pub fn LLVMRustArchiveIteratorNext(
1614 AIR: &ArchiveIterator<'a>,
1615 ) -> Option<&'a mut ArchiveChild<'a>>;
1616 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1617 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1618 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1619 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1620 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1622 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1625 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1627 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1631 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1632 Handler: DiagnosticHandler,
1633 DiagnosticContext: *mut c_void);
1636 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1638 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1639 pass_name_out: &RustString,
1640 function_out: &mut Option<&'a Value>,
1641 loc_line_out: &mut c_uint,
1642 loc_column_out: &mut c_uint,
1643 loc_filename_out: &RustString,
1644 message_out: &RustString);
1648 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1649 cookie_out: &mut c_uint,
1650 message_out: &mut Option<&'a Twine>,
1651 instruction_out: &mut Option<&'a Value>);
1654 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1656 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1660 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1662 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1663 H: InlineAsmDiagHandler,
1667 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1669 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1673 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1675 Members: *const &RustArchiveMember,
1679 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1680 Name: *const c_char,
1681 Child: Option<&ArchiveChild<'a>>)
1682 -> &'a mut RustArchiveMember<'a>;
1683 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1685 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1687 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1688 Inputs: *const &'a Value,
1690 -> &'a mut OperandBundleDef<'a>;
1691 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1693 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1695 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1696 pub fn LLVMRustUnsetComdat(V: &Value);
1697 pub fn LLVMRustSetModulePIELevel(M: &Module);
1698 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1699 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1700 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1701 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1702 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1704 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1705 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1706 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1707 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1708 pub fn LLVMRustCreateThinLTOData(
1709 Modules: *const ThinLTOModule,
1711 PreservedSymbols: *const *const c_char,
1712 PreservedSymbolsLen: c_uint,
1713 ) -> Option<&'static mut ThinLTOData>;
1714 pub fn LLVMRustPrepareThinLTORename(
1718 pub fn LLVMRustPrepareThinLTOResolveWeak(
1722 pub fn LLVMRustPrepareThinLTOInternalize(
1726 pub fn LLVMRustPrepareThinLTOImport(
1730 pub fn LLVMRustGetThinLTOModuleImports(
1731 Data: *const ThinLTOData,
1732 ModuleNameCallback: ThinLTOModuleNameCallback,
1733 CallbackPayload: *mut c_void,
1735 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1736 pub fn LLVMRustParseBitcodeForThinLTO(
1740 Identifier: *const c_char,
1741 ) -> Option<&Module>;
1742 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1743 CU1: &mut *mut c_void,
1744 CU2: &mut *mut c_void);
1745 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1747 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1748 pub fn LLVMRustLinkerAdd(linker: &Linker,
1749 bytecode: *const c_char,
1750 bytecode_len: usize) -> bool;
1751 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);