1 #![allow(non_camel_case_types)]
2 #![allow(non_upper_case_globals)]
4 use rustc_codegen_ssa::coverageinfo::map as coverage_map;
6 use super::debuginfo::{
7 DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
8 DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace,
9 DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable,
13 use libc::{c_char, c_int, c_uint, size_t};
14 use libc::{c_ulonglong, c_void};
16 use std::marker::PhantomData;
18 use super::RustString;
20 pub type Bool = c_uint;
22 pub const True: Bool = 1 as Bool;
23 pub const False: Bool = 0 as Bool;
25 #[derive(Copy, Clone, PartialEq)]
27 #[allow(dead_code)] // Variants constructed by C++.
28 pub enum LLVMRustResult {
33 // Rust version of the C struct with the same name in rustc_llvm/llvm-wrapper/RustWrapper.cpp.
35 pub struct LLVMRustCOFFShortExport {
36 pub name: *const c_char,
37 pub ordinal_present: bool,
38 // value of `ordinal` only important when `ordinal_present` is true
42 impl LLVMRustCOFFShortExport {
43 pub fn new(name: *const c_char, ordinal: Option<u16>) -> LLVMRustCOFFShortExport {
44 LLVMRustCOFFShortExport {
46 ordinal_present: ordinal.is_some(),
47 ordinal: ordinal.unwrap_or(0),
52 /// Translation of LLVM's MachineTypes enum, defined in llvm\include\llvm\BinaryFormat\COFF.h.
54 /// We include only architectures supported on Windows.
55 #[derive(Copy, Clone, PartialEq)]
57 pub enum LLVMMachineType {
64 /// LLVM's Module::ModFlagBehavior, defined in llvm/include/llvm/IR/Module.h.
66 /// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are
67 /// resolved according to the merge behaviors specified here. Flags differing only in merge
68 /// behavior are still considered to be in conflict.
70 /// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably,
71 /// 'Error' and 'Warning' cannot be mixed for a given flag.
72 #[derive(Copy, Clone, PartialEq)]
74 pub enum LLVMModFlagBehavior {
84 // Consts for the LLVM CallConv type, pre-cast to usize.
86 /// LLVM CallingConv::ID. Should we wrap this?
87 #[derive(Copy, Clone, PartialEq, Debug)]
93 X86StdcallCallConv = 64,
94 X86FastcallCallConv = 65,
95 ArmAapcsCallConv = 67,
103 AvrNonBlockingInterrupt = 84,
109 #[derive(Copy, Clone, PartialEq)]
113 AvailableExternallyLinkage = 1,
114 LinkOnceAnyLinkage = 2,
115 LinkOnceODRLinkage = 3,
118 AppendingLinkage = 6,
121 ExternalWeakLinkage = 9,
125 // LLVMRustVisibility
127 #[derive(Copy, Clone, PartialEq)]
128 pub enum Visibility {
136 pub enum UnnamedAddr {
142 /// LLVMDLLStorageClass
143 #[derive(Copy, Clone)]
145 pub enum DLLStorageClass {
148 DllImport = 1, // Function to be imported from DLL.
150 DllExport = 2, // Function to be accessible from DLL.
153 /// Matches LLVMRustAttribute in LLVMWrapper.h
154 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
155 /// though it is not ABI compatible (since it's a C++ enum)
157 #[derive(Copy, Clone, Debug)]
172 OptimizeForSize = 13,
180 SanitizeAddress = 21,
186 InaccessibleMemOnly = 27,
187 SanitizeHWAddress = 28,
189 StackProtectReq = 30,
190 StackProtectStrong = 31,
195 #[derive(Copy, Clone)]
197 pub enum IntPredicate {
211 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
213 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
214 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
215 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
216 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
217 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
218 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
219 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
220 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
221 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
222 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
227 /// LLVMRealPredicate
228 #[derive(Copy, Clone)]
230 pub enum RealPredicate {
231 RealPredicateFalse = 0,
246 RealPredicateTrue = 15,
250 pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
252 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
253 RealPredicate::RealPredicateFalse
255 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
256 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
257 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
258 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
259 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
260 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
261 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
262 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
263 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
264 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
265 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
266 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
267 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
268 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
269 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
270 RealPredicate::RealPredicateTrue
277 #[derive(Copy, Clone, PartialEq, Debug)]
303 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
305 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
306 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
307 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
308 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
309 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
310 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
311 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
312 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
313 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
314 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
315 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
316 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
317 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
318 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
319 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
320 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
321 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
322 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
323 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
324 TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX,
329 /// LLVMAtomicRmwBinOp
330 #[derive(Copy, Clone)]
332 pub enum AtomicRmwBinOp {
346 impl AtomicRmwBinOp {
347 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
349 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
350 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
351 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
352 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
353 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
354 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
355 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
356 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
357 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
358 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
359 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
364 /// LLVMAtomicOrdering
365 #[derive(Copy, Clone)]
367 pub enum AtomicOrdering {
372 // Consume = 3, // Not specified yet.
376 SequentiallyConsistent = 7,
379 impl AtomicOrdering {
380 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
382 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
383 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
384 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
385 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
386 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
387 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
388 AtomicOrdering::AcquireRelease
390 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
391 AtomicOrdering::SequentiallyConsistent
397 /// LLVMRustSynchronizationScope
398 #[derive(Copy, Clone)]
400 pub enum SynchronizationScope {
405 impl SynchronizationScope {
406 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
408 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
409 SynchronizationScope::SingleThread
411 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
412 SynchronizationScope::CrossThread
419 #[derive(Copy, Clone)]
427 #[derive(Copy, Clone)]
429 pub enum MetadataType {
436 MD_invariant_load = 6,
440 MD_mem_parallel_loop_access = 10,
445 /// LLVMRustAsmDialect
446 #[derive(Copy, Clone, PartialEq)]
448 pub enum AsmDialect {
453 /// LLVMRustCodeGenOptLevel
454 #[derive(Copy, Clone, PartialEq)]
456 pub enum CodeGenOptLevel {
463 /// LLVMRustPassBuilderOptLevel
465 pub enum PassBuilderOptLevel {
485 /// LLVMRustSanitizerOptions
487 pub struct SanitizerOptions {
488 pub sanitize_address: bool,
489 pub sanitize_address_recover: bool,
490 pub sanitize_memory: bool,
491 pub sanitize_memory_recover: bool,
492 pub sanitize_memory_track_origins: c_int,
493 pub sanitize_thread: bool,
494 pub sanitize_hwaddress: bool,
495 pub sanitize_hwaddress_recover: bool,
499 #[derive(Copy, Clone, PartialEq)]
501 pub enum RelocModel {
510 /// LLVMRustCodeModel
511 #[derive(Copy, Clone)]
522 /// LLVMRustDiagnosticKind
523 #[derive(Copy, Clone)]
525 #[allow(dead_code)] // Variants constructed by C++.
526 pub enum DiagnosticKind {
530 DebugMetadataVersion,
533 OptimizationRemarkMissed,
534 OptimizationRemarkAnalysis,
535 OptimizationRemarkAnalysisFPCommute,
536 OptimizationRemarkAnalysisAliasing,
537 OptimizationRemarkOther,
545 /// LLVMRustDiagnosticLevel
546 #[derive(Copy, Clone)]
548 #[allow(dead_code)] // Variants constructed by C++.
549 pub enum DiagnosticLevel {
556 /// LLVMRustArchiveKind
557 #[derive(Copy, Clone)]
559 pub enum ArchiveKind {
567 #[derive(Copy, Clone, PartialEq, Debug)]
569 #[allow(dead_code)] // Variants constructed by C++.
576 /// LLVMRustThinLTOData
578 pub type ThinLTOData;
581 /// LLVMRustThinLTOBuffer
583 pub type ThinLTOBuffer;
586 // LLVMRustModuleNameCallback
587 pub type ThinLTOModuleNameCallback =
588 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
590 /// LLVMRustThinLTOModule
592 pub struct ThinLTOModule {
593 pub identifier: *const c_char,
598 /// LLVMThreadLocalMode
599 #[derive(Copy, Clone)]
601 pub enum ThreadLocalMode {
609 /// LLVMRustChecksumKind
610 #[derive(Copy, Clone)]
612 pub enum ChecksumKind {
623 struct InvariantOpaque<'a> {
624 _marker: PhantomData<&'a mut &'a ()>,
628 // Opaque pointer types
642 pub type ConstantInt;
651 pub struct Builder<'a>(InvariantOpaque<'a>);
653 pub type MemoryBuffer;
656 pub struct PassManager<'a>(InvariantOpaque<'a>);
658 pub type PassManagerBuilder;
664 pub type TargetMachine;
670 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
672 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
677 pub type DiagnosticInfo;
680 pub type SMDiagnostic;
683 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
685 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
687 pub struct Linker<'a>(InvariantOpaque<'a>);
690 pub type DiagnosticHandler;
693 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
694 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
696 pub mod coverageinfo {
697 use super::coverage_map;
699 /// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L209-L230)
700 #[derive(Copy, Clone, Debug)]
702 pub enum RegionKind {
703 /// A CodeRegion associates some code with a counter
706 /// An ExpansionRegion represents a file expansion region that associates
707 /// a source range with the expansion of a virtual source file, such as
708 /// for a macro instantiation or #include file.
711 /// A SkippedRegion represents a source range with code that was skipped
712 /// by a preprocessor or similar means.
715 /// A GapRegion is like a CodeRegion, but its count is only set as the
716 /// line execution count when its the only region in the line.
719 /// A BranchRegion represents leaf-level boolean expressions and is
720 /// associated with two counters, each representing the number of times the
721 /// expression evaluates to true or false.
725 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
726 /// coverage map, in accordance with the
727 /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/13.0-2021-09-30/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format).
728 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
729 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
730 /// array", encoded separately), and source location (start and end positions of the represented
733 /// Matches LLVMRustCounterMappingRegion.
734 #[derive(Copy, Clone, Debug)]
736 pub struct CounterMappingRegion {
737 /// The counter type and type-dependent counter data, if any.
738 counter: coverage_map::Counter,
740 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
741 /// for the false branch of the region.
742 false_counter: coverage_map::Counter,
744 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
745 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
746 /// that, in turn, are used to look up the filename for this region.
749 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
750 /// the mapping regions created as a result of macro expansion, by checking if their file id
751 /// matches the expanded file id.
752 expanded_file_id: u32,
754 /// 1-based starting line of the mapping region.
757 /// 1-based starting column of the mapping region.
760 /// 1-based ending line of the mapping region.
763 /// 1-based ending column of the mapping region. If the high bit is set, the current
764 /// mapping region is a gap area.
770 impl CounterMappingRegion {
771 crate fn code_region(
772 counter: coverage_map::Counter,
781 false_counter: coverage_map::Counter::zero(),
788 kind: RegionKind::CodeRegion,
792 // This function might be used in the future; the LLVM API is still evolving, as is coverage
795 crate fn branch_region(
796 counter: coverage_map::Counter,
797 false_counter: coverage_map::Counter,
813 kind: RegionKind::BranchRegion,
817 // This function might be used in the future; the LLVM API is still evolving, as is coverage
820 crate fn expansion_region(
822 expanded_file_id: u32,
829 counter: coverage_map::Counter::zero(),
830 false_counter: coverage_map::Counter::zero(),
837 kind: RegionKind::ExpansionRegion,
841 // This function might be used in the future; the LLVM API is still evolving, as is coverage
844 crate fn skipped_region(
852 counter: coverage_map::Counter::zero(),
853 false_counter: coverage_map::Counter::zero(),
860 kind: RegionKind::SkippedRegion,
864 // This function might be used in the future; the LLVM API is still evolving, as is coverage
868 counter: coverage_map::Counter,
877 false_counter: coverage_map::Counter::zero(),
883 end_col: (1_u32 << 31) | end_col,
884 kind: RegionKind::GapRegion,
891 use super::{InvariantOpaque, Metadata};
892 use bitflags::bitflags;
895 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
897 pub type DIDescriptor = Metadata;
898 pub type DILocation = Metadata;
899 pub type DIScope = DIDescriptor;
900 pub type DIFile = DIScope;
901 pub type DILexicalBlock = DIScope;
902 pub type DISubprogram = DIScope;
903 pub type DINameSpace = DIScope;
904 pub type DIType = DIDescriptor;
905 pub type DIBasicType = DIType;
906 pub type DIDerivedType = DIType;
907 pub type DICompositeType = DIDerivedType;
908 pub type DIVariable = DIDescriptor;
909 pub type DIGlobalVariableExpression = DIDescriptor;
910 pub type DIArray = DIDescriptor;
911 pub type DISubrange = DIDescriptor;
912 pub type DIEnumerator = DIDescriptor;
913 pub type DITemplateTypeParameter = DIDescriptor;
915 // These values **must** match with LLVMRustDIFlags!!
919 pub struct DIFlags: u32 {
921 const FlagPrivate = 1;
922 const FlagProtected = 2;
923 const FlagPublic = 3;
924 const FlagFwdDecl = (1 << 2);
925 const FlagAppleBlock = (1 << 3);
926 const FlagBlockByrefStruct = (1 << 4);
927 const FlagVirtual = (1 << 5);
928 const FlagArtificial = (1 << 6);
929 const FlagExplicit = (1 << 7);
930 const FlagPrototyped = (1 << 8);
931 const FlagObjcClassComplete = (1 << 9);
932 const FlagObjectPointer = (1 << 10);
933 const FlagVector = (1 << 11);
934 const FlagStaticMember = (1 << 12);
935 const FlagLValueReference = (1 << 13);
936 const FlagRValueReference = (1 << 14);
937 const FlagExternalTypeRef = (1 << 15);
938 const FlagIntroducedVirtual = (1 << 18);
939 const FlagBitField = (1 << 19);
940 const FlagNoReturn = (1 << 20);
944 // These values **must** match with LLVMRustDISPFlags!!
948 pub struct DISPFlags: u32 {
949 const SPFlagZero = 0;
950 const SPFlagVirtual = 1;
951 const SPFlagPureVirtual = 2;
952 const SPFlagLocalToUnit = (1 << 2);
953 const SPFlagDefinition = (1 << 3);
954 const SPFlagOptimized = (1 << 4);
955 const SPFlagMainSubprogram = (1 << 5);
959 /// LLVMRustDebugEmissionKind
960 #[derive(Copy, Clone)]
962 pub enum DebugEmissionKind {
968 impl DebugEmissionKind {
969 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
970 use rustc_session::config::DebugInfo;
972 DebugInfo::None => DebugEmissionKind::NoDebug,
973 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
974 DebugInfo::Full => DebugEmissionKind::FullDebug,
981 pub type ModuleBuffer;
984 pub type SelfProfileBeforePassCallback =
985 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
986 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
989 pub fn LLVMRustInstallFatalErrorHandler();
991 // Create and destroy contexts.
992 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
993 pub fn LLVMContextDispose(C: &'static mut Context);
994 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
997 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
998 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
999 pub fn LLVMCloneModule(M: &Module) -> &Module;
1001 /// Data layout. See Module::getDataLayout.
1002 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1003 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1005 /// See Module::setModuleInlineAsm.
1006 pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
1007 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1009 /// See llvm::LLVMTypeKind::getTypeID.
1010 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1012 // Operations on integer types
1013 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1014 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1015 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1016 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1017 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1018 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1020 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1022 // Operations on real types
1023 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1024 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1026 // Operations on function types
1027 pub fn LLVMFunctionType<'a>(
1028 ReturnType: &'a Type,
1029 ParamTypes: *const &'a Type,
1033 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1034 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1036 // Operations on struct types
1037 pub fn LLVMStructTypeInContext<'a>(
1039 ElementTypes: *const &'a Type,
1040 ElementCount: c_uint,
1044 // Operations on array, pointer, and vector types (sequence types)
1045 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1046 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1047 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1049 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1050 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1052 // Operations on other types
1053 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1054 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1056 // Operations on all values
1057 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1058 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1059 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1060 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1061 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1062 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1063 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1065 // Operations on constants of any type
1066 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1067 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1069 // Operations on metadata
1070 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1071 pub fn LLVMMDNodeInContext<'a>(
1073 Vals: *const &'a Value,
1076 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1078 // Operations on scalar constants
1079 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1080 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1081 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1082 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1083 pub fn LLVMRustConstInt128Get(
1084 ConstantVal: &ConstantInt,
1090 // Operations on composite constants
1091 pub fn LLVMConstStringInContext(
1095 DontNullTerminate: Bool,
1097 pub fn LLVMConstStructInContext<'a>(
1099 ConstantVals: *const &'a Value,
1104 pub fn LLVMConstArray<'a>(
1105 ElementTy: &'a Type,
1106 ConstantVals: *const &'a Value,
1109 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1111 // Constant expressions
1112 pub fn LLVMRustConstInBoundsGEP2<'a>(
1114 ConstantVal: &'a Value,
1115 ConstantIndices: *const &'a Value,
1118 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1119 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1120 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1121 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1122 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1123 pub fn LLVMConstExtractValue(
1124 AggConstant: &Value,
1125 IdxList: *const c_uint,
1129 // Operations on global variables, functions, and aliases (globals)
1130 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1131 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1132 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1133 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1134 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1135 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1136 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1137 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1138 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1139 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1141 // Operations on global variables
1142 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1143 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1144 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1145 pub fn LLVMRustGetOrInsertGlobal<'a>(
1147 Name: *const c_char,
1151 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1152 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1153 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1154 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1155 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1156 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1157 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1158 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
1159 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1160 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1161 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1162 pub fn LLVMRustGetNamedValue(
1164 Name: *const c_char,
1166 ) -> Option<&Value>;
1167 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1169 // Operations on functions
1170 pub fn LLVMRustGetOrInsertFunction<'a>(
1172 Name: *const c_char,
1174 FunctionTy: &'a Type,
1176 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1177 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
1178 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
1179 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
1180 pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type);
1181 pub fn LLVMRustAddStructRetAttr(Fn: &Value, index: c_uint, ty: &Type);
1182 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
1183 pub fn LLVMRustAddFunctionAttrStringValue(
1186 Name: *const c_char,
1187 Value: *const c_char,
1189 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
1191 // Operations on parameters
1192 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1193 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1194 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1196 // Operations on basic blocks
1197 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1198 pub fn LLVMAppendBasicBlockInContext<'a>(
1201 Name: *const c_char,
1202 ) -> &'a BasicBlock;
1204 // Operations on instructions
1205 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1206 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1208 // Operations on call sites
1209 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1210 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
1211 pub fn LLVMRustAddCallSiteAttrString(Instr: &Value, index: c_uint, Name: *const c_char);
1212 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
1213 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
1214 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
1215 pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
1216 pub fn LLVMRustAddStructRetCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
1218 // Operations on load/store instructions (only)
1219 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1221 // Operations on phi nodes
1222 pub fn LLVMAddIncoming<'a>(
1224 IncomingValues: *const &'a Value,
1225 IncomingBlocks: *const &'a BasicBlock,
1229 // Instruction builders
1230 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1231 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1232 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1233 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1236 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1239 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1240 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1241 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1242 pub fn LLVMBuildCondBr<'a>(
1245 Then: &'a BasicBlock,
1246 Else: &'a BasicBlock,
1248 pub fn LLVMBuildSwitch<'a>(
1251 Else: &'a BasicBlock,
1254 pub fn LLVMRustBuildInvoke<'a>(
1258 Args: *const &'a Value,
1260 Then: &'a BasicBlock,
1261 Catch: &'a BasicBlock,
1262 Bundle: Option<&OperandBundleDef<'a>>,
1263 Name: *const c_char,
1265 pub fn LLVMBuildLandingPad<'a>(
1268 PersFn: Option<&'a Value>,
1270 Name: *const c_char,
1272 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1273 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1275 pub fn LLVMRustBuildCleanupPad<'a>(
1277 ParentPad: Option<&'a Value>,
1279 Args: *const &'a Value,
1280 Name: *const c_char,
1281 ) -> Option<&'a Value>;
1282 pub fn LLVMRustBuildCleanupRet<'a>(
1284 CleanupPad: &'a Value,
1285 UnwindBB: Option<&'a BasicBlock>,
1286 ) -> Option<&'a Value>;
1287 pub fn LLVMRustBuildCatchPad<'a>(
1289 ParentPad: &'a Value,
1291 Args: *const &'a Value,
1292 Name: *const c_char,
1293 ) -> Option<&'a Value>;
1294 pub fn LLVMRustBuildCatchRet<'a>(
1298 ) -> Option<&'a Value>;
1299 pub fn LLVMRustBuildCatchSwitch<'a>(
1300 Builder: &Builder<'a>,
1301 ParentPad: Option<&'a Value>,
1302 BB: Option<&'a BasicBlock>,
1303 NumHandlers: c_uint,
1304 Name: *const c_char,
1305 ) -> Option<&'a Value>;
1306 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1307 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1309 // Add a case to the switch instruction
1310 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1312 // Add a clause to the landing pad instruction
1313 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1315 // Set the cleanup on a landing pad instruction
1316 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1319 pub fn LLVMBuildAdd<'a>(
1323 Name: *const c_char,
1325 pub fn LLVMBuildFAdd<'a>(
1329 Name: *const c_char,
1331 pub fn LLVMBuildSub<'a>(
1335 Name: *const c_char,
1337 pub fn LLVMBuildFSub<'a>(
1341 Name: *const c_char,
1343 pub fn LLVMBuildMul<'a>(
1347 Name: *const c_char,
1349 pub fn LLVMBuildFMul<'a>(
1353 Name: *const c_char,
1355 pub fn LLVMBuildUDiv<'a>(
1359 Name: *const c_char,
1361 pub fn LLVMBuildExactUDiv<'a>(
1365 Name: *const c_char,
1367 pub fn LLVMBuildSDiv<'a>(
1371 Name: *const c_char,
1373 pub fn LLVMBuildExactSDiv<'a>(
1377 Name: *const c_char,
1379 pub fn LLVMBuildFDiv<'a>(
1383 Name: *const c_char,
1385 pub fn LLVMBuildURem<'a>(
1389 Name: *const c_char,
1391 pub fn LLVMBuildSRem<'a>(
1395 Name: *const c_char,
1397 pub fn LLVMBuildFRem<'a>(
1401 Name: *const c_char,
1403 pub fn LLVMBuildShl<'a>(
1407 Name: *const c_char,
1409 pub fn LLVMBuildLShr<'a>(
1413 Name: *const c_char,
1415 pub fn LLVMBuildAShr<'a>(
1419 Name: *const c_char,
1421 pub fn LLVMBuildNSWAdd<'a>(
1425 Name: *const c_char,
1427 pub fn LLVMBuildNUWAdd<'a>(
1431 Name: *const c_char,
1433 pub fn LLVMBuildNSWSub<'a>(
1437 Name: *const c_char,
1439 pub fn LLVMBuildNUWSub<'a>(
1443 Name: *const c_char,
1445 pub fn LLVMBuildNSWMul<'a>(
1449 Name: *const c_char,
1451 pub fn LLVMBuildNUWMul<'a>(
1455 Name: *const c_char,
1457 pub fn LLVMBuildAnd<'a>(
1461 Name: *const c_char,
1463 pub fn LLVMBuildOr<'a>(
1467 Name: *const c_char,
1469 pub fn LLVMBuildXor<'a>(
1473 Name: *const c_char,
1475 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1476 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1477 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1478 pub fn LLVMRustSetFastMath(Instr: &Value);
1481 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1482 pub fn LLVMBuildArrayAlloca<'a>(
1486 Name: *const c_char,
1488 pub fn LLVMBuildLoad2<'a>(
1491 PointerVal: &'a Value,
1492 Name: *const c_char,
1495 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1497 pub fn LLVMBuildGEP2<'a>(
1501 Indices: *const &'a Value,
1503 Name: *const c_char,
1505 pub fn LLVMBuildInBoundsGEP2<'a>(
1509 Indices: *const &'a Value,
1511 Name: *const c_char,
1513 pub fn LLVMBuildStructGEP2<'a>(
1518 Name: *const c_char,
1522 pub fn LLVMBuildTrunc<'a>(
1526 Name: *const c_char,
1528 pub fn LLVMBuildZExt<'a>(
1532 Name: *const c_char,
1534 pub fn LLVMBuildSExt<'a>(
1538 Name: *const c_char,
1540 pub fn LLVMBuildFPToUI<'a>(
1544 Name: *const c_char,
1546 pub fn LLVMBuildFPToSI<'a>(
1550 Name: *const c_char,
1552 pub fn LLVMBuildUIToFP<'a>(
1556 Name: *const c_char,
1558 pub fn LLVMBuildSIToFP<'a>(
1562 Name: *const c_char,
1564 pub fn LLVMBuildFPTrunc<'a>(
1568 Name: *const c_char,
1570 pub fn LLVMBuildFPExt<'a>(
1574 Name: *const c_char,
1576 pub fn LLVMBuildPtrToInt<'a>(
1580 Name: *const c_char,
1582 pub fn LLVMBuildIntToPtr<'a>(
1586 Name: *const c_char,
1588 pub fn LLVMBuildBitCast<'a>(
1592 Name: *const c_char,
1594 pub fn LLVMBuildPointerCast<'a>(
1598 Name: *const c_char,
1600 pub fn LLVMRustBuildIntCast<'a>(
1608 pub fn LLVMBuildICmp<'a>(
1613 Name: *const c_char,
1615 pub fn LLVMBuildFCmp<'a>(
1620 Name: *const c_char,
1623 // Miscellaneous instructions
1624 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1625 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1626 pub fn LLVMRustBuildCall<'a>(
1630 Args: *const &'a Value,
1632 Bundle: Option<&OperandBundleDef<'a>>,
1634 pub fn LLVMRustBuildMemCpy<'a>(
1643 pub fn LLVMRustBuildMemMove<'a>(
1652 pub fn LLVMRustBuildMemSet<'a>(
1660 pub fn LLVMBuildSelect<'a>(
1665 Name: *const c_char,
1667 pub fn LLVMBuildVAArg<'a>(
1671 Name: *const c_char,
1673 pub fn LLVMBuildExtractElement<'a>(
1677 Name: *const c_char,
1679 pub fn LLVMBuildInsertElement<'a>(
1684 Name: *const c_char,
1686 pub fn LLVMBuildShuffleVector<'a>(
1691 Name: *const c_char,
1693 pub fn LLVMBuildExtractValue<'a>(
1697 Name: *const c_char,
1699 pub fn LLVMBuildInsertValue<'a>(
1704 Name: *const c_char,
1707 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1712 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1717 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1718 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1719 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1720 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1721 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1722 pub fn LLVMRustBuildVectorReduceMin<'a>(
1727 pub fn LLVMRustBuildVectorReduceMax<'a>(
1732 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1737 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1743 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1744 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1746 // Atomic Operations
1747 pub fn LLVMRustBuildAtomicLoad<'a>(
1749 ElementType: &'a Type,
1750 PointerVal: &'a Value,
1751 Name: *const c_char,
1752 Order: AtomicOrdering,
1755 pub fn LLVMRustBuildAtomicStore<'a>(
1759 Order: AtomicOrdering,
1762 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1767 Order: AtomicOrdering,
1768 FailureOrder: AtomicOrdering,
1772 pub fn LLVMBuildAtomicRMW<'a>(
1777 Order: AtomicOrdering,
1778 SingleThreaded: Bool,
1781 pub fn LLVMRustBuildAtomicFence(
1783 Order: AtomicOrdering,
1784 Scope: SynchronizationScope,
1787 /// Writes a module to the specified path. Returns 0 on success.
1788 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1790 /// Creates a pass manager.
1791 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1793 /// Creates a function-by-function pass manager
1794 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1796 /// Disposes a pass manager.
1797 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1799 /// Runs a pass manager on a module.
1800 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1802 pub fn LLVMInitializePasses();
1804 pub fn LLVMTimeTraceProfilerInitialize();
1806 pub fn LLVMTimeTraceProfilerFinishThread();
1808 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1810 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1812 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1813 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1814 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1815 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1816 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1817 PMB: &PassManagerBuilder,
1820 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1821 PMB: &PassManagerBuilder,
1822 PM: &PassManager<'_>,
1825 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1826 PMB: &PassManagerBuilder,
1827 PM: &PassManager<'_>,
1829 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1830 PMB: &PassManagerBuilder,
1831 PM: &PassManager<'_>,
1835 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1836 PMB: &PassManagerBuilder,
1837 PM: &PassManager<'_>,
1840 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1842 pub fn LLVMDisposeMessage(message: *mut c_char);
1844 pub fn LLVMIsMultithreaded() -> Bool;
1846 /// Returns a string describing the last error caused by an LLVMRust* call.
1847 pub fn LLVMRustGetLastError() -> *const c_char;
1849 /// Print the pass timings since static dtors aren't picking them up.
1850 pub fn LLVMRustPrintPassTimings();
1852 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1854 pub fn LLVMStructSetBody<'a>(
1856 ElementTypes: *const &'a Type,
1857 ElementCount: c_uint,
1861 /// Prepares inline assembly.
1862 pub fn LLVMRustInlineAsm(
1864 AsmString: *const c_char,
1865 AsmStringLen: size_t,
1866 Constraints: *const c_char,
1867 ConstraintsLen: size_t,
1870 Dialect: AsmDialect,
1873 pub fn LLVMRustInlineAsmVerify(
1875 Constraints: *const c_char,
1876 ConstraintsLen: size_t,
1879 #[allow(improper_ctypes)]
1880 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1881 Filenames: *const *const c_char,
1882 FilenamesLen: size_t,
1883 BufferOut: &RustString,
1886 #[allow(improper_ctypes)]
1887 pub fn LLVMRustCoverageWriteMappingToBuffer(
1888 VirtualFileMappingIDs: *const c_uint,
1889 NumVirtualFileMappingIDs: c_uint,
1890 Expressions: *const coverage_map::CounterExpression,
1891 NumExpressions: c_uint,
1892 MappingRegions: *const coverageinfo::CounterMappingRegion,
1893 NumMappingRegions: c_uint,
1894 BufferOut: &RustString,
1897 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1898 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1899 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1901 #[allow(improper_ctypes)]
1902 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1904 #[allow(improper_ctypes)]
1905 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1907 #[allow(improper_ctypes)]
1908 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1910 pub fn LLVMRustCoverageMappingVersion() -> u32;
1911 pub fn LLVMRustDebugMetadataVersion() -> u32;
1912 pub fn LLVMRustVersionMajor() -> u32;
1913 pub fn LLVMRustVersionMinor() -> u32;
1914 pub fn LLVMRustVersionPatch() -> u32;
1916 pub fn LLVMRustIsRustLLVM() -> bool;
1918 /// Add LLVM module flags.
1920 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1921 /// "compatible" means depends on the merge behaviors involved.
1922 pub fn LLVMRustAddModuleFlag(
1924 merge_behavior: LLVMModFlagBehavior,
1925 name: *const c_char,
1929 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1931 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1933 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1935 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1937 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1938 Builder: &DIBuilder<'a>,
1941 Producer: *const c_char,
1942 ProducerLen: size_t,
1944 Flags: *const c_char,
1946 SplitName: *const c_char,
1947 SplitNameLen: size_t,
1948 kind: DebugEmissionKind,
1950 SplitDebugInlining: bool,
1951 ) -> &'a DIDescriptor;
1953 pub fn LLVMRustDIBuilderCreateFile<'a>(
1954 Builder: &DIBuilder<'a>,
1955 Filename: *const c_char,
1956 FilenameLen: size_t,
1957 Directory: *const c_char,
1958 DirectoryLen: size_t,
1959 CSKind: ChecksumKind,
1960 Checksum: *const c_char,
1961 ChecksumLen: size_t,
1964 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1965 Builder: &DIBuilder<'a>,
1966 ParameterTypes: &'a DIArray,
1967 ) -> &'a DICompositeType;
1969 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1970 Builder: &DIBuilder<'a>,
1971 Scope: &'a DIDescriptor,
1972 Name: *const c_char,
1974 LinkageName: *const c_char,
1975 LinkageNameLen: size_t,
1982 MaybeFn: Option<&'a Value>,
1983 TParam: &'a DIArray,
1984 Decl: Option<&'a DIDescriptor>,
1985 ) -> &'a DISubprogram;
1987 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
1988 Builder: &DIBuilder<'a>,
1989 Name: *const c_char,
1993 ) -> &'a DIBasicType;
1995 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
1996 Builder: &DIBuilder<'a>,
1997 Type: &'a DIBasicType,
1998 Name: *const c_char,
2002 Scope: Option<&'a DIScope>,
2003 ) -> &'a DIDerivedType;
2005 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2006 Builder: &DIBuilder<'a>,
2007 PointeeTy: &'a DIType,
2010 AddressSpace: c_uint,
2011 Name: *const c_char,
2013 ) -> &'a DIDerivedType;
2015 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2016 Builder: &DIBuilder<'a>,
2017 Scope: Option<&'a DIDescriptor>,
2018 Name: *const c_char,
2025 DerivedFrom: Option<&'a DIType>,
2026 Elements: &'a DIArray,
2027 RunTimeLang: c_uint,
2028 VTableHolder: Option<&'a DIType>,
2029 UniqueId: *const c_char,
2030 UniqueIdLen: size_t,
2031 ) -> &'a DICompositeType;
2033 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2034 Builder: &DIBuilder<'a>,
2035 Scope: &'a DIDescriptor,
2036 Name: *const c_char,
2045 ) -> &'a DIDerivedType;
2047 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2048 Builder: &DIBuilder<'a>,
2050 Name: *const c_char,
2057 Discriminant: Option<&'a Value>,
2062 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2063 Builder: &DIBuilder<'a>,
2068 ) -> &'a DILexicalBlock;
2070 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2071 Builder: &DIBuilder<'a>,
2074 ) -> &'a DILexicalBlock;
2076 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2077 Builder: &DIBuilder<'a>,
2078 Context: Option<&'a DIScope>,
2079 Name: *const c_char,
2081 LinkageName: *const c_char,
2082 LinkageNameLen: size_t,
2086 isLocalToUnit: bool,
2088 Decl: Option<&'a DIDescriptor>,
2090 ) -> &'a DIGlobalVariableExpression;
2092 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2093 Builder: &DIBuilder<'a>,
2095 Scope: &'a DIDescriptor,
2096 Name: *const c_char,
2101 AlwaysPreserve: bool,
2105 ) -> &'a DIVariable;
2107 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2108 Builder: &DIBuilder<'a>,
2112 Subscripts: &'a DIArray,
2115 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2116 Builder: &DIBuilder<'a>,
2119 ) -> &'a DISubrange;
2121 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2122 Builder: &DIBuilder<'a>,
2123 Ptr: *const Option<&'a DIDescriptor>,
2127 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2128 Builder: &DIBuilder<'a>,
2130 VarInfo: &'a DIVariable,
2131 AddrOps: *const u64,
2132 AddrOpsCount: c_uint,
2134 InsertAtEnd: &'a BasicBlock,
2137 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2138 Builder: &DIBuilder<'a>,
2139 Name: *const c_char,
2143 ) -> &'a DIEnumerator;
2145 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2146 Builder: &DIBuilder<'a>,
2148 Name: *const c_char,
2154 Elements: &'a DIArray,
2155 ClassType: &'a DIType,
2159 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2160 Builder: &DIBuilder<'a>,
2161 Scope: Option<&'a DIScope>,
2162 Name: *const c_char,
2169 Elements: Option<&'a DIArray>,
2170 RunTimeLang: c_uint,
2171 UniqueId: *const c_char,
2172 UniqueIdLen: size_t,
2175 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2176 Builder: &DIBuilder<'a>,
2178 Name: *const c_char,
2185 Discriminator: Option<&'a DIDerivedType>,
2186 Elements: &'a DIArray,
2187 UniqueId: *const c_char,
2188 UniqueIdLen: size_t,
2189 ) -> &'a DIDerivedType;
2191 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2193 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2194 Builder: &DIBuilder<'a>,
2195 Scope: Option<&'a DIScope>,
2196 Name: *const c_char,
2199 ) -> &'a DITemplateTypeParameter;
2201 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2202 Builder: &DIBuilder<'a>,
2203 Scope: Option<&'a DIScope>,
2204 Name: *const c_char,
2206 ExportSymbols: bool,
2207 ) -> &'a DINameSpace;
2209 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2210 Builder: &DIBuilder<'a>,
2211 CompositeType: &'a DIType,
2212 Elements: Option<&'a DIArray>,
2213 Params: Option<&'a DIArray>,
2216 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2220 InlinedAt: Option<&'a DILocation>,
2221 ) -> &'a DILocation;
2222 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2223 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2225 #[allow(improper_ctypes)]
2226 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2227 #[allow(improper_ctypes)]
2228 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2230 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2232 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
2233 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2234 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2235 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2236 pub fn LLVMRustCreateMemorySanitizerPass(
2237 TrackOrigins: c_int,
2239 ) -> &'static mut Pass;
2240 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2241 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2242 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2243 pub fn LLVMRustAddLastExtensionPasses(
2244 PMB: &PassManagerBuilder,
2245 Passes: *const &'static mut Pass,
2249 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2251 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2252 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2253 pub fn LLVMRustGetTargetFeature(
2256 Feature: &mut *const c_char,
2257 Desc: &mut *const c_char,
2260 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2261 pub fn LLVMRustCreateTargetMachine(
2262 Triple: *const c_char,
2264 Features: *const c_char,
2268 Level: CodeGenOptLevel,
2270 FunctionSections: bool,
2272 UniqueSectionNames: bool,
2273 TrapUnreachable: bool,
2276 EmitStackSizeSection: bool,
2277 RelaxELFRelocations: bool,
2279 SplitDwarfFile: *const c_char,
2280 ) -> Option<&'static mut TargetMachine>;
2281 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2282 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2283 PMB: &'a PassManagerBuilder,
2285 DisableSimplifyLibCalls: bool,
2287 pub fn LLVMRustConfigurePassManagerBuilder(
2288 PMB: &PassManagerBuilder,
2289 OptLevel: CodeGenOptLevel,
2290 MergeFunctions: bool,
2292 LoopVectorize: bool,
2293 PrepareForThinLTO: bool,
2294 PGOGenPath: *const c_char,
2295 PGOUsePath: *const c_char,
2296 PGOSampleUsePath: *const c_char,
2298 pub fn LLVMRustAddLibraryInfo<'a>(
2299 PM: &PassManager<'a>,
2301 DisableSimplifyLibCalls: bool,
2303 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2304 pub fn LLVMRustWriteOutputFile<'a>(
2305 T: &'a TargetMachine,
2306 PM: &PassManager<'a>,
2308 Output: *const c_char,
2309 DwoOutput: *const c_char,
2311 ) -> LLVMRustResult;
2312 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2314 TM: &'a TargetMachine,
2315 OptLevel: PassBuilderOptLevel,
2317 NoPrepopulatePasses: bool,
2319 UseThinLTOBuffers: bool,
2320 MergeFunctions: bool,
2323 LoopVectorize: bool,
2324 DisableSimplifyLibCalls: bool,
2325 EmitLifetimeMarkers: bool,
2326 SanitizerOptions: Option<&SanitizerOptions>,
2327 PGOGenPath: *const c_char,
2328 PGOUsePath: *const c_char,
2329 InstrumentCoverage: bool,
2330 InstrumentGCOV: bool,
2331 PGOSampleUsePath: *const c_char,
2332 DebugInfoForProfiling: bool,
2333 llvm_selfprofiler: *mut c_void,
2334 begin_callback: SelfProfileBeforePassCallback,
2335 end_callback: SelfProfileAfterPassCallback,
2336 ExtraPasses: *const c_char,
2337 ExtraPassesLen: size_t,
2338 LLVMPlugins: *const c_char,
2339 LLVMPluginsLen: size_t,
2340 ) -> LLVMRustResult;
2341 pub fn LLVMRustPrintModule(
2343 Output: *const c_char,
2344 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2345 ) -> LLVMRustResult;
2346 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2347 pub fn LLVMRustPrintPasses();
2348 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
2349 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2350 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2351 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2353 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2354 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2355 pub fn LLVMRustArchiveIteratorNext<'a>(
2356 AIR: &ArchiveIterator<'a>,
2357 ) -> Option<&'a mut ArchiveChild<'a>>;
2358 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2359 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2360 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2361 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2362 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2364 #[allow(improper_ctypes)]
2365 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2367 #[allow(improper_ctypes)]
2368 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2369 DI: &'a DiagnosticInfo,
2370 pass_name_out: &RustString,
2371 function_out: &mut Option<&'a Value>,
2372 loc_line_out: &mut c_uint,
2373 loc_column_out: &mut c_uint,
2374 loc_filename_out: &RustString,
2375 message_out: &RustString,
2378 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2379 DI: &'a DiagnosticInfo,
2380 level_out: &mut DiagnosticLevel,
2381 cookie_out: &mut c_uint,
2382 message_out: &mut Option<&'a Twine>,
2385 #[allow(improper_ctypes)]
2386 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2387 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2389 pub fn LLVMRustGetSMDiagnostic<'a>(
2390 DI: &'a DiagnosticInfo,
2391 cookie_out: &mut c_uint,
2392 ) -> &'a SMDiagnostic;
2394 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2396 H: InlineAsmDiagHandlerTy,
2400 #[allow(improper_ctypes)]
2401 pub fn LLVMRustUnpackSMDiagnostic(
2403 message_out: &RustString,
2404 buffer_out: &RustString,
2405 level_out: &mut DiagnosticLevel,
2406 loc_out: &mut c_uint,
2407 ranges_out: *mut c_uint,
2408 num_ranges: &mut usize,
2411 pub fn LLVMRustWriteArchive(
2414 Members: *const &RustArchiveMember<'_>,
2417 ) -> LLVMRustResult;
2418 pub fn LLVMRustArchiveMemberNew<'a>(
2419 Filename: *const c_char,
2420 Name: *const c_char,
2421 Child: Option<&ArchiveChild<'a>>,
2422 ) -> &'a mut RustArchiveMember<'a>;
2423 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2425 pub fn LLVMRustWriteImportLibrary(
2426 ImportName: *const c_char,
2427 Path: *const c_char,
2428 Exports: *const LLVMRustCOFFShortExport,
2432 ) -> LLVMRustResult;
2434 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2436 pub fn LLVMRustBuildOperandBundleDef<'a>(
2437 Name: *const c_char,
2438 Inputs: *const &'a Value,
2440 ) -> &'a mut OperandBundleDef<'a>;
2441 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2443 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2445 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2446 pub fn LLVMRustUnsetComdat(V: &Value);
2447 pub fn LLVMRustSetModulePICLevel(M: &Module);
2448 pub fn LLVMRustSetModulePIELevel(M: &Module);
2449 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2450 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2451 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2452 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2453 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2454 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2456 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2457 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2458 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2459 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2460 pub fn LLVMRustCreateThinLTOData(
2461 Modules: *const ThinLTOModule,
2463 PreservedSymbols: *const *const c_char,
2464 PreservedSymbolsLen: c_uint,
2465 ) -> Option<&'static mut ThinLTOData>;
2466 pub fn LLVMRustPrepareThinLTORename(
2469 Target: &TargetMachine,
2471 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2472 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2473 pub fn LLVMRustPrepareThinLTOImport(
2476 Target: &TargetMachine,
2478 pub fn LLVMRustGetThinLTOModuleImports(
2479 Data: *const ThinLTOData,
2480 ModuleNameCallback: ThinLTOModuleNameCallback,
2481 CallbackPayload: *mut c_void,
2483 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2484 pub fn LLVMRustParseBitcodeForLTO(
2488 Identifier: *const c_char,
2489 ) -> Option<&Module>;
2490 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2493 out_len: &mut usize,
2495 pub fn LLVMRustLTOGetDICompileUnit(M: &Module, CU1: &mut *mut c_void, CU2: &mut *mut c_void);
2496 pub fn LLVMRustLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2498 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2499 pub fn LLVMRustLinkerAdd(
2500 linker: &Linker<'_>,
2501 bytecode: *const c_char,
2502 bytecode_len: usize,
2504 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2505 #[allow(improper_ctypes)]
2506 pub fn LLVMRustComputeLTOCacheKey(
2507 key_out: &RustString,
2508 mod_id: *const c_char,
2512 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2513 pub fn LLVMRustContextSetDiagnosticHandler(
2515 diagnostic_handler: Option<&DiagnosticHandler>,
2517 pub fn LLVMRustContextConfigureDiagnosticHandler(
2519 diagnostic_handler_callback: DiagnosticHandlerTy,
2520 diagnostic_handler_context: *mut c_void,
2521 remark_all_passes: bool,
2522 remark_passes: *const *const c_char,
2523 remark_passes_len: usize,