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 impl AtomicOrdering {
281 pub fn from_generic(ao : traits::AtomicOrdering) -> Self {
283 traits::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
284 traits::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
285 traits::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
286 traits::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
287 traits::AtomicOrdering::Release => AtomicOrdering::Release,
288 traits::AtomicOrdering::AcquireRelease => AtomicOrdering::AcquireRelease,
289 traits::AtomicOrdering::SequentiallyConsistent =>
290 AtomicOrdering::SequentiallyConsistent
296 /// LLVMRustSynchronizationScope
297 #[derive(Copy, Clone)]
299 pub enum SynchronizationScope {
300 // FIXME: figure out if this variant is needed at all.
308 #[derive(Copy, Clone)]
311 // FIXME: figure out if this variant is needed at all.
319 #[derive(Copy, Clone)]
321 pub enum MetadataType {
328 MD_invariant_load = 6,
332 MD_mem_parallel_loop_access = 10,
336 /// LLVMRustAsmDialect
337 #[derive(Copy, Clone)]
339 pub enum AsmDialect {
340 // FIXME: figure out if this variant is needed at all.
347 /// LLVMRustCodeGenOptLevel
348 #[derive(Copy, Clone, PartialEq)]
350 pub enum CodeGenOptLevel {
351 // FIXME: figure out if this variant is needed at all.
361 #[derive(Copy, Clone, PartialEq)]
373 /// LLVMRustCodeModel
374 #[derive(Copy, Clone)]
377 // FIXME: figure out if this variant is needed at all.
387 /// LLVMRustDiagnosticKind
388 #[derive(Copy, Clone)]
390 #[allow(dead_code)] // Variants constructed by C++.
391 pub enum DiagnosticKind {
395 DebugMetadataVersion,
398 OptimizationRemarkMissed,
399 OptimizationRemarkAnalysis,
400 OptimizationRemarkAnalysisFPCommute,
401 OptimizationRemarkAnalysisAliasing,
402 OptimizationRemarkOther,
408 /// LLVMRustArchiveKind
409 #[derive(Copy, Clone)]
411 pub enum ArchiveKind {
412 // FIXME: figure out if this variant is needed at all.
421 #[derive(Copy, Clone, PartialEq, Debug)]
423 #[allow(dead_code)] // Variants constructed by C++.
430 /// LLVMRustThinLTOData
431 extern { pub type ThinLTOData; }
433 /// LLVMRustThinLTOBuffer
434 extern { pub type ThinLTOBuffer; }
436 // LLVMRustModuleNameCallback
437 pub type ThinLTOModuleNameCallback =
438 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
440 /// LLVMRustThinLTOModule
442 pub struct ThinLTOModule {
443 pub identifier: *const c_char,
448 /// LLVMThreadLocalMode
449 #[derive(Copy, Clone)]
451 pub enum ThreadLocalMode {
459 extern { type Opaque; }
461 struct InvariantOpaque<'a> {
462 _marker: PhantomData<&'a mut &'a ()>,
466 // Opaque pointer types
467 extern { pub type Module; }
468 extern { pub type Context; }
469 extern { pub type Type; }
470 extern { pub type Value; }
471 extern { pub type Metadata; }
472 extern { pub type BasicBlock; }
474 pub struct Builder<'a>(InvariantOpaque<'a>);
475 extern { pub type MemoryBuffer; }
477 pub struct PassManager<'a>(InvariantOpaque<'a>);
478 extern { pub type PassManagerBuilder; }
479 extern { pub type ObjectFile; }
481 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
482 extern { pub type Pass; }
483 extern { pub type TargetMachine; }
484 extern { pub type Archive; }
486 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
488 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
489 extern { pub type Twine; }
490 extern { pub type DiagnosticInfo; }
491 extern { pub type SMDiagnostic; }
493 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
495 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
497 pub struct Linker<'a>(InvariantOpaque<'a>);
499 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
500 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
504 use super::{InvariantOpaque, Metadata};
507 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
509 pub type DIDescriptor = Metadata;
510 pub type DIScope = DIDescriptor;
511 pub type DIFile = DIScope;
512 pub type DILexicalBlock = DIScope;
513 pub type DISubprogram = DIScope;
514 pub type DINameSpace = DIScope;
515 pub type DIType = DIDescriptor;
516 pub type DIBasicType = DIType;
517 pub type DIDerivedType = DIType;
518 pub type DICompositeType = DIDerivedType;
519 pub type DIVariable = DIDescriptor;
520 pub type DIGlobalVariableExpression = DIDescriptor;
521 pub type DIArray = DIDescriptor;
522 pub type DISubrange = DIDescriptor;
523 pub type DIEnumerator = DIDescriptor;
524 pub type DITemplateTypeParameter = DIDescriptor;
526 // These values **must** match with LLVMRustDIFlags!!
530 pub struct DIFlags: ::libc::uint32_t {
532 const FlagPrivate = 1;
533 const FlagProtected = 2;
534 const FlagPublic = 3;
535 const FlagFwdDecl = (1 << 2);
536 const FlagAppleBlock = (1 << 3);
537 const FlagBlockByrefStruct = (1 << 4);
538 const FlagVirtual = (1 << 5);
539 const FlagArtificial = (1 << 6);
540 const FlagExplicit = (1 << 7);
541 const FlagPrototyped = (1 << 8);
542 const FlagObjcClassComplete = (1 << 9);
543 const FlagObjectPointer = (1 << 10);
544 const FlagVector = (1 << 11);
545 const FlagStaticMember = (1 << 12);
546 const FlagLValueReference = (1 << 13);
547 const FlagRValueReference = (1 << 14);
548 const FlagExternalTypeRef = (1 << 15);
549 const FlagIntroducedVirtual = (1 << 18);
550 const FlagBitField = (1 << 19);
551 const FlagNoReturn = (1 << 20);
552 const FlagMainSubprogram = (1 << 21);
557 extern { pub type ModuleBuffer; }
560 pub fn LLVMRustInstallFatalErrorHandler();
562 // Create and destroy contexts.
563 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
564 pub fn LLVMContextDispose(C: &'static mut Context);
565 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
568 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
569 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
570 pub fn LLVMCloneModule(M: &Module) -> &Module;
572 /// Data layout. See Module::getDataLayout.
573 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
574 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
576 /// See Module::setModuleInlineAsm.
577 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
578 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
580 /// See llvm::LLVMTypeKind::getTypeID.
581 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
583 // Operations on integer types
584 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
585 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
586 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
587 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
588 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
589 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
591 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
593 // Operations on real types
594 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
595 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
597 // Operations on function types
598 pub fn LLVMFunctionType(ReturnType: &'a Type,
599 ParamTypes: *const &'a Type,
603 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
604 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
606 // Operations on struct types
607 pub fn LLVMStructTypeInContext(C: &'a Context,
608 ElementTypes: *const &'a Type,
609 ElementCount: c_uint,
613 // Operations on array, pointer, and vector types (sequence types)
614 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
615 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
616 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
618 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
619 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
621 // Operations on other types
622 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
623 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
624 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
626 // Operations on all values
627 pub fn LLVMTypeOf(Val: &Value) -> &Type;
628 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
629 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
630 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
631 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
633 // Operations on constants of any type
634 pub fn LLVMConstNull(Ty: &Type) -> &Value;
635 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
637 // Operations on metadata
638 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
639 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
640 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
642 // Operations on scalar constants
643 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
644 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
645 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
646 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
647 high: &mut u64, low: &mut u64) -> bool;
648 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
651 // Operations on composite constants
652 pub fn LLVMConstStringInContext(C: &Context,
655 DontNullTerminate: Bool)
657 pub fn LLVMConstStructInContext(C: &'a Context,
658 ConstantVals: *const &'a Value,
663 pub fn LLVMConstArray(ElementTy: &'a Type,
664 ConstantVals: *const &'a Value,
667 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
669 // Constant expressions
670 pub fn LLVMConstInBoundsGEP(
671 ConstantVal: &'a Value,
672 ConstantIndices: *const &'a Value,
675 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
676 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
677 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
678 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
679 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
680 pub fn LLVMConstExtractValue(AggConstant: &Value,
681 IdxList: *const c_uint,
685 // Operations on global variables, functions, and aliases (globals)
686 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
687 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
688 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
689 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
690 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
691 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
692 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
693 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
694 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
697 // Operations on global variables
698 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
699 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
700 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
701 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
702 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
703 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
704 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
705 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
706 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
707 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
708 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
709 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
710 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
711 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
712 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
713 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
715 // Operations on functions
716 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
718 FunctionTy: &'a Type)
720 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
721 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
722 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
723 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
724 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
725 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
728 Value: *const c_char);
729 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
731 // Operations on parameters
732 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
733 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
735 // Operations on basic blocks
736 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
737 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
741 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
743 // Operations on instructions
744 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
746 // Operations on call sites
747 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
748 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
749 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
750 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
751 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
755 // Operations on load/store instructions (only)
756 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
758 // Operations on phi nodes
759 pub fn LLVMAddIncoming(PhiNode: &'a Value,
760 IncomingValues: *const &'a Value,
761 IncomingBlocks: *const &'a BasicBlock,
764 // Instruction builders
765 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
766 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
767 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
768 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
771 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
772 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
773 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
776 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
777 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
778 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
779 pub fn LLVMBuildCondBr(B: &Builder<'a>,
781 Then: &'a BasicBlock,
782 Else: &'a BasicBlock)
784 pub fn LLVMBuildSwitch(B: &Builder<'a>,
786 Else: &'a BasicBlock,
789 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
791 Args: *const &'a Value,
793 Then: &'a BasicBlock,
794 Catch: &'a BasicBlock,
795 Bundle: Option<&OperandBundleDef<'a>>,
798 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
804 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
805 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
807 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
808 ParentPad: Option<&'a Value>,
810 Args: *const &'a Value,
812 -> Option<&'a Value>;
813 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
814 CleanupPad: &'a Value,
815 UnwindBB: Option<&'a BasicBlock>)
816 -> Option<&'a Value>;
817 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
818 ParentPad: &'a Value,
820 Args: *const &'a Value,
822 -> Option<&'a Value>;
823 pub fn LLVMRustBuildCatchRet(
827 ) -> Option<&'a Value>;
828 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
829 ParentPad: Option<&'a Value>,
830 BB: Option<&'a BasicBlock>,
833 -> Option<&'a Value>;
834 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
835 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
837 // Add a case to the switch instruction
838 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
840 // Add a clause to the landing pad instruction
841 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
843 // Set the cleanup on a landing pad instruction
844 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
847 pub fn LLVMBuildAdd(B: &Builder<'a>,
852 pub fn LLVMBuildFAdd(B: &Builder<'a>,
857 pub fn LLVMBuildSub(B: &Builder<'a>,
862 pub fn LLVMBuildFSub(B: &Builder<'a>,
867 pub fn LLVMBuildMul(B: &Builder<'a>,
872 pub fn LLVMBuildFMul(B: &Builder<'a>,
877 pub fn LLVMBuildUDiv(B: &Builder<'a>,
882 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
887 pub fn LLVMBuildSDiv(B: &Builder<'a>,
892 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
897 pub fn LLVMBuildFDiv(B: &Builder<'a>,
902 pub fn LLVMBuildURem(B: &Builder<'a>,
907 pub fn LLVMBuildSRem(B: &Builder<'a>,
912 pub fn LLVMBuildFRem(B: &Builder<'a>,
917 pub fn LLVMBuildShl(B: &Builder<'a>,
922 pub fn LLVMBuildLShr(B: &Builder<'a>,
927 pub fn LLVMBuildAShr(B: &Builder<'a>,
932 pub fn LLVMBuildAnd(B: &Builder<'a>,
937 pub fn LLVMBuildOr(B: &Builder<'a>,
942 pub fn LLVMBuildXor(B: &Builder<'a>,
947 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
948 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
949 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
950 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
953 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
954 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
959 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
961 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
963 pub fn LLVMBuildGEP(B: &Builder<'a>,
965 Indices: *const &'a Value,
969 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
971 Indices: *const &'a Value,
975 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
982 pub fn LLVMBuildTrunc(B: &Builder<'a>,
987 pub fn LLVMBuildZExt(B: &Builder<'a>,
992 pub fn LLVMBuildSExt(B: &Builder<'a>,
997 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
1000 Name: *const c_char)
1002 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
1005 Name: *const c_char)
1007 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
1010 Name: *const c_char)
1012 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
1015 Name: *const c_char)
1017 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
1020 Name: *const c_char)
1022 pub fn LLVMBuildFPExt(B: &Builder<'a>,
1025 Name: *const c_char)
1027 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
1030 Name: *const c_char)
1032 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
1035 Name: *const c_char)
1037 pub fn LLVMBuildBitCast(B: &Builder<'a>,
1040 Name: *const c_char)
1042 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
1045 Name: *const c_char)
1047 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
1054 pub fn LLVMBuildICmp(B: &Builder<'a>,
1058 Name: *const c_char)
1060 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1064 Name: *const c_char)
1067 // Miscellaneous instructions
1068 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1069 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1071 Args: *const &'a Value,
1073 Bundle: Option<&OperandBundleDef<'a>>,
1074 Name: *const c_char)
1076 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1084 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1092 pub fn LLVMBuildSelect(B: &Builder<'a>,
1096 Name: *const c_char)
1098 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1101 Name: *const c_char)
1103 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1106 Name: *const c_char)
1108 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1112 Name: *const c_char)
1114 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1118 Name: *const c_char)
1120 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1123 Name: *const c_char)
1125 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1129 Name: *const c_char)
1132 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1136 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1140 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1143 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1146 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1149 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1152 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1155 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1159 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1163 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1167 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1172 pub fn LLVMRustBuildMinNum(
1176 ) -> Option<&'a Value>;
1177 pub fn LLVMRustBuildMaxNum(
1181 ) -> Option<&'a Value>;
1183 // Atomic Operations
1184 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1185 PointerVal: &'a Value,
1186 Name: *const c_char,
1187 Order: AtomicOrdering)
1190 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1193 Order: AtomicOrdering)
1196 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1200 Order: AtomicOrdering,
1201 FailureOrder: AtomicOrdering,
1205 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1209 Order: AtomicOrdering,
1210 SingleThreaded: Bool)
1213 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1214 Order: AtomicOrdering,
1215 Scope: SynchronizationScope);
1217 /// Writes a module to the specified path. Returns 0 on success.
1218 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1220 /// Creates a pass manager.
1221 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1223 /// Creates a function-by-function pass manager
1224 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1226 /// Disposes a pass manager.
1227 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1229 /// Runs a pass manager on a module.
1230 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1232 pub fn LLVMInitializePasses();
1234 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1235 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1236 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1237 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1238 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1240 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1243 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1245 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1249 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1250 PMB: &PassManagerBuilder,
1253 // Stuff that's in rustllvm/ because it's not upstream yet.
1255 /// Opens an object file.
1256 pub fn LLVMCreateObjectFile(
1257 MemBuf: &'static mut MemoryBuffer,
1258 ) -> Option<&'static mut ObjectFile>;
1259 /// Closes an object file.
1260 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1262 /// Enumerates the sections in an object file.
1263 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1264 /// Destroys a section iterator.
1265 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1266 /// Returns true if the section iterator is at the end of the section
1268 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1269 /// Moves the section iterator to point to the next section.
1270 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1271 /// Returns the current section size.
1272 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1273 /// Returns the current section contents as a string buffer.
1274 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1276 /// Reads the given file and returns it as a memory buffer. Use
1277 /// LLVMDisposeMemoryBuffer() to get rid of it.
1278 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1279 Path: *const c_char,
1280 ) -> Option<&'static mut MemoryBuffer>;
1282 pub fn LLVMStartMultithreaded() -> Bool;
1284 /// Returns a string describing the last error caused by an LLVMRust* call.
1285 pub fn LLVMRustGetLastError() -> *const c_char;
1287 /// Print the pass timings since static dtors aren't picking them up.
1288 pub fn LLVMRustPrintPassTimings();
1290 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1292 pub fn LLVMStructSetBody(StructTy: &'a Type,
1293 ElementTypes: *const &'a Type,
1294 ElementCount: c_uint,
1297 /// Prepares inline assembly.
1298 pub fn LLVMRustInlineAsm(Ty: &Type,
1299 AsmString: *const c_char,
1300 Constraints: *const c_char,
1303 Dialect: AsmDialect)
1305 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1306 Constraints: *const c_char)
1309 pub fn LLVMRustDebugMetadataVersion() -> u32;
1310 pub fn LLVMRustVersionMajor() -> u32;
1311 pub fn LLVMRustVersionMinor() -> u32;
1313 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1315 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1317 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1319 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1321 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1323 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1326 Producer: *const c_char,
1328 Flags: *const c_char,
1330 SplitName: *const c_char)
1331 -> &'a DIDescriptor;
1333 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1334 Filename: *const c_char,
1335 Directory: *const c_char)
1338 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1340 ParameterTypes: &'a DIArray)
1341 -> &'a DICompositeType;
1343 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1344 Scope: &'a DIDescriptor,
1345 Name: *const c_char,
1346 LinkageName: *const c_char,
1350 isLocalToUnit: bool,
1356 TParam: &'a DIArray,
1357 Decl: Option<&'a DIDescriptor>)
1358 -> &'a DISubprogram;
1360 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1361 Name: *const c_char,
1367 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1368 PointeeTy: &'a DIType,
1371 Name: *const c_char)
1372 -> &'a DIDerivedType;
1374 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1375 Scope: Option<&'a DIDescriptor>,
1376 Name: *const c_char,
1382 DerivedFrom: Option<&'a DIType>,
1383 Elements: &'a DIArray,
1384 RunTimeLang: c_uint,
1385 VTableHolder: Option<&'a DIType>,
1386 UniqueId: *const c_char)
1387 -> &'a DICompositeType;
1389 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1390 Scope: &'a DIDescriptor,
1391 Name: *const c_char,
1399 -> &'a DIDerivedType;
1401 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1403 Name: *const c_char,
1409 Discriminant: Option<&'a Value>,
1414 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1419 -> &'a DILexicalBlock;
1421 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1424 -> &'a DILexicalBlock;
1426 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1427 Context: Option<&'a DIScope>,
1428 Name: *const c_char,
1429 LinkageName: *const c_char,
1433 isLocalToUnit: bool,
1435 Decl: Option<&'a DIDescriptor>,
1437 -> &'a DIGlobalVariableExpression;
1439 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1441 Scope: &'a DIDescriptor,
1442 Name: *const c_char,
1446 AlwaysPreserve: bool,
1452 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1456 Subscripts: &'a DIArray)
1459 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1464 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1465 Ptr: *const Option<&'a DIDescriptor>,
1469 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1471 VarInfo: &'a DIVariable,
1472 AddrOps: *const i64,
1473 AddrOpsCount: c_uint,
1475 InsertAtEnd: &'a BasicBlock)
1478 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1479 Name: *const c_char,
1481 -> &'a DIEnumerator;
1483 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1485 Name: *const c_char,
1490 Elements: &'a DIArray,
1491 ClassType: &'a DIType,
1495 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1497 Name: *const c_char,
1503 Elements: Option<&'a DIArray>,
1504 RunTimeLang: c_uint,
1505 UniqueId: *const c_char)
1508 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1510 Name: *const c_char,
1516 Discriminator: Option<&'a DIDerivedType>,
1517 Elements: &'a DIArray,
1518 UniqueId: *const c_char)
1519 -> &'a DIDerivedType;
1521 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1523 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1524 Scope: Option<&'a DIScope>,
1525 Name: *const c_char,
1530 -> &'a DITemplateTypeParameter;
1533 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1534 Scope: Option<&'a DIScope>,
1535 Name: *const c_char,
1540 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1541 CompositeType: &'a DIType,
1542 TypeArray: &'a DIArray);
1545 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1549 InlinedAt: Option<&'a Metadata>)
1551 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1552 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1555 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1557 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1558 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1562 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1563 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1565 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1566 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1567 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1569 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1571 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1572 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1574 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1575 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1577 Features: *const c_char,
1580 Level: CodeGenOptLevel,
1582 PositionIndependentExecutable: bool,
1583 FunctionSections: bool,
1585 TrapUnreachable: bool,
1588 EmitStackSizeSection: bool)
1589 -> Option<&'static mut TargetMachine>;
1590 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1591 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1592 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1594 DisableSimplifyLibCalls: bool);
1595 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1596 OptLevel: CodeGenOptLevel,
1597 MergeFunctions: bool,
1599 LoopVectorize: bool,
1600 PrepareForThinLTO: bool,
1601 PGOGenPath: *const c_char,
1602 PGOUsePath: *const c_char);
1603 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1605 DisableSimplifyLibCalls: bool);
1606 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1607 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1608 PM: &PassManager<'a>,
1610 Output: *const c_char,
1613 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1615 Output: *const c_char,
1616 Demangle: extern fn(*const c_char,
1620 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1621 pub fn LLVMRustPrintPasses();
1622 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1623 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1624 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1625 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1627 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1628 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1629 pub fn LLVMRustArchiveIteratorNext(
1630 AIR: &ArchiveIterator<'a>,
1631 ) -> Option<&'a mut ArchiveChild<'a>>;
1632 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1633 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1634 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1635 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1636 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1638 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1641 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1643 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1647 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1648 Handler: DiagnosticHandler,
1649 DiagnosticContext: *mut c_void);
1652 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1654 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1655 pass_name_out: &RustString,
1656 function_out: &mut Option<&'a Value>,
1657 loc_line_out: &mut c_uint,
1658 loc_column_out: &mut c_uint,
1659 loc_filename_out: &RustString,
1660 message_out: &RustString);
1664 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1665 cookie_out: &mut c_uint,
1666 message_out: &mut Option<&'a Twine>,
1667 instruction_out: &mut Option<&'a Value>);
1670 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1672 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1676 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1678 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1679 H: InlineAsmDiagHandler,
1683 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1685 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1689 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1691 Members: *const &RustArchiveMember,
1695 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1696 Name: *const c_char,
1697 Child: Option<&ArchiveChild<'a>>)
1698 -> &'a mut RustArchiveMember<'a>;
1699 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1701 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1703 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1704 Inputs: *const &'a Value,
1706 -> &'a mut OperandBundleDef<'a>;
1707 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1709 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1711 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1712 pub fn LLVMRustUnsetComdat(V: &Value);
1713 pub fn LLVMRustSetModulePIELevel(M: &Module);
1714 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1715 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1716 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1717 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1718 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1720 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1721 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1722 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1723 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1724 pub fn LLVMRustCreateThinLTOData(
1725 Modules: *const ThinLTOModule,
1727 PreservedSymbols: *const *const c_char,
1728 PreservedSymbolsLen: c_uint,
1729 ) -> Option<&'static mut ThinLTOData>;
1730 pub fn LLVMRustPrepareThinLTORename(
1734 pub fn LLVMRustPrepareThinLTOResolveWeak(
1738 pub fn LLVMRustPrepareThinLTOInternalize(
1742 pub fn LLVMRustPrepareThinLTOImport(
1746 pub fn LLVMRustGetThinLTOModuleImports(
1747 Data: *const ThinLTOData,
1748 ModuleNameCallback: ThinLTOModuleNameCallback,
1749 CallbackPayload: *mut c_void,
1751 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1752 pub fn LLVMRustParseBitcodeForThinLTO(
1756 Identifier: *const c_char,
1757 ) -> Option<&Module>;
1758 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1759 CU1: &mut *mut c_void,
1760 CU2: &mut *mut c_void);
1761 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1763 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1764 pub fn LLVMRustLinkerAdd(linker: &Linker,
1765 bytecode: *const c_char,
1766 bytecode_len: usize) -> bool;
1767 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);