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: rustc_ast::ast::AsmDialect) -> Self {
386 rustc_ast::ast::AsmDialect::Att => AsmDialect::Att,
387 rustc_ast::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;
712 pub type SelfProfileBeforePassCallback =
713 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
714 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
717 pub fn LLVMRustInstallFatalErrorHandler();
719 // Create and destroy contexts.
720 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
721 pub fn LLVMContextDispose(C: &'static mut Context);
722 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
725 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
726 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
727 pub fn LLVMCloneModule(M: &Module) -> &Module;
729 /// Data layout. See Module::getDataLayout.
730 pub fn LLVMGetDataLayout(M: &Module) -> *const c_char;
731 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
733 /// See Module::setModuleInlineAsm.
734 pub fn LLVMSetModuleInlineAsm(M: &Module, Asm: *const c_char);
735 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char);
737 /// See llvm::LLVMTypeKind::getTypeID.
738 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
740 // Operations on integer types
741 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
742 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
743 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
744 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
745 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
746 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
748 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
750 // Operations on real types
751 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
752 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
754 // Operations on function types
755 pub fn LLVMFunctionType(
756 ReturnType: &'a Type,
757 ParamTypes: *const &'a Type,
761 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
762 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
764 // Operations on struct types
765 pub fn LLVMStructTypeInContext(
767 ElementTypes: *const &'a Type,
768 ElementCount: c_uint,
772 // Operations on array, pointer, and vector types (sequence types)
773 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
774 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
775 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
777 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
778 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
780 // Operations on other types
781 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
782 pub fn LLVMX86MMXTypeInContext(C: &Context) -> &Type;
783 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
785 // Operations on all values
786 pub fn LLVMTypeOf(Val: &Value) -> &Type;
787 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
788 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
789 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
790 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
792 // Operations on constants of any type
793 pub fn LLVMConstNull(Ty: &Type) -> &Value;
794 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
796 // Operations on metadata
797 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
798 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
799 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
801 // Operations on scalar constants
802 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
803 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
804 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
805 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
806 pub fn LLVMRustConstInt128Get(
807 ConstantVal: &ConstantInt,
813 // Operations on composite constants
814 pub fn LLVMConstStringInContext(
818 DontNullTerminate: Bool,
820 pub fn LLVMConstStructInContext(
822 ConstantVals: *const &'a Value,
827 pub fn LLVMConstArray(
829 ConstantVals: *const &'a Value,
832 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
834 // Constant expressions
835 pub fn LLVMConstInBoundsGEP(
836 ConstantVal: &'a Value,
837 ConstantIndices: *const &'a Value,
840 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
841 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
842 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
843 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
844 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
845 pub fn LLVMConstExtractValue(
847 IdxList: *const c_uint,
851 // Operations on global variables, functions, and aliases (globals)
852 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
853 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
854 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
855 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
856 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
857 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
858 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
859 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
860 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
862 // Operations on global variables
863 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
864 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
865 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
866 pub fn LLVMRustGetOrInsertGlobal(
872 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
873 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
874 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
875 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
876 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
877 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
878 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
879 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
880 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
881 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
882 pub fn LLVMRustGetNamedValue(M: &Module, Name: *const c_char) -> Option<&Value>;
883 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
885 // Operations on functions
886 pub fn LLVMRustGetOrInsertFunction(
889 FunctionTy: &'a Type,
891 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
892 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
893 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
894 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
895 pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type);
896 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
897 pub fn LLVMRustAddFunctionAttrStringValue(
901 Value: *const c_char,
903 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
905 // Operations on parameters
906 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
907 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
908 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
910 // Operations on basic blocks
911 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
912 pub fn LLVMAppendBasicBlockInContext(
917 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
919 // Operations on instructions
920 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
921 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
923 // Operations on call sites
924 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
925 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
926 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
927 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
928 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
929 pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
931 // Operations on load/store instructions (only)
932 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
934 // Operations on phi nodes
935 pub fn LLVMAddIncoming(
937 IncomingValues: *const &'a Value,
938 IncomingBlocks: *const &'a BasicBlock,
942 // Instruction builders
943 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
944 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
945 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
946 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
949 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: &'a Value);
952 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
953 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
954 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
955 pub fn LLVMBuildCondBr(
958 Then: &'a BasicBlock,
959 Else: &'a BasicBlock,
961 pub fn LLVMBuildSwitch(
964 Else: &'a BasicBlock,
967 pub fn LLVMRustBuildInvoke(
970 Args: *const &'a Value,
972 Then: &'a BasicBlock,
973 Catch: &'a BasicBlock,
974 Bundle: Option<&OperandBundleDef<'a>>,
977 pub fn LLVMBuildLandingPad(
984 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
985 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
987 pub fn LLVMRustBuildCleanupPad(
989 ParentPad: Option<&'a Value>,
991 Args: *const &'a Value,
993 ) -> Option<&'a Value>;
994 pub fn LLVMRustBuildCleanupRet(
996 CleanupPad: &'a Value,
997 UnwindBB: Option<&'a BasicBlock>,
998 ) -> Option<&'a Value>;
999 pub fn LLVMRustBuildCatchPad(
1001 ParentPad: &'a Value,
1003 Args: *const &'a Value,
1004 Name: *const c_char,
1005 ) -> Option<&'a Value>;
1006 pub fn LLVMRustBuildCatchRet(
1010 ) -> Option<&'a Value>;
1011 pub fn LLVMRustBuildCatchSwitch(
1012 Builder: &Builder<'a>,
1013 ParentPad: Option<&'a Value>,
1014 BB: Option<&'a BasicBlock>,
1015 NumHandlers: c_uint,
1016 Name: *const c_char,
1017 ) -> Option<&'a Value>;
1018 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1019 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
1021 // Add a case to the switch instruction
1022 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1024 // Add a clause to the landing pad instruction
1025 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
1027 // Set the cleanup on a landing pad instruction
1028 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1031 pub fn LLVMBuildAdd(
1035 Name: *const c_char,
1037 pub fn LLVMBuildFAdd(
1041 Name: *const c_char,
1043 pub fn LLVMBuildSub(
1047 Name: *const c_char,
1049 pub fn LLVMBuildFSub(
1053 Name: *const c_char,
1055 pub fn LLVMBuildMul(
1059 Name: *const c_char,
1061 pub fn LLVMBuildFMul(
1065 Name: *const c_char,
1067 pub fn LLVMBuildUDiv(
1071 Name: *const c_char,
1073 pub fn LLVMBuildExactUDiv(
1077 Name: *const c_char,
1079 pub fn LLVMBuildSDiv(
1083 Name: *const c_char,
1085 pub fn LLVMBuildExactSDiv(
1089 Name: *const c_char,
1091 pub fn LLVMBuildFDiv(
1095 Name: *const c_char,
1097 pub fn LLVMBuildURem(
1101 Name: *const c_char,
1103 pub fn LLVMBuildSRem(
1107 Name: *const c_char,
1109 pub fn LLVMBuildFRem(
1113 Name: *const c_char,
1115 pub fn LLVMBuildShl(
1119 Name: *const c_char,
1121 pub fn LLVMBuildLShr(
1125 Name: *const c_char,
1127 pub fn LLVMBuildAShr(
1131 Name: *const c_char,
1133 pub fn LLVMBuildNSWAdd(
1137 Name: *const c_char,
1139 pub fn LLVMBuildNUWAdd(
1143 Name: *const c_char,
1145 pub fn LLVMBuildNSWSub(
1149 Name: *const c_char,
1151 pub fn LLVMBuildNUWSub(
1155 Name: *const c_char,
1157 pub fn LLVMBuildNSWMul(
1161 Name: *const c_char,
1163 pub fn LLVMBuildNUWMul(
1167 Name: *const c_char,
1169 pub fn LLVMBuildAnd(
1173 Name: *const c_char,
1179 Name: *const c_char,
1181 pub fn LLVMBuildXor(
1185 Name: *const c_char,
1187 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1188 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1189 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1190 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
1193 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1194 pub fn LLVMBuildArrayAlloca(
1198 Name: *const c_char,
1200 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
1202 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1204 pub fn LLVMBuildGEP(
1207 Indices: *const &'a Value,
1209 Name: *const c_char,
1211 pub fn LLVMBuildInBoundsGEP(
1214 Indices: *const &'a Value,
1216 Name: *const c_char,
1218 pub fn LLVMBuildStructGEP(
1222 Name: *const c_char,
1226 pub fn LLVMBuildTrunc(
1230 Name: *const c_char,
1232 pub fn LLVMBuildZExt(
1236 Name: *const c_char,
1238 pub fn LLVMBuildSExt(
1242 Name: *const c_char,
1244 pub fn LLVMBuildFPToUI(
1248 Name: *const c_char,
1250 pub fn LLVMBuildFPToSI(
1254 Name: *const c_char,
1256 pub fn LLVMBuildUIToFP(
1260 Name: *const c_char,
1262 pub fn LLVMBuildSIToFP(
1266 Name: *const c_char,
1268 pub fn LLVMBuildFPTrunc(
1272 Name: *const c_char,
1274 pub fn LLVMBuildFPExt(
1278 Name: *const c_char,
1280 pub fn LLVMBuildPtrToInt(
1284 Name: *const c_char,
1286 pub fn LLVMBuildIntToPtr(
1290 Name: *const c_char,
1292 pub fn LLVMBuildBitCast(
1296 Name: *const c_char,
1298 pub fn LLVMBuildPointerCast(
1302 Name: *const c_char,
1304 pub fn LLVMRustBuildIntCast(
1312 pub fn LLVMBuildICmp(
1317 Name: *const c_char,
1319 pub fn LLVMBuildFCmp(
1324 Name: *const c_char,
1327 // Miscellaneous instructions
1328 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1329 pub fn LLVMRustBuildCall(
1332 Args: *const &'a Value,
1334 Bundle: Option<&OperandBundleDef<'a>>,
1335 Name: *const c_char,
1337 pub fn LLVMRustBuildMemCpy(
1346 pub fn LLVMRustBuildMemMove(
1355 pub fn LLVMRustBuildMemSet(
1363 pub fn LLVMBuildSelect(
1368 Name: *const c_char,
1370 pub fn LLVMBuildVAArg(
1374 Name: *const c_char,
1376 pub fn LLVMBuildExtractElement(
1380 Name: *const c_char,
1382 pub fn LLVMBuildInsertElement(
1387 Name: *const c_char,
1389 pub fn LLVMBuildShuffleVector(
1394 Name: *const c_char,
1396 pub fn LLVMBuildExtractValue(
1400 Name: *const c_char,
1402 pub fn LLVMBuildInsertValue(
1407 Name: *const c_char,
1410 pub fn LLVMRustBuildVectorReduceFAdd(
1415 pub fn LLVMRustBuildVectorReduceFMul(
1420 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1421 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1422 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1423 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1424 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1425 pub fn LLVMRustBuildVectorReduceMin(
1430 pub fn LLVMRustBuildVectorReduceMax(
1435 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1437 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1440 pub fn LLVMRustBuildMinNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1441 pub fn LLVMRustBuildMaxNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1443 // Atomic Operations
1444 pub fn LLVMRustBuildAtomicLoad(
1446 PointerVal: &'a Value,
1447 Name: *const c_char,
1448 Order: AtomicOrdering,
1451 pub fn LLVMRustBuildAtomicStore(
1455 Order: AtomicOrdering,
1458 pub fn LLVMRustBuildAtomicCmpXchg(
1463 Order: AtomicOrdering,
1464 FailureOrder: AtomicOrdering,
1468 pub fn LLVMBuildAtomicRMW(
1473 Order: AtomicOrdering,
1474 SingleThreaded: Bool,
1477 pub fn LLVMRustBuildAtomicFence(
1479 Order: AtomicOrdering,
1480 Scope: SynchronizationScope,
1483 /// Writes a module to the specified path. Returns 0 on success.
1484 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1486 /// Creates a pass manager.
1487 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1489 /// Creates a function-by-function pass manager
1490 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1492 /// Disposes a pass manager.
1493 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1495 /// Runs a pass manager on a module.
1496 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1498 pub fn LLVMInitializePasses();
1500 pub fn LLVMTimeTraceProfilerInitialize();
1502 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1504 pub fn LLVMAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>);
1506 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1507 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1508 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1509 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1510 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1511 PMB: &PassManagerBuilder,
1514 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1515 PMB: &PassManagerBuilder,
1516 PM: &PassManager<'_>,
1519 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1520 PMB: &PassManagerBuilder,
1521 PM: &PassManager<'_>,
1523 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1524 PMB: &PassManagerBuilder,
1525 PM: &PassManager<'_>,
1529 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1530 PMB: &PassManagerBuilder,
1531 PM: &PassManager<'_>,
1534 // Stuff that's in rustllvm/ because it's not upstream yet.
1536 /// Opens an object file.
1537 pub fn LLVMCreateObjectFile(
1538 MemBuf: &'static mut MemoryBuffer,
1539 ) -> Option<&'static mut ObjectFile>;
1540 /// Closes an object file.
1541 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1543 /// Enumerates the sections in an object file.
1544 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1545 /// Destroys a section iterator.
1546 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1547 /// Returns `true` if the section iterator is at the end of the section
1549 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1550 /// Moves the section iterator to point to the next section.
1551 pub fn LLVMMoveToNextSection(SI: &SectionIterator<'_>);
1552 /// Returns the current section size.
1553 pub fn LLVMGetSectionSize(SI: &SectionIterator<'_>) -> c_ulonglong;
1554 /// Returns the current section contents as a string buffer.
1555 pub fn LLVMGetSectionContents(SI: &SectionIterator<'_>) -> *const c_char;
1557 /// Reads the given file and returns it as a memory buffer. Use
1558 /// LLVMDisposeMemoryBuffer() to get rid of it.
1559 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1560 Path: *const c_char,
1561 ) -> Option<&'static mut MemoryBuffer>;
1563 pub fn LLVMStartMultithreaded() -> Bool;
1565 /// Returns a string describing the last error caused by an LLVMRust* call.
1566 pub fn LLVMRustGetLastError() -> *const c_char;
1568 /// Print the pass timings since static dtors aren't picking them up.
1569 pub fn LLVMRustPrintPassTimings();
1571 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1573 pub fn LLVMStructSetBody(
1575 ElementTypes: *const &'a Type,
1576 ElementCount: c_uint,
1580 /// Prepares inline assembly.
1581 pub fn LLVMRustInlineAsm(
1583 AsmString: *const c_char,
1584 Constraints: *const c_char,
1587 Dialect: AsmDialect,
1589 pub fn LLVMRustInlineAsmVerify(Ty: &Type, Constraints: *const c_char) -> bool;
1591 pub fn LLVMRustDebugMetadataVersion() -> u32;
1592 pub fn LLVMRustVersionMajor() -> u32;
1593 pub fn LLVMRustVersionMinor() -> u32;
1595 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1597 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1599 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1601 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1603 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1605 pub fn LLVMRustDIBuilderCreateCompileUnit(
1606 Builder: &DIBuilder<'a>,
1609 Producer: *const c_char,
1611 Flags: *const c_char,
1613 SplitName: *const c_char,
1614 kind: DebugEmissionKind,
1615 ) -> &'a DIDescriptor;
1617 pub fn LLVMRustDIBuilderCreateFile(
1618 Builder: &DIBuilder<'a>,
1619 Filename: *const c_char,
1620 Directory: *const c_char,
1623 pub fn LLVMRustDIBuilderCreateSubroutineType(
1624 Builder: &DIBuilder<'a>,
1626 ParameterTypes: &'a DIArray,
1627 ) -> &'a DICompositeType;
1629 pub fn LLVMRustDIBuilderCreateFunction(
1630 Builder: &DIBuilder<'a>,
1631 Scope: &'a DIDescriptor,
1632 Name: *const c_char,
1633 LinkageName: *const c_char,
1641 TParam: &'a DIArray,
1642 Decl: Option<&'a DIDescriptor>,
1643 ) -> &'a DISubprogram;
1645 pub fn LLVMRustDIBuilderCreateBasicType(
1646 Builder: &DIBuilder<'a>,
1647 Name: *const c_char,
1651 ) -> &'a DIBasicType;
1653 pub fn LLVMRustDIBuilderCreatePointerType(
1654 Builder: &DIBuilder<'a>,
1655 PointeeTy: &'a DIType,
1658 Name: *const c_char,
1659 ) -> &'a DIDerivedType;
1661 pub fn LLVMRustDIBuilderCreateStructType(
1662 Builder: &DIBuilder<'a>,
1663 Scope: Option<&'a DIDescriptor>,
1664 Name: *const c_char,
1670 DerivedFrom: Option<&'a DIType>,
1671 Elements: &'a DIArray,
1672 RunTimeLang: c_uint,
1673 VTableHolder: Option<&'a DIType>,
1674 UniqueId: *const c_char,
1675 ) -> &'a DICompositeType;
1677 pub fn LLVMRustDIBuilderCreateMemberType(
1678 Builder: &DIBuilder<'a>,
1679 Scope: &'a DIDescriptor,
1680 Name: *const c_char,
1688 ) -> &'a DIDerivedType;
1690 pub fn LLVMRustDIBuilderCreateVariantMemberType(
1691 Builder: &DIBuilder<'a>,
1693 Name: *const c_char,
1699 Discriminant: Option<&'a Value>,
1704 pub fn LLVMRustDIBuilderCreateLexicalBlock(
1705 Builder: &DIBuilder<'a>,
1710 ) -> &'a DILexicalBlock;
1712 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(
1713 Builder: &DIBuilder<'a>,
1716 ) -> &'a DILexicalBlock;
1718 pub fn LLVMRustDIBuilderCreateStaticVariable(
1719 Builder: &DIBuilder<'a>,
1720 Context: Option<&'a DIScope>,
1721 Name: *const c_char,
1722 LinkageName: *const c_char,
1726 isLocalToUnit: bool,
1728 Decl: Option<&'a DIDescriptor>,
1730 ) -> &'a DIGlobalVariableExpression;
1732 pub fn LLVMRustDIBuilderCreateVariable(
1733 Builder: &DIBuilder<'a>,
1735 Scope: &'a DIDescriptor,
1736 Name: *const c_char,
1740 AlwaysPreserve: bool,
1744 ) -> &'a DIVariable;
1746 pub fn LLVMRustDIBuilderCreateArrayType(
1747 Builder: &DIBuilder<'a>,
1751 Subscripts: &'a DIArray,
1754 pub fn LLVMRustDIBuilderGetOrCreateSubrange(
1755 Builder: &DIBuilder<'a>,
1758 ) -> &'a DISubrange;
1760 pub fn LLVMRustDIBuilderGetOrCreateArray(
1761 Builder: &DIBuilder<'a>,
1762 Ptr: *const Option<&'a DIDescriptor>,
1766 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
1767 Builder: &DIBuilder<'a>,
1769 VarInfo: &'a DIVariable,
1770 AddrOps: *const i64,
1771 AddrOpsCount: c_uint,
1773 InsertAtEnd: &'a BasicBlock,
1776 pub fn LLVMRustDIBuilderCreateEnumerator(
1777 Builder: &DIBuilder<'a>,
1778 Name: *const c_char,
1780 ) -> &'a DIEnumerator;
1782 pub fn LLVMRustDIBuilderCreateEnumerationType(
1783 Builder: &DIBuilder<'a>,
1785 Name: *const c_char,
1790 Elements: &'a DIArray,
1791 ClassType: &'a DIType,
1795 pub fn LLVMRustDIBuilderCreateUnionType(
1796 Builder: &DIBuilder<'a>,
1798 Name: *const c_char,
1804 Elements: Option<&'a DIArray>,
1805 RunTimeLang: c_uint,
1806 UniqueId: *const c_char,
1809 pub fn LLVMRustDIBuilderCreateVariantPart(
1810 Builder: &DIBuilder<'a>,
1812 Name: *const c_char,
1818 Discriminator: Option<&'a DIDerivedType>,
1819 Elements: &'a DIArray,
1820 UniqueId: *const c_char,
1821 ) -> &'a DIDerivedType;
1823 pub fn LLVMSetUnnamedAddr(GlobalVar: &Value, UnnamedAddr: Bool);
1825 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
1826 Builder: &DIBuilder<'a>,
1827 Scope: Option<&'a DIScope>,
1828 Name: *const c_char,
1833 ) -> &'a DITemplateTypeParameter;
1835 pub fn LLVMRustDIBuilderCreateNameSpace(
1836 Builder: &DIBuilder<'a>,
1837 Scope: Option<&'a DIScope>,
1838 Name: *const c_char,
1841 ) -> &'a DINameSpace;
1843 pub fn LLVMRustDICompositeTypeReplaceArrays(
1844 Builder: &DIBuilder<'a>,
1845 CompositeType: &'a DIType,
1846 Elements: Option<&'a DIArray>,
1847 Params: Option<&'a DIArray>,
1850 pub fn LLVMRustDIBuilderCreateDebugLocation(
1851 Context: &'a Context,
1855 InlinedAt: Option<&'a Metadata>,
1857 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
1858 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
1860 #[allow(improper_ctypes)]
1861 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
1862 #[allow(improper_ctypes)]
1863 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
1865 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
1867 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
1868 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
1869 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
1870 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
1871 pub fn LLVMRustCreateMemorySanitizerPass(
1872 TrackOrigins: c_int,
1874 ) -> &'static mut Pass;
1875 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
1876 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
1877 pub fn LLVMRustAddLastExtensionPasses(
1878 PMB: &PassManagerBuilder,
1879 Passes: *const &'static mut Pass,
1883 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
1885 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
1886 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
1888 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
1889 pub fn LLVMRustCreateTargetMachine(
1890 Triple: *const c_char,
1892 Features: *const c_char,
1896 Level: CodeGenOptLevel,
1898 PositionIndependentExecutable: bool,
1899 FunctionSections: bool,
1901 TrapUnreachable: bool,
1904 EmitStackSizeSection: bool,
1905 RelaxELFRelocations: bool,
1906 ) -> Option<&'static mut TargetMachine>;
1907 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
1908 pub fn LLVMRustAddBuilderLibraryInfo(
1909 PMB: &'a PassManagerBuilder,
1911 DisableSimplifyLibCalls: bool,
1913 pub fn LLVMRustConfigurePassManagerBuilder(
1914 PMB: &PassManagerBuilder,
1915 OptLevel: CodeGenOptLevel,
1916 MergeFunctions: bool,
1918 LoopVectorize: bool,
1919 PrepareForThinLTO: bool,
1920 PGOGenPath: *const c_char,
1921 PGOUsePath: *const c_char,
1923 pub fn LLVMRustAddLibraryInfo(
1924 PM: &PassManager<'a>,
1926 DisableSimplifyLibCalls: bool,
1928 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
1929 pub fn LLVMRustWriteOutputFile(
1930 T: &'a TargetMachine,
1931 PM: &PassManager<'a>,
1933 Output: *const c_char,
1935 ) -> LLVMRustResult;
1936 pub fn LLVMRustOptimizeWithNewPassManager(
1938 TM: &'a TargetMachine,
1939 OptLevel: PassBuilderOptLevel,
1941 NoPrepopulatePasses: bool,
1943 UseThinLTOBuffers: bool,
1944 MergeFunctions: bool,
1947 LoopVectorize: bool,
1948 DisableSimplifyLibCalls: bool,
1949 SanitizerOptions: Option<&SanitizerOptions>,
1950 PGOGenPath: *const c_char,
1951 PGOUsePath: *const c_char,
1952 llvm_selfprofiler: *mut c_void,
1953 begin_callback: SelfProfileBeforePassCallback,
1954 end_callback: SelfProfileAfterPassCallback,
1956 pub fn LLVMRustPrintModule(
1958 Output: *const c_char,
1959 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
1960 ) -> LLVMRustResult;
1961 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
1962 pub fn LLVMRustPrintPasses();
1963 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
1964 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
1965 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
1966 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
1967 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
1969 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
1970 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
1971 pub fn LLVMRustArchiveIteratorNext(
1972 AIR: &ArchiveIterator<'a>,
1973 ) -> Option<&'a mut ArchiveChild<'a>>;
1974 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1975 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
1976 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
1977 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
1978 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
1980 #[allow(improper_ctypes)]
1981 pub fn LLVMRustGetSectionName(
1982 SI: &SectionIterator<'_>,
1983 data: &mut Option<std::ptr::NonNull<c_char>>,
1986 #[allow(improper_ctypes)]
1987 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
1989 pub fn LLVMContextSetDiagnosticHandler(
1991 Handler: DiagnosticHandler,
1992 DiagnosticContext: *mut c_void,
1995 #[allow(improper_ctypes)]
1996 pub fn LLVMRustUnpackOptimizationDiagnostic(
1997 DI: &'a DiagnosticInfo,
1998 pass_name_out: &RustString,
1999 function_out: &mut Option<&'a Value>,
2000 loc_line_out: &mut c_uint,
2001 loc_column_out: &mut c_uint,
2002 loc_filename_out: &RustString,
2003 message_out: &RustString,
2006 pub fn LLVMRustUnpackInlineAsmDiagnostic(
2007 DI: &'a DiagnosticInfo,
2008 cookie_out: &mut c_uint,
2009 message_out: &mut Option<&'a Twine>,
2010 instruction_out: &mut Option<&'a Value>,
2013 #[allow(improper_ctypes)]
2014 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2015 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2017 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2019 H: InlineAsmDiagHandler,
2023 #[allow(improper_ctypes)]
2024 pub fn LLVMRustWriteSMDiagnosticToString(d: &SMDiagnostic, s: &RustString);
2026 pub fn LLVMRustWriteArchive(
2029 Members: *const &RustArchiveMember<'_>,
2032 ) -> LLVMRustResult;
2033 pub fn LLVMRustArchiveMemberNew(
2034 Filename: *const c_char,
2035 Name: *const c_char,
2036 Child: Option<&ArchiveChild<'a>>,
2037 ) -> &'a mut RustArchiveMember<'a>;
2038 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
2040 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
2042 pub fn LLVMRustBuildOperandBundleDef(
2043 Name: *const c_char,
2044 Inputs: *const &'a Value,
2046 ) -> &'a mut OperandBundleDef<'a>;
2047 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
2049 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
2051 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2052 pub fn LLVMRustUnsetComdat(V: &Value);
2053 pub fn LLVMRustSetModulePICLevel(M: &Module);
2054 pub fn LLVMRustSetModulePIELevel(M: &Module);
2055 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2056 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2057 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2058 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2059 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2061 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2062 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2063 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2064 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2065 pub fn LLVMRustCreateThinLTOData(
2066 Modules: *const ThinLTOModule,
2068 PreservedSymbols: *const *const c_char,
2069 PreservedSymbolsLen: c_uint,
2070 ) -> Option<&'static mut ThinLTOData>;
2071 pub fn LLVMRustPrepareThinLTORename(Data: &ThinLTOData, Module: &Module) -> bool;
2072 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2073 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2074 pub fn LLVMRustPrepareThinLTOImport(Data: &ThinLTOData, Module: &Module) -> bool;
2075 pub fn LLVMRustGetThinLTOModuleImports(
2076 Data: *const ThinLTOData,
2077 ModuleNameCallback: ThinLTOModuleNameCallback,
2078 CallbackPayload: *mut c_void,
2080 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2081 pub fn LLVMRustParseBitcodeForLTO(
2085 Identifier: *const c_char,
2086 ) -> Option<&Module>;
2087 pub fn LLVMRustThinLTOGetDICompileUnit(
2089 CU1: &mut *mut c_void,
2090 CU2: &mut *mut c_void,
2092 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2094 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
2095 pub fn LLVMRustLinkerAdd(
2096 linker: &Linker<'_>,
2097 bytecode: *const c_char,
2098 bytecode_len: usize,
2100 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);