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)]
158 pub enum AttributeKind {
172 OptimizeForSize = 13,
180 SanitizeAddress = 21,
186 InaccessibleMemOnly = 27,
187 SanitizeHWAddress = 28,
189 StackProtectReq = 30,
190 StackProtectStrong = 31,
197 #[derive(Copy, Clone)]
199 pub enum IntPredicate {
213 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
215 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
216 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
217 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
218 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
219 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
220 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
221 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
222 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
223 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
224 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
229 /// LLVMRealPredicate
230 #[derive(Copy, Clone)]
232 pub enum RealPredicate {
233 RealPredicateFalse = 0,
248 RealPredicateTrue = 15,
252 pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
254 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
255 RealPredicate::RealPredicateFalse
257 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
258 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
259 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
260 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
261 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
262 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
263 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
264 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
265 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
266 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
267 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
268 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
269 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
270 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
271 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
272 RealPredicate::RealPredicateTrue
279 #[derive(Copy, Clone, PartialEq, Debug)]
305 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
307 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
308 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
309 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
310 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
311 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
312 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
313 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
314 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
315 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
316 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
317 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
318 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
319 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
320 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
321 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
322 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
323 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
324 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
325 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
326 TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX,
331 /// LLVMAtomicRmwBinOp
332 #[derive(Copy, Clone)]
334 pub enum AtomicRmwBinOp {
348 impl AtomicRmwBinOp {
349 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
351 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
352 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
353 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
354 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
355 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
356 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
357 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
358 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
359 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
360 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
361 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
366 /// LLVMAtomicOrdering
367 #[derive(Copy, Clone)]
369 pub enum AtomicOrdering {
374 // Consume = 3, // Not specified yet.
378 SequentiallyConsistent = 7,
381 impl AtomicOrdering {
382 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
384 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
385 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
386 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
387 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
388 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
389 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
390 AtomicOrdering::AcquireRelease
392 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
393 AtomicOrdering::SequentiallyConsistent
399 /// LLVMRustSynchronizationScope
400 #[derive(Copy, Clone)]
402 pub enum SynchronizationScope {
407 impl SynchronizationScope {
408 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
410 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
411 SynchronizationScope::SingleThread
413 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
414 SynchronizationScope::CrossThread
421 #[derive(Copy, Clone)]
429 #[derive(Copy, Clone)]
431 pub enum MetadataType {
438 MD_invariant_load = 6,
442 MD_mem_parallel_loop_access = 10,
449 /// LLVMRustAsmDialect
450 #[derive(Copy, Clone, PartialEq)]
452 pub enum AsmDialect {
457 /// LLVMRustCodeGenOptLevel
458 #[derive(Copy, Clone, PartialEq)]
460 pub enum CodeGenOptLevel {
467 /// LLVMRustPassBuilderOptLevel
469 pub enum PassBuilderOptLevel {
489 /// LLVMRustSanitizerOptions
491 pub struct SanitizerOptions {
492 pub sanitize_address: bool,
493 pub sanitize_address_recover: bool,
494 pub sanitize_memory: bool,
495 pub sanitize_memory_recover: bool,
496 pub sanitize_memory_track_origins: c_int,
497 pub sanitize_thread: bool,
498 pub sanitize_hwaddress: bool,
499 pub sanitize_hwaddress_recover: bool,
503 #[derive(Copy, Clone, PartialEq)]
505 pub enum RelocModel {
514 /// LLVMRustCodeModel
515 #[derive(Copy, Clone)]
526 /// LLVMRustDiagnosticKind
527 #[derive(Copy, Clone)]
529 #[allow(dead_code)] // Variants constructed by C++.
530 pub enum DiagnosticKind {
534 DebugMetadataVersion,
537 OptimizationRemarkMissed,
538 OptimizationRemarkAnalysis,
539 OptimizationRemarkAnalysisFPCommute,
540 OptimizationRemarkAnalysisAliasing,
541 OptimizationRemarkOther,
549 /// LLVMRustDiagnosticLevel
550 #[derive(Copy, Clone)]
552 #[allow(dead_code)] // Variants constructed by C++.
553 pub enum DiagnosticLevel {
560 /// LLVMRustArchiveKind
561 #[derive(Copy, Clone)]
563 pub enum ArchiveKind {
571 #[derive(Copy, Clone, PartialEq, Debug)]
573 #[allow(dead_code)] // Variants constructed by C++.
580 // LLVMRustThinLTOData
582 pub type ThinLTOData;
585 // LLVMRustThinLTOBuffer
587 pub type ThinLTOBuffer;
590 // LLVMRustModuleNameCallback
591 pub type ThinLTOModuleNameCallback =
592 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
594 /// LLVMRustThinLTOModule
596 pub struct ThinLTOModule {
597 pub identifier: *const c_char,
602 /// LLVMThreadLocalMode
603 #[derive(Copy, Clone)]
605 pub enum ThreadLocalMode {
613 /// LLVMRustChecksumKind
614 #[derive(Copy, Clone)]
616 pub enum ChecksumKind {
627 struct InvariantOpaque<'a> {
628 _marker: PhantomData<&'a mut &'a ()>,
632 // Opaque pointer types
646 pub type ConstantInt;
658 pub struct Builder<'a>(InvariantOpaque<'a>);
660 pub type MemoryBuffer;
663 pub struct PassManager<'a>(InvariantOpaque<'a>);
665 pub type PassManagerBuilder;
671 pub type TargetMachine;
677 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
679 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
684 pub type DiagnosticInfo;
687 pub type SMDiagnostic;
690 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
692 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
694 pub struct Linker<'a>(InvariantOpaque<'a>);
697 pub type DiagnosticHandler;
700 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
701 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
703 pub mod coverageinfo {
704 use super::coverage_map;
706 /// 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)
707 #[derive(Copy, Clone, Debug)]
709 pub enum RegionKind {
710 /// A CodeRegion associates some code with a counter
713 /// An ExpansionRegion represents a file expansion region that associates
714 /// a source range with the expansion of a virtual source file, such as
715 /// for a macro instantiation or #include file.
718 /// A SkippedRegion represents a source range with code that was skipped
719 /// by a preprocessor or similar means.
722 /// A GapRegion is like a CodeRegion, but its count is only set as the
723 /// line execution count when its the only region in the line.
726 /// A BranchRegion represents leaf-level boolean expressions and is
727 /// associated with two counters, each representing the number of times the
728 /// expression evaluates to true or false.
732 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
733 /// coverage map, in accordance with the
734 /// [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).
735 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
736 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
737 /// array", encoded separately), and source location (start and end positions of the represented
740 /// Matches LLVMRustCounterMappingRegion.
741 #[derive(Copy, Clone, Debug)]
743 pub struct CounterMappingRegion {
744 /// The counter type and type-dependent counter data, if any.
745 counter: coverage_map::Counter,
747 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
748 /// for the false branch of the region.
749 false_counter: coverage_map::Counter,
751 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
752 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
753 /// that, in turn, are used to look up the filename for this region.
756 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
757 /// the mapping regions created as a result of macro expansion, by checking if their file id
758 /// matches the expanded file id.
759 expanded_file_id: u32,
761 /// 1-based starting line of the mapping region.
764 /// 1-based starting column of the mapping region.
767 /// 1-based ending line of the mapping region.
770 /// 1-based ending column of the mapping region. If the high bit is set, the current
771 /// mapping region is a gap area.
777 impl CounterMappingRegion {
778 crate fn code_region(
779 counter: coverage_map::Counter,
788 false_counter: coverage_map::Counter::zero(),
795 kind: RegionKind::CodeRegion,
799 // This function might be used in the future; the LLVM API is still evolving, as is coverage
802 crate fn branch_region(
803 counter: coverage_map::Counter,
804 false_counter: coverage_map::Counter,
820 kind: RegionKind::BranchRegion,
824 // This function might be used in the future; the LLVM API is still evolving, as is coverage
827 crate fn expansion_region(
829 expanded_file_id: u32,
836 counter: coverage_map::Counter::zero(),
837 false_counter: coverage_map::Counter::zero(),
844 kind: RegionKind::ExpansionRegion,
848 // This function might be used in the future; the LLVM API is still evolving, as is coverage
851 crate fn skipped_region(
859 counter: coverage_map::Counter::zero(),
860 false_counter: coverage_map::Counter::zero(),
867 kind: RegionKind::SkippedRegion,
871 // This function might be used in the future; the LLVM API is still evolving, as is coverage
875 counter: coverage_map::Counter,
884 false_counter: coverage_map::Counter::zero(),
890 end_col: (1_u32 << 31) | end_col,
891 kind: RegionKind::GapRegion,
898 use super::{InvariantOpaque, Metadata};
899 use bitflags::bitflags;
902 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
904 pub type DIDescriptor = Metadata;
905 pub type DILocation = Metadata;
906 pub type DIScope = DIDescriptor;
907 pub type DIFile = DIScope;
908 pub type DILexicalBlock = DIScope;
909 pub type DISubprogram = DIScope;
910 pub type DINameSpace = DIScope;
911 pub type DIType = DIDescriptor;
912 pub type DIBasicType = DIType;
913 pub type DIDerivedType = DIType;
914 pub type DICompositeType = DIDerivedType;
915 pub type DIVariable = DIDescriptor;
916 pub type DIGlobalVariableExpression = DIDescriptor;
917 pub type DIArray = DIDescriptor;
918 pub type DISubrange = DIDescriptor;
919 pub type DIEnumerator = DIDescriptor;
920 pub type DITemplateTypeParameter = DIDescriptor;
922 // These values **must** match with LLVMRustDIFlags!!
926 pub struct DIFlags: u32 {
928 const FlagPrivate = 1;
929 const FlagProtected = 2;
930 const FlagPublic = 3;
931 const FlagFwdDecl = (1 << 2);
932 const FlagAppleBlock = (1 << 3);
933 const FlagBlockByrefStruct = (1 << 4);
934 const FlagVirtual = (1 << 5);
935 const FlagArtificial = (1 << 6);
936 const FlagExplicit = (1 << 7);
937 const FlagPrototyped = (1 << 8);
938 const FlagObjcClassComplete = (1 << 9);
939 const FlagObjectPointer = (1 << 10);
940 const FlagVector = (1 << 11);
941 const FlagStaticMember = (1 << 12);
942 const FlagLValueReference = (1 << 13);
943 const FlagRValueReference = (1 << 14);
944 const FlagExternalTypeRef = (1 << 15);
945 const FlagIntroducedVirtual = (1 << 18);
946 const FlagBitField = (1 << 19);
947 const FlagNoReturn = (1 << 20);
951 // These values **must** match with LLVMRustDISPFlags!!
955 pub struct DISPFlags: u32 {
956 const SPFlagZero = 0;
957 const SPFlagVirtual = 1;
958 const SPFlagPureVirtual = 2;
959 const SPFlagLocalToUnit = (1 << 2);
960 const SPFlagDefinition = (1 << 3);
961 const SPFlagOptimized = (1 << 4);
962 const SPFlagMainSubprogram = (1 << 5);
966 /// LLVMRustDebugEmissionKind
967 #[derive(Copy, Clone)]
969 pub enum DebugEmissionKind {
975 impl DebugEmissionKind {
976 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
977 use rustc_session::config::DebugInfo;
979 DebugInfo::None => DebugEmissionKind::NoDebug,
980 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
981 DebugInfo::Full => DebugEmissionKind::FullDebug,
988 pub type ModuleBuffer;
991 pub type SelfProfileBeforePassCallback =
992 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
993 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
996 pub fn LLVMRustInstallFatalErrorHandler();
997 pub fn LLVMRustDisableSystemDialogsOnCrash();
999 // Create and destroy contexts.
1000 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1001 pub fn LLVMContextDispose(C: &'static mut Context);
1002 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
1005 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
1006 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
1007 pub fn LLVMCloneModule(M: &Module) -> &Module;
1009 /// Data layout. See Module::getDataLayout.
1010 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1011 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1013 /// See Module::setModuleInlineAsm.
1014 pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
1015 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1017 /// See llvm::LLVMTypeKind::getTypeID.
1018 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1020 // Operations on integer types
1021 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1022 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1023 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1024 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1025 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1026 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1028 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1030 // Operations on real types
1031 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1032 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1034 // Operations on function types
1035 pub fn LLVMFunctionType<'a>(
1036 ReturnType: &'a Type,
1037 ParamTypes: *const &'a Type,
1041 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1042 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1044 // Operations on struct types
1045 pub fn LLVMStructTypeInContext<'a>(
1047 ElementTypes: *const &'a Type,
1048 ElementCount: c_uint,
1052 // Operations on array, pointer, and vector types (sequence types)
1053 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1054 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1055 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1057 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1058 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1060 // Operations on other types
1061 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1062 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1064 // Operations on all values
1065 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1066 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1067 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1068 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1069 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1070 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1071 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1073 // Operations on constants of any type
1074 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1075 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1077 // Operations on metadata
1078 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1079 pub fn LLVMMDNodeInContext<'a>(
1081 Vals: *const &'a Value,
1084 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1086 // Operations on scalar constants
1087 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1088 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1089 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1090 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1091 pub fn LLVMRustConstInt128Get(
1092 ConstantVal: &ConstantInt,
1098 // Operations on composite constants
1099 pub fn LLVMConstStringInContext(
1103 DontNullTerminate: Bool,
1105 pub fn LLVMConstStructInContext<'a>(
1107 ConstantVals: *const &'a Value,
1112 pub fn LLVMConstArray<'a>(
1113 ElementTy: &'a Type,
1114 ConstantVals: *const &'a Value,
1117 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1119 // Constant expressions
1120 pub fn LLVMRustConstInBoundsGEP2<'a>(
1122 ConstantVal: &'a Value,
1123 ConstantIndices: *const &'a Value,
1126 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1127 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1128 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1129 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1130 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1131 pub fn LLVMConstExtractValue(
1132 AggConstant: &Value,
1133 IdxList: *const c_uint,
1137 // Operations on global variables, functions, and aliases (globals)
1138 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1139 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1140 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1141 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1142 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1143 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1144 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1145 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1146 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1147 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1149 // Operations on global variables
1150 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1151 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1152 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1153 pub fn LLVMRustGetOrInsertGlobal<'a>(
1155 Name: *const c_char,
1159 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1160 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1161 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1162 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1163 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1164 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1165 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1166 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
1167 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1168 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1169 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1170 pub fn LLVMRustGetNamedValue(
1172 Name: *const c_char,
1174 ) -> Option<&Value>;
1175 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1177 // Operations on attributes
1178 pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
1179 pub fn LLVMCreateStringAttribute(
1181 Name: *const c_char,
1183 Value: *const c_char,
1186 pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
1187 pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
1188 pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
1189 pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1190 pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1191 pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1193 // Operations on functions
1194 pub fn LLVMRustGetOrInsertFunction<'a>(
1196 Name: *const c_char,
1198 FunctionTy: &'a Type,
1200 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1201 pub fn LLVMRustAddFunctionAttributes<'a>(
1204 Attrs: *const &'a Attribute,
1208 // Operations on parameters
1209 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1210 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1211 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1213 // Operations on basic blocks
1214 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1215 pub fn LLVMAppendBasicBlockInContext<'a>(
1218 Name: *const c_char,
1219 ) -> &'a BasicBlock;
1221 // Operations on instructions
1222 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1223 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1225 // Operations on call sites
1226 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1227 pub fn LLVMRustAddCallSiteAttributes<'a>(
1230 Attrs: *const &'a Attribute,
1234 // Operations on load/store instructions (only)
1235 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1237 // Operations on phi nodes
1238 pub fn LLVMAddIncoming<'a>(
1240 IncomingValues: *const &'a Value,
1241 IncomingBlocks: *const &'a BasicBlock,
1245 // Instruction builders
1246 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1247 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1248 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1249 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1252 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1255 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1256 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1257 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1258 pub fn LLVMBuildCondBr<'a>(
1261 Then: &'a BasicBlock,
1262 Else: &'a BasicBlock,
1264 pub fn LLVMBuildSwitch<'a>(
1267 Else: &'a BasicBlock,
1270 pub fn LLVMRustBuildInvoke<'a>(
1274 Args: *const &'a Value,
1276 Then: &'a BasicBlock,
1277 Catch: &'a BasicBlock,
1278 Bundle: Option<&OperandBundleDef<'a>>,
1279 Name: *const c_char,
1281 pub fn LLVMBuildLandingPad<'a>(
1284 PersFn: Option<&'a Value>,
1286 Name: *const c_char,
1288 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1289 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1291 pub fn LLVMRustBuildCleanupPad<'a>(
1293 ParentPad: Option<&'a Value>,
1295 Args: *const &'a Value,
1296 Name: *const c_char,
1297 ) -> Option<&'a Value>;
1298 pub fn LLVMRustBuildCleanupRet<'a>(
1300 CleanupPad: &'a Value,
1301 UnwindBB: Option<&'a BasicBlock>,
1302 ) -> Option<&'a Value>;
1303 pub fn LLVMRustBuildCatchPad<'a>(
1305 ParentPad: &'a Value,
1307 Args: *const &'a Value,
1308 Name: *const c_char,
1309 ) -> Option<&'a Value>;
1310 pub fn LLVMRustBuildCatchRet<'a>(
1314 ) -> Option<&'a Value>;
1315 pub fn LLVMRustBuildCatchSwitch<'a>(
1316 Builder: &Builder<'a>,
1317 ParentPad: Option<&'a Value>,
1318 BB: Option<&'a BasicBlock>,
1319 NumHandlers: c_uint,
1320 Name: *const c_char,
1321 ) -> Option<&'a Value>;
1322 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1323 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1325 // Add a case to the switch instruction
1326 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1328 // Add a clause to the landing pad instruction
1329 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1331 // Set the cleanup on a landing pad instruction
1332 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1335 pub fn LLVMBuildAdd<'a>(
1339 Name: *const c_char,
1341 pub fn LLVMBuildFAdd<'a>(
1345 Name: *const c_char,
1347 pub fn LLVMBuildSub<'a>(
1351 Name: *const c_char,
1353 pub fn LLVMBuildFSub<'a>(
1357 Name: *const c_char,
1359 pub fn LLVMBuildMul<'a>(
1363 Name: *const c_char,
1365 pub fn LLVMBuildFMul<'a>(
1369 Name: *const c_char,
1371 pub fn LLVMBuildUDiv<'a>(
1375 Name: *const c_char,
1377 pub fn LLVMBuildExactUDiv<'a>(
1381 Name: *const c_char,
1383 pub fn LLVMBuildSDiv<'a>(
1387 Name: *const c_char,
1389 pub fn LLVMBuildExactSDiv<'a>(
1393 Name: *const c_char,
1395 pub fn LLVMBuildFDiv<'a>(
1399 Name: *const c_char,
1401 pub fn LLVMBuildURem<'a>(
1405 Name: *const c_char,
1407 pub fn LLVMBuildSRem<'a>(
1411 Name: *const c_char,
1413 pub fn LLVMBuildFRem<'a>(
1417 Name: *const c_char,
1419 pub fn LLVMBuildShl<'a>(
1423 Name: *const c_char,
1425 pub fn LLVMBuildLShr<'a>(
1429 Name: *const c_char,
1431 pub fn LLVMBuildAShr<'a>(
1435 Name: *const c_char,
1437 pub fn LLVMBuildNSWAdd<'a>(
1441 Name: *const c_char,
1443 pub fn LLVMBuildNUWAdd<'a>(
1447 Name: *const c_char,
1449 pub fn LLVMBuildNSWSub<'a>(
1453 Name: *const c_char,
1455 pub fn LLVMBuildNUWSub<'a>(
1459 Name: *const c_char,
1461 pub fn LLVMBuildNSWMul<'a>(
1465 Name: *const c_char,
1467 pub fn LLVMBuildNUWMul<'a>(
1471 Name: *const c_char,
1473 pub fn LLVMBuildAnd<'a>(
1477 Name: *const c_char,
1479 pub fn LLVMBuildOr<'a>(
1483 Name: *const c_char,
1485 pub fn LLVMBuildXor<'a>(
1489 Name: *const c_char,
1491 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1492 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1493 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1494 pub fn LLVMRustSetFastMath(Instr: &Value);
1497 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1498 pub fn LLVMBuildArrayAlloca<'a>(
1502 Name: *const c_char,
1504 pub fn LLVMBuildLoad2<'a>(
1507 PointerVal: &'a Value,
1508 Name: *const c_char,
1511 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1513 pub fn LLVMBuildGEP2<'a>(
1517 Indices: *const &'a Value,
1519 Name: *const c_char,
1521 pub fn LLVMBuildInBoundsGEP2<'a>(
1525 Indices: *const &'a Value,
1527 Name: *const c_char,
1529 pub fn LLVMBuildStructGEP2<'a>(
1534 Name: *const c_char,
1538 pub fn LLVMBuildTrunc<'a>(
1542 Name: *const c_char,
1544 pub fn LLVMBuildZExt<'a>(
1548 Name: *const c_char,
1550 pub fn LLVMBuildSExt<'a>(
1554 Name: *const c_char,
1556 pub fn LLVMBuildFPToUI<'a>(
1560 Name: *const c_char,
1562 pub fn LLVMBuildFPToSI<'a>(
1566 Name: *const c_char,
1568 pub fn LLVMBuildUIToFP<'a>(
1572 Name: *const c_char,
1574 pub fn LLVMBuildSIToFP<'a>(
1578 Name: *const c_char,
1580 pub fn LLVMBuildFPTrunc<'a>(
1584 Name: *const c_char,
1586 pub fn LLVMBuildFPExt<'a>(
1590 Name: *const c_char,
1592 pub fn LLVMBuildPtrToInt<'a>(
1596 Name: *const c_char,
1598 pub fn LLVMBuildIntToPtr<'a>(
1602 Name: *const c_char,
1604 pub fn LLVMBuildBitCast<'a>(
1608 Name: *const c_char,
1610 pub fn LLVMBuildPointerCast<'a>(
1614 Name: *const c_char,
1616 pub fn LLVMRustBuildIntCast<'a>(
1624 pub fn LLVMBuildICmp<'a>(
1629 Name: *const c_char,
1631 pub fn LLVMBuildFCmp<'a>(
1636 Name: *const c_char,
1639 // Miscellaneous instructions
1640 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1641 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1642 pub fn LLVMRustBuildCall<'a>(
1646 Args: *const &'a Value,
1648 Bundle: Option<&OperandBundleDef<'a>>,
1650 pub fn LLVMRustBuildMemCpy<'a>(
1659 pub fn LLVMRustBuildMemMove<'a>(
1668 pub fn LLVMRustBuildMemSet<'a>(
1676 pub fn LLVMBuildSelect<'a>(
1681 Name: *const c_char,
1683 pub fn LLVMBuildVAArg<'a>(
1687 Name: *const c_char,
1689 pub fn LLVMBuildExtractElement<'a>(
1693 Name: *const c_char,
1695 pub fn LLVMBuildInsertElement<'a>(
1700 Name: *const c_char,
1702 pub fn LLVMBuildShuffleVector<'a>(
1707 Name: *const c_char,
1709 pub fn LLVMBuildExtractValue<'a>(
1713 Name: *const c_char,
1715 pub fn LLVMBuildInsertValue<'a>(
1720 Name: *const c_char,
1723 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1728 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1733 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1734 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1735 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1736 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1737 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1738 pub fn LLVMRustBuildVectorReduceMin<'a>(
1743 pub fn LLVMRustBuildVectorReduceMax<'a>(
1748 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1753 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1759 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1760 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1762 // Atomic Operations
1763 pub fn LLVMRustBuildAtomicLoad<'a>(
1765 ElementType: &'a Type,
1766 PointerVal: &'a Value,
1767 Name: *const c_char,
1768 Order: AtomicOrdering,
1771 pub fn LLVMRustBuildAtomicStore<'a>(
1775 Order: AtomicOrdering,
1778 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1783 Order: AtomicOrdering,
1784 FailureOrder: AtomicOrdering,
1788 pub fn LLVMBuildAtomicRMW<'a>(
1793 Order: AtomicOrdering,
1794 SingleThreaded: Bool,
1797 pub fn LLVMRustBuildAtomicFence(
1799 Order: AtomicOrdering,
1800 Scope: SynchronizationScope,
1803 /// Writes a module to the specified path. Returns 0 on success.
1804 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1806 /// Creates a pass manager.
1807 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1809 /// Creates a function-by-function pass manager
1810 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1812 /// Disposes a pass manager.
1813 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1815 /// Runs a pass manager on a module.
1816 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1818 pub fn LLVMInitializePasses();
1820 pub fn LLVMTimeTraceProfilerInitialize();
1822 pub fn LLVMTimeTraceProfilerFinishThread();
1824 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1826 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1828 pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1829 pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1830 pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold(
1831 PMB: &PassManagerBuilder,
1834 pub fn LLVMRustPassManagerBuilderPopulateModulePassManager(
1835 PMB: &PassManagerBuilder,
1836 PM: &PassManager<'_>,
1839 pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager(
1840 PMB: &PassManagerBuilder,
1841 PM: &PassManager<'_>,
1843 pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager(
1844 PMB: &PassManagerBuilder,
1845 PM: &PassManager<'_>,
1849 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1850 PMB: &PassManagerBuilder,
1851 PM: &PassManager<'_>,
1854 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1856 pub fn LLVMDisposeMessage(message: *mut c_char);
1858 pub fn LLVMIsMultithreaded() -> Bool;
1860 /// Returns a string describing the last error caused by an LLVMRust* call.
1861 pub fn LLVMRustGetLastError() -> *const c_char;
1863 /// Print the pass timings since static dtors aren't picking them up.
1864 pub fn LLVMRustPrintPassTimings();
1866 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1868 pub fn LLVMStructSetBody<'a>(
1870 ElementTypes: *const &'a Type,
1871 ElementCount: c_uint,
1875 /// Prepares inline assembly.
1876 pub fn LLVMRustInlineAsm(
1878 AsmString: *const c_char,
1879 AsmStringLen: size_t,
1880 Constraints: *const c_char,
1881 ConstraintsLen: size_t,
1884 Dialect: AsmDialect,
1887 pub fn LLVMRustInlineAsmVerify(
1889 Constraints: *const c_char,
1890 ConstraintsLen: size_t,
1893 #[allow(improper_ctypes)]
1894 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1895 Filenames: *const *const c_char,
1896 FilenamesLen: size_t,
1897 BufferOut: &RustString,
1900 #[allow(improper_ctypes)]
1901 pub fn LLVMRustCoverageWriteMappingToBuffer(
1902 VirtualFileMappingIDs: *const c_uint,
1903 NumVirtualFileMappingIDs: c_uint,
1904 Expressions: *const coverage_map::CounterExpression,
1905 NumExpressions: c_uint,
1906 MappingRegions: *const coverageinfo::CounterMappingRegion,
1907 NumMappingRegions: c_uint,
1908 BufferOut: &RustString,
1911 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1912 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1913 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1915 #[allow(improper_ctypes)]
1916 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1918 #[allow(improper_ctypes)]
1919 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1921 #[allow(improper_ctypes)]
1922 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1924 pub fn LLVMRustCoverageMappingVersion() -> u32;
1925 pub fn LLVMRustDebugMetadataVersion() -> u32;
1926 pub fn LLVMRustVersionMajor() -> u32;
1927 pub fn LLVMRustVersionMinor() -> u32;
1928 pub fn LLVMRustVersionPatch() -> u32;
1930 /// Add LLVM module flags.
1932 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1933 /// "compatible" means depends on the merge behaviors involved.
1934 pub fn LLVMRustAddModuleFlag(
1936 merge_behavior: LLVMModFlagBehavior,
1937 name: *const c_char,
1941 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1943 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1945 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1947 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1949 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1950 Builder: &DIBuilder<'a>,
1953 Producer: *const c_char,
1954 ProducerLen: size_t,
1956 Flags: *const c_char,
1958 SplitName: *const c_char,
1959 SplitNameLen: size_t,
1960 kind: DebugEmissionKind,
1962 SplitDebugInlining: bool,
1963 ) -> &'a DIDescriptor;
1965 pub fn LLVMRustDIBuilderCreateFile<'a>(
1966 Builder: &DIBuilder<'a>,
1967 Filename: *const c_char,
1968 FilenameLen: size_t,
1969 Directory: *const c_char,
1970 DirectoryLen: size_t,
1971 CSKind: ChecksumKind,
1972 Checksum: *const c_char,
1973 ChecksumLen: size_t,
1976 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1977 Builder: &DIBuilder<'a>,
1978 ParameterTypes: &'a DIArray,
1979 ) -> &'a DICompositeType;
1981 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1982 Builder: &DIBuilder<'a>,
1983 Scope: &'a DIDescriptor,
1984 Name: *const c_char,
1986 LinkageName: *const c_char,
1987 LinkageNameLen: size_t,
1994 MaybeFn: Option<&'a Value>,
1995 TParam: &'a DIArray,
1996 Decl: Option<&'a DIDescriptor>,
1997 ) -> &'a DISubprogram;
1999 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2000 Builder: &DIBuilder<'a>,
2001 Name: *const c_char,
2005 ) -> &'a DIBasicType;
2007 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
2008 Builder: &DIBuilder<'a>,
2009 Type: &'a DIBasicType,
2010 Name: *const c_char,
2014 Scope: Option<&'a DIScope>,
2015 ) -> &'a DIDerivedType;
2017 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2018 Builder: &DIBuilder<'a>,
2019 PointeeTy: &'a DIType,
2022 AddressSpace: c_uint,
2023 Name: *const c_char,
2025 ) -> &'a DIDerivedType;
2027 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2028 Builder: &DIBuilder<'a>,
2029 Scope: Option<&'a DIDescriptor>,
2030 Name: *const c_char,
2037 DerivedFrom: Option<&'a DIType>,
2038 Elements: &'a DIArray,
2039 RunTimeLang: c_uint,
2040 VTableHolder: Option<&'a DIType>,
2041 UniqueId: *const c_char,
2042 UniqueIdLen: size_t,
2043 ) -> &'a DICompositeType;
2045 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2046 Builder: &DIBuilder<'a>,
2047 Scope: &'a DIDescriptor,
2048 Name: *const c_char,
2057 ) -> &'a DIDerivedType;
2059 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2060 Builder: &DIBuilder<'a>,
2062 Name: *const c_char,
2069 Discriminant: Option<&'a Value>,
2074 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2075 Builder: &DIBuilder<'a>,
2080 ) -> &'a DILexicalBlock;
2082 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2083 Builder: &DIBuilder<'a>,
2086 ) -> &'a DILexicalBlock;
2088 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2089 Builder: &DIBuilder<'a>,
2090 Context: Option<&'a DIScope>,
2091 Name: *const c_char,
2093 LinkageName: *const c_char,
2094 LinkageNameLen: size_t,
2098 isLocalToUnit: bool,
2100 Decl: Option<&'a DIDescriptor>,
2102 ) -> &'a DIGlobalVariableExpression;
2104 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2105 Builder: &DIBuilder<'a>,
2107 Scope: &'a DIDescriptor,
2108 Name: *const c_char,
2113 AlwaysPreserve: bool,
2117 ) -> &'a DIVariable;
2119 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2120 Builder: &DIBuilder<'a>,
2124 Subscripts: &'a DIArray,
2127 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2128 Builder: &DIBuilder<'a>,
2131 ) -> &'a DISubrange;
2133 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2134 Builder: &DIBuilder<'a>,
2135 Ptr: *const Option<&'a DIDescriptor>,
2139 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2140 Builder: &DIBuilder<'a>,
2142 VarInfo: &'a DIVariable,
2143 AddrOps: *const u64,
2144 AddrOpsCount: c_uint,
2146 InsertAtEnd: &'a BasicBlock,
2149 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2150 Builder: &DIBuilder<'a>,
2151 Name: *const c_char,
2155 ) -> &'a DIEnumerator;
2157 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2158 Builder: &DIBuilder<'a>,
2160 Name: *const c_char,
2166 Elements: &'a DIArray,
2167 ClassType: &'a DIType,
2171 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2172 Builder: &DIBuilder<'a>,
2173 Scope: Option<&'a DIScope>,
2174 Name: *const c_char,
2181 Elements: Option<&'a DIArray>,
2182 RunTimeLang: c_uint,
2183 UniqueId: *const c_char,
2184 UniqueIdLen: size_t,
2187 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2188 Builder: &DIBuilder<'a>,
2190 Name: *const c_char,
2197 Discriminator: Option<&'a DIDerivedType>,
2198 Elements: &'a DIArray,
2199 UniqueId: *const c_char,
2200 UniqueIdLen: size_t,
2201 ) -> &'a DIDerivedType;
2203 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2205 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2206 Builder: &DIBuilder<'a>,
2207 Scope: Option<&'a DIScope>,
2208 Name: *const c_char,
2211 ) -> &'a DITemplateTypeParameter;
2213 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2214 Builder: &DIBuilder<'a>,
2215 Scope: Option<&'a DIScope>,
2216 Name: *const c_char,
2218 ExportSymbols: bool,
2219 ) -> &'a DINameSpace;
2221 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2222 Builder: &DIBuilder<'a>,
2223 CompositeType: &'a DIType,
2224 Elements: Option<&'a DIArray>,
2225 Params: Option<&'a DIArray>,
2228 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2232 InlinedAt: Option<&'a DILocation>,
2233 ) -> &'a DILocation;
2234 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2235 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2237 #[allow(improper_ctypes)]
2238 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2239 #[allow(improper_ctypes)]
2240 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2242 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2244 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
2245 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2246 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2247 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2248 pub fn LLVMRustCreateMemorySanitizerPass(
2249 TrackOrigins: c_int,
2251 ) -> &'static mut Pass;
2252 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2253 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2254 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2255 pub fn LLVMRustAddLastExtensionPasses(
2256 PMB: &PassManagerBuilder,
2257 Passes: *const &'static mut Pass,
2261 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2263 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2264 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2265 pub fn LLVMRustGetTargetFeature(
2268 Feature: &mut *const c_char,
2269 Desc: &mut *const c_char,
2272 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2273 pub fn LLVMRustCreateTargetMachine(
2274 Triple: *const c_char,
2276 Features: *const c_char,
2280 Level: CodeGenOptLevel,
2282 FunctionSections: bool,
2284 UniqueSectionNames: bool,
2285 TrapUnreachable: bool,
2288 EmitStackSizeSection: bool,
2289 RelaxELFRelocations: bool,
2291 SplitDwarfFile: *const c_char,
2292 ) -> Option<&'static mut TargetMachine>;
2293 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2294 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2295 PMB: &'a PassManagerBuilder,
2297 DisableSimplifyLibCalls: bool,
2299 pub fn LLVMRustConfigurePassManagerBuilder(
2300 PMB: &PassManagerBuilder,
2301 OptLevel: CodeGenOptLevel,
2302 MergeFunctions: bool,
2304 LoopVectorize: bool,
2305 PrepareForThinLTO: bool,
2306 PGOGenPath: *const c_char,
2307 PGOUsePath: *const c_char,
2308 PGOSampleUsePath: *const c_char,
2311 pub fn LLVMRustAddLibraryInfo<'a>(
2312 PM: &PassManager<'a>,
2314 DisableSimplifyLibCalls: bool,
2316 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2317 pub fn LLVMRustWriteOutputFile<'a>(
2318 T: &'a TargetMachine,
2319 PM: &PassManager<'a>,
2321 Output: *const c_char,
2322 DwoOutput: *const c_char,
2324 ) -> LLVMRustResult;
2325 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2327 TM: &'a TargetMachine,
2328 OptLevel: PassBuilderOptLevel,
2330 NoPrepopulatePasses: bool,
2332 UseThinLTOBuffers: bool,
2333 MergeFunctions: bool,
2336 LoopVectorize: bool,
2337 DisableSimplifyLibCalls: bool,
2338 EmitLifetimeMarkers: bool,
2339 SanitizerOptions: Option<&SanitizerOptions>,
2340 PGOGenPath: *const c_char,
2341 PGOUsePath: *const c_char,
2342 InstrumentCoverage: bool,
2343 InstrumentGCOV: bool,
2344 PGOSampleUsePath: *const c_char,
2345 DebugInfoForProfiling: bool,
2346 llvm_selfprofiler: *mut c_void,
2347 begin_callback: SelfProfileBeforePassCallback,
2348 end_callback: SelfProfileAfterPassCallback,
2349 ExtraPasses: *const c_char,
2350 ExtraPassesLen: size_t,
2351 LLVMPlugins: *const c_char,
2352 LLVMPluginsLen: size_t,
2353 ) -> LLVMRustResult;
2354 pub fn LLVMRustPrintModule(
2356 Output: *const c_char,
2357 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2358 ) -> LLVMRustResult;
2359 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2360 pub fn LLVMRustPrintPasses();
2361 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
2362 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2363 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2364 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2366 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2367 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2368 pub fn LLVMRustArchiveIteratorNext<'a>(
2369 AIR: &ArchiveIterator<'a>,
2370 ) -> Option<&'a mut ArchiveChild<'a>>;
2371 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2372 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2373 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2374 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2375 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2377 #[allow(improper_ctypes)]
2378 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2380 #[allow(improper_ctypes)]
2381 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2382 DI: &'a DiagnosticInfo,
2383 pass_name_out: &RustString,
2384 function_out: &mut Option<&'a Value>,
2385 loc_line_out: &mut c_uint,
2386 loc_column_out: &mut c_uint,
2387 loc_filename_out: &RustString,
2388 message_out: &RustString,
2391 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2392 DI: &'a DiagnosticInfo,
2393 level_out: &mut DiagnosticLevel,
2394 cookie_out: &mut c_uint,
2395 message_out: &mut Option<&'a Twine>,
2398 #[allow(improper_ctypes)]
2399 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2400 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2402 pub fn LLVMRustGetSMDiagnostic<'a>(
2403 DI: &'a DiagnosticInfo,
2404 cookie_out: &mut c_uint,
2405 ) -> &'a SMDiagnostic;
2407 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2409 H: InlineAsmDiagHandlerTy,
2413 #[allow(improper_ctypes)]
2414 pub fn LLVMRustUnpackSMDiagnostic(
2416 message_out: &RustString,
2417 buffer_out: &RustString,
2418 level_out: &mut DiagnosticLevel,
2419 loc_out: &mut c_uint,
2420 ranges_out: *mut c_uint,
2421 num_ranges: &mut usize,
2424 pub fn LLVMRustWriteArchive(
2427 Members: *const &RustArchiveMember<'_>,
2430 ) -> LLVMRustResult;
2431 pub fn LLVMRustArchiveMemberNew<'a>(
2432 Filename: *const c_char,
2433 Name: *const c_char,
2434 Child: Option<&ArchiveChild<'a>>,
2435 ) -> &'a mut RustArchiveMember<'a>;
2436 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2438 pub fn LLVMRustWriteImportLibrary(
2439 ImportName: *const c_char,
2440 Path: *const c_char,
2441 Exports: *const LLVMRustCOFFShortExport,
2445 ) -> LLVMRustResult;
2447 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2449 pub fn LLVMRustBuildOperandBundleDef<'a>(
2450 Name: *const c_char,
2451 Inputs: *const &'a Value,
2453 ) -> &'a mut OperandBundleDef<'a>;
2454 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2456 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2458 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2459 pub fn LLVMRustUnsetComdat(V: &Value);
2460 pub fn LLVMRustSetModulePICLevel(M: &Module);
2461 pub fn LLVMRustSetModulePIELevel(M: &Module);
2462 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2463 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2464 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2465 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2466 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2467 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2469 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2470 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2471 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2472 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2473 pub fn LLVMRustCreateThinLTOData(
2474 Modules: *const ThinLTOModule,
2476 PreservedSymbols: *const *const c_char,
2477 PreservedSymbolsLen: c_uint,
2478 ) -> Option<&'static mut ThinLTOData>;
2479 pub fn LLVMRustPrepareThinLTORename(
2482 Target: &TargetMachine,
2484 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2485 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2486 pub fn LLVMRustPrepareThinLTOImport(
2489 Target: &TargetMachine,
2491 pub fn LLVMRustGetThinLTOModuleImports(
2492 Data: *const ThinLTOData,
2493 ModuleNameCallback: ThinLTOModuleNameCallback,
2494 CallbackPayload: *mut c_void,
2496 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2497 pub fn LLVMRustParseBitcodeForLTO(
2501 Identifier: *const c_char,
2502 ) -> Option<&Module>;
2503 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2506 out_len: &mut usize,
2508 pub fn LLVMRustLTOGetDICompileUnit(M: &Module, CU1: &mut *mut c_void, CU2: &mut *mut c_void);
2509 pub fn LLVMRustLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2511 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2512 pub fn LLVMRustLinkerAdd(
2513 linker: &Linker<'_>,
2514 bytecode: *const c_char,
2515 bytecode_len: usize,
2517 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2518 #[allow(improper_ctypes)]
2519 pub fn LLVMRustComputeLTOCacheKey(
2520 key_out: &RustString,
2521 mod_id: *const c_char,
2525 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2526 pub fn LLVMRustContextSetDiagnosticHandler(
2528 diagnostic_handler: Option<&DiagnosticHandler>,
2530 pub fn LLVMRustContextConfigureDiagnosticHandler(
2532 diagnostic_handler_callback: DiagnosticHandlerTy,
2533 diagnostic_handler_context: *mut c_void,
2534 remark_all_passes: bool,
2535 remark_passes: *const *const c_char,
2536 remark_passes_len: usize,
2539 #[allow(improper_ctypes)]
2540 pub fn LLVMRustGetMangledName(V: &Value, out: &RustString);