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;
23 use super::RustString;
25 pub type Bool = c_uint;
27 pub const True: Bool = 1 as Bool;
28 pub const False: Bool = 0 as Bool;
30 #[derive(Copy, Clone, PartialEq)]
32 #[allow(dead_code)] // Variants constructed by C++.
33 pub enum LLVMRustResult {
37 // Consts for the LLVM CallConv type, pre-cast to usize.
39 /// LLVM CallingConv::ID. Should we wrap this?
40 #[derive(Copy, Clone, PartialEq, Debug)]
46 X86StdcallCallConv = 64,
47 X86FastcallCallConv = 65,
48 ArmAapcsCallConv = 67,
60 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
64 AvailableExternallyLinkage = 1,
65 LinkOnceAnyLinkage = 2,
66 LinkOnceODRLinkage = 3,
72 ExternalWeakLinkage = 9,
77 #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
85 /// LLVMDLLStorageClass
86 #[derive(Copy, Clone)]
88 pub enum DLLStorageClass {
91 DllImport = 1, // Function to be imported from DLL.
93 DllExport = 2, // Function to be accessible from DLL.
96 /// Matches LLVMRustAttribute in rustllvm.h
97 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
98 /// though it is not ABI compatible (since it's a C++ enum)
100 #[derive(Copy, Clone, Debug)]
115 OptimizeForSize = 13,
123 SanitizeAddress = 21,
129 #[derive(Copy, Clone)]
131 pub enum IntPredicate {
144 /// LLVMRealPredicate
145 #[derive(Copy, Clone)]
147 pub enum RealPredicate {
148 RealPredicateFalse = 0,
163 RealPredicateTrue = 15,
167 #[derive(Copy, Clone, PartialEq, Debug)]
189 /// LLVMAtomicRmwBinOp
190 #[derive(Copy, Clone)]
192 pub enum AtomicRmwBinOp {
206 /// LLVMAtomicOrdering
207 #[derive(Copy, Clone)]
209 pub enum AtomicOrdering {
214 // Consume = 3, // Not specified yet.
218 SequentiallyConsistent = 7,
221 /// LLVMRustSynchronizationScope
222 #[derive(Copy, Clone)]
224 pub enum SynchronizationScope {
225 // FIXME: figure out if this variant is needed at all.
233 #[derive(Copy, Clone)]
236 // FIXME: figure out if this variant is needed at all.
244 #[derive(Copy, Clone)]
246 pub enum MetadataType {
253 MD_invariant_load = 6,
257 MD_mem_parallel_loop_access = 10,
261 /// LLVMRustAsmDialect
262 #[derive(Copy, Clone)]
264 pub enum AsmDialect {
265 // FIXME: figure out if this variant is needed at all.
272 /// LLVMRustCodeGenOptLevel
273 #[derive(Copy, Clone, PartialEq)]
275 pub enum CodeGenOptLevel {
276 // FIXME: figure out if this variant is needed at all.
286 #[derive(Copy, Clone, PartialEq)]
298 /// LLVMRustCodeModel
299 #[derive(Copy, Clone)]
302 // FIXME: figure out if this variant is needed at all.
312 /// LLVMRustDiagnosticKind
313 #[derive(Copy, Clone)]
315 #[allow(dead_code)] // Variants constructed by C++.
316 pub enum DiagnosticKind {
320 DebugMetadataVersion,
323 OptimizationRemarkMissed,
324 OptimizationRemarkAnalysis,
325 OptimizationRemarkAnalysisFPCommute,
326 OptimizationRemarkAnalysisAliasing,
327 OptimizationRemarkOther,
333 /// LLVMRustArchiveKind
334 #[derive(Copy, Clone)]
336 pub enum ArchiveKind {
337 // FIXME: figure out if this variant is needed at all.
346 #[derive(Copy, Clone, PartialEq, Debug)]
348 #[allow(dead_code)] // Variants constructed by C++.
355 /// LLVMRustThinLTOData
356 extern { pub type ThinLTOData; }
358 /// LLVMRustThinLTOBuffer
359 extern { pub type ThinLTOBuffer; }
361 // LLVMRustModuleNameCallback
362 pub type ThinLTOModuleNameCallback =
363 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
365 /// LLVMRustThinLTOModule
367 pub struct ThinLTOModule {
368 pub identifier: *const c_char,
373 /// LLVMThreadLocalMode
374 #[derive(Copy, Clone)]
376 pub enum ThreadLocalMode {
384 extern { type Opaque; }
386 struct InvariantOpaque<'a> {
387 _marker: PhantomData<&'a mut &'a ()>,
391 // Opaque pointer types
392 extern { pub type Module; }
393 extern { pub type Context; }
394 extern { pub type Type; }
395 extern { pub type Value; }
396 extern { pub type Metadata; }
397 extern { pub type BasicBlock; }
399 pub struct Builder<'a>(InvariantOpaque<'a>);
400 extern { pub type MemoryBuffer; }
402 pub struct PassManager<'a>(InvariantOpaque<'a>);
403 extern { pub type PassManagerBuilder; }
404 extern { pub type ObjectFile; }
406 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
407 extern { pub type Pass; }
408 extern { pub type TargetMachine; }
409 extern { pub type Archive; }
411 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
413 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
414 extern { pub type Twine; }
415 extern { pub type DiagnosticInfo; }
416 extern { pub type SMDiagnostic; }
418 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
420 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
422 pub struct Linker<'a>(InvariantOpaque<'a>);
424 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
425 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
429 use super::{InvariantOpaque, Metadata};
432 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
434 pub type DIDescriptor = Metadata;
435 pub type DIScope = DIDescriptor;
436 pub type DIFile = DIScope;
437 pub type DILexicalBlock = DIScope;
438 pub type DISubprogram = DIScope;
439 pub type DINameSpace = DIScope;
440 pub type DIType = DIDescriptor;
441 pub type DIBasicType = DIType;
442 pub type DIDerivedType = DIType;
443 pub type DICompositeType = DIDerivedType;
444 pub type DIVariable = DIDescriptor;
445 pub type DIGlobalVariableExpression = DIDescriptor;
446 pub type DIArray = DIDescriptor;
447 pub type DISubrange = DIDescriptor;
448 pub type DIEnumerator = DIDescriptor;
449 pub type DITemplateTypeParameter = DIDescriptor;
451 // These values **must** match with LLVMRustDIFlags!!
455 pub struct DIFlags: ::libc::uint32_t {
457 const FlagPrivate = 1;
458 const FlagProtected = 2;
459 const FlagPublic = 3;
460 const FlagFwdDecl = (1 << 2);
461 const FlagAppleBlock = (1 << 3);
462 const FlagBlockByrefStruct = (1 << 4);
463 const FlagVirtual = (1 << 5);
464 const FlagArtificial = (1 << 6);
465 const FlagExplicit = (1 << 7);
466 const FlagPrototyped = (1 << 8);
467 const FlagObjcClassComplete = (1 << 9);
468 const FlagObjectPointer = (1 << 10);
469 const FlagVector = (1 << 11);
470 const FlagStaticMember = (1 << 12);
471 const FlagLValueReference = (1 << 13);
472 const FlagRValueReference = (1 << 14);
473 const FlagExternalTypeRef = (1 << 15);
474 const FlagIntroducedVirtual = (1 << 18);
475 const FlagBitField = (1 << 19);
476 const FlagNoReturn = (1 << 20);
477 const FlagMainSubprogram = (1 << 21);
482 extern { pub type ModuleBuffer; }
485 pub fn LLVMRustInstallFatalErrorHandler();
487 // Create and destroy contexts.
488 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
489 pub fn LLVMContextDispose(C: &'static mut Context);
490 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
493 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
494 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
495 pub fn LLVMCloneModule(M: &Module) -> &Module;
497 /// Data layout. See Module::getDataLayout.
498 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
499 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
501 /// See Module::setModuleInlineAsm.
502 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
503 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
505 /// See llvm::LLVMTypeKind::getTypeID.
506 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
508 // Operations on integer types
509 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
510 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
511 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
512 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
513 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
514 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
516 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
518 // Operations on real types
519 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
520 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
522 // Operations on function types
523 pub fn LLVMFunctionType(ReturnType: &'a Type,
524 ParamTypes: *const &'a Type,
528 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
529 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
531 // Operations on struct types
532 pub fn LLVMStructTypeInContext(C: &'a Context,
533 ElementTypes: *const &'a Type,
534 ElementCount: c_uint,
538 // Operations on array, pointer, and vector types (sequence types)
539 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
540 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
541 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
543 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
544 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
546 // Operations on other types
547 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
548 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
549 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
551 // Operations on all values
552 pub fn LLVMTypeOf(Val: &Value) -> &Type;
553 pub fn LLVMGetValueName(Val: &Value) -> *const c_char;
554 pub fn LLVMSetValueName(Val: &Value, Name: *const c_char);
555 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
556 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
558 // Operations on constants of any type
559 pub fn LLVMConstNull(Ty: &Type) -> &Value;
560 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
562 // Operations on metadata
563 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
564 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
565 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
567 // Operations on scalar constants
568 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
569 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
570 pub fn LLVMConstIntGetZExtValue(ConstantVal: &Value) -> c_ulonglong;
571 pub fn LLVMRustConstInt128Get(ConstantVal: &Value, SExt: bool,
572 high: &mut u64, low: &mut u64) -> bool;
573 pub fn LLVMConstRealGetDouble (ConstantVal: &Value, losesInfo: &mut Bool) -> f64;
576 // Operations on composite constants
577 pub fn LLVMConstStringInContext(C: &Context,
580 DontNullTerminate: Bool)
582 pub fn LLVMConstStructInContext(C: &'a Context,
583 ConstantVals: *const &'a Value,
588 pub fn LLVMConstArray(ElementTy: &'a Type,
589 ConstantVals: *const &'a Value,
592 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
594 // Constant expressions
595 pub fn LLVMConstInBoundsGEP(
596 ConstantVal: &'a Value,
597 ConstantIndices: *const &'a Value,
600 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
601 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
602 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
603 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
604 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
605 pub fn LLVMConstExtractValue(AggConstant: &Value,
606 IdxList: *const c_uint,
610 // Operations on global variables, functions, and aliases (globals)
611 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
612 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
613 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
614 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
615 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
616 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
617 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
618 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
619 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
622 // Operations on global variables
623 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
624 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
625 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
626 pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value;
627 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
628 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
629 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
630 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
631 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
632 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
633 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
634 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
635 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
636 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
637 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
638 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
640 // Operations on functions
641 pub fn LLVMRustGetOrInsertFunction(M: &'a Module,
643 FunctionTy: &'a Type)
645 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
646 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
647 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
648 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
649 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
650 pub fn LLVMRustAddFunctionAttrStringValue(Fn: &Value,
653 Value: *const c_char);
654 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
656 // Operations on parameters
657 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
658 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
660 // Operations on basic blocks
661 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
662 pub fn LLVMAppendBasicBlockInContext(C: &'a Context,
666 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
668 // Operations on instructions
669 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
671 // Operations on call sites
672 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
673 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
674 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
675 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
676 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value,
680 // Operations on load/store instructions (only)
681 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
683 // Operations on phi nodes
684 pub fn LLVMAddIncoming(PhiNode: &'a Value,
685 IncomingValues: *const &'a Value,
686 IncomingBlocks: *const &'a BasicBlock,
689 // Instruction builders
690 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
691 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
692 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
693 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
696 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: Option<&'a Value>);
697 pub fn LLVMGetCurrentDebugLocation(Builder: &Builder<'a>) -> &'a Value;
698 pub fn LLVMSetInstDebugLocation(Builder: &Builder<'a>, Inst: &'a Value);
701 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
702 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
703 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
704 pub fn LLVMBuildCondBr(B: &Builder<'a>,
706 Then: &'a BasicBlock,
707 Else: &'a BasicBlock)
709 pub fn LLVMBuildSwitch(B: &Builder<'a>,
711 Else: &'a BasicBlock,
714 pub fn LLVMRustBuildInvoke(B: &Builder<'a>,
716 Args: *const &'a Value,
718 Then: &'a BasicBlock,
719 Catch: &'a BasicBlock,
720 Bundle: Option<&OperandBundleDef<'a>>,
723 pub fn LLVMBuildLandingPad(B: &Builder<'a>,
729 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
730 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
732 pub fn LLVMRustBuildCleanupPad(B: &Builder<'a>,
733 ParentPad: Option<&'a Value>,
735 Args: *const &'a Value,
737 -> Option<&'a Value>;
738 pub fn LLVMRustBuildCleanupRet(B: &Builder<'a>,
739 CleanupPad: &'a Value,
740 UnwindBB: Option<&'a BasicBlock>)
741 -> Option<&'a Value>;
742 pub fn LLVMRustBuildCatchPad(B: &Builder<'a>,
743 ParentPad: &'a Value,
745 Args: *const &'a Value,
747 -> Option<&'a Value>;
748 pub fn LLVMRustBuildCatchRet(
752 ) -> Option<&'a Value>;
753 pub fn LLVMRustBuildCatchSwitch(Builder: &Builder<'a>,
754 ParentPad: Option<&'a Value>,
755 BB: Option<&'a BasicBlock>,
758 -> Option<&'a Value>;
759 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
760 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
762 // Add a case to the switch instruction
763 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
765 // Add a clause to the landing pad instruction
766 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
768 // Set the cleanup on a landing pad instruction
769 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
772 pub fn LLVMBuildAdd(B: &Builder<'a>,
777 pub fn LLVMBuildFAdd(B: &Builder<'a>,
782 pub fn LLVMBuildSub(B: &Builder<'a>,
787 pub fn LLVMBuildFSub(B: &Builder<'a>,
792 pub fn LLVMBuildMul(B: &Builder<'a>,
797 pub fn LLVMBuildFMul(B: &Builder<'a>,
802 pub fn LLVMBuildUDiv(B: &Builder<'a>,
807 pub fn LLVMBuildExactUDiv(B: &Builder<'a>,
812 pub fn LLVMBuildSDiv(B: &Builder<'a>,
817 pub fn LLVMBuildExactSDiv(B: &Builder<'a>,
822 pub fn LLVMBuildFDiv(B: &Builder<'a>,
827 pub fn LLVMBuildURem(B: &Builder<'a>,
832 pub fn LLVMBuildSRem(B: &Builder<'a>,
837 pub fn LLVMBuildFRem(B: &Builder<'a>,
842 pub fn LLVMBuildShl(B: &Builder<'a>,
847 pub fn LLVMBuildLShr(B: &Builder<'a>,
852 pub fn LLVMBuildAShr(B: &Builder<'a>,
857 pub fn LLVMBuildAnd(B: &Builder<'a>,
862 pub fn LLVMBuildOr(B: &Builder<'a>,
867 pub fn LLVMBuildXor(B: &Builder<'a>,
872 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
873 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
874 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
875 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
878 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
879 pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
884 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
886 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
888 pub fn LLVMBuildGEP(B: &Builder<'a>,
890 Indices: *const &'a Value,
894 pub fn LLVMBuildInBoundsGEP(B: &Builder<'a>,
896 Indices: *const &'a Value,
900 pub fn LLVMBuildStructGEP(B: &Builder<'a>,
907 pub fn LLVMBuildTrunc(B: &Builder<'a>,
912 pub fn LLVMBuildZExt(B: &Builder<'a>,
917 pub fn LLVMBuildSExt(B: &Builder<'a>,
922 pub fn LLVMBuildFPToUI(B: &Builder<'a>,
927 pub fn LLVMBuildFPToSI(B: &Builder<'a>,
932 pub fn LLVMBuildUIToFP(B: &Builder<'a>,
937 pub fn LLVMBuildSIToFP(B: &Builder<'a>,
942 pub fn LLVMBuildFPTrunc(B: &Builder<'a>,
947 pub fn LLVMBuildFPExt(B: &Builder<'a>,
952 pub fn LLVMBuildPtrToInt(B: &Builder<'a>,
957 pub fn LLVMBuildIntToPtr(B: &Builder<'a>,
962 pub fn LLVMBuildBitCast(B: &Builder<'a>,
967 pub fn LLVMBuildPointerCast(B: &Builder<'a>,
972 pub fn LLVMRustBuildIntCast(B: &Builder<'a>,
979 pub fn LLVMBuildICmp(B: &Builder<'a>,
985 pub fn LLVMBuildFCmp(B: &Builder<'a>,
992 // Miscellaneous instructions
993 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
994 pub fn LLVMRustBuildCall(B: &Builder<'a>,
996 Args: *const &'a Value,
998 Bundle: Option<&OperandBundleDef<'a>>,
1001 pub fn LLVMBuildSelect(B: &Builder<'a>,
1005 Name: *const c_char)
1007 pub fn LLVMBuildVAArg(B: &Builder<'a>,
1010 Name: *const c_char)
1012 pub fn LLVMBuildExtractElement(B: &Builder<'a>,
1015 Name: *const c_char)
1017 pub fn LLVMBuildInsertElement(B: &Builder<'a>,
1021 Name: *const c_char)
1023 pub fn LLVMBuildShuffleVector(B: &Builder<'a>,
1027 Name: *const c_char)
1029 pub fn LLVMBuildExtractValue(B: &Builder<'a>,
1032 Name: *const c_char)
1034 pub fn LLVMBuildInsertValue(B: &Builder<'a>,
1038 Name: *const c_char)
1041 pub fn LLVMRustBuildVectorReduceFAdd(B: &Builder<'a>,
1044 -> Option<&'a Value>;
1045 pub fn LLVMRustBuildVectorReduceFMul(B: &Builder<'a>,
1048 -> Option<&'a Value>;
1049 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>,
1051 -> Option<&'a Value>;
1052 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>,
1054 -> Option<&'a Value>;
1055 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>,
1057 -> Option<&'a Value>;
1058 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>,
1060 -> Option<&'a Value>;
1061 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>,
1063 -> Option<&'a Value>;
1064 pub fn LLVMRustBuildVectorReduceMin(B: &Builder<'a>,
1067 -> Option<&'a Value>;
1068 pub fn LLVMRustBuildVectorReduceMax(B: &Builder<'a>,
1071 -> Option<&'a Value>;
1072 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>,
1075 -> Option<&'a Value>;
1076 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>,
1079 -> Option<&'a Value>;
1081 pub fn LLVMRustBuildMinNum(
1085 ) -> Option<&'a Value>;
1086 pub fn LLVMRustBuildMaxNum(
1090 ) -> Option<&'a Value>;
1092 // Atomic Operations
1093 pub fn LLVMRustBuildAtomicLoad(B: &Builder<'a>,
1094 PointerVal: &'a Value,
1095 Name: *const c_char,
1096 Order: AtomicOrdering)
1099 pub fn LLVMRustBuildAtomicStore(B: &Builder<'a>,
1102 Order: AtomicOrdering)
1105 pub fn LLVMRustBuildAtomicCmpXchg(B: &Builder<'a>,
1109 Order: AtomicOrdering,
1110 FailureOrder: AtomicOrdering,
1114 pub fn LLVMBuildAtomicRMW(B: &Builder<'a>,
1118 Order: AtomicOrdering,
1119 SingleThreaded: Bool)
1122 pub fn LLVMRustBuildAtomicFence(B: &Builder,
1123 Order: AtomicOrdering,
1124 Scope: SynchronizationScope);
1126 /// Writes a module to the specified path. Returns 0 on success.
1127 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1129 /// Creates a pass manager.
1130 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1132 /// Creates a function-by-function pass manager
1133 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1135 /// Disposes a pass manager.
1136 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1138 /// Runs a pass manager on a module.
1139 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1141 pub fn LLVMInitializePasses();
1143 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1144 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1145 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1146 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1147 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(PMB: &PassManagerBuilder,
1149 pub fn LLVMPassManagerBuilderPopulateModulePassManager(PMB: &PassManagerBuilder,
1152 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(PMB: &PassManagerBuilder,
1154 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(PMB: &PassManagerBuilder,
1158 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1159 PMB: &PassManagerBuilder,
1160 PM: &PassManager) -> bool;
1162 // Stuff that's in rustllvm/ because it's not upstream yet.
1164 /// Opens an object file.
1165 pub fn LLVMCreateObjectFile(
1166 MemBuf: &'static mut MemoryBuffer,
1167 ) -> Option<&'static mut ObjectFile>;
1168 /// Closes an object file.
1169 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1171 /// Enumerates the sections in an object file.
1172 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1173 /// Destroys a section iterator.
1174 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1175 /// Returns true if the section iterator is at the end of the section
1177 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1178 /// Moves the section iterator to point to the next section.
1179 pub fn LLVMMoveToNextSection(SI: &SectionIterator);
1180 /// Returns the current section size.
1181 pub fn LLVMGetSectionSize(SI: &SectionIterator) -> c_ulonglong;
1182 /// Returns the current section contents as a string buffer.
1183 pub fn LLVMGetSectionContents(SI: &SectionIterator) -> *const c_char;
1185 /// Reads the given file and returns it as a memory buffer. Use
1186 /// LLVMDisposeMemoryBuffer() to get rid of it.
1187 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1188 Path: *const c_char,
1189 ) -> Option<&'static mut MemoryBuffer>;
1191 pub fn LLVMStartMultithreaded() -> Bool;
1193 /// Returns a string describing the last error caused by an LLVMRust* call.
1194 pub fn LLVMRustGetLastError() -> *const c_char;
1196 /// Print the pass timings since static dtors aren't picking them up.
1197 pub fn LLVMRustPrintPassTimings();
1199 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1201 pub fn LLVMStructSetBody(StructTy: &'a Type,
1202 ElementTypes: *const &'a Type,
1203 ElementCount: c_uint,
1206 /// Prepares inline assembly.
1207 pub fn LLVMRustInlineAsm(Ty: &Type,
1208 AsmString: *const c_char,
1209 Constraints: *const c_char,
1212 Dialect: AsmDialect)
1214 pub fn LLVMRustInlineAsmVerify(Ty: &Type,
1215 Constraints: *const c_char)
1218 pub fn LLVMRustDebugMetadataVersion() -> u32;
1219 pub fn LLVMRustVersionMajor() -> u32;
1220 pub fn LLVMRustVersionMinor() -> u32;
1222 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1224 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1226 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1228 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1230 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder);
1232 pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: &DIBuilder<'a>,
1235 Producer: *const c_char,
1237 Flags: *const c_char,
1239 SplitName: *const c_char)
1240 -> &'a DIDescriptor;
1242 pub fn LLVMRustDIBuilderCreateFile(Builder: &DIBuilder<'a>,
1243 Filename: *const c_char,
1244 Directory: *const c_char)
1247 pub fn LLVMRustDIBuilderCreateSubroutineType(Builder: &DIBuilder<'a>,
1249 ParameterTypes: &'a DIArray)
1250 -> &'a DICompositeType;
1252 pub fn LLVMRustDIBuilderCreateFunction(Builder: &DIBuilder<'a>,
1253 Scope: &'a DIDescriptor,
1254 Name: *const c_char,
1255 LinkageName: *const c_char,
1259 isLocalToUnit: bool,
1265 TParam: &'a DIArray,
1266 Decl: Option<&'a DIDescriptor>)
1267 -> &'a DISubprogram;
1269 pub fn LLVMRustDIBuilderCreateBasicType(Builder: &DIBuilder<'a>,
1270 Name: *const c_char,
1276 pub fn LLVMRustDIBuilderCreatePointerType(Builder: &DIBuilder<'a>,
1277 PointeeTy: &'a DIType,
1280 Name: *const c_char)
1281 -> &'a DIDerivedType;
1283 pub fn LLVMRustDIBuilderCreateStructType(Builder: &DIBuilder<'a>,
1284 Scope: Option<&'a DIDescriptor>,
1285 Name: *const c_char,
1291 DerivedFrom: Option<&'a DIType>,
1292 Elements: &'a DIArray,
1293 RunTimeLang: c_uint,
1294 VTableHolder: Option<&'a DIType>,
1295 UniqueId: *const c_char)
1296 -> &'a DICompositeType;
1298 pub fn LLVMRustDIBuilderCreateMemberType(Builder: &DIBuilder<'a>,
1299 Scope: &'a DIDescriptor,
1300 Name: *const c_char,
1308 -> &'a DIDerivedType;
1310 pub fn LLVMRustDIBuilderCreateVariantMemberType(Builder: &DIBuilder<'a>,
1312 Name: *const c_char,
1318 Discriminant: Option<&'a Value>,
1323 pub fn LLVMRustDIBuilderCreateLexicalBlock(Builder: &DIBuilder<'a>,
1328 -> &'a DILexicalBlock;
1330 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(Builder: &DIBuilder<'a>,
1333 -> &'a DILexicalBlock;
1335 pub fn LLVMRustDIBuilderCreateStaticVariable(Builder: &DIBuilder<'a>,
1336 Context: Option<&'a DIScope>,
1337 Name: *const c_char,
1338 LinkageName: *const c_char,
1342 isLocalToUnit: bool,
1344 Decl: Option<&'a DIDescriptor>,
1346 -> &'a DIGlobalVariableExpression;
1348 pub fn LLVMRustDIBuilderCreateVariable(Builder: &DIBuilder<'a>,
1350 Scope: &'a DIDescriptor,
1351 Name: *const c_char,
1355 AlwaysPreserve: bool,
1361 pub fn LLVMRustDIBuilderCreateArrayType(Builder: &DIBuilder<'a>,
1365 Subscripts: &'a DIArray)
1368 pub fn LLVMRustDIBuilderGetOrCreateSubrange(Builder: &DIBuilder<'a>,
1373 pub fn LLVMRustDIBuilderGetOrCreateArray(Builder: &DIBuilder<'a>,
1374 Ptr: *const Option<&'a DIDescriptor>,
1378 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(Builder: &DIBuilder<'a>,
1380 VarInfo: &'a DIVariable,
1381 AddrOps: *const i64,
1382 AddrOpsCount: c_uint,
1384 InsertAtEnd: &'a BasicBlock)
1387 pub fn LLVMRustDIBuilderCreateEnumerator(Builder: &DIBuilder<'a>,
1388 Name: *const c_char,
1390 -> &'a DIEnumerator;
1392 pub fn LLVMRustDIBuilderCreateEnumerationType(Builder: &DIBuilder<'a>,
1394 Name: *const c_char,
1399 Elements: &'a DIArray,
1400 ClassType: &'a DIType,
1404 pub fn LLVMRustDIBuilderCreateUnionType(Builder: &DIBuilder<'a>,
1406 Name: *const c_char,
1412 Elements: Option<&'a DIArray>,
1413 RunTimeLang: c_uint,
1414 UniqueId: *const c_char)
1417 pub fn LLVMRustDIBuilderCreateVariantPart(Builder: &DIBuilder<'a>,
1419 Name: *const c_char,
1425 Discriminator: Option<&'a DIDerivedType>,
1426 Elements: &'a DIArray,
1427 UniqueId: *const c_char)
1428 -> &'a DIDerivedType;
1430 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1432 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(Builder: &DIBuilder<'a>,
1433 Scope: Option<&'a DIScope>,
1434 Name: *const c_char,
1439 -> &'a DITemplateTypeParameter;
1442 pub fn LLVMRustDIBuilderCreateNameSpace(Builder: &DIBuilder<'a>,
1443 Scope: Option<&'a DIScope>,
1444 Name: *const c_char,
1449 pub fn LLVMRustDICompositeTypeSetTypeArray(Builder: &DIBuilder<'a>,
1450 CompositeType: &'a DIType,
1451 TypeArray: &'a DIArray);
1454 pub fn LLVMRustDIBuilderCreateDebugLocation(Context: &'a Context,
1458 InlinedAt: Option<&'a Metadata>)
1460 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1461 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1464 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1466 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1467 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1471 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&Value>;
1472 pub fn LLVMIsAConstantFP(value_ref: &Value) -> Option<&Value>;
1474 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1475 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1476 pub fn LLVMRustAddPass(PM: &PassManager, Pass: &'static mut Pass);
1478 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1480 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1481 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1483 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1484 pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
1486 Features: *const c_char,
1489 Level: CodeGenOptLevel,
1491 PositionIndependentExecutable: bool,
1492 FunctionSections: bool,
1494 TrapUnreachable: bool,
1497 EmitStackSizeSection: bool)
1498 -> Option<&'static mut TargetMachine>;
1499 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1500 pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
1501 pub fn LLVMRustAddBuilderLibraryInfo(PMB: &'a PassManagerBuilder,
1503 DisableSimplifyLibCalls: bool);
1504 pub fn LLVMRustConfigurePassManagerBuilder(PMB: &PassManagerBuilder,
1505 OptLevel: CodeGenOptLevel,
1506 MergeFunctions: bool,
1508 LoopVectorize: bool,
1509 PrepareForThinLTO: bool,
1510 PGOGenPath: *const c_char,
1511 PGOUsePath: *const c_char);
1512 pub fn LLVMRustAddLibraryInfo(PM: &PassManager<'a>,
1514 DisableSimplifyLibCalls: bool);
1515 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1516 pub fn LLVMRustWriteOutputFile(T: &'a TargetMachine,
1517 PM: &PassManager<'a>,
1519 Output: *const c_char,
1522 pub fn LLVMRustPrintModule(PM: &PassManager<'a>,
1524 Output: *const c_char,
1525 Demangle: extern fn(*const c_char,
1529 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1530 pub fn LLVMRustPrintPasses();
1531 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1532 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1533 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1534 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1536 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1537 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1538 pub fn LLVMRustArchiveIteratorNext(
1539 AIR: &ArchiveIterator<'a>,
1540 ) -> Option<&'a mut ArchiveChild<'a>>;
1541 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1542 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild, size: &mut size_t) -> *const c_char;
1543 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1544 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1545 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1547 pub fn LLVMRustGetSectionName(SI: &SectionIterator, data: &mut *const c_char) -> size_t;
1550 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1552 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1556 pub fn LLVMContextSetDiagnosticHandler(C: &Context,
1557 Handler: DiagnosticHandler,
1558 DiagnosticContext: *mut c_void);
1561 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1563 pub fn LLVMRustUnpackOptimizationDiagnostic(DI: &'a DiagnosticInfo,
1564 pass_name_out: &RustString,
1565 function_out: &mut Option<&'a Value>,
1566 loc_line_out: &mut c_uint,
1567 loc_column_out: &mut c_uint,
1568 loc_filename_out: &RustString,
1569 message_out: &RustString);
1573 pub fn LLVMRustUnpackInlineAsmDiagnostic(DI: &'a DiagnosticInfo,
1574 cookie_out: &mut c_uint,
1575 message_out: &mut Option<&'a Twine>,
1576 instruction_out: &mut Option<&'a Value>);
1579 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1581 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
1585 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
1587 pub fn LLVMRustSetInlineAsmDiagnosticHandler(C: &Context,
1588 H: InlineAsmDiagHandler,
1592 #[allow(improper_ctypes)] // FIXME(#52456) needed for RustString.
1594 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
1598 pub fn LLVMRustWriteArchive(Dst: *const c_char,
1600 Members: *const &RustArchiveMember,
1604 pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
1605 Name: *const c_char,
1606 Child: Option<&ArchiveChild<'a>>)
1607 -> &'a mut RustArchiveMember<'a>;
1608 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
1610 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
1612 pub fn LLVMRustBuildOperandBundleDef(Name: *const c_char,
1613 Inputs: *const &'a Value,
1615 -> &'a mut OperandBundleDef<'a>;
1616 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
1618 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
1620 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
1621 pub fn LLVMRustUnsetComdat(V: &Value);
1622 pub fn LLVMRustSetModulePIELevel(M: &Module);
1623 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
1624 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
1625 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
1626 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
1627 pub fn LLVMRustModuleCost(M: &Module) -> u64;
1629 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
1630 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
1631 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
1632 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
1633 pub fn LLVMRustCreateThinLTOData(
1634 Modules: *const ThinLTOModule,
1636 PreservedSymbols: *const *const c_char,
1637 PreservedSymbolsLen: c_uint,
1638 ) -> Option<&'static mut ThinLTOData>;
1639 pub fn LLVMRustPrepareThinLTORename(
1643 pub fn LLVMRustPrepareThinLTOResolveWeak(
1647 pub fn LLVMRustPrepareThinLTOInternalize(
1651 pub fn LLVMRustPrepareThinLTOImport(
1655 pub fn LLVMRustGetThinLTOModuleImports(
1656 Data: *const ThinLTOData,
1657 ModuleNameCallback: ThinLTOModuleNameCallback,
1658 CallbackPayload: *mut c_void,
1660 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
1661 pub fn LLVMRustParseBitcodeForThinLTO(
1665 Identifier: *const c_char,
1666 ) -> Option<&Module>;
1667 pub fn LLVMRustThinLTOGetDICompileUnit(M: &Module,
1668 CU1: &mut *mut c_void,
1669 CU2: &mut *mut c_void);
1670 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
1672 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
1673 pub fn LLVMRustLinkerAdd(linker: &Linker,
1674 bytecode: *const c_char,
1675 bytecode_len: usize) -> bool;
1676 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);