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,
198 #[derive(Copy, Clone)]
200 pub enum IntPredicate {
214 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
216 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
217 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
218 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
219 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
220 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
221 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
222 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
223 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
224 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
225 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
230 /// LLVMRealPredicate
231 #[derive(Copy, Clone)]
233 pub enum RealPredicate {
234 RealPredicateFalse = 0,
249 RealPredicateTrue = 15,
253 pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
255 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
256 RealPredicate::RealPredicateFalse
258 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
259 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
260 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
261 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
262 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
263 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
264 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
265 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
266 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
267 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
268 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
269 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
270 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
271 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
272 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
273 RealPredicate::RealPredicateTrue
280 #[derive(Copy, Clone, PartialEq, Debug)]
306 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
308 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
309 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
310 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
311 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
312 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
313 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
314 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
315 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
316 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
317 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
318 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
319 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
320 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
321 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
322 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
323 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
324 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
325 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
326 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
327 TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX,
332 /// LLVMAtomicRmwBinOp
333 #[derive(Copy, Clone)]
335 pub enum AtomicRmwBinOp {
349 impl AtomicRmwBinOp {
350 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
352 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
353 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
354 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
355 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
356 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
357 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
358 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
359 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
360 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
361 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
362 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
367 /// LLVMAtomicOrdering
368 #[derive(Copy, Clone)]
370 pub enum AtomicOrdering {
375 // Consume = 3, // Not specified yet.
379 SequentiallyConsistent = 7,
382 impl AtomicOrdering {
383 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
385 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
386 rustc_codegen_ssa::common::AtomicOrdering::Relaxed => 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,
446 MD_vcall_visibility = 28,
450 /// LLVMRustAsmDialect
451 #[derive(Copy, Clone, PartialEq)]
453 pub enum AsmDialect {
458 /// LLVMRustCodeGenOptLevel
459 #[derive(Copy, Clone, PartialEq)]
461 pub enum CodeGenOptLevel {
468 /// LLVMRustPassBuilderOptLevel
470 pub enum PassBuilderOptLevel {
490 /// LLVMRustSanitizerOptions
492 pub struct SanitizerOptions {
493 pub sanitize_address: bool,
494 pub sanitize_address_recover: bool,
495 pub sanitize_memory: bool,
496 pub sanitize_memory_recover: bool,
497 pub sanitize_memory_track_origins: c_int,
498 pub sanitize_thread: bool,
499 pub sanitize_hwaddress: bool,
500 pub sanitize_hwaddress_recover: bool,
504 #[derive(Copy, Clone, PartialEq)]
506 pub enum RelocModel {
515 /// LLVMRustCodeModel
516 #[derive(Copy, Clone)]
527 /// LLVMRustDiagnosticKind
528 #[derive(Copy, Clone)]
530 #[allow(dead_code)] // Variants constructed by C++.
531 pub enum DiagnosticKind {
535 DebugMetadataVersion,
538 OptimizationRemarkMissed,
539 OptimizationRemarkAnalysis,
540 OptimizationRemarkAnalysisFPCommute,
541 OptimizationRemarkAnalysisAliasing,
542 OptimizationRemarkOther,
550 /// LLVMRustDiagnosticLevel
551 #[derive(Copy, Clone)]
553 #[allow(dead_code)] // Variants constructed by C++.
554 pub enum DiagnosticLevel {
561 /// LLVMRustArchiveKind
562 #[derive(Copy, Clone)]
564 pub enum ArchiveKind {
572 #[derive(Copy, Clone, PartialEq, Debug)]
574 #[allow(dead_code)] // Variants constructed by C++.
581 // LLVMRustThinLTOData
583 pub type ThinLTOData;
586 // LLVMRustThinLTOBuffer
588 pub type ThinLTOBuffer;
591 // LLVMRustModuleNameCallback
592 pub type ThinLTOModuleNameCallback =
593 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
595 /// LLVMRustThinLTOModule
597 pub struct ThinLTOModule {
598 pub identifier: *const c_char,
603 /// LLVMThreadLocalMode
604 #[derive(Copy, Clone)]
606 pub enum ThreadLocalMode {
614 /// LLVMRustChecksumKind
615 #[derive(Copy, Clone)]
617 pub enum ChecksumKind {
628 struct InvariantOpaque<'a> {
629 _marker: PhantomData<&'a mut &'a ()>,
633 // Opaque pointer types
647 pub type ConstantInt;
659 pub struct Builder<'a>(InvariantOpaque<'a>);
661 pub type MemoryBuffer;
664 pub struct PassManager<'a>(InvariantOpaque<'a>);
666 pub type PassManagerBuilder;
672 pub type TargetMachine;
678 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
680 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
685 pub type DiagnosticInfo;
688 pub type SMDiagnostic;
691 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
693 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
695 pub struct Linker<'a>(InvariantOpaque<'a>);
698 pub type DiagnosticHandler;
701 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
702 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
704 pub mod coverageinfo {
705 use super::coverage_map;
707 /// 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)
708 #[derive(Copy, Clone, Debug)]
710 pub enum RegionKind {
711 /// A CodeRegion associates some code with a counter
714 /// An ExpansionRegion represents a file expansion region that associates
715 /// a source range with the expansion of a virtual source file, such as
716 /// for a macro instantiation or #include file.
719 /// A SkippedRegion represents a source range with code that was skipped
720 /// by a preprocessor or similar means.
723 /// A GapRegion is like a CodeRegion, but its count is only set as the
724 /// line execution count when its the only region in the line.
727 /// A BranchRegion represents leaf-level boolean expressions and is
728 /// associated with two counters, each representing the number of times the
729 /// expression evaluates to true or false.
733 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
734 /// coverage map, in accordance with the
735 /// [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).
736 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
737 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
738 /// array", encoded separately), and source location (start and end positions of the represented
741 /// Matches LLVMRustCounterMappingRegion.
742 #[derive(Copy, Clone, Debug)]
744 pub struct CounterMappingRegion {
745 /// The counter type and type-dependent counter data, if any.
746 counter: coverage_map::Counter,
748 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
749 /// for the false branch of the region.
750 false_counter: coverage_map::Counter,
752 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
753 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
754 /// that, in turn, are used to look up the filename for this region.
757 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
758 /// the mapping regions created as a result of macro expansion, by checking if their file id
759 /// matches the expanded file id.
760 expanded_file_id: u32,
762 /// 1-based starting line of the mapping region.
765 /// 1-based starting column of the mapping region.
768 /// 1-based ending line of the mapping region.
771 /// 1-based ending column of the mapping region. If the high bit is set, the current
772 /// mapping region is a gap area.
778 impl CounterMappingRegion {
779 pub(crate) fn code_region(
780 counter: coverage_map::Counter,
789 false_counter: coverage_map::Counter::zero(),
796 kind: RegionKind::CodeRegion,
800 // This function might be used in the future; the LLVM API is still evolving, as is coverage
803 pub(crate) fn branch_region(
804 counter: coverage_map::Counter,
805 false_counter: coverage_map::Counter,
821 kind: RegionKind::BranchRegion,
825 // This function might be used in the future; the LLVM API is still evolving, as is coverage
828 pub(crate) fn expansion_region(
830 expanded_file_id: u32,
837 counter: coverage_map::Counter::zero(),
838 false_counter: coverage_map::Counter::zero(),
845 kind: RegionKind::ExpansionRegion,
849 // This function might be used in the future; the LLVM API is still evolving, as is coverage
852 pub(crate) fn skipped_region(
860 counter: coverage_map::Counter::zero(),
861 false_counter: coverage_map::Counter::zero(),
868 kind: RegionKind::SkippedRegion,
872 // This function might be used in the future; the LLVM API is still evolving, as is coverage
875 pub(crate) fn gap_region(
876 counter: coverage_map::Counter,
885 false_counter: coverage_map::Counter::zero(),
891 end_col: (1_u32 << 31) | end_col,
892 kind: RegionKind::GapRegion,
899 use super::{InvariantOpaque, Metadata};
900 use bitflags::bitflags;
903 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
905 pub type DIDescriptor = Metadata;
906 pub type DILocation = Metadata;
907 pub type DIScope = DIDescriptor;
908 pub type DIFile = DIScope;
909 pub type DILexicalBlock = DIScope;
910 pub type DISubprogram = DIScope;
911 pub type DINameSpace = DIScope;
912 pub type DIType = DIDescriptor;
913 pub type DIBasicType = DIType;
914 pub type DIDerivedType = DIType;
915 pub type DICompositeType = DIDerivedType;
916 pub type DIVariable = DIDescriptor;
917 pub type DIGlobalVariableExpression = DIDescriptor;
918 pub type DIArray = DIDescriptor;
919 pub type DISubrange = DIDescriptor;
920 pub type DIEnumerator = DIDescriptor;
921 pub type DITemplateTypeParameter = DIDescriptor;
923 // These values **must** match with LLVMRustDIFlags!!
927 pub struct DIFlags: u32 {
929 const FlagPrivate = 1;
930 const FlagProtected = 2;
931 const FlagPublic = 3;
932 const FlagFwdDecl = (1 << 2);
933 const FlagAppleBlock = (1 << 3);
934 const FlagBlockByrefStruct = (1 << 4);
935 const FlagVirtual = (1 << 5);
936 const FlagArtificial = (1 << 6);
937 const FlagExplicit = (1 << 7);
938 const FlagPrototyped = (1 << 8);
939 const FlagObjcClassComplete = (1 << 9);
940 const FlagObjectPointer = (1 << 10);
941 const FlagVector = (1 << 11);
942 const FlagStaticMember = (1 << 12);
943 const FlagLValueReference = (1 << 13);
944 const FlagRValueReference = (1 << 14);
945 const FlagExternalTypeRef = (1 << 15);
946 const FlagIntroducedVirtual = (1 << 18);
947 const FlagBitField = (1 << 19);
948 const FlagNoReturn = (1 << 20);
952 // These values **must** match with LLVMRustDISPFlags!!
956 pub struct DISPFlags: u32 {
957 const SPFlagZero = 0;
958 const SPFlagVirtual = 1;
959 const SPFlagPureVirtual = 2;
960 const SPFlagLocalToUnit = (1 << 2);
961 const SPFlagDefinition = (1 << 3);
962 const SPFlagOptimized = (1 << 4);
963 const SPFlagMainSubprogram = (1 << 5);
967 /// LLVMRustDebugEmissionKind
968 #[derive(Copy, Clone)]
970 pub enum DebugEmissionKind {
976 impl DebugEmissionKind {
977 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
978 use rustc_session::config::DebugInfo;
980 DebugInfo::None => DebugEmissionKind::NoDebug,
981 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
982 DebugInfo::Full => DebugEmissionKind::FullDebug,
989 pub type ModuleBuffer;
992 pub type SelfProfileBeforePassCallback =
993 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
994 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
997 pub fn LLVMRustInstallFatalErrorHandler();
998 pub fn LLVMRustDisableSystemDialogsOnCrash();
1000 // Create and destroy contexts.
1001 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1002 pub fn LLVMContextDispose(C: &'static mut Context);
1003 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
1006 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
1007 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
1008 pub fn LLVMCloneModule(M: &Module) -> &Module;
1010 /// Data layout. See Module::getDataLayout.
1011 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1012 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1014 /// See Module::setModuleInlineAsm.
1015 pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
1016 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1018 /// See llvm::LLVMTypeKind::getTypeID.
1019 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1021 // Operations on integer types
1022 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1023 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1024 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1025 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1026 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1027 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1029 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1031 // Operations on real types
1032 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1033 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1035 // Operations on function types
1036 pub fn LLVMFunctionType<'a>(
1037 ReturnType: &'a Type,
1038 ParamTypes: *const &'a Type,
1042 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1043 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1045 // Operations on struct types
1046 pub fn LLVMStructTypeInContext<'a>(
1048 ElementTypes: *const &'a Type,
1049 ElementCount: c_uint,
1053 // Operations on array, pointer, and vector types (sequence types)
1054 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1055 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1056 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1058 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1059 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1061 // Operations on other types
1062 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1063 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1065 // Operations on all values
1066 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1067 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1068 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1069 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1070 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1071 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1072 pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1073 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1075 // Operations on constants of any type
1076 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1077 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1079 // Operations on metadata
1080 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1081 pub fn LLVMMDNodeInContext<'a>(
1083 Vals: *const &'a Value,
1086 pub fn LLVMMDNodeInContext2<'a>(
1088 Vals: *const &'a Metadata,
1091 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1093 // Operations on scalar constants
1094 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1095 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1096 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1097 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1098 pub fn LLVMRustConstInt128Get(
1099 ConstantVal: &ConstantInt,
1105 // Operations on composite constants
1106 pub fn LLVMConstStringInContext(
1110 DontNullTerminate: Bool,
1112 pub fn LLVMConstStructInContext<'a>(
1114 ConstantVals: *const &'a Value,
1119 pub fn LLVMConstArray<'a>(
1120 ElementTy: &'a Type,
1121 ConstantVals: *const &'a Value,
1124 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1126 // Constant expressions
1127 pub fn LLVMRustConstInBoundsGEP2<'a>(
1129 ConstantVal: &'a Value,
1130 ConstantIndices: *const &'a Value,
1133 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1134 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1135 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1136 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1137 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1138 pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1140 // Operations on global variables, functions, and aliases (globals)
1141 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1142 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1143 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1144 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1145 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1146 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1147 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1148 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1149 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1150 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1152 // Operations on global variables
1153 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1154 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1155 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1156 pub fn LLVMRustGetOrInsertGlobal<'a>(
1158 Name: *const c_char,
1162 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1163 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1164 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1165 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1166 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1167 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1168 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1169 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
1170 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1171 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1172 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1173 pub fn LLVMRustGetNamedValue(
1175 Name: *const c_char,
1177 ) -> Option<&Value>;
1178 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1180 // Operations on attributes
1181 pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
1182 pub fn LLVMCreateStringAttribute(
1184 Name: *const c_char,
1186 Value: *const c_char,
1189 pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
1190 pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
1191 pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
1192 pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1193 pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1194 pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1196 // Operations on functions
1197 pub fn LLVMRustGetOrInsertFunction<'a>(
1199 Name: *const c_char,
1201 FunctionTy: &'a Type,
1203 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1204 pub fn LLVMRustAddFunctionAttributes<'a>(
1207 Attrs: *const &'a Attribute,
1211 // Operations on parameters
1212 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1213 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1214 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1216 // Operations on basic blocks
1217 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1218 pub fn LLVMAppendBasicBlockInContext<'a>(
1221 Name: *const c_char,
1222 ) -> &'a BasicBlock;
1224 // Operations on instructions
1225 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1226 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1228 // Operations on call sites
1229 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1230 pub fn LLVMRustAddCallSiteAttributes<'a>(
1233 Attrs: *const &'a Attribute,
1237 // Operations on load/store instructions (only)
1238 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1240 // Operations on phi nodes
1241 pub fn LLVMAddIncoming<'a>(
1243 IncomingValues: *const &'a Value,
1244 IncomingBlocks: *const &'a BasicBlock,
1248 // Instruction builders
1249 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1250 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1251 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1252 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1255 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1258 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1259 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1260 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1261 pub fn LLVMBuildCondBr<'a>(
1264 Then: &'a BasicBlock,
1265 Else: &'a BasicBlock,
1267 pub fn LLVMBuildSwitch<'a>(
1270 Else: &'a BasicBlock,
1273 pub fn LLVMRustBuildInvoke<'a>(
1277 Args: *const &'a Value,
1279 Then: &'a BasicBlock,
1280 Catch: &'a BasicBlock,
1281 Bundle: Option<&OperandBundleDef<'a>>,
1282 Name: *const c_char,
1284 pub fn LLVMBuildLandingPad<'a>(
1287 PersFn: Option<&'a Value>,
1289 Name: *const c_char,
1291 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1292 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1294 pub fn LLVMRustBuildCleanupPad<'a>(
1296 ParentPad: Option<&'a Value>,
1298 Args: *const &'a Value,
1299 Name: *const c_char,
1300 ) -> Option<&'a Value>;
1301 pub fn LLVMRustBuildCleanupRet<'a>(
1303 CleanupPad: &'a Value,
1304 UnwindBB: Option<&'a BasicBlock>,
1305 ) -> Option<&'a Value>;
1306 pub fn LLVMRustBuildCatchPad<'a>(
1308 ParentPad: &'a Value,
1310 Args: *const &'a Value,
1311 Name: *const c_char,
1312 ) -> Option<&'a Value>;
1313 pub fn LLVMRustBuildCatchRet<'a>(
1317 ) -> Option<&'a Value>;
1318 pub fn LLVMRustBuildCatchSwitch<'a>(
1319 Builder: &Builder<'a>,
1320 ParentPad: Option<&'a Value>,
1321 BB: Option<&'a BasicBlock>,
1322 NumHandlers: c_uint,
1323 Name: *const c_char,
1324 ) -> Option<&'a Value>;
1325 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1326 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1328 // Add a case to the switch instruction
1329 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1331 // Add a clause to the landing pad instruction
1332 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1334 // Set the cleanup on a landing pad instruction
1335 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1338 pub fn LLVMBuildAdd<'a>(
1342 Name: *const c_char,
1344 pub fn LLVMBuildFAdd<'a>(
1348 Name: *const c_char,
1350 pub fn LLVMBuildSub<'a>(
1354 Name: *const c_char,
1356 pub fn LLVMBuildFSub<'a>(
1360 Name: *const c_char,
1362 pub fn LLVMBuildMul<'a>(
1366 Name: *const c_char,
1368 pub fn LLVMBuildFMul<'a>(
1372 Name: *const c_char,
1374 pub fn LLVMBuildUDiv<'a>(
1378 Name: *const c_char,
1380 pub fn LLVMBuildExactUDiv<'a>(
1384 Name: *const c_char,
1386 pub fn LLVMBuildSDiv<'a>(
1390 Name: *const c_char,
1392 pub fn LLVMBuildExactSDiv<'a>(
1396 Name: *const c_char,
1398 pub fn LLVMBuildFDiv<'a>(
1402 Name: *const c_char,
1404 pub fn LLVMBuildURem<'a>(
1408 Name: *const c_char,
1410 pub fn LLVMBuildSRem<'a>(
1414 Name: *const c_char,
1416 pub fn LLVMBuildFRem<'a>(
1420 Name: *const c_char,
1422 pub fn LLVMBuildShl<'a>(
1426 Name: *const c_char,
1428 pub fn LLVMBuildLShr<'a>(
1432 Name: *const c_char,
1434 pub fn LLVMBuildAShr<'a>(
1438 Name: *const c_char,
1440 pub fn LLVMBuildNSWAdd<'a>(
1444 Name: *const c_char,
1446 pub fn LLVMBuildNUWAdd<'a>(
1450 Name: *const c_char,
1452 pub fn LLVMBuildNSWSub<'a>(
1456 Name: *const c_char,
1458 pub fn LLVMBuildNUWSub<'a>(
1462 Name: *const c_char,
1464 pub fn LLVMBuildNSWMul<'a>(
1468 Name: *const c_char,
1470 pub fn LLVMBuildNUWMul<'a>(
1474 Name: *const c_char,
1476 pub fn LLVMBuildAnd<'a>(
1480 Name: *const c_char,
1482 pub fn LLVMBuildOr<'a>(
1486 Name: *const c_char,
1488 pub fn LLVMBuildXor<'a>(
1492 Name: *const c_char,
1494 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1495 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1496 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1497 pub fn LLVMRustSetFastMath(Instr: &Value);
1500 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1501 pub fn LLVMBuildArrayAlloca<'a>(
1505 Name: *const c_char,
1507 pub fn LLVMBuildLoad2<'a>(
1510 PointerVal: &'a Value,
1511 Name: *const c_char,
1514 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1516 pub fn LLVMBuildGEP2<'a>(
1520 Indices: *const &'a Value,
1522 Name: *const c_char,
1524 pub fn LLVMBuildInBoundsGEP2<'a>(
1528 Indices: *const &'a Value,
1530 Name: *const c_char,
1532 pub fn LLVMBuildStructGEP2<'a>(
1537 Name: *const c_char,
1541 pub fn LLVMBuildTrunc<'a>(
1545 Name: *const c_char,
1547 pub fn LLVMBuildZExt<'a>(
1551 Name: *const c_char,
1553 pub fn LLVMBuildSExt<'a>(
1557 Name: *const c_char,
1559 pub fn LLVMBuildFPToUI<'a>(
1563 Name: *const c_char,
1565 pub fn LLVMBuildFPToSI<'a>(
1569 Name: *const c_char,
1571 pub fn LLVMBuildUIToFP<'a>(
1575 Name: *const c_char,
1577 pub fn LLVMBuildSIToFP<'a>(
1581 Name: *const c_char,
1583 pub fn LLVMBuildFPTrunc<'a>(
1587 Name: *const c_char,
1589 pub fn LLVMBuildFPExt<'a>(
1593 Name: *const c_char,
1595 pub fn LLVMBuildPtrToInt<'a>(
1599 Name: *const c_char,
1601 pub fn LLVMBuildIntToPtr<'a>(
1605 Name: *const c_char,
1607 pub fn LLVMBuildBitCast<'a>(
1611 Name: *const c_char,
1613 pub fn LLVMBuildPointerCast<'a>(
1617 Name: *const c_char,
1619 pub fn LLVMRustBuildIntCast<'a>(
1627 pub fn LLVMBuildICmp<'a>(
1632 Name: *const c_char,
1634 pub fn LLVMBuildFCmp<'a>(
1639 Name: *const c_char,
1642 // Miscellaneous instructions
1643 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1644 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1645 pub fn LLVMRustBuildCall<'a>(
1649 Args: *const &'a Value,
1651 Bundle: Option<&OperandBundleDef<'a>>,
1653 pub fn LLVMRustBuildMemCpy<'a>(
1662 pub fn LLVMRustBuildMemMove<'a>(
1671 pub fn LLVMRustBuildMemSet<'a>(
1679 pub fn LLVMBuildSelect<'a>(
1684 Name: *const c_char,
1686 pub fn LLVMBuildVAArg<'a>(
1690 Name: *const c_char,
1692 pub fn LLVMBuildExtractElement<'a>(
1696 Name: *const c_char,
1698 pub fn LLVMBuildInsertElement<'a>(
1703 Name: *const c_char,
1705 pub fn LLVMBuildShuffleVector<'a>(
1710 Name: *const c_char,
1712 pub fn LLVMBuildExtractValue<'a>(
1716 Name: *const c_char,
1718 pub fn LLVMBuildInsertValue<'a>(
1723 Name: *const c_char,
1726 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1731 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1736 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1737 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1738 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1739 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1740 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1741 pub fn LLVMRustBuildVectorReduceMin<'a>(
1746 pub fn LLVMRustBuildVectorReduceMax<'a>(
1751 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1756 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1762 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1763 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1765 // Atomic Operations
1766 pub fn LLVMRustBuildAtomicLoad<'a>(
1768 ElementType: &'a Type,
1769 PointerVal: &'a Value,
1770 Name: *const c_char,
1771 Order: AtomicOrdering,
1774 pub fn LLVMRustBuildAtomicStore<'a>(
1778 Order: AtomicOrdering,
1781 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1786 Order: AtomicOrdering,
1787 FailureOrder: AtomicOrdering,
1791 pub fn LLVMBuildAtomicRMW<'a>(
1796 Order: AtomicOrdering,
1797 SingleThreaded: Bool,
1800 pub fn LLVMRustBuildAtomicFence(
1802 Order: AtomicOrdering,
1803 Scope: SynchronizationScope,
1806 /// Writes a module to the specified path. Returns 0 on success.
1807 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1809 /// Creates a pass manager.
1810 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1812 /// Creates a function-by-function pass manager
1813 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1815 /// Disposes a pass manager.
1816 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1818 /// Runs a pass manager on a module.
1819 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1821 pub fn LLVMInitializePasses();
1823 pub fn LLVMTimeTraceProfilerInitialize();
1825 pub fn LLVMTimeTraceProfilerFinishThread();
1827 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1829 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1831 pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1832 pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1833 pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold(
1834 PMB: &PassManagerBuilder,
1837 pub fn LLVMRustPassManagerBuilderPopulateModulePassManager(
1838 PMB: &PassManagerBuilder,
1839 PM: &PassManager<'_>,
1842 pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager(
1843 PMB: &PassManagerBuilder,
1844 PM: &PassManager<'_>,
1846 pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager(
1847 PMB: &PassManagerBuilder,
1848 PM: &PassManager<'_>,
1852 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1853 PMB: &PassManagerBuilder,
1854 PM: &PassManager<'_>,
1857 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1859 pub fn LLVMDisposeMessage(message: *mut c_char);
1861 pub fn LLVMIsMultithreaded() -> Bool;
1863 /// Returns a string describing the last error caused by an LLVMRust* call.
1864 pub fn LLVMRustGetLastError() -> *const c_char;
1866 /// Print the pass timings since static dtors aren't picking them up.
1867 pub fn LLVMRustPrintPassTimings();
1869 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1871 pub fn LLVMStructSetBody<'a>(
1873 ElementTypes: *const &'a Type,
1874 ElementCount: c_uint,
1878 /// Prepares inline assembly.
1879 pub fn LLVMRustInlineAsm(
1881 AsmString: *const c_char,
1882 AsmStringLen: size_t,
1883 Constraints: *const c_char,
1884 ConstraintsLen: size_t,
1887 Dialect: AsmDialect,
1890 pub fn LLVMRustInlineAsmVerify(
1892 Constraints: *const c_char,
1893 ConstraintsLen: size_t,
1896 #[allow(improper_ctypes)]
1897 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1898 Filenames: *const *const c_char,
1899 FilenamesLen: size_t,
1900 BufferOut: &RustString,
1903 #[allow(improper_ctypes)]
1904 pub fn LLVMRustCoverageWriteMappingToBuffer(
1905 VirtualFileMappingIDs: *const c_uint,
1906 NumVirtualFileMappingIDs: c_uint,
1907 Expressions: *const coverage_map::CounterExpression,
1908 NumExpressions: c_uint,
1909 MappingRegions: *const coverageinfo::CounterMappingRegion,
1910 NumMappingRegions: c_uint,
1911 BufferOut: &RustString,
1914 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1915 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1916 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1918 #[allow(improper_ctypes)]
1919 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1921 #[allow(improper_ctypes)]
1922 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1924 #[allow(improper_ctypes)]
1925 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1927 pub fn LLVMRustCoverageMappingVersion() -> u32;
1928 pub fn LLVMRustDebugMetadataVersion() -> u32;
1929 pub fn LLVMRustVersionMajor() -> u32;
1930 pub fn LLVMRustVersionMinor() -> u32;
1931 pub fn LLVMRustVersionPatch() -> u32;
1933 /// Add LLVM module flags.
1935 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1936 /// "compatible" means depends on the merge behaviors involved.
1937 pub fn LLVMRustAddModuleFlag(
1939 merge_behavior: LLVMModFlagBehavior,
1940 name: *const c_char,
1943 pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool;
1945 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1947 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1949 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1951 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1953 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1954 Builder: &DIBuilder<'a>,
1957 Producer: *const c_char,
1958 ProducerLen: size_t,
1960 Flags: *const c_char,
1962 SplitName: *const c_char,
1963 SplitNameLen: size_t,
1964 kind: DebugEmissionKind,
1966 SplitDebugInlining: bool,
1967 ) -> &'a DIDescriptor;
1969 pub fn LLVMRustDIBuilderCreateFile<'a>(
1970 Builder: &DIBuilder<'a>,
1971 Filename: *const c_char,
1972 FilenameLen: size_t,
1973 Directory: *const c_char,
1974 DirectoryLen: size_t,
1975 CSKind: ChecksumKind,
1976 Checksum: *const c_char,
1977 ChecksumLen: size_t,
1980 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1981 Builder: &DIBuilder<'a>,
1982 ParameterTypes: &'a DIArray,
1983 ) -> &'a DICompositeType;
1985 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1986 Builder: &DIBuilder<'a>,
1987 Scope: &'a DIDescriptor,
1988 Name: *const c_char,
1990 LinkageName: *const c_char,
1991 LinkageNameLen: size_t,
1998 MaybeFn: Option<&'a Value>,
1999 TParam: &'a DIArray,
2000 Decl: Option<&'a DIDescriptor>,
2001 ) -> &'a DISubprogram;
2003 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2004 Builder: &DIBuilder<'a>,
2005 Name: *const c_char,
2009 ) -> &'a DIBasicType;
2011 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
2012 Builder: &DIBuilder<'a>,
2013 Type: &'a DIBasicType,
2014 Name: *const c_char,
2018 Scope: Option<&'a DIScope>,
2019 ) -> &'a DIDerivedType;
2021 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2022 Builder: &DIBuilder<'a>,
2023 PointeeTy: &'a DIType,
2026 AddressSpace: c_uint,
2027 Name: *const c_char,
2029 ) -> &'a DIDerivedType;
2031 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2032 Builder: &DIBuilder<'a>,
2033 Scope: Option<&'a DIDescriptor>,
2034 Name: *const c_char,
2041 DerivedFrom: Option<&'a DIType>,
2042 Elements: &'a DIArray,
2043 RunTimeLang: c_uint,
2044 VTableHolder: Option<&'a DIType>,
2045 UniqueId: *const c_char,
2046 UniqueIdLen: size_t,
2047 ) -> &'a DICompositeType;
2049 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2050 Builder: &DIBuilder<'a>,
2051 Scope: &'a DIDescriptor,
2052 Name: *const c_char,
2061 ) -> &'a DIDerivedType;
2063 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2064 Builder: &DIBuilder<'a>,
2066 Name: *const c_char,
2073 Discriminant: Option<&'a Value>,
2078 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2079 Builder: &DIBuilder<'a>,
2084 ) -> &'a DILexicalBlock;
2086 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2087 Builder: &DIBuilder<'a>,
2090 ) -> &'a DILexicalBlock;
2092 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2093 Builder: &DIBuilder<'a>,
2094 Context: Option<&'a DIScope>,
2095 Name: *const c_char,
2097 LinkageName: *const c_char,
2098 LinkageNameLen: size_t,
2102 isLocalToUnit: bool,
2104 Decl: Option<&'a DIDescriptor>,
2106 ) -> &'a DIGlobalVariableExpression;
2108 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2109 Builder: &DIBuilder<'a>,
2111 Scope: &'a DIDescriptor,
2112 Name: *const c_char,
2117 AlwaysPreserve: bool,
2121 ) -> &'a DIVariable;
2123 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2124 Builder: &DIBuilder<'a>,
2128 Subscripts: &'a DIArray,
2131 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2132 Builder: &DIBuilder<'a>,
2135 ) -> &'a DISubrange;
2137 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2138 Builder: &DIBuilder<'a>,
2139 Ptr: *const Option<&'a DIDescriptor>,
2143 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2144 Builder: &DIBuilder<'a>,
2146 VarInfo: &'a DIVariable,
2147 AddrOps: *const u64,
2148 AddrOpsCount: c_uint,
2150 InsertAtEnd: &'a BasicBlock,
2153 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2154 Builder: &DIBuilder<'a>,
2155 Name: *const c_char,
2159 ) -> &'a DIEnumerator;
2161 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2162 Builder: &DIBuilder<'a>,
2164 Name: *const c_char,
2170 Elements: &'a DIArray,
2171 ClassType: &'a DIType,
2175 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2176 Builder: &DIBuilder<'a>,
2177 Scope: Option<&'a DIScope>,
2178 Name: *const c_char,
2185 Elements: Option<&'a DIArray>,
2186 RunTimeLang: c_uint,
2187 UniqueId: *const c_char,
2188 UniqueIdLen: size_t,
2191 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2192 Builder: &DIBuilder<'a>,
2194 Name: *const c_char,
2201 Discriminator: Option<&'a DIDerivedType>,
2202 Elements: &'a DIArray,
2203 UniqueId: *const c_char,
2204 UniqueIdLen: size_t,
2205 ) -> &'a DIDerivedType;
2207 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2209 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2210 Builder: &DIBuilder<'a>,
2211 Scope: Option<&'a DIScope>,
2212 Name: *const c_char,
2215 ) -> &'a DITemplateTypeParameter;
2217 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2218 Builder: &DIBuilder<'a>,
2219 Scope: Option<&'a DIScope>,
2220 Name: *const c_char,
2222 ExportSymbols: bool,
2223 ) -> &'a DINameSpace;
2225 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2226 Builder: &DIBuilder<'a>,
2227 CompositeType: &'a DIType,
2228 Elements: Option<&'a DIArray>,
2229 Params: Option<&'a DIArray>,
2232 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2236 InlinedAt: Option<&'a DILocation>,
2237 ) -> &'a DILocation;
2238 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2239 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2241 #[allow(improper_ctypes)]
2242 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2243 #[allow(improper_ctypes)]
2244 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2246 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2248 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
2249 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2250 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2251 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2252 pub fn LLVMRustCreateMemorySanitizerPass(
2253 TrackOrigins: c_int,
2255 ) -> &'static mut Pass;
2256 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2257 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2258 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2259 pub fn LLVMRustAddLastExtensionPasses(
2260 PMB: &PassManagerBuilder,
2261 Passes: *const &'static mut Pass,
2265 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2267 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2268 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2269 pub fn LLVMRustGetTargetFeature(
2272 Feature: &mut *const c_char,
2273 Desc: &mut *const c_char,
2276 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2277 pub fn LLVMRustCreateTargetMachine(
2278 Triple: *const c_char,
2280 Features: *const c_char,
2284 Level: CodeGenOptLevel,
2286 FunctionSections: bool,
2288 UniqueSectionNames: bool,
2289 TrapUnreachable: bool,
2292 EmitStackSizeSection: bool,
2293 RelaxELFRelocations: bool,
2295 SplitDwarfFile: *const c_char,
2296 ) -> Option<&'static mut TargetMachine>;
2297 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2298 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2299 PMB: &'a PassManagerBuilder,
2301 DisableSimplifyLibCalls: bool,
2303 pub fn LLVMRustConfigurePassManagerBuilder(
2304 PMB: &PassManagerBuilder,
2305 OptLevel: CodeGenOptLevel,
2306 MergeFunctions: bool,
2308 LoopVectorize: bool,
2309 PrepareForThinLTO: bool,
2310 PGOGenPath: *const c_char,
2311 PGOUsePath: *const c_char,
2312 PGOSampleUsePath: *const c_char,
2315 pub fn LLVMRustAddLibraryInfo<'a>(
2316 PM: &PassManager<'a>,
2318 DisableSimplifyLibCalls: bool,
2320 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2321 pub fn LLVMRustWriteOutputFile<'a>(
2322 T: &'a TargetMachine,
2323 PM: &PassManager<'a>,
2325 Output: *const c_char,
2326 DwoOutput: *const c_char,
2328 ) -> LLVMRustResult;
2329 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2331 TM: &'a TargetMachine,
2332 OptLevel: PassBuilderOptLevel,
2334 NoPrepopulatePasses: bool,
2336 UseThinLTOBuffers: bool,
2337 MergeFunctions: bool,
2340 LoopVectorize: bool,
2341 DisableSimplifyLibCalls: bool,
2342 EmitLifetimeMarkers: bool,
2343 SanitizerOptions: Option<&SanitizerOptions>,
2344 PGOGenPath: *const c_char,
2345 PGOUsePath: *const c_char,
2346 InstrumentCoverage: bool,
2347 InstrumentGCOV: bool,
2348 PGOSampleUsePath: *const c_char,
2349 DebugInfoForProfiling: bool,
2350 llvm_selfprofiler: *mut c_void,
2351 begin_callback: SelfProfileBeforePassCallback,
2352 end_callback: SelfProfileAfterPassCallback,
2353 ExtraPasses: *const c_char,
2354 ExtraPassesLen: size_t,
2355 LLVMPlugins: *const c_char,
2356 LLVMPluginsLen: size_t,
2357 ) -> LLVMRustResult;
2358 pub fn LLVMRustPrintModule(
2360 Output: *const c_char,
2361 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2362 ) -> LLVMRustResult;
2363 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2364 pub fn LLVMRustPrintPasses();
2365 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
2366 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2367 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2368 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2370 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2371 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2372 pub fn LLVMRustArchiveIteratorNext<'a>(
2373 AIR: &ArchiveIterator<'a>,
2374 ) -> Option<&'a mut ArchiveChild<'a>>;
2375 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2376 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2377 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2378 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2379 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2381 #[allow(improper_ctypes)]
2382 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2384 #[allow(improper_ctypes)]
2385 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2386 DI: &'a DiagnosticInfo,
2387 pass_name_out: &RustString,
2388 function_out: &mut Option<&'a Value>,
2389 loc_line_out: &mut c_uint,
2390 loc_column_out: &mut c_uint,
2391 loc_filename_out: &RustString,
2392 message_out: &RustString,
2395 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2396 DI: &'a DiagnosticInfo,
2397 level_out: &mut DiagnosticLevel,
2398 cookie_out: &mut c_uint,
2399 message_out: &mut Option<&'a Twine>,
2402 #[allow(improper_ctypes)]
2403 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2404 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2406 pub fn LLVMRustGetSMDiagnostic<'a>(
2407 DI: &'a DiagnosticInfo,
2408 cookie_out: &mut c_uint,
2409 ) -> &'a SMDiagnostic;
2411 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2413 H: InlineAsmDiagHandlerTy,
2417 #[allow(improper_ctypes)]
2418 pub fn LLVMRustUnpackSMDiagnostic(
2420 message_out: &RustString,
2421 buffer_out: &RustString,
2422 level_out: &mut DiagnosticLevel,
2423 loc_out: &mut c_uint,
2424 ranges_out: *mut c_uint,
2425 num_ranges: &mut usize,
2428 pub fn LLVMRustWriteArchive(
2431 Members: *const &RustArchiveMember<'_>,
2434 ) -> LLVMRustResult;
2435 pub fn LLVMRustArchiveMemberNew<'a>(
2436 Filename: *const c_char,
2437 Name: *const c_char,
2438 Child: Option<&ArchiveChild<'a>>,
2439 ) -> &'a mut RustArchiveMember<'a>;
2440 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2442 pub fn LLVMRustWriteImportLibrary(
2443 ImportName: *const c_char,
2444 Path: *const c_char,
2445 Exports: *const LLVMRustCOFFShortExport,
2449 ) -> LLVMRustResult;
2451 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2453 pub fn LLVMRustBuildOperandBundleDef<'a>(
2454 Name: *const c_char,
2455 Inputs: *const &'a Value,
2457 ) -> &'a mut OperandBundleDef<'a>;
2458 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2460 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2462 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2463 pub fn LLVMRustUnsetComdat(V: &Value);
2464 pub fn LLVMRustSetModulePICLevel(M: &Module);
2465 pub fn LLVMRustSetModulePIELevel(M: &Module);
2466 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2467 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2468 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2469 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2470 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2471 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2473 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2474 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2475 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2476 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2477 pub fn LLVMRustCreateThinLTOData(
2478 Modules: *const ThinLTOModule,
2480 PreservedSymbols: *const *const c_char,
2481 PreservedSymbolsLen: c_uint,
2482 ) -> Option<&'static mut ThinLTOData>;
2483 pub fn LLVMRustPrepareThinLTORename(
2486 Target: &TargetMachine,
2488 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2489 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2490 pub fn LLVMRustPrepareThinLTOImport(
2493 Target: &TargetMachine,
2495 pub fn LLVMRustGetThinLTOModuleImports(
2496 Data: *const ThinLTOData,
2497 ModuleNameCallback: ThinLTOModuleNameCallback,
2498 CallbackPayload: *mut c_void,
2500 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2501 pub fn LLVMRustParseBitcodeForLTO(
2505 Identifier: *const c_char,
2506 ) -> Option<&Module>;
2507 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2510 out_len: &mut usize,
2512 pub fn LLVMRustThinLTOGetDICompileUnit(
2514 CU1: &mut *mut c_void,
2515 CU2: &mut *mut c_void,
2517 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2519 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2520 pub fn LLVMRustLinkerAdd(
2521 linker: &Linker<'_>,
2522 bytecode: *const c_char,
2523 bytecode_len: usize,
2525 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2526 #[allow(improper_ctypes)]
2527 pub fn LLVMRustComputeLTOCacheKey(
2528 key_out: &RustString,
2529 mod_id: *const c_char,
2533 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2534 pub fn LLVMRustContextSetDiagnosticHandler(
2536 diagnostic_handler: Option<&DiagnosticHandler>,
2538 pub fn LLVMRustContextConfigureDiagnosticHandler(
2540 diagnostic_handler_callback: DiagnosticHandlerTy,
2541 diagnostic_handler_context: *mut c_void,
2542 remark_all_passes: bool,
2543 remark_passes: *const *const c_char,
2544 remark_passes_len: usize,
2547 #[allow(improper_ctypes)]
2548 pub fn LLVMRustGetMangledName(V: &Value, out: &RustString);