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 {
145 impl traits::IntPredicateMethods for IntPredicate {
146 fn convert_to_backend_specific(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 #[derive(Copy, Clone, PartialEq, Debug)]
207 /// LLVMAtomicRmwBinOp
208 #[derive(Copy, Clone)]
210 pub enum AtomicRmwBinOp {
224 /// LLVMAtomicOrdering
225 #[derive(Copy, Clone)]
227 pub enum AtomicOrdering {
232 // Consume = 3, // Not specified yet.
236 SequentiallyConsistent = 7,
239 /// LLVMRustSynchronizationScope
240 #[derive(Copy, Clone)]
242 pub enum SynchronizationScope {
243 // FIXME: figure out if this variant is needed at all.
251 #[derive(Copy, Clone)]
254 // FIXME: figure out if this variant is needed at all.
262 #[derive(Copy, Clone)]
264 pub enum MetadataType {
271 MD_invariant_load = 6,
275 MD_mem_parallel_loop_access = 10,
279 /// LLVMRustAsmDialect
280 #[derive(Copy, Clone)]
282 pub enum AsmDialect {
283 // FIXME: figure out if this variant is needed at all.
290 /// LLVMRustCodeGenOptLevel
291 #[derive(Copy, Clone, PartialEq)]
293 pub enum CodeGenOptLevel {
294 // FIXME: figure out if this variant is needed at all.
304 #[derive(Copy, Clone, PartialEq)]
316 /// LLVMRustCodeModel
317 #[derive(Copy, Clone)]
320 // FIXME: figure out if this variant is needed at all.
330 /// LLVMRustDiagnosticKind
331 #[derive(Copy, Clone)]
333 #[allow(dead_code)] // Variants constructed by C++.
334 pub enum DiagnosticKind {
338 DebugMetadataVersion,
341 OptimizationRemarkMissed,
342 OptimizationRemarkAnalysis,
343 OptimizationRemarkAnalysisFPCommute,
344 OptimizationRemarkAnalysisAliasing,
345 OptimizationRemarkOther,
351 /// LLVMRustArchiveKind
352 #[derive(Copy, Clone)]
354 pub enum ArchiveKind {
355 // FIXME: figure out if this variant is needed at all.
364 #[derive(Copy, Clone, PartialEq, Debug)]
366 #[allow(dead_code)] // Variants constructed by C++.
373 /// LLVMRustThinLTOData
374 extern { pub type ThinLTOData; }
376 /// LLVMRustThinLTOBuffer
377 extern { pub type ThinLTOBuffer; }
379 // LLVMRustModuleNameCallback
380 pub type ThinLTOModuleNameCallback =
381 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
383 /// LLVMRustThinLTOModule
385 pub struct ThinLTOModule {
386 pub identifier: *const c_char,
391 /// LLVMThreadLocalMode
392 #[derive(Copy, Clone)]
394 pub enum ThreadLocalMode {
402 extern { type Opaque; }
404 struct InvariantOpaque<'a> {
405 _marker: PhantomData<&'a mut &'a ()>,
409 // Opaque pointer types
410 extern { pub type Module; }
411 extern { pub type Context; }
412 extern { pub type Type; }
413 extern { pub type Value; }
414 extern { pub type Metadata; }
415 extern { pub type BasicBlock; }
417 pub struct Builder<'a>(InvariantOpaque<'a>);
418 extern { pub type MemoryBuffer; }
420 pub struct PassManager<'a>(InvariantOpaque<'a>);
421 extern { pub type PassManagerBuilder; }
422 extern { pub type ObjectFile; }
424 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
425 extern { pub type Pass; }
426 extern { pub type TargetMachine; }
427 extern { pub type Archive; }
429 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
431 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
432 extern { pub type Twine; }
433 extern { pub type DiagnosticInfo; }
434 extern { pub type SMDiagnostic; }
436 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
438 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
440 pub struct Linker<'a>(InvariantOpaque<'a>);
442 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
443 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
447 use super::{InvariantOpaque, Metadata};
450 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
452 pub type DIDescriptor = Metadata;
453 pub type DIScope = DIDescriptor;
454 pub type DIFile = DIScope;
455 pub type DILexicalBlock = DIScope;
456 pub type DISubprogram = DIScope;
457 pub type DINameSpace = DIScope;
458 pub type DIType = DIDescriptor;
459 pub type DIBasicType = DIType;
460 pub type DIDerivedType = DIType;
461 pub type DICompositeType = DIDerivedType;
462 pub type DIVariable = DIDescriptor;
463 pub type DIGlobalVariableExpression = DIDescriptor;
464 pub type DIArray = DIDescriptor;
465 pub type DISubrange = DIDescriptor;
466 pub type DIEnumerator = DIDescriptor;
467 pub type DITemplateTypeParameter = DIDescriptor;
469 // These values **must** match with LLVMRustDIFlags!!
473 pub struct DIFlags: ::libc::uint32_t {
475 const FlagPrivate = 1;
476 const FlagProtected = 2;
477 const FlagPublic = 3;
478 const FlagFwdDecl = (1 << 2);
479 const FlagAppleBlock = (1 << 3);
480 const FlagBlockByrefStruct = (1 << 4);
481 const FlagVirtual = (1 << 5);
482 const FlagArtificial = (1 << 6);
483 const FlagExplicit = (1 << 7);
484 const FlagPrototyped = (1 << 8);
485 const FlagObjcClassComplete = (1 << 9);
486 const FlagObjectPointer = (1 << 10);
487 const FlagVector = (1 << 11);
488 const FlagStaticMember = (1 << 12);
489 const FlagLValueReference = (1 << 13);
490 const FlagRValueReference = (1 << 14);
491 const FlagExternalTypeRef = (1 << 15);
492 const FlagIntroducedVirtual = (1 << 18);
493 const FlagBitField = (1 << 19);
494 const FlagNoReturn = (1 << 20);
495 const FlagMainSubprogram = (1 << 21);
500 extern { pub type ModuleBuffer; }
503 pub fn LLVMRustInstallFatalErrorHandler();
505 // Create and destroy contexts.
506 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
507 pub fn LLVMContextDispose(C: &'static mut Context);
508 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
511 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
512 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
513 pub fn LLVMCloneModule(M: &Module) -> &Module;
515 /// Data layout. See Module::getDataLayout.
516 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
517 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
519 /// See Module::setModuleInlineAsm.
520 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
521 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
523 /// See llvm::LLVMTypeKind::getTypeID.
524 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
526 // Operations on integer types
527 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
528 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
529 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
530 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
531 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
532 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
534 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
536 // Operations on real types
537 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
538 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
540 // Operations on function types
541 pub fn LLVMFunctionType(ReturnType: &'a Type,
542 ParamTypes: *const &'a Type,
546 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
547 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
549 // Operations on struct types
550 pub fn LLVMStructTypeInContext(C: &'a Context,
551 ElementTypes: *const &'a Type,
552 ElementCount: c_uint,
556 // Operations on array, pointer, and vector types (sequence types)
557 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
558 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
559 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
561 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
562 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
564 // Operations on other types
565 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
566 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
567 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
569 // Operations on all values
570 pub fn LLVMTypeOf(Val: &Value) -> &Type;
571 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
572 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
573 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
574 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
576 // Operations on constants of any type
577 pub fn LLVMConstNull(Ty: &Type) -> &Value;
578 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
580 // Operations on metadata
581 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
582 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
583 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
585 // Operations on scalar constants
586 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
587 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
588 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
589 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
590 high: &mut u64, low: &mut u64) -> bool;
591 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
594 // Operations on composite constants
595 pub fn LLVMConstStringInContext(C: &Context,
598 DontNullTerminate: Bool)
600 pub fn LLVMConstStructInContext(C: &'a Context,
601 ConstantVals: *const &'a Value,
606 pub fn LLVMConstArray(ElementTy: &'a Type,
607 ConstantVals: *const &'a Value,
610 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
612 // Constant expressions
613 pub fn LLVMConstInBoundsGEP(
614 ConstantVal: &'a Value,
615 ConstantIndices: *const &'a Value,
618 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
619 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
620 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
621 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
622 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
623 pub fn LLVMConstExtractValue(AggConstant: &Value,
624 IdxList: *const c_uint,
628 // Operations on global variables, functions, and aliases (globals)
629 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
630 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
631 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
632 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
633 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
634 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
635 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
636 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
637 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
640 // Operations on global variables
641 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
642 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
643 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
644 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
645 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
646 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
647 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
648 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
649 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
650 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
651 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
652 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
653 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
654 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
655 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
656 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
658 // Operations on functions
659 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
661 FunctionTy: &'a Type)
663 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
664 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
665 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
666 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
667 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
668 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
671 Value: *const c_char);
672 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
674 // Operations on parameters
675 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
676 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
678 // Operations on basic blocks
679 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
680 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
684 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
686 // Operations on instructions
687 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
689 // Operations on call sites
690 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
691 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
692 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
693 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
694 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
698 // Operations on load/store instructions (only)
699 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
701 // Operations on phi nodes
702 pub fn LLVMAddIncoming(PhiNode: &'a Value,
703 IncomingValues: *const &'a Value,
704 IncomingBlocks: *const &'a BasicBlock,
707 // Instruction builders
708 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
709 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
710 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
711 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
714 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
715 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
716 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
719 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
720 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
721 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
722 pub fn LLVMBuildCondBr(B: &Builder<'a>,
724 Then: &'a BasicBlock,
725 Else: &'a BasicBlock)
727 pub fn LLVMBuildSwitch(B: &Builder<'a>,
729 Else: &'a BasicBlock,
732 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
734 Args: *const &'a Value,
736 Then: &'a BasicBlock,
737 Catch: &'a BasicBlock,
738 Bundle: Option<&OperandBundleDef<'a>>,
741 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
747 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
748 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
750 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
751 ParentPad: Option<&'a Value>,
753 Args: *const &'a Value,
755 -> Option<&'a Value>;
756 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
757 CleanupPad: &'a Value,
758 UnwindBB: Option<&'a BasicBlock>)
759 -> Option<&'a Value>;
760 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
761 ParentPad: &'a Value,
763 Args: *const &'a Value,
765 -> Option<&'a Value>;
766 pub fn LLVMRustBuildCatchRet(
770 ) -> Option<&'a Value>;
771 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
772 ParentPad: Option<&'a Value>,
773 BB: Option<&'a BasicBlock>,
776 -> Option<&'a Value>;
777 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
778 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
780 // Add a case to the switch instruction
781 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
783 // Add a clause to the landing pad instruction
784 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
786 // Set the cleanup on a landing pad instruction
787 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
790 pub fn LLVMBuildAdd(B: &Builder<'a>,
795 pub fn LLVMBuildFAdd(B: &Builder<'a>,
800 pub fn LLVMBuildSub(B: &Builder<'a>,
805 pub fn LLVMBuildFSub(B: &Builder<'a>,
810 pub fn LLVMBuildMul(B: &Builder<'a>,
815 pub fn LLVMBuildFMul(B: &Builder<'a>,
820 pub fn LLVMBuildUDiv(B: &Builder<'a>,
825 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
830 pub fn LLVMBuildSDiv(B: &Builder<'a>,
835 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
840 pub fn LLVMBuildFDiv(B: &Builder<'a>,
845 pub fn LLVMBuildURem(B: &Builder<'a>,
850 pub fn LLVMBuildSRem(B: &Builder<'a>,
855 pub fn LLVMBuildFRem(B: &Builder<'a>,
860 pub fn LLVMBuildShl(B: &Builder<'a>,
865 pub fn LLVMBuildLShr(B: &Builder<'a>,
870 pub fn LLVMBuildAShr(B: &Builder<'a>,
875 pub fn LLVMBuildAnd(B: &Builder<'a>,
880 pub fn LLVMBuildOr(B: &Builder<'a>,
885 pub fn LLVMBuildXor(B: &Builder<'a>,
890 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
891 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
892 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
893 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
896 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
897 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
902 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
904 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
906 pub fn LLVMBuildGEP(B: &Builder<'a>,
908 Indices: *const &'a Value,
912 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
914 Indices: *const &'a Value,
918 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
925 pub fn LLVMBuildTrunc(B: &Builder<'a>,
930 pub fn LLVMBuildZExt(B: &Builder<'a>,
935 pub fn LLVMBuildSExt(B: &Builder<'a>,
940 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
945 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
950 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
955 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
960 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
965 pub fn LLVMBuildFPExt(B: &Builder<'a>,
970 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
975 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
980 pub fn LLVMBuildBitCast(B: &Builder<'a>,
985 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
990 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
997 pub fn LLVMBuildICmp(B: &Builder<'a>,
1001 Name: *const c_char)
1003 pub fn LLVMBuildFCmp(B: &Builder<'a>,
1007 Name: *const c_char)
1010 // Miscellaneous instructions
1011 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1012 pub fn LLVMRustBuildCall(B: &Builder<'a>,
1014 Args: *const &'a Value,
1016 Bundle: Option<&OperandBundleDef<'a>>,
1017 Name: *const c_char)
1019 pub fn LLVMRustBuildMemCpy(B: &Builder<'a>,
1027 pub fn LLVMRustBuildMemMove(B: &Builder<'a>,
1035 pub fn LLVMBuildSelect(B: &Builder<'a>,
1039 Name: *const c_char)
1041 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1044 Name: *const c_char)
1046 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1049 Name: *const c_char)
1051 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1055 Name: *const c_char)
1057 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1061 Name: *const c_char)
1063 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1066 Name: *const c_char)
1068 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1072 Name: *const c_char)
1075 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1079 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1083 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1086 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1089 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1092 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1095 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1098 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1102 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1106 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1110 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1115 pub fn LLVMRustBuildMinNum(
1119 ) -> Option<&'a Value>;
1120 pub fn LLVMRustBuildMaxNum(
1124 ) -> Option<&'a Value>;
1126 // Atomic Operations
1127 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1128 PointerVal: &'a Value,
1129 Name: *const c_char,
1130 Order: AtomicOrdering)
1133 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1136 Order: AtomicOrdering)
1139 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1143 Order: AtomicOrdering,
1144 FailureOrder: AtomicOrdering,
1148 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1152 Order: AtomicOrdering,
1153 SingleThreaded: Bool)
1156 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1157 Order: AtomicOrdering,
1158 Scope: SynchronizationScope);
1160 /// Writes a module to the specified path. Returns 0 on success.
1161 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1163 /// Creates a pass manager.
1164 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1166 /// Creates a function-by-function pass manager
1167 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1169 /// Disposes a pass manager.
1170 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1172 /// Runs a pass manager on a module.
1173 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1175 pub fn LLVMInitializePasses();
1177 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1178 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1179 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1180 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1181 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1183 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1186 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1188 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1192 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1193 PMB: &PassManagerBuilder,
1196 // Stuff that's in rustllvm/ because it's not upstream yet.
1198 /// Opens an object file.
1199 pub fn LLVMCreateObjectFile(
1200 MemBuf: &'static mut MemoryBuffer,
1201 ) -> Option<&'static mut ObjectFile>;
1202 /// Closes an object file.
1203 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1205 /// Enumerates the sections in an object file.
1206 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1207 /// Destroys a section iterator.
1208 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1209 /// Returns true if the section iterator is at the end of the section
1211 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1212 /// Moves the section iterator to point to the next section.
1213 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1214 /// Returns the current section size.
1215 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1216 /// Returns the current section contents as a string buffer.
1217 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1219 /// Reads the given file and returns it as a memory buffer. Use
1220 /// LLVMDisposeMemoryBuffer() to get rid of it.
1221 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1222 Path: *const c_char,
1223 ) -> Option<&'static mut MemoryBuffer>;
1225 pub fn LLVMStartMultithreaded() -> Bool;
1227 /// Returns a string describing the last error caused by an LLVMRust* call.
1228 pub fn LLVMRustGetLastError() -> *const c_char;
1230 /// Print the pass timings since static dtors aren't picking them up.
1231 pub fn LLVMRustPrintPassTimings();
1233 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1235 pub fn LLVMStructSetBody(StructTy: &'a Type,
1236 ElementTypes: *const &'a Type,
1237 ElementCount: c_uint,
1240 /// Prepares inline assembly.
1241 pub fn LLVMRustInlineAsm(Ty: &Type,
1242 AsmString: *const c_char,
1243 Constraints: *const c_char,
1246 Dialect: AsmDialect)
1248 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1249 Constraints: *const c_char)
1252 pub fn LLVMRustDebugMetadataVersion() -> u32;
1253 pub fn LLVMRustVersionMajor() -> u32;
1254 pub fn LLVMRustVersionMinor() -> u32;
1256 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1258 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1260 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1262 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1264 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1266 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1269 Producer: *const c_char,
1271 Flags: *const c_char,
1273 SplitName: *const c_char)
1274 -> &'a DIDescriptor;
1276 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1277 Filename: *const c_char,
1278 Directory: *const c_char)
1281 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1283 ParameterTypes: &'a DIArray)
1284 -> &'a DICompositeType;
1286 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1287 Scope: &'a DIDescriptor,
1288 Name: *const c_char,
1289 LinkageName: *const c_char,
1293 isLocalToUnit: bool,
1299 TParam: &'a DIArray,
1300 Decl: Option<&'a DIDescriptor>)
1301 -> &'a DISubprogram;
1303 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1304 Name: *const c_char,
1310 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1311 PointeeTy: &'a DIType,
1314 Name: *const c_char)
1315 -> &'a DIDerivedType;
1317 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1318 Scope: Option<&'a DIDescriptor>,
1319 Name: *const c_char,
1325 DerivedFrom: Option<&'a DIType>,
1326 Elements: &'a DIArray,
1327 RunTimeLang: c_uint,
1328 VTableHolder: Option<&'a DIType>,
1329 UniqueId: *const c_char)
1330 -> &'a DICompositeType;
1332 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1333 Scope: &'a DIDescriptor,
1334 Name: *const c_char,
1342 -> &'a DIDerivedType;
1344 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1346 Name: *const c_char,
1352 Discriminant: Option<&'a Value>,
1357 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1362 -> &'a DILexicalBlock;
1364 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1367 -> &'a DILexicalBlock;
1369 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1370 Context: Option<&'a DIScope>,
1371 Name: *const c_char,
1372 LinkageName: *const c_char,
1376 isLocalToUnit: bool,
1378 Decl: Option<&'a DIDescriptor>,
1380 -> &'a DIGlobalVariableExpression;
1382 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1384 Scope: &'a DIDescriptor,
1385 Name: *const c_char,
1389 AlwaysPreserve: bool,
1395 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1399 Subscripts: &'a DIArray)
1402 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1407 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1408 Ptr: *const Option<&'a DIDescriptor>,
1412 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1414 VarInfo: &'a DIVariable,
1415 AddrOps: *const i64,
1416 AddrOpsCount: c_uint,
1418 InsertAtEnd: &'a BasicBlock)
1421 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1422 Name: *const c_char,
1424 -> &'a DIEnumerator;
1426 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1428 Name: *const c_char,
1433 Elements: &'a DIArray,
1434 ClassType: &'a DIType,
1438 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1440 Name: *const c_char,
1446 Elements: Option<&'a DIArray>,
1447 RunTimeLang: c_uint,
1448 UniqueId: *const c_char)
1451 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1453 Name: *const c_char,
1459 Discriminator: Option<&'a DIDerivedType>,
1460 Elements: &'a DIArray,
1461 UniqueId: *const c_char)
1462 -> &'a DIDerivedType;
1464 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1466 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1467 Scope: Option<&'a DIScope>,
1468 Name: *const c_char,
1473 -> &'a DITemplateTypeParameter;
1476 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1477 Scope: Option<&'a DIScope>,
1478 Name: *const c_char,
1483 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1484 CompositeType: &'a DIType,
1485 TypeArray: &'a DIArray);
1488 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1492 InlinedAt: Option<&'a Metadata>)
1494 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1495 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1498 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1500 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1501 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1505 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1506 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1508 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1509 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1510 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1512 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1514 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1515 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1517 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1518 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1520 Features: *const c_char,
1523 Level: CodeGenOptLevel,
1525 PositionIndependentExecutable: bool,
1526 FunctionSections: bool,
1528 TrapUnreachable: bool,
1531 EmitStackSizeSection: bool)
1532 -> Option<&'static mut TargetMachine>;
1533 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1534 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1535 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1537 DisableSimplifyLibCalls: bool);
1538 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1539 OptLevel: CodeGenOptLevel,
1540 MergeFunctions: bool,
1542 LoopVectorize: bool,
1543 PrepareForThinLTO: bool,
1544 PGOGenPath: *const c_char,
1545 PGOUsePath: *const c_char);
1546 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1548 DisableSimplifyLibCalls: bool);
1549 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1550 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1551 PM: &PassManager<'a>,
1553 Output: *const c_char,
1556 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1558 Output: *const c_char,
1559 Demangle: extern fn(*const c_char,
1563 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1564 pub fn LLVMRustPrintPasses();
1565 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1566 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1567 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1568 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1570 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1571 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1572 pub fn LLVMRustArchiveIteratorNext(
1573 AIR: &ArchiveIterator<'a>,
1574 ) -> Option<&'a mut ArchiveChild<'a>>;
1575 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1576 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1577 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1578 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1579 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1581 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1584 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1586 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1590 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1591 Handler: DiagnosticHandler,
1592 DiagnosticContext: *mut c_void);
1595 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1597 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1598 pass_name_out: &RustString,
1599 function_out: &mut Option<&'a Value>,
1600 loc_line_out: &mut c_uint,
1601 loc_column_out: &mut c_uint,
1602 loc_filename_out: &RustString,
1603 message_out: &RustString);
1607 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1608 cookie_out: &mut c_uint,
1609 message_out: &mut Option<&'a Twine>,
1610 instruction_out: &mut Option<&'a Value>);
1613 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1615 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1619 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1621 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1622 H: InlineAsmDiagHandler,
1626 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1628 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1632 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1634 Members: *const &RustArchiveMember,
1638 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1639 Name: *const c_char,
1640 Child: Option<&ArchiveChild<'a>>)
1641 -> &'a mut RustArchiveMember<'a>;
1642 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1644 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1646 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1647 Inputs: *const &'a Value,
1649 -> &'a mut OperandBundleDef<'a>;
1650 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1652 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1654 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1655 pub fn LLVMRustUnsetComdat(V: &Value);
1656 pub fn LLVMRustSetModulePIELevel(M: &Module);
1657 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1658 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1659 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1660 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1661 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1663 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1664 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1665 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1666 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1667 pub fn LLVMRustCreateThinLTOData(
1668 Modules: *const ThinLTOModule,
1670 PreservedSymbols: *const *const c_char,
1671 PreservedSymbolsLen: c_uint,
1672 ) -> Option<&'static mut ThinLTOData>;
1673 pub fn LLVMRustPrepareThinLTORename(
1677 pub fn LLVMRustPrepareThinLTOResolveWeak(
1681 pub fn LLVMRustPrepareThinLTOInternalize(
1685 pub fn LLVMRustPrepareThinLTOImport(
1689 pub fn LLVMRustGetThinLTOModuleImports(
1690 Data: *const ThinLTOData,
1691 ModuleNameCallback: ThinLTOModuleNameCallback,
1692 CallbackPayload: *mut c_void,
1694 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1695 pub fn LLVMRustParseBitcodeForThinLTO(
1699 Identifier: *const c_char,
1700 ) -> Option<&Module>;
1701 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1702 CU1: &mut *mut c_void,
1703 CU2: &mut *mut c_void);
1704 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1706 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1707 pub fn LLVMRustLinkerAdd(linker: &Linker,
1708 bytecode: *const c_char,
1709 bytecode_len: usize) -> bool;
1710 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);