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 /// LLVMAtomicOrdering
248 #[derive(Copy, Clone)]
250 pub enum AtomicOrdering {
255 // Consume = 3, // Not specified yet.
259 SequentiallyConsistent = 7,
262 /// LLVMRustSynchronizationScope
263 #[derive(Copy, Clone)]
265 pub enum SynchronizationScope {
266 // FIXME: figure out if this variant is needed at all.
274 #[derive(Copy, Clone)]
277 // FIXME: figure out if this variant is needed at all.
285 #[derive(Copy, Clone)]
287 pub enum MetadataType {
294 MD_invariant_load = 6,
298 MD_mem_parallel_loop_access = 10,
302 /// LLVMRustAsmDialect
303 #[derive(Copy, Clone)]
305 pub enum AsmDialect {
306 // FIXME: figure out if this variant is needed at all.
313 /// LLVMRustCodeGenOptLevel
314 #[derive(Copy, Clone, PartialEq)]
316 pub enum CodeGenOptLevel {
317 // FIXME: figure out if this variant is needed at all.
327 #[derive(Copy, Clone, PartialEq)]
339 /// LLVMRustCodeModel
340 #[derive(Copy, Clone)]
343 // FIXME: figure out if this variant is needed at all.
353 /// LLVMRustDiagnosticKind
354 #[derive(Copy, Clone)]
356 #[allow(dead_code)] // Variants constructed by C++.
357 pub enum DiagnosticKind {
361 DebugMetadataVersion,
364 OptimizationRemarkMissed,
365 OptimizationRemarkAnalysis,
366 OptimizationRemarkAnalysisFPCommute,
367 OptimizationRemarkAnalysisAliasing,
368 OptimizationRemarkOther,
374 /// LLVMRustArchiveKind
375 #[derive(Copy, Clone)]
377 pub enum ArchiveKind {
378 // FIXME: figure out if this variant is needed at all.
387 #[derive(Copy, Clone, PartialEq, Debug)]
389 #[allow(dead_code)] // Variants constructed by C++.
396 /// LLVMRustThinLTOData
397 extern { pub type ThinLTOData; }
399 /// LLVMRustThinLTOBuffer
400 extern { pub type ThinLTOBuffer; }
402 // LLVMRustModuleNameCallback
403 pub type ThinLTOModuleNameCallback =
404 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
406 /// LLVMRustThinLTOModule
408 pub struct ThinLTOModule {
409 pub identifier: *const c_char,
414 /// LLVMThreadLocalMode
415 #[derive(Copy, Clone)]
417 pub enum ThreadLocalMode {
425 extern { type Opaque; }
427 struct InvariantOpaque<'a> {
428 _marker: PhantomData<&'a mut &'a ()>,
432 // Opaque pointer types
433 extern { pub type Module; }
434 extern { pub type Context; }
435 extern { pub type Type; }
436 extern { pub type Value; }
437 extern { pub type Metadata; }
438 extern { pub type BasicBlock; }
440 pub struct Builder<'a>(InvariantOpaque<'a>);
441 extern { pub type MemoryBuffer; }
443 pub struct PassManager<'a>(InvariantOpaque<'a>);
444 extern { pub type PassManagerBuilder; }
445 extern { pub type ObjectFile; }
447 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
448 extern { pub type Pass; }
449 extern { pub type TargetMachine; }
450 extern { pub type Archive; }
452 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
454 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
455 extern { pub type Twine; }
456 extern { pub type DiagnosticInfo; }
457 extern { pub type SMDiagnostic; }
459 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
461 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
463 pub struct Linker<'a>(InvariantOpaque<'a>);
465 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
466 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
470 use super::{InvariantOpaque, Metadata};
473 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
475 pub type DIDescriptor = Metadata;
476 pub type DIScope = DIDescriptor;
477 pub type DIFile = DIScope;
478 pub type DILexicalBlock = DIScope;
479 pub type DISubprogram = DIScope;
480 pub type DINameSpace = DIScope;
481 pub type DIType = DIDescriptor;
482 pub type DIBasicType = DIType;
483 pub type DIDerivedType = DIType;
484 pub type DICompositeType = DIDerivedType;
485 pub type DIVariable = DIDescriptor;
486 pub type DIGlobalVariableExpression = DIDescriptor;
487 pub type DIArray = DIDescriptor;
488 pub type DISubrange = DIDescriptor;
489 pub type DIEnumerator = DIDescriptor;
490 pub type DITemplateTypeParameter = DIDescriptor;
492 // These values **must** match with LLVMRustDIFlags!!
496 pub struct DIFlags: ::libc::uint32_t {
498 const FlagPrivate = 1;
499 const FlagProtected = 2;
500 const FlagPublic = 3;
501 const FlagFwdDecl = (1 << 2);
502 const FlagAppleBlock = (1 << 3);
503 const FlagBlockByrefStruct = (1 << 4);
504 const FlagVirtual = (1 << 5);
505 const FlagArtificial = (1 << 6);
506 const FlagExplicit = (1 << 7);
507 const FlagPrototyped = (1 << 8);
508 const FlagObjcClassComplete = (1 << 9);
509 const FlagObjectPointer = (1 << 10);
510 const FlagVector = (1 << 11);
511 const FlagStaticMember = (1 << 12);
512 const FlagLValueReference = (1 << 13);
513 const FlagRValueReference = (1 << 14);
514 const FlagExternalTypeRef = (1 << 15);
515 const FlagIntroducedVirtual = (1 << 18);
516 const FlagBitField = (1 << 19);
517 const FlagNoReturn = (1 << 20);
518 const FlagMainSubprogram = (1 << 21);
523 extern { pub type ModuleBuffer; }
526 pub fn LLVMRustInstallFatalErrorHandler();
528 // Create and destroy contexts.
529 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
530 pub fn LLVMContextDispose(C: &'static mut Context);
531 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
534 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
535 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
536 pub fn LLVMCloneModule(M: &Module) -> &Module;
538 /// Data layout. See Module::getDataLayout.
539 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
540 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
542 /// See Module::setModuleInlineAsm.
543 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
544 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
546 /// See llvm::LLVMTypeKind::getTypeID.
547 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
549 // Operations on integer types
550 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
551 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
552 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
553 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
554 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
555 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
557 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
559 // Operations on real types
560 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
561 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
563 // Operations on function types
564 pub fn LLVMFunctionType(ReturnType: &'a Type,
565 ParamTypes: *const &'a Type,
569 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
570 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
572 // Operations on struct types
573 pub fn LLVMStructTypeInContext(C: &'a Context,
574 ElementTypes: *const &'a Type,
575 ElementCount: c_uint,
579 // Operations on array, pointer, and vector types (sequence types)
580 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
581 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
582 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
584 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
585 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
587 // Operations on other types
588 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
589 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
590 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
592 // Operations on all values
593 pub fn LLVMTypeOf(Val: &Value) -> &Type;
594 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
595 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
596 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
597 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
599 // Operations on constants of any type
600 pub fn LLVMConstNull(Ty: &Type) -> &Value;
601 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
603 // Operations on metadata
604 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
605 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
606 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
608 // Operations on scalar constants
609 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
610 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
611 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
612 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
613 high: &mut u64, low: &mut u64) -> bool;
614 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
617 // Operations on composite constants
618 pub fn LLVMConstStringInContext(C: &Context,
621 DontNullTerminate: Bool)
623 pub fn LLVMConstStructInContext(C: &'a Context,
624 ConstantVals: *const &'a Value,
629 pub fn LLVMConstArray(ElementTy: &'a Type,
630 ConstantVals: *const &'a Value,
633 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
635 // Constant expressions
636 pub fn LLVMConstInBoundsGEP(
637 ConstantVal: &'a Value,
638 ConstantIndices: *const &'a Value,
641 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
642 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
643 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
644 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
645 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
646 pub fn LLVMConstExtractValue(AggConstant: &Value,
647 IdxList: *const c_uint,
651 // Operations on global variables, functions, and aliases (globals)
652 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
653 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
654 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
655 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
656 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
657 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
658 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
659 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
660 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
663 // Operations on global variables
664 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
665 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
666 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
667 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
668 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
669 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
670 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
671 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
672 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
673 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
674 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
675 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
676 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
677 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
678 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
679 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
681 // Operations on functions
682 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
684 FunctionTy: &'a Type)
686 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
687 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
688 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
689 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
690 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
691 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
694 Value: *const c_char);
695 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
697 // Operations on parameters
698 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
699 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
701 // Operations on basic blocks
702 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
703 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
707 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
709 // Operations on instructions
710 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
712 // Operations on call sites
713 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
714 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
715 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
716 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
717 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
721 // Operations on load/store instructions (only)
722 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
724 // Operations on phi nodes
725 pub fn LLVMAddIncoming(PhiNode: &'a Value,
726 IncomingValues: *const &'a Value,
727 IncomingBlocks: *const &'a BasicBlock,
730 // Instruction builders
731 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
732 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
733 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
734 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
737 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
738 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
739 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
742 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
743 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
744 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
745 pub fn LLVMBuildCondBr(B: &Builder<'a>,
747 Then: &'a BasicBlock,
748 Else: &'a BasicBlock)
750 pub fn LLVMBuildSwitch(B: &Builder<'a>,
752 Else: &'a BasicBlock,
755 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
757 Args: *const &'a Value,
759 Then: &'a BasicBlock,
760 Catch: &'a BasicBlock,
761 Bundle: Option<&OperandBundleDef<'a>>,
764 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
770 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
771 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
773 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
774 ParentPad: Option<&'a Value>,
776 Args: *const &'a Value,
778 -> Option<&'a Value>;
779 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
780 CleanupPad: &'a Value,
781 UnwindBB: Option<&'a BasicBlock>)
782 -> Option<&'a Value>;
783 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
784 ParentPad: &'a Value,
786 Args: *const &'a Value,
788 -> Option<&'a Value>;
789 pub fn LLVMRustBuildCatchRet(
793 ) -> Option<&'a Value>;
794 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
795 ParentPad: Option<&'a Value>,
796 BB: Option<&'a BasicBlock>,
799 -> Option<&'a Value>;
800 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
801 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
803 // Add a case to the switch instruction
804 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
806 // Add a clause to the landing pad instruction
807 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
809 // Set the cleanup on a landing pad instruction
810 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
813 pub fn LLVMBuildAdd(B: &Builder<'a>,
818 pub fn LLVMBuildFAdd(B: &Builder<'a>,
823 pub fn LLVMBuildSub(B: &Builder<'a>,
828 pub fn LLVMBuildFSub(B: &Builder<'a>,
833 pub fn LLVMBuildMul(B: &Builder<'a>,
838 pub fn LLVMBuildFMul(B: &Builder<'a>,
843 pub fn LLVMBuildUDiv(B: &Builder<'a>,
848 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
853 pub fn LLVMBuildSDiv(B: &Builder<'a>,
858 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
863 pub fn LLVMBuildFDiv(B: &Builder<'a>,
868 pub fn LLVMBuildURem(B: &Builder<'a>,
873 pub fn LLVMBuildSRem(B: &Builder<'a>,
878 pub fn LLVMBuildFRem(B: &Builder<'a>,
883 pub fn LLVMBuildShl(B: &Builder<'a>,
888 pub fn LLVMBuildLShr(B: &Builder<'a>,
893 pub fn LLVMBuildAShr(B: &Builder<'a>,
898 pub fn LLVMBuildAnd(B: &Builder<'a>,
903 pub fn LLVMBuildOr(B: &Builder<'a>,
908 pub fn LLVMBuildXor(B: &Builder<'a>,
913 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
914 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
915 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
916 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
919 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
920 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
925 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
927 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
929 pub fn LLVMBuildGEP(B: &Builder<'a>,
931 Indices: *const &'a Value,
935 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
937 Indices: *const &'a Value,
941 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
948 pub fn LLVMBuildTrunc(B: &Builder<'a>,
953 pub fn LLVMBuildZExt(B: &Builder<'a>,
958 pub fn LLVMBuildSExt(B: &Builder<'a>,
963 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
968 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
973 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
978 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
983 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
988 pub fn LLVMBuildFPExt(B: &Builder<'a>,
993 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
998 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
1001 Name: *const c_char)
1003 pub fn LLVMBuildBitCast(B: &Builder<'a>,
1006 Name: *const c_char)
1008 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
1011 Name: *const c_char)
1013 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
1020 pub fn LLVMBuildICmp(B: &Builder<'a>,
1024 Name: *const c_char)
1026 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1030 Name: *const c_char)
1033 // Miscellaneous instructions
1034 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1035 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1037 Args: *const &'a Value,
1039 Bundle: Option<&OperandBundleDef<'a>>,
1040 Name: *const c_char)
1042 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1050 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1058 pub fn LLVMBuildSelect(B: &Builder<'a>,
1062 Name: *const c_char)
1064 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1067 Name: *const c_char)
1069 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1072 Name: *const c_char)
1074 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1078 Name: *const c_char)
1080 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1084 Name: *const c_char)
1086 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1089 Name: *const c_char)
1091 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1095 Name: *const c_char)
1098 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1102 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1106 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1109 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1112 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1115 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1118 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1121 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1125 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1129 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1133 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1138 pub fn LLVMRustBuildMinNum(
1142 ) -> Option<&'a Value>;
1143 pub fn LLVMRustBuildMaxNum(
1147 ) -> Option<&'a Value>;
1149 // Atomic Operations
1150 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1151 PointerVal: &'a Value,
1152 Name: *const c_char,
1153 Order: AtomicOrdering)
1156 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1159 Order: AtomicOrdering)
1162 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1166 Order: AtomicOrdering,
1167 FailureOrder: AtomicOrdering,
1171 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1175 Order: AtomicOrdering,
1176 SingleThreaded: Bool)
1179 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1180 Order: AtomicOrdering,
1181 Scope: SynchronizationScope);
1183 /// Writes a module to the specified path. Returns 0 on success.
1184 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1186 /// Creates a pass manager.
1187 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1189 /// Creates a function-by-function pass manager
1190 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1192 /// Disposes a pass manager.
1193 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1195 /// Runs a pass manager on a module.
1196 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1198 pub fn LLVMInitializePasses();
1200 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1201 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1202 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1203 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1204 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1206 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1209 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1211 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1215 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1216 PMB: &PassManagerBuilder,
1219 // Stuff that's in rustllvm/ because it's not upstream yet.
1221 /// Opens an object file.
1222 pub fn LLVMCreateObjectFile(
1223 MemBuf: &'static mut MemoryBuffer,
1224 ) -> Option<&'static mut ObjectFile>;
1225 /// Closes an object file.
1226 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1228 /// Enumerates the sections in an object file.
1229 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1230 /// Destroys a section iterator.
1231 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1232 /// Returns true if the section iterator is at the end of the section
1234 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1235 /// Moves the section iterator to point to the next section.
1236 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1237 /// Returns the current section size.
1238 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1239 /// Returns the current section contents as a string buffer.
1240 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1242 /// Reads the given file and returns it as a memory buffer. Use
1243 /// LLVMDisposeMemoryBuffer() to get rid of it.
1244 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1245 Path: *const c_char,
1246 ) -> Option<&'static mut MemoryBuffer>;
1248 pub fn LLVMStartMultithreaded() -> Bool;
1250 /// Returns a string describing the last error caused by an LLVMRust* call.
1251 pub fn LLVMRustGetLastError() -> *const c_char;
1253 /// Print the pass timings since static dtors aren't picking them up.
1254 pub fn LLVMRustPrintPassTimings();
1256 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1258 pub fn LLVMStructSetBody(StructTy: &'a Type,
1259 ElementTypes: *const &'a Type,
1260 ElementCount: c_uint,
1263 /// Prepares inline assembly.
1264 pub fn LLVMRustInlineAsm(Ty: &Type,
1265 AsmString: *const c_char,
1266 Constraints: *const c_char,
1269 Dialect: AsmDialect)
1271 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1272 Constraints: *const c_char)
1275 pub fn LLVMRustDebugMetadataVersion() -> u32;
1276 pub fn LLVMRustVersionMajor() -> u32;
1277 pub fn LLVMRustVersionMinor() -> u32;
1279 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1281 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1283 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1285 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1287 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1289 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1292 Producer: *const c_char,
1294 Flags: *const c_char,
1296 SplitName: *const c_char)
1297 -> &'a DIDescriptor;
1299 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1300 Filename: *const c_char,
1301 Directory: *const c_char)
1304 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1306 ParameterTypes: &'a DIArray)
1307 -> &'a DICompositeType;
1309 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1310 Scope: &'a DIDescriptor,
1311 Name: *const c_char,
1312 LinkageName: *const c_char,
1316 isLocalToUnit: bool,
1322 TParam: &'a DIArray,
1323 Decl: Option<&'a DIDescriptor>)
1324 -> &'a DISubprogram;
1326 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1327 Name: *const c_char,
1333 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1334 PointeeTy: &'a DIType,
1337 Name: *const c_char)
1338 -> &'a DIDerivedType;
1340 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1341 Scope: Option<&'a DIDescriptor>,
1342 Name: *const c_char,
1348 DerivedFrom: Option<&'a DIType>,
1349 Elements: &'a DIArray,
1350 RunTimeLang: c_uint,
1351 VTableHolder: Option<&'a DIType>,
1352 UniqueId: *const c_char)
1353 -> &'a DICompositeType;
1355 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1356 Scope: &'a DIDescriptor,
1357 Name: *const c_char,
1365 -> &'a DIDerivedType;
1367 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1369 Name: *const c_char,
1375 Discriminant: Option<&'a Value>,
1380 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1385 -> &'a DILexicalBlock;
1387 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1390 -> &'a DILexicalBlock;
1392 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1393 Context: Option<&'a DIScope>,
1394 Name: *const c_char,
1395 LinkageName: *const c_char,
1399 isLocalToUnit: bool,
1401 Decl: Option<&'a DIDescriptor>,
1403 -> &'a DIGlobalVariableExpression;
1405 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1407 Scope: &'a DIDescriptor,
1408 Name: *const c_char,
1412 AlwaysPreserve: bool,
1418 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1422 Subscripts: &'a DIArray)
1425 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1430 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1431 Ptr: *const Option<&'a DIDescriptor>,
1435 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1437 VarInfo: &'a DIVariable,
1438 AddrOps: *const i64,
1439 AddrOpsCount: c_uint,
1441 InsertAtEnd: &'a BasicBlock)
1444 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1445 Name: *const c_char,
1447 -> &'a DIEnumerator;
1449 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1451 Name: *const c_char,
1456 Elements: &'a DIArray,
1457 ClassType: &'a DIType,
1461 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1463 Name: *const c_char,
1469 Elements: Option<&'a DIArray>,
1470 RunTimeLang: c_uint,
1471 UniqueId: *const c_char)
1474 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1476 Name: *const c_char,
1482 Discriminator: Option<&'a DIDerivedType>,
1483 Elements: &'a DIArray,
1484 UniqueId: *const c_char)
1485 -> &'a DIDerivedType;
1487 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1489 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1490 Scope: Option<&'a DIScope>,
1491 Name: *const c_char,
1496 -> &'a DITemplateTypeParameter;
1499 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1500 Scope: Option<&'a DIScope>,
1501 Name: *const c_char,
1506 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1507 CompositeType: &'a DIType,
1508 TypeArray: &'a DIArray);
1511 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1515 InlinedAt: Option<&'a Metadata>)
1517 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1518 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1521 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1523 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1524 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1528 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1529 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1531 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1532 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1533 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1535 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1537 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1538 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1540 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1541 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1543 Features: *const c_char,
1546 Level: CodeGenOptLevel,
1548 PositionIndependentExecutable: bool,
1549 FunctionSections: bool,
1551 TrapUnreachable: bool,
1554 EmitStackSizeSection: bool)
1555 -> Option<&'static mut TargetMachine>;
1556 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1557 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1558 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1560 DisableSimplifyLibCalls: bool);
1561 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1562 OptLevel: CodeGenOptLevel,
1563 MergeFunctions: bool,
1565 LoopVectorize: bool,
1566 PrepareForThinLTO: bool,
1567 PGOGenPath: *const c_char,
1568 PGOUsePath: *const c_char);
1569 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1571 DisableSimplifyLibCalls: bool);
1572 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1573 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1574 PM: &PassManager<'a>,
1576 Output: *const c_char,
1579 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1581 Output: *const c_char,
1582 Demangle: extern fn(*const c_char,
1586 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1587 pub fn LLVMRustPrintPasses();
1588 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1589 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1590 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1591 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1593 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1594 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1595 pub fn LLVMRustArchiveIteratorNext(
1596 AIR: &ArchiveIterator<'a>,
1597 ) -> Option<&'a mut ArchiveChild<'a>>;
1598 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1599 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1600 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1601 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1602 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1604 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1607 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1609 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1613 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1614 Handler: DiagnosticHandler,
1615 DiagnosticContext: *mut c_void);
1618 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1620 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1621 pass_name_out: &RustString,
1622 function_out: &mut Option<&'a Value>,
1623 loc_line_out: &mut c_uint,
1624 loc_column_out: &mut c_uint,
1625 loc_filename_out: &RustString,
1626 message_out: &RustString);
1630 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1631 cookie_out: &mut c_uint,
1632 message_out: &mut Option<&'a Twine>,
1633 instruction_out: &mut Option<&'a Value>);
1636 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1638 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1642 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1644 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1645 H: InlineAsmDiagHandler,
1649 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1651 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1655 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1657 Members: *const &RustArchiveMember,
1661 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1662 Name: *const c_char,
1663 Child: Option<&ArchiveChild<'a>>)
1664 -> &'a mut RustArchiveMember<'a>;
1665 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1667 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1669 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1670 Inputs: *const &'a Value,
1672 -> &'a mut OperandBundleDef<'a>;
1673 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1675 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1677 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1678 pub fn LLVMRustUnsetComdat(V: &Value);
1679 pub fn LLVMRustSetModulePIELevel(M: &Module);
1680 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1681 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1682 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1683 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1684 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1686 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1687 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1688 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1689 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1690 pub fn LLVMRustCreateThinLTOData(
1691 Modules: *const ThinLTOModule,
1693 PreservedSymbols: *const *const c_char,
1694 PreservedSymbolsLen: c_uint,
1695 ) -> Option<&'static mut ThinLTOData>;
1696 pub fn LLVMRustPrepareThinLTORename(
1700 pub fn LLVMRustPrepareThinLTOResolveWeak(
1704 pub fn LLVMRustPrepareThinLTOInternalize(
1708 pub fn LLVMRustPrepareThinLTOImport(
1712 pub fn LLVMRustGetThinLTOModuleImports(
1713 Data: *const ThinLTOData,
1714 ModuleNameCallback: ThinLTOModuleNameCallback,
1715 CallbackPayload: *mut c_void,
1717 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1718 pub fn LLVMRustParseBitcodeForThinLTO(
1722 Identifier: *const c_char,
1723 ) -> Option<&Module>;
1724 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1725 CU1: &mut *mut c_void,
1726 CU2: &mut *mut c_void);
1727 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1729 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1730 pub fn LLVMRustLinkerAdd(linker: &Linker,
1731 bytecode: *const c_char,
1732 bytecode_len: usize) -> bool;
1733 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);