1 #![allow(non_camel_case_types)]
2 #![allow(non_upper_case_globals)]
4 use super::debuginfo::{
5 DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
6 DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DINameSpace, DISPFlags, DIScope,
7 DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind,
10 use libc::{c_char, c_int, c_uint, size_t};
11 use libc::{c_ulonglong, c_void};
13 use std::marker::PhantomData;
15 use super::RustString;
17 pub type Bool = c_uint;
19 pub const True: Bool = 1 as Bool;
20 pub const False: Bool = 0 as Bool;
22 #[derive(Copy, Clone, PartialEq)]
24 #[allow(dead_code)] // Variants constructed by C++.
25 pub enum LLVMRustResult {
29 // Consts for the LLVM CallConv type, pre-cast to usize.
31 /// LLVM CallingConv::ID. Should we wrap this?
32 #[derive(Copy, Clone, PartialEq, Debug)]
38 X86StdcallCallConv = 64,
39 X86FastcallCallConv = 65,
40 ArmAapcsCallConv = 67,
56 AvailableExternallyLinkage = 1,
57 LinkOnceAnyLinkage = 2,
58 LinkOnceODRLinkage = 3,
64 ExternalWeakLinkage = 9,
76 /// LLVMDLLStorageClass
77 #[derive(Copy, Clone)]
79 pub enum DLLStorageClass {
82 DllImport = 1, // Function to be imported from DLL.
84 DllExport = 2, // Function to be accessible from DLL.
87 /// Matches LLVMRustAttribute in rustllvm.h
88 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
89 /// though it is not ABI compatible (since it's a C++ enum)
91 #[derive(Copy, Clone, Debug)]
106 OptimizeForSize = 13,
114 SanitizeAddress = 21,
122 #[derive(Copy, Clone)]
124 pub enum IntPredicate {
138 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
140 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
141 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
142 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
143 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
144 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
145 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
146 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
147 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
148 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
149 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
154 /// LLVMRealPredicate
155 #[derive(Copy, Clone)]
157 pub enum RealPredicate {
158 RealPredicateFalse = 0,
173 RealPredicateTrue = 15,
177 pub fn from_generic(realpred: rustc_codegen_ssa::common::RealPredicate) -> Self {
179 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
180 RealPredicate::RealPredicateFalse
182 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
183 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
184 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
185 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
186 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
187 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
188 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
189 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
190 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
191 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
192 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
193 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
194 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
195 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
196 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
197 RealPredicate::RealPredicateTrue
204 #[derive(Copy, Clone, PartialEq, Debug)]
227 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
229 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
230 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
231 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
232 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
233 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
234 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
235 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
236 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
237 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
238 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
239 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
240 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
241 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
242 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
243 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
244 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
245 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
250 /// LLVMAtomicRmwBinOp
251 #[derive(Copy, Clone)]
253 pub enum AtomicRmwBinOp {
267 impl AtomicRmwBinOp {
268 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
270 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
271 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
272 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
273 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
274 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
275 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
276 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
277 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
278 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
279 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
280 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
285 /// LLVMAtomicOrdering
286 #[derive(Copy, Clone)]
288 pub enum AtomicOrdering {
293 // Consume = 3, // Not specified yet.
297 SequentiallyConsistent = 7,
300 impl AtomicOrdering {
301 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
303 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
304 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
305 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
306 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
307 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
308 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
309 AtomicOrdering::AcquireRelease
311 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
312 AtomicOrdering::SequentiallyConsistent
318 /// LLVMRustSynchronizationScope
319 #[derive(Copy, Clone)]
321 pub enum SynchronizationScope {
322 // FIXME: figure out if this variant is needed at all.
329 impl SynchronizationScope {
330 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
332 rustc_codegen_ssa::common::SynchronizationScope::Other => SynchronizationScope::Other,
333 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
334 SynchronizationScope::SingleThread
336 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
337 SynchronizationScope::CrossThread
344 #[derive(Copy, Clone)]
347 // FIXME: figure out if this variant is needed at all.
355 #[derive(Copy, Clone)]
357 pub enum MetadataType {
364 MD_invariant_load = 6,
368 MD_mem_parallel_loop_access = 10,
372 /// LLVMRustAsmDialect
373 #[derive(Copy, Clone)]
375 pub enum AsmDialect {
376 // FIXME: figure out if this variant is needed at all.
384 pub fn from_generic(asm: syntax::ast::AsmDialect) -> Self {
386 syntax::ast::AsmDialect::Att => AsmDialect::Att,
387 syntax::ast::AsmDialect::Intel => AsmDialect::Intel,
392 /// LLVMRustCodeGenOptLevel
393 #[derive(Copy, Clone, PartialEq)]
395 pub enum CodeGenOptLevel {
396 // FIXME: figure out if this variant is needed at all.
405 /// LLVMRustPassBuilderOptLevel
407 pub enum PassBuilderOptLevel {
427 /// LLVMRustSanitizerOptions
429 pub struct SanitizerOptions {
430 pub sanitize_memory: bool,
431 pub sanitize_thread: bool,
432 pub sanitize_address: bool,
433 pub sanitize_recover: bool,
434 pub sanitize_memory_track_origins: c_int,
438 #[derive(Copy, Clone, PartialEq)]
450 /// LLVMRustCodeModel
451 #[derive(Copy, Clone)]
454 // FIXME: figure out if this variant is needed at all.
464 /// LLVMRustDiagnosticKind
465 #[derive(Copy, Clone)]
467 #[allow(dead_code)] // Variants constructed by C++.
468 pub enum DiagnosticKind {
472 DebugMetadataVersion,
475 OptimizationRemarkMissed,
476 OptimizationRemarkAnalysis,
477 OptimizationRemarkAnalysisFPCommute,
478 OptimizationRemarkAnalysisAliasing,
479 OptimizationRemarkOther,
485 /// LLVMRustArchiveKind
486 #[derive(Copy, Clone)]
488 pub enum ArchiveKind {
489 // FIXME: figure out if this variant is needed at all.
499 #[derive(Copy, Clone, PartialEq, Debug)]
501 #[allow(dead_code)] // Variants constructed by C++.
508 /// LLVMRustThinLTOData
510 pub type ThinLTOData;
513 /// LLVMRustThinLTOBuffer
515 pub type ThinLTOBuffer;
518 // LLVMRustModuleNameCallback
519 pub type ThinLTOModuleNameCallback =
520 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
522 /// LLVMRustThinLTOModule
524 pub struct ThinLTOModule {
525 pub identifier: *const c_char,
530 /// LLVMThreadLocalMode
531 #[derive(Copy, Clone)]
533 pub enum ThreadLocalMode {
545 struct InvariantOpaque<'a> {
546 _marker: PhantomData<&'a mut &'a ()>,
550 // Opaque pointer types
564 pub type ConstantInt;
573 pub struct Builder<'a>(InvariantOpaque<'a>);
575 pub type MemoryBuffer;
578 pub struct PassManager<'a>(InvariantOpaque<'a>);
580 pub type PassManagerBuilder;
586 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
591 pub type TargetMachine;
597 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
599 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
604 pub type DiagnosticInfo;
607 pub type SMDiagnostic;
610 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
612 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
614 pub struct Linker<'a>(InvariantOpaque<'a>);
616 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
617 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
620 use super::{InvariantOpaque, Metadata};
621 use bitflags::bitflags;
624 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
626 pub type DIDescriptor = Metadata;
627 pub type DIScope = DIDescriptor;
628 pub type DIFile = DIScope;
629 pub type DILexicalBlock = DIScope;
630 pub type DISubprogram = DIScope;
631 pub type DINameSpace = DIScope;
632 pub type DIType = DIDescriptor;
633 pub type DIBasicType = DIType;
634 pub type DIDerivedType = DIType;
635 pub type DICompositeType = DIDerivedType;
636 pub type DIVariable = DIDescriptor;
637 pub type DIGlobalVariableExpression = DIDescriptor;
638 pub type DIArray = DIDescriptor;
639 pub type DISubrange = DIDescriptor;
640 pub type DIEnumerator = DIDescriptor;
641 pub type DITemplateTypeParameter = DIDescriptor;
643 // These values **must** match with LLVMRustDIFlags!!
647 pub struct DIFlags: u32 {
649 const FlagPrivate = 1;
650 const FlagProtected = 2;
651 const FlagPublic = 3;
652 const FlagFwdDecl = (1 << 2);
653 const FlagAppleBlock = (1 << 3);
654 const FlagBlockByrefStruct = (1 << 4);
655 const FlagVirtual = (1 << 5);
656 const FlagArtificial = (1 << 6);
657 const FlagExplicit = (1 << 7);
658 const FlagPrototyped = (1 << 8);
659 const FlagObjcClassComplete = (1 << 9);
660 const FlagObjectPointer = (1 << 10);
661 const FlagVector = (1 << 11);
662 const FlagStaticMember = (1 << 12);
663 const FlagLValueReference = (1 << 13);
664 const FlagRValueReference = (1 << 14);
665 const FlagExternalTypeRef = (1 << 15);
666 const FlagIntroducedVirtual = (1 << 18);
667 const FlagBitField = (1 << 19);
668 const FlagNoReturn = (1 << 20);
672 // These values **must** match with LLVMRustDISPFlags!!
676 pub struct DISPFlags: u32 {
677 const SPFlagZero = 0;
678 const SPFlagVirtual = 1;
679 const SPFlagPureVirtual = 2;
680 const SPFlagLocalToUnit = (1 << 2);
681 const SPFlagDefinition = (1 << 3);
682 const SPFlagOptimized = (1 << 4);
683 const SPFlagMainSubprogram = (1 << 5);
687 /// LLVMRustDebugEmissionKind
688 #[derive(Copy, Clone)]
690 pub enum DebugEmissionKind {
696 impl DebugEmissionKind {
697 pub fn from_generic(kind: rustc::session::config::DebugInfo) -> Self {
698 use rustc::session::config::DebugInfo;
700 DebugInfo::None => DebugEmissionKind::NoDebug,
701 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
702 DebugInfo::Full => DebugEmissionKind::FullDebug,
709 pub type ModuleBuffer;
713 pub fn LLVMRustInstallFatalErrorHandler();
715 // Create and destroy contexts.
716 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
717 pub fn LLVMContextDispose(C: &'static mut Context);
718 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
721 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
722 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
723 pub fn LLVMCloneModule(M: &Module) -> &Module;
725 /// Data layout. See Module::getDataLayout.
726 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
727 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
729 /// See Module::setModuleInlineAsm.
730 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
731 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
733 /// See llvm::LLVMTypeKind::getTypeID.
734 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
736 // Operations on integer types
737 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
738 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
739 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
740 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
741 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
742 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
744 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
746 // Operations on real types
747 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
748 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
750 // Operations on function types
751 pub fn LLVMFunctionType(
752 ReturnType: &'a Type,
753 ParamTypes: *const &'a Type,
757 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
758 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
760 // Operations on struct types
761 pub fn LLVMStructTypeInContext(
763 ElementTypes: *const &'a Type,
764 ElementCount: c_uint,
768 // Operations on array, pointer, and vector types (sequence types)
769 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
770 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
771 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
773 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
774 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
776 // Operations on other types
777 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
778 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
779 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
781 // Operations on all values
782 pub fn LLVMTypeOf(Val: &Value) -> &Type;
783 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
784 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
785 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
786 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
788 // Operations on constants of any type
789 pub fn LLVMConstNull(Ty: &Type) -> &Value;
790 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
792 // Operations on metadata
793 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
794 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
795 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
797 // Operations on scalar constants
798 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
799 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
800 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
801 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
802 pub fn LLVMRustConstInt128Get(
803 ConstantVal: &ConstantInt,
809 // Operations on composite constants
810 pub fn LLVMConstStringInContext(
814 DontNullTerminate: Bool,
816 pub fn LLVMConstStructInContext(
818 ConstantVals: *const &'a Value,
823 pub fn LLVMConstArray(
825 ConstantVals: *const &'a Value,
828 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
830 // Constant expressions
831 pub fn LLVMConstInBoundsGEP(
832 ConstantVal: &'a Value,
833 ConstantIndices: *const &'a Value,
836 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
837 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
838 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
839 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
840 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
841 pub fn LLVMConstExtractValue(
843 IdxList: *const c_uint,
847 // Operations on global variables, functions, and aliases (globals)
848 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
849 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
850 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
851 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
852 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
853 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
854 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
855 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
856 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
858 // Operations on global variables
859 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
860 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
861 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
862 pub fn LLVMRustGetOrInsertGlobal(
868 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
869 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
870 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
871 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
872 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
873 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
874 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
875 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
876 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
877 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
878 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
879 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
881 // Operations on functions
882 pub fn LLVMRustGetOrInsertFunction(
885 FunctionTy: &'a Type,
887 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
888 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
889 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
890 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
891 pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type);
892 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
893 pub fn LLVMRustAddFunctionAttrStringValue(
897 Value: *const c_char,
899 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
901 // Operations on parameters
902 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
903 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
904 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
906 // Operations on basic blocks
907 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
908 pub fn LLVMAppendBasicBlockInContext(
913 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
915 // Operations on instructions
916 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
917 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
919 // Operations on call sites
920 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
921 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
922 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
923 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
924 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
925 pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
927 // Operations on load/store instructions (only)
928 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
930 // Operations on phi nodes
931 pub fn LLVMAddIncoming(
933 IncomingValues: *const &'a Value,
934 IncomingBlocks: *const &'a BasicBlock,
938 // Instruction builders
939 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
940 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
941 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
942 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
945 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: &'a Value);
948 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
949 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
950 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
951 pub fn LLVMBuildCondBr(
954 Then: &'a BasicBlock,
955 Else: &'a BasicBlock,
957 pub fn LLVMBuildSwitch(
960 Else: &'a BasicBlock,
963 pub fn LLVMRustBuildInvoke(
966 Args: *const &'a Value,
968 Then: &'a BasicBlock,
969 Catch: &'a BasicBlock,
970 Bundle: Option<&OperandBundleDef<'a>>,
973 pub fn LLVMBuildLandingPad(
980 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
981 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
983 pub fn LLVMRustBuildCleanupPad(
985 ParentPad: Option<&'a Value>,
987 Args: *const &'a Value,
989 ) -> Option<&'a Value>;
990 pub fn LLVMRustBuildCleanupRet(
992 CleanupPad: &'a Value,
993 UnwindBB: Option<&'a BasicBlock>,
994 ) -> Option<&'a Value>;
995 pub fn LLVMRustBuildCatchPad(
997 ParentPad: &'a Value,
999 Args: *const &'a Value,
1000 Name: *const c_char,
1001 ) -> Option<&'a Value>;
1002 pub fn LLVMRustBuildCatchRet(
1006 ) -> Option<&'a Value>;
1007 pub fn LLVMRustBuildCatchSwitch(
1008 Builder: &Builder<'a>,
1009 ParentPad: Option<&'a Value>,
1010 BB: Option<&'a BasicBlock>,
1011 NumHandlers: c_uint,
1012 Name: *const c_char,
1013 ) -> Option<&'a Value>;
1014 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1015 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
1017 // Add a case to the switch instruction
1018 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1020 // Add a clause to the landing pad instruction
1021 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
1023 // Set the cleanup on a landing pad instruction
1024 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1027 pub fn LLVMBuildAdd(
1031 Name: *const c_char,
1033 pub fn LLVMBuildFAdd(
1037 Name: *const c_char,
1039 pub fn LLVMBuildSub(
1043 Name: *const c_char,
1045 pub fn LLVMBuildFSub(
1049 Name: *const c_char,
1051 pub fn LLVMBuildMul(
1055 Name: *const c_char,
1057 pub fn LLVMBuildFMul(
1061 Name: *const c_char,
1063 pub fn LLVMBuildUDiv(
1067 Name: *const c_char,
1069 pub fn LLVMBuildExactUDiv(
1073 Name: *const c_char,
1075 pub fn LLVMBuildSDiv(
1079 Name: *const c_char,
1081 pub fn LLVMBuildExactSDiv(
1085 Name: *const c_char,
1087 pub fn LLVMBuildFDiv(
1091 Name: *const c_char,
1093 pub fn LLVMBuildURem(
1097 Name: *const c_char,
1099 pub fn LLVMBuildSRem(
1103 Name: *const c_char,
1105 pub fn LLVMBuildFRem(
1109 Name: *const c_char,
1111 pub fn LLVMBuildShl(
1115 Name: *const c_char,
1117 pub fn LLVMBuildLShr(
1121 Name: *const c_char,
1123 pub fn LLVMBuildAShr(
1127 Name: *const c_char,
1129 pub fn LLVMBuildNSWAdd(
1133 Name: *const c_char,
1135 pub fn LLVMBuildNUWAdd(
1139 Name: *const c_char,
1141 pub fn LLVMBuildNSWSub(
1145 Name: *const c_char,
1147 pub fn LLVMBuildNUWSub(
1151 Name: *const c_char,
1153 pub fn LLVMBuildNSWMul(
1157 Name: *const c_char,
1159 pub fn LLVMBuildNUWMul(
1163 Name: *const c_char,
1165 pub fn LLVMBuildAnd(
1169 Name: *const c_char,
1175 Name: *const c_char,
1177 pub fn LLVMBuildXor(
1181 Name: *const c_char,
1183 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1184 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1185 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1186 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
1189 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1190 pub fn LLVMBuildArrayAlloca(
1194 Name: *const c_char,
1196 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
1198 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1200 pub fn LLVMBuildGEP(
1203 Indices: *const &'a Value,
1205 Name: *const c_char,
1207 pub fn LLVMBuildInBoundsGEP(
1210 Indices: *const &'a Value,
1212 Name: *const c_char,
1214 pub fn LLVMBuildStructGEP(
1218 Name: *const c_char,
1222 pub fn LLVMBuildTrunc(
1226 Name: *const c_char,
1228 pub fn LLVMBuildZExt(
1232 Name: *const c_char,
1234 pub fn LLVMBuildSExt(
1238 Name: *const c_char,
1240 pub fn LLVMBuildFPToUI(
1244 Name: *const c_char,
1246 pub fn LLVMBuildFPToSI(
1250 Name: *const c_char,
1252 pub fn LLVMBuildUIToFP(
1256 Name: *const c_char,
1258 pub fn LLVMBuildSIToFP(
1262 Name: *const c_char,
1264 pub fn LLVMBuildFPTrunc(
1268 Name: *const c_char,
1270 pub fn LLVMBuildFPExt(
1274 Name: *const c_char,
1276 pub fn LLVMBuildPtrToInt(
1280 Name: *const c_char,
1282 pub fn LLVMBuildIntToPtr(
1286 Name: *const c_char,
1288 pub fn LLVMBuildBitCast(
1292 Name: *const c_char,
1294 pub fn LLVMBuildPointerCast(
1298 Name: *const c_char,
1300 pub fn LLVMRustBuildIntCast(
1308 pub fn LLVMBuildICmp(
1313 Name: *const c_char,
1315 pub fn LLVMBuildFCmp(
1320 Name: *const c_char,
1323 // Miscellaneous instructions
1324 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1325 pub fn LLVMRustBuildCall(
1328 Args: *const &'a Value,
1330 Bundle: Option<&OperandBundleDef<'a>>,
1331 Name: *const c_char,
1333 pub fn LLVMRustBuildMemCpy(
1342 pub fn LLVMRustBuildMemMove(
1351 pub fn LLVMRustBuildMemSet(
1359 pub fn LLVMBuildSelect(
1364 Name: *const c_char,
1366 pub fn LLVMBuildVAArg(
1370 Name: *const c_char,
1372 pub fn LLVMBuildExtractElement(
1376 Name: *const c_char,
1378 pub fn LLVMBuildInsertElement(
1383 Name: *const c_char,
1385 pub fn LLVMBuildShuffleVector(
1390 Name: *const c_char,
1392 pub fn LLVMBuildExtractValue(
1396 Name: *const c_char,
1398 pub fn LLVMBuildInsertValue(
1403 Name: *const c_char,
1406 pub fn LLVMRustBuildVectorReduceFAdd(
1411 pub fn LLVMRustBuildVectorReduceFMul(
1416 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1417 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1418 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1419 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1420 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1421 pub fn LLVMRustBuildVectorReduceMin(
1426 pub fn LLVMRustBuildVectorReduceMax(
1431 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1433 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1436 pub fn LLVMRustBuildMinNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1437 pub fn LLVMRustBuildMaxNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1439 // Atomic Operations
1440 pub fn LLVMRustBuildAtomicLoad(
1442 PointerVal: &'a Value,
1443 Name: *const c_char,
1444 Order: AtomicOrdering,
1447 pub fn LLVMRustBuildAtomicStore(
1451 Order: AtomicOrdering,
1454 pub fn LLVMRustBuildAtomicCmpXchg(
1459 Order: AtomicOrdering,
1460 FailureOrder: AtomicOrdering,
1464 pub fn LLVMBuildAtomicRMW(
1469 Order: AtomicOrdering,
1470 SingleThreaded: Bool,
1473 pub fn LLVMRustBuildAtomicFence(
1475 Order: AtomicOrdering,
1476 Scope: SynchronizationScope,
1479 /// Writes a module to the specified path. Returns 0 on success.
1480 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1482 /// Creates a pass manager.
1483 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1485 /// Creates a function-by-function pass manager
1486 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1488 /// Disposes a pass manager.
1489 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1491 /// Runs a pass manager on a module.
1492 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1494 pub fn LLVMInitializePasses();
1496 pub fn LLVMTimeTraceProfilerInitialize();
1498 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1500 pub fn LLVMAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>);
1502 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1503 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1504 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1505 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1506 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1507 PMB: &PassManagerBuilder,
1510 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1511 PMB: &PassManagerBuilder,
1512 PM: &PassManager<'_>,
1515 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1516 PMB: &PassManagerBuilder,
1517 PM: &PassManager<'_>,
1519 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1520 PMB: &PassManagerBuilder,
1521 PM: &PassManager<'_>,
1525 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1526 PMB: &PassManagerBuilder,
1527 PM: &PassManager<'_>,
1530 // Stuff that's in rustllvm/ because it's not upstream yet.
1532 /// Opens an object file.
1533 pub fn LLVMCreateObjectFile(
1534 MemBuf: &'static mut MemoryBuffer,
1535 ) -> Option<&'static mut ObjectFile>;
1536 /// Closes an object file.
1537 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1539 /// Enumerates the sections in an object file.
1540 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1541 /// Destroys a section iterator.
1542 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1543 /// Returns `true` if the section iterator is at the end of the section
1545 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1546 /// Moves the section iterator to point to the next section.
1547 pub fn LLVMMoveToNextSection(SI: &SectionIterator<'_>);
1548 /// Returns the current section size.
1549 pub fn LLVMGetSectionSize(SI: &SectionIterator<'_>) -> c_ulonglong;
1550 /// Returns the current section contents as a string buffer.
1551 pub fn LLVMGetSectionContents(SI: &SectionIterator<'_>) -> *const c_char;
1553 /// Reads the given file and returns it as a memory buffer. Use
1554 /// LLVMDisposeMemoryBuffer() to get rid of it.
1555 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1556 Path: *const c_char,
1557 ) -> Option<&'static mut MemoryBuffer>;
1559 pub fn LLVMStartMultithreaded() -> Bool;
1561 /// Returns a string describing the last error caused by an LLVMRust* call.
1562 pub fn LLVMRustGetLastError() -> *const c_char;
1564 /// Print the pass timings since static dtors aren't picking them up.
1565 pub fn LLVMRustPrintPassTimings();
1567 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1569 pub fn LLVMStructSetBody(
1571 ElementTypes: *const &'a Type,
1572 ElementCount: c_uint,
1576 /// Prepares inline assembly.
1577 pub fn LLVMRustInlineAsm(
1579 AsmString: *const c_char,
1580 Constraints: *const c_char,
1583 Dialect: AsmDialect,
1585 pub fn LLVMRustInlineAsmVerify(Ty: &Type, Constraints: *const c_char) -> bool;
1587 pub fn LLVMRustDebugMetadataVersion() -> u32;
1588 pub fn LLVMRustVersionMajor() -> u32;
1589 pub fn LLVMRustVersionMinor() -> u32;
1591 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1593 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1595 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1597 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1599 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1601 pub fn LLVMRustDIBuilderCreateCompileUnit(
1602 Builder: &DIBuilder<'a>,
1605 Producer: *const c_char,
1607 Flags: *const c_char,
1609 SplitName: *const c_char,
1610 kind: DebugEmissionKind,
1611 ) -> &'a DIDescriptor;
1613 pub fn LLVMRustDIBuilderCreateFile(
1614 Builder: &DIBuilder<'a>,
1615 Filename: *const c_char,
1616 Directory: *const c_char,
1619 pub fn LLVMRustDIBuilderCreateSubroutineType(
1620 Builder: &DIBuilder<'a>,
1622 ParameterTypes: &'a DIArray,
1623 ) -> &'a DICompositeType;
1625 pub fn LLVMRustDIBuilderCreateFunction(
1626 Builder: &DIBuilder<'a>,
1627 Scope: &'a DIDescriptor,
1628 Name: *const c_char,
1629 LinkageName: *const c_char,
1637 TParam: &'a DIArray,
1638 Decl: Option<&'a DIDescriptor>,
1639 ) -> &'a DISubprogram;
1641 pub fn LLVMRustDIBuilderCreateBasicType(
1642 Builder: &DIBuilder<'a>,
1643 Name: *const c_char,
1647 ) -> &'a DIBasicType;
1649 pub fn LLVMRustDIBuilderCreatePointerType(
1650 Builder: &DIBuilder<'a>,
1651 PointeeTy: &'a DIType,
1654 Name: *const c_char,
1655 ) -> &'a DIDerivedType;
1657 pub fn LLVMRustDIBuilderCreateStructType(
1658 Builder: &DIBuilder<'a>,
1659 Scope: Option<&'a DIDescriptor>,
1660 Name: *const c_char,
1666 DerivedFrom: Option<&'a DIType>,
1667 Elements: &'a DIArray,
1668 RunTimeLang: c_uint,
1669 VTableHolder: Option<&'a DIType>,
1670 UniqueId: *const c_char,
1671 ) -> &'a DICompositeType;
1673 pub fn LLVMRustDIBuilderCreateMemberType(
1674 Builder: &DIBuilder<'a>,
1675 Scope: &'a DIDescriptor,
1676 Name: *const c_char,
1684 ) -> &'a DIDerivedType;
1686 pub fn LLVMRustDIBuilderCreateVariantMemberType(
1687 Builder: &DIBuilder<'a>,
1689 Name: *const c_char,
1695 Discriminant: Option<&'a Value>,
1700 pub fn LLVMRustDIBuilderCreateLexicalBlock(
1701 Builder: &DIBuilder<'a>,
1706 ) -> &'a DILexicalBlock;
1708 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(
1709 Builder: &DIBuilder<'a>,
1712 ) -> &'a DILexicalBlock;
1714 pub fn LLVMRustDIBuilderCreateStaticVariable(
1715 Builder: &DIBuilder<'a>,
1716 Context: Option<&'a DIScope>,
1717 Name: *const c_char,
1718 LinkageName: *const c_char,
1722 isLocalToUnit: bool,
1724 Decl: Option<&'a DIDescriptor>,
1726 ) -> &'a DIGlobalVariableExpression;
1728 pub fn LLVMRustDIBuilderCreateVariable(
1729 Builder: &DIBuilder<'a>,
1731 Scope: &'a DIDescriptor,
1732 Name: *const c_char,
1736 AlwaysPreserve: bool,
1740 ) -> &'a DIVariable;
1742 pub fn LLVMRustDIBuilderCreateArrayType(
1743 Builder: &DIBuilder<'a>,
1747 Subscripts: &'a DIArray,
1750 pub fn LLVMRustDIBuilderGetOrCreateSubrange(
1751 Builder: &DIBuilder<'a>,
1754 ) -> &'a DISubrange;
1756 pub fn LLVMRustDIBuilderGetOrCreateArray(
1757 Builder: &DIBuilder<'a>,
1758 Ptr: *const Option<&'a DIDescriptor>,
1762 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
1763 Builder: &DIBuilder<'a>,
1765 VarInfo: &'a DIVariable,
1766 AddrOps: *const i64,
1767 AddrOpsCount: c_uint,
1769 InsertAtEnd: &'a BasicBlock,
1772 pub fn LLVMRustDIBuilderCreateEnumerator(
1773 Builder: &DIBuilder<'a>,
1774 Name: *const c_char,
1776 ) -> &'a DIEnumerator;
1778 pub fn LLVMRustDIBuilderCreateEnumerationType(
1779 Builder: &DIBuilder<'a>,
1781 Name: *const c_char,
1786 Elements: &'a DIArray,
1787 ClassType: &'a DIType,
1791 pub fn LLVMRustDIBuilderCreateUnionType(
1792 Builder: &DIBuilder<'a>,
1794 Name: *const c_char,
1800 Elements: Option<&'a DIArray>,
1801 RunTimeLang: c_uint,
1802 UniqueId: *const c_char,
1805 pub fn LLVMRustDIBuilderCreateVariantPart(
1806 Builder: &DIBuilder<'a>,
1808 Name: *const c_char,
1814 Discriminator: Option<&'a DIDerivedType>,
1815 Elements: &'a DIArray,
1816 UniqueId: *const c_char,
1817 ) -> &'a DIDerivedType;
1819 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1821 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
1822 Builder: &DIBuilder<'a>,
1823 Scope: Option<&'a DIScope>,
1824 Name: *const c_char,
1829 ) -> &'a DITemplateTypeParameter;
1831 pub fn LLVMRustDIBuilderCreateNameSpace(
1832 Builder: &DIBuilder<'a>,
1833 Scope: Option<&'a DIScope>,
1834 Name: *const c_char,
1837 ) -> &'a DINameSpace;
1839 pub fn LLVMRustDICompositeTypeReplaceArrays(
1840 Builder: &DIBuilder<'a>,
1841 CompositeType: &'a DIType,
1842 Elements: Option<&'a DIArray>,
1843 Params: Option<&'a DIArray>,
1846 pub fn LLVMRustDIBuilderCreateDebugLocation(
1847 Context: &'a Context,
1851 InlinedAt: Option<&'a Metadata>,
1853 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1854 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1856 #[allow(improper_ctypes)]
1857 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1858 #[allow(improper_ctypes)]
1859 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1861 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
1863 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1864 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1865 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
1866 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
1867 pub fn LLVMRustCreateMemorySanitizerPass(
1868 TrackOrigins: c_int,
1870 ) -> &'static mut Pass;
1871 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
1872 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
1873 pub fn LLVMRustAddLastExtensionPasses(
1874 PMB: &PassManagerBuilder,
1875 Passes: *const &'static mut Pass,
1879 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1881 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1882 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1884 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1885 pub fn LLVMRustCreateTargetMachine(
1886 Triple: *const c_char,
1888 Features: *const c_char,
1892 Level: CodeGenOptLevel,
1894 PositionIndependentExecutable: bool,
1895 FunctionSections: bool,
1897 TrapUnreachable: bool,
1900 EmitStackSizeSection: bool,
1901 RelaxELFRelocations: bool,
1902 ) -> Option<&'static mut TargetMachine>;
1903 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1904 pub fn LLVMRustAddBuilderLibraryInfo(
1905 PMB: &'a PassManagerBuilder,
1907 DisableSimplifyLibCalls: bool,
1909 pub fn LLVMRustConfigurePassManagerBuilder(
1910 PMB: &PassManagerBuilder,
1911 OptLevel: CodeGenOptLevel,
1912 MergeFunctions: bool,
1914 LoopVectorize: bool,
1915 PrepareForThinLTO: bool,
1916 PGOGenPath: *const c_char,
1917 PGOUsePath: *const c_char,
1919 pub fn LLVMRustAddLibraryInfo(
1920 PM: &PassManager<'a>,
1922 DisableSimplifyLibCalls: bool,
1924 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1925 pub fn LLVMRustWriteOutputFile(
1926 T: &'a TargetMachine,
1927 PM: &PassManager<'a>,
1929 Output: *const c_char,
1931 ) -> LLVMRustResult;
1932 pub fn LLVMRustOptimizeWithNewPassManager(
1934 TM: &'a TargetMachine,
1935 OptLevel: PassBuilderOptLevel,
1937 NoPrepopulatePasses: bool,
1939 UseThinLTOBuffers: bool,
1940 MergeFunctions: bool,
1943 LoopVectorize: bool,
1944 DisableSimplifyLibCalls: bool,
1945 SanitizerOptions: Option<&SanitizerOptions>,
1946 PGOGenPath: *const c_char,
1947 PGOUsePath: *const c_char,
1949 pub fn LLVMRustPrintModule(
1951 Output: *const c_char,
1952 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
1953 ) -> LLVMRustResult;
1954 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1955 pub fn LLVMRustPrintPasses();
1956 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
1957 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1958 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1959 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1960 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1962 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1963 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1964 pub fn LLVMRustArchiveIteratorNext(
1965 AIR: &ArchiveIterator<'a>,
1966 ) -> Option<&'a mut ArchiveChild<'a>>;
1967 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1968 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1969 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1970 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1971 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1973 #[allow(improper_ctypes)]
1974 pub fn LLVMRustGetSectionName(
1975 SI: &SectionIterator<'_>,
1976 data: &mut Option<std::ptr::NonNull<c_char>>,
1979 #[allow(improper_ctypes)]
1980 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1982 pub fn LLVMContextSetDiagnosticHandler(
1984 Handler: DiagnosticHandler,
1985 DiagnosticContext: *mut c_void,
1988 #[allow(improper_ctypes)]
1989 pub fn LLVMRustUnpackOptimizationDiagnostic(
1990 DI: &'a DiagnosticInfo,
1991 pass_name_out: &RustString,
1992 function_out: &mut Option<&'a Value>,
1993 loc_line_out: &mut c_uint,
1994 loc_column_out: &mut c_uint,
1995 loc_filename_out: &RustString,
1996 message_out: &RustString,
1999 pub fn LLVMRustUnpackInlineAsmDiagnostic(
2000 DI: &'a DiagnosticInfo,
2001 cookie_out: &mut c_uint,
2002 message_out: &mut Option<&'a Twine>,
2003 instruction_out: &mut Option<&'a Value>,
2006 #[allow(improper_ctypes)]
2007 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2008 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2010 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2012 H: InlineAsmDiagHandler,
2016 #[allow(improper_ctypes)]
2017 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
2019 pub fn LLVMRustWriteArchive(
2022 Members: *const &RustArchiveMember<'_>,
2025 ) -> LLVMRustResult;
2026 pub fn LLVMRustArchiveMemberNew(
2027 Filename: *const c_char,
2028 Name: *const c_char,
2029 Child: Option<&ArchiveChild<'a>>,
2030 ) -> &'a mut RustArchiveMember<'a>;
2031 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
2033 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
2035 pub fn LLVMRustBuildOperandBundleDef(
2036 Name: *const c_char,
2037 Inputs: *const &'a Value,
2039 ) -> &'a mut OperandBundleDef<'a>;
2040 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
2042 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
2044 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2045 pub fn LLVMRustUnsetComdat(V: &Value);
2046 pub fn LLVMRustSetModulePICLevel(M: &Module);
2047 pub fn LLVMRustSetModulePIELevel(M: &Module);
2048 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2049 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2050 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2051 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2052 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2054 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2055 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2056 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2057 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2058 pub fn LLVMRustCreateThinLTOData(
2059 Modules: *const ThinLTOModule,
2061 PreservedSymbols: *const *const c_char,
2062 PreservedSymbolsLen: c_uint,
2063 ) -> Option<&'static mut ThinLTOData>;
2064 pub fn LLVMRustPrepareThinLTORename(Data: &ThinLTOData, Module: &Module) -> bool;
2065 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2066 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2067 pub fn LLVMRustPrepareThinLTOImport(Data: &ThinLTOData, Module: &Module) -> bool;
2068 pub fn LLVMRustGetThinLTOModuleImports(
2069 Data: *const ThinLTOData,
2070 ModuleNameCallback: ThinLTOModuleNameCallback,
2071 CallbackPayload: *mut c_void,
2073 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2074 pub fn LLVMRustParseBitcodeForLTO(
2078 Identifier: *const c_char,
2079 ) -> Option<&Module>;
2080 pub fn LLVMRustThinLTOGetDICompileUnit(
2082 CU1: &mut *mut c_void,
2083 CU2: &mut *mut c_void,
2085 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2087 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
2088 pub fn LLVMRustLinkerAdd(
2089 linker: &Linker<'_>,
2090 bytecode: *const c_char,
2091 bytecode_len: usize,
2093 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);