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,
195 ShadowCallStack = 36,
199 #[derive(Copy, Clone)]
201 pub enum IntPredicate {
215 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
217 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
218 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
219 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
220 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
221 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
222 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
223 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
224 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
225 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
226 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
231 /// LLVMRealPredicate
232 #[derive(Copy, Clone)]
234 pub enum RealPredicate {
235 RealPredicateFalse = 0,
250 RealPredicateTrue = 15,
254 pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
256 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
257 RealPredicate::RealPredicateFalse
259 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
260 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
261 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
262 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
263 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
264 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
265 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
266 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
267 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
268 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
269 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
270 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
271 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
272 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
273 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
274 RealPredicate::RealPredicateTrue
281 #[derive(Copy, Clone, PartialEq, Debug)]
307 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
309 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
310 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
311 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
312 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
313 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
314 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
315 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
316 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
317 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
318 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
319 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
320 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
321 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
322 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
323 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
324 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
325 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
326 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
327 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
328 TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX,
333 /// LLVMAtomicRmwBinOp
334 #[derive(Copy, Clone)]
336 pub enum AtomicRmwBinOp {
350 impl AtomicRmwBinOp {
351 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
353 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
354 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
355 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
356 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
357 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
358 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
359 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
360 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
361 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
362 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
363 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
368 /// LLVMAtomicOrdering
369 #[derive(Copy, Clone)]
371 pub enum AtomicOrdering {
376 // Consume = 3, // Not specified yet.
380 SequentiallyConsistent = 7,
383 impl AtomicOrdering {
384 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
386 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
387 rustc_codegen_ssa::common::AtomicOrdering::Relaxed => AtomicOrdering::Monotonic,
388 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
389 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
390 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
391 AtomicOrdering::AcquireRelease
393 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
394 AtomicOrdering::SequentiallyConsistent
400 /// LLVMRustSynchronizationScope
401 #[derive(Copy, Clone)]
403 pub enum SynchronizationScope {
408 impl SynchronizationScope {
409 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
411 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
412 SynchronizationScope::SingleThread
414 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
415 SynchronizationScope::CrossThread
422 #[derive(Copy, Clone)]
430 #[derive(Copy, Clone)]
432 pub enum MetadataType {
439 MD_invariant_load = 6,
443 MD_mem_parallel_loop_access = 10,
447 MD_vcall_visibility = 28,
451 /// LLVMRustAsmDialect
452 #[derive(Copy, Clone, PartialEq)]
454 pub enum AsmDialect {
459 /// LLVMRustCodeGenOptLevel
460 #[derive(Copy, Clone, PartialEq)]
462 pub enum CodeGenOptLevel {
469 /// LLVMRustPassBuilderOptLevel
471 pub enum PassBuilderOptLevel {
491 /// LLVMRustSanitizerOptions
493 pub struct SanitizerOptions {
494 pub sanitize_address: bool,
495 pub sanitize_address_recover: bool,
496 pub sanitize_memory: bool,
497 pub sanitize_memory_recover: bool,
498 pub sanitize_memory_track_origins: c_int,
499 pub sanitize_thread: bool,
500 pub sanitize_hwaddress: bool,
501 pub sanitize_hwaddress_recover: bool,
505 #[derive(Copy, Clone, PartialEq)]
507 pub enum RelocModel {
516 /// LLVMRustCodeModel
517 #[derive(Copy, Clone)]
528 /// LLVMRustDiagnosticKind
529 #[derive(Copy, Clone)]
531 #[allow(dead_code)] // Variants constructed by C++.
532 pub enum DiagnosticKind {
536 DebugMetadataVersion,
539 OptimizationRemarkMissed,
540 OptimizationRemarkAnalysis,
541 OptimizationRemarkAnalysisFPCommute,
542 OptimizationRemarkAnalysisAliasing,
543 OptimizationRemarkOther,
551 /// LLVMRustDiagnosticLevel
552 #[derive(Copy, Clone)]
554 #[allow(dead_code)] // Variants constructed by C++.
555 pub enum DiagnosticLevel {
562 /// LLVMRustArchiveKind
563 #[derive(Copy, Clone)]
565 pub enum ArchiveKind {
573 #[derive(Copy, Clone, PartialEq, Debug)]
575 #[allow(dead_code)] // Variants constructed by C++.
582 // LLVMRustThinLTOData
584 pub type ThinLTOData;
587 // LLVMRustThinLTOBuffer
589 pub type ThinLTOBuffer;
592 // LLVMRustModuleNameCallback
593 pub type ThinLTOModuleNameCallback =
594 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
596 /// LLVMRustThinLTOModule
598 pub struct ThinLTOModule {
599 pub identifier: *const c_char,
604 /// LLVMThreadLocalMode
605 #[derive(Copy, Clone)]
607 pub enum ThreadLocalMode {
615 /// LLVMRustChecksumKind
616 #[derive(Copy, Clone)]
618 pub enum ChecksumKind {
629 struct InvariantOpaque<'a> {
630 _marker: PhantomData<&'a mut &'a ()>,
634 // Opaque pointer types
648 pub type ConstantInt;
660 pub struct Builder<'a>(InvariantOpaque<'a>);
662 pub type MemoryBuffer;
665 pub struct PassManager<'a>(InvariantOpaque<'a>);
667 pub type PassManagerBuilder;
673 pub type TargetMachine;
679 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
681 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
686 pub type DiagnosticInfo;
689 pub type SMDiagnostic;
692 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
694 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
696 pub struct Linker<'a>(InvariantOpaque<'a>);
699 pub type DiagnosticHandler;
702 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
703 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
705 pub mod coverageinfo {
706 use super::coverage_map;
708 /// 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)
709 #[derive(Copy, Clone, Debug)]
711 pub enum RegionKind {
712 /// A CodeRegion associates some code with a counter
715 /// An ExpansionRegion represents a file expansion region that associates
716 /// a source range with the expansion of a virtual source file, such as
717 /// for a macro instantiation or #include file.
720 /// A SkippedRegion represents a source range with code that was skipped
721 /// by a preprocessor or similar means.
724 /// A GapRegion is like a CodeRegion, but its count is only set as the
725 /// line execution count when its the only region in the line.
728 /// A BranchRegion represents leaf-level boolean expressions and is
729 /// associated with two counters, each representing the number of times the
730 /// expression evaluates to true or false.
734 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
735 /// coverage map, in accordance with the
736 /// [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).
737 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
738 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
739 /// array", encoded separately), and source location (start and end positions of the represented
742 /// Matches LLVMRustCounterMappingRegion.
743 #[derive(Copy, Clone, Debug)]
745 pub struct CounterMappingRegion {
746 /// The counter type and type-dependent counter data, if any.
747 counter: coverage_map::Counter,
749 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
750 /// for the false branch of the region.
751 false_counter: coverage_map::Counter,
753 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
754 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
755 /// that, in turn, are used to look up the filename for this region.
758 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
759 /// the mapping regions created as a result of macro expansion, by checking if their file id
760 /// matches the expanded file id.
761 expanded_file_id: u32,
763 /// 1-based starting line of the mapping region.
766 /// 1-based starting column of the mapping region.
769 /// 1-based ending line of the mapping region.
772 /// 1-based ending column of the mapping region. If the high bit is set, the current
773 /// mapping region is a gap area.
779 impl CounterMappingRegion {
780 pub(crate) fn code_region(
781 counter: coverage_map::Counter,
790 false_counter: coverage_map::Counter::zero(),
797 kind: RegionKind::CodeRegion,
801 // This function might be used in the future; the LLVM API is still evolving, as is coverage
804 pub(crate) fn branch_region(
805 counter: coverage_map::Counter,
806 false_counter: coverage_map::Counter,
822 kind: RegionKind::BranchRegion,
826 // This function might be used in the future; the LLVM API is still evolving, as is coverage
829 pub(crate) fn expansion_region(
831 expanded_file_id: u32,
838 counter: coverage_map::Counter::zero(),
839 false_counter: coverage_map::Counter::zero(),
846 kind: RegionKind::ExpansionRegion,
850 // This function might be used in the future; the LLVM API is still evolving, as is coverage
853 pub(crate) fn skipped_region(
861 counter: coverage_map::Counter::zero(),
862 false_counter: coverage_map::Counter::zero(),
869 kind: RegionKind::SkippedRegion,
873 // This function might be used in the future; the LLVM API is still evolving, as is coverage
876 pub(crate) fn gap_region(
877 counter: coverage_map::Counter,
886 false_counter: coverage_map::Counter::zero(),
892 end_col: (1_u32 << 31) | end_col,
893 kind: RegionKind::GapRegion,
900 use super::{InvariantOpaque, Metadata};
901 use bitflags::bitflags;
904 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
906 pub type DIDescriptor = Metadata;
907 pub type DILocation = Metadata;
908 pub type DIScope = DIDescriptor;
909 pub type DIFile = DIScope;
910 pub type DILexicalBlock = DIScope;
911 pub type DISubprogram = DIScope;
912 pub type DINameSpace = DIScope;
913 pub type DIType = DIDescriptor;
914 pub type DIBasicType = DIType;
915 pub type DIDerivedType = DIType;
916 pub type DICompositeType = DIDerivedType;
917 pub type DIVariable = DIDescriptor;
918 pub type DIGlobalVariableExpression = DIDescriptor;
919 pub type DIArray = DIDescriptor;
920 pub type DISubrange = DIDescriptor;
921 pub type DIEnumerator = DIDescriptor;
922 pub type DITemplateTypeParameter = DIDescriptor;
924 // These values **must** match with LLVMRustDIFlags!!
928 pub struct DIFlags: u32 {
930 const FlagPrivate = 1;
931 const FlagProtected = 2;
932 const FlagPublic = 3;
933 const FlagFwdDecl = (1 << 2);
934 const FlagAppleBlock = (1 << 3);
935 const FlagBlockByrefStruct = (1 << 4);
936 const FlagVirtual = (1 << 5);
937 const FlagArtificial = (1 << 6);
938 const FlagExplicit = (1 << 7);
939 const FlagPrototyped = (1 << 8);
940 const FlagObjcClassComplete = (1 << 9);
941 const FlagObjectPointer = (1 << 10);
942 const FlagVector = (1 << 11);
943 const FlagStaticMember = (1 << 12);
944 const FlagLValueReference = (1 << 13);
945 const FlagRValueReference = (1 << 14);
946 const FlagExternalTypeRef = (1 << 15);
947 const FlagIntroducedVirtual = (1 << 18);
948 const FlagBitField = (1 << 19);
949 const FlagNoReturn = (1 << 20);
953 // These values **must** match with LLVMRustDISPFlags!!
957 pub struct DISPFlags: u32 {
958 const SPFlagZero = 0;
959 const SPFlagVirtual = 1;
960 const SPFlagPureVirtual = 2;
961 const SPFlagLocalToUnit = (1 << 2);
962 const SPFlagDefinition = (1 << 3);
963 const SPFlagOptimized = (1 << 4);
964 const SPFlagMainSubprogram = (1 << 5);
968 /// LLVMRustDebugEmissionKind
969 #[derive(Copy, Clone)]
971 pub enum DebugEmissionKind {
977 impl DebugEmissionKind {
978 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
979 use rustc_session::config::DebugInfo;
981 DebugInfo::None => DebugEmissionKind::NoDebug,
982 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
983 DebugInfo::Full => DebugEmissionKind::FullDebug,
990 pub type ModuleBuffer;
993 pub type SelfProfileBeforePassCallback =
994 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
995 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
998 pub fn LLVMRustInstallFatalErrorHandler();
999 pub fn LLVMRustDisableSystemDialogsOnCrash();
1001 // Create and destroy contexts.
1002 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1003 pub fn LLVMContextDispose(C: &'static mut Context);
1004 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
1007 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
1008 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
1009 pub fn LLVMCloneModule(M: &Module) -> &Module;
1011 /// Data layout. See Module::getDataLayout.
1012 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1013 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1015 /// See Module::setModuleInlineAsm.
1016 pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
1017 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1019 /// See llvm::LLVMTypeKind::getTypeID.
1020 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1022 // Operations on integer types
1023 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1024 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1025 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1026 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1027 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1028 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1030 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1032 // Operations on real types
1033 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1034 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1036 // Operations on function types
1037 pub fn LLVMFunctionType<'a>(
1038 ReturnType: &'a Type,
1039 ParamTypes: *const &'a Type,
1043 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1044 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1046 // Operations on struct types
1047 pub fn LLVMStructTypeInContext<'a>(
1049 ElementTypes: *const &'a Type,
1050 ElementCount: c_uint,
1054 // Operations on array, pointer, and vector types (sequence types)
1055 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1056 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1057 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1059 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1060 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1062 // Operations on other types
1063 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1064 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1066 // Operations on all values
1067 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1068 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1069 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1070 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1071 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1072 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1073 pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1074 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1076 // Operations on constants of any type
1077 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1078 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1080 // Operations on metadata
1081 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1082 pub fn LLVMMDNodeInContext<'a>(
1084 Vals: *const &'a Value,
1087 pub fn LLVMMDNodeInContext2<'a>(
1089 Vals: *const &'a Metadata,
1092 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1094 // Operations on scalar constants
1095 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1096 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1097 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1098 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1099 pub fn LLVMRustConstInt128Get(
1100 ConstantVal: &ConstantInt,
1106 // Operations on composite constants
1107 pub fn LLVMConstStringInContext(
1111 DontNullTerminate: Bool,
1113 pub fn LLVMConstStructInContext<'a>(
1115 ConstantVals: *const &'a Value,
1120 pub fn LLVMConstArray<'a>(
1121 ElementTy: &'a Type,
1122 ConstantVals: *const &'a Value,
1125 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1127 // Constant expressions
1128 pub fn LLVMRustConstInBoundsGEP2<'a>(
1130 ConstantVal: &'a Value,
1131 ConstantIndices: *const &'a Value,
1134 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1135 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1136 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1137 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1138 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1139 pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1141 // Operations on global variables, functions, and aliases (globals)
1142 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1143 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1144 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1145 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1146 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1147 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1148 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1149 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1150 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1151 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1153 // Operations on global variables
1154 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1155 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1156 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1157 pub fn LLVMRustGetOrInsertGlobal<'a>(
1159 Name: *const c_char,
1163 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1164 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1165 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1166 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1167 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1168 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1169 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1170 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
1171 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1172 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1173 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1174 pub fn LLVMRustGetNamedValue(
1176 Name: *const c_char,
1178 ) -> Option<&Value>;
1179 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1181 // Operations on attributes
1182 pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
1183 pub fn LLVMCreateStringAttribute(
1185 Name: *const c_char,
1187 Value: *const c_char,
1190 pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
1191 pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
1192 pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
1193 pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1194 pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1195 pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1197 // Operations on functions
1198 pub fn LLVMRustGetOrInsertFunction<'a>(
1200 Name: *const c_char,
1202 FunctionTy: &'a Type,
1204 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1205 pub fn LLVMRustAddFunctionAttributes<'a>(
1208 Attrs: *const &'a Attribute,
1212 // Operations on parameters
1213 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1214 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1215 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1217 // Operations on basic blocks
1218 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1219 pub fn LLVMAppendBasicBlockInContext<'a>(
1222 Name: *const c_char,
1223 ) -> &'a BasicBlock;
1225 // Operations on instructions
1226 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1227 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1229 // Operations on call sites
1230 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1231 pub fn LLVMRustAddCallSiteAttributes<'a>(
1234 Attrs: *const &'a Attribute,
1238 // Operations on load/store instructions (only)
1239 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1241 // Operations on phi nodes
1242 pub fn LLVMAddIncoming<'a>(
1244 IncomingValues: *const &'a Value,
1245 IncomingBlocks: *const &'a BasicBlock,
1249 // Instruction builders
1250 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1251 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1252 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1253 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1256 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1259 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1260 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1261 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1262 pub fn LLVMBuildCondBr<'a>(
1265 Then: &'a BasicBlock,
1266 Else: &'a BasicBlock,
1268 pub fn LLVMBuildSwitch<'a>(
1271 Else: &'a BasicBlock,
1274 pub fn LLVMRustBuildInvoke<'a>(
1278 Args: *const &'a Value,
1280 Then: &'a BasicBlock,
1281 Catch: &'a BasicBlock,
1282 Bundle: Option<&OperandBundleDef<'a>>,
1283 Name: *const c_char,
1285 pub fn LLVMBuildLandingPad<'a>(
1288 PersFn: Option<&'a Value>,
1290 Name: *const c_char,
1292 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1293 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1295 pub fn LLVMRustBuildCleanupPad<'a>(
1297 ParentPad: Option<&'a Value>,
1299 Args: *const &'a Value,
1300 Name: *const c_char,
1301 ) -> Option<&'a Value>;
1302 pub fn LLVMRustBuildCleanupRet<'a>(
1304 CleanupPad: &'a Value,
1305 UnwindBB: Option<&'a BasicBlock>,
1306 ) -> Option<&'a Value>;
1307 pub fn LLVMRustBuildCatchPad<'a>(
1309 ParentPad: &'a Value,
1311 Args: *const &'a Value,
1312 Name: *const c_char,
1313 ) -> Option<&'a Value>;
1314 pub fn LLVMRustBuildCatchRet<'a>(
1318 ) -> Option<&'a Value>;
1319 pub fn LLVMRustBuildCatchSwitch<'a>(
1320 Builder: &Builder<'a>,
1321 ParentPad: Option<&'a Value>,
1322 BB: Option<&'a BasicBlock>,
1323 NumHandlers: c_uint,
1324 Name: *const c_char,
1325 ) -> Option<&'a Value>;
1326 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1327 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1329 // Add a case to the switch instruction
1330 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1332 // Add a clause to the landing pad instruction
1333 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1335 // Set the cleanup on a landing pad instruction
1336 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1339 pub fn LLVMBuildAdd<'a>(
1343 Name: *const c_char,
1345 pub fn LLVMBuildFAdd<'a>(
1349 Name: *const c_char,
1351 pub fn LLVMBuildSub<'a>(
1355 Name: *const c_char,
1357 pub fn LLVMBuildFSub<'a>(
1361 Name: *const c_char,
1363 pub fn LLVMBuildMul<'a>(
1367 Name: *const c_char,
1369 pub fn LLVMBuildFMul<'a>(
1373 Name: *const c_char,
1375 pub fn LLVMBuildUDiv<'a>(
1379 Name: *const c_char,
1381 pub fn LLVMBuildExactUDiv<'a>(
1385 Name: *const c_char,
1387 pub fn LLVMBuildSDiv<'a>(
1391 Name: *const c_char,
1393 pub fn LLVMBuildExactSDiv<'a>(
1397 Name: *const c_char,
1399 pub fn LLVMBuildFDiv<'a>(
1403 Name: *const c_char,
1405 pub fn LLVMBuildURem<'a>(
1409 Name: *const c_char,
1411 pub fn LLVMBuildSRem<'a>(
1415 Name: *const c_char,
1417 pub fn LLVMBuildFRem<'a>(
1421 Name: *const c_char,
1423 pub fn LLVMBuildShl<'a>(
1427 Name: *const c_char,
1429 pub fn LLVMBuildLShr<'a>(
1433 Name: *const c_char,
1435 pub fn LLVMBuildAShr<'a>(
1439 Name: *const c_char,
1441 pub fn LLVMBuildNSWAdd<'a>(
1445 Name: *const c_char,
1447 pub fn LLVMBuildNUWAdd<'a>(
1451 Name: *const c_char,
1453 pub fn LLVMBuildNSWSub<'a>(
1457 Name: *const c_char,
1459 pub fn LLVMBuildNUWSub<'a>(
1463 Name: *const c_char,
1465 pub fn LLVMBuildNSWMul<'a>(
1469 Name: *const c_char,
1471 pub fn LLVMBuildNUWMul<'a>(
1475 Name: *const c_char,
1477 pub fn LLVMBuildAnd<'a>(
1481 Name: *const c_char,
1483 pub fn LLVMBuildOr<'a>(
1487 Name: *const c_char,
1489 pub fn LLVMBuildXor<'a>(
1493 Name: *const c_char,
1495 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1496 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1497 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1498 pub fn LLVMRustSetFastMath(Instr: &Value);
1501 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1502 pub fn LLVMBuildArrayAlloca<'a>(
1506 Name: *const c_char,
1508 pub fn LLVMBuildLoad2<'a>(
1511 PointerVal: &'a Value,
1512 Name: *const c_char,
1515 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1517 pub fn LLVMBuildGEP2<'a>(
1521 Indices: *const &'a Value,
1523 Name: *const c_char,
1525 pub fn LLVMBuildInBoundsGEP2<'a>(
1529 Indices: *const &'a Value,
1531 Name: *const c_char,
1533 pub fn LLVMBuildStructGEP2<'a>(
1538 Name: *const c_char,
1542 pub fn LLVMBuildTrunc<'a>(
1546 Name: *const c_char,
1548 pub fn LLVMBuildZExt<'a>(
1552 Name: *const c_char,
1554 pub fn LLVMBuildSExt<'a>(
1558 Name: *const c_char,
1560 pub fn LLVMBuildFPToUI<'a>(
1564 Name: *const c_char,
1566 pub fn LLVMBuildFPToSI<'a>(
1570 Name: *const c_char,
1572 pub fn LLVMBuildUIToFP<'a>(
1576 Name: *const c_char,
1578 pub fn LLVMBuildSIToFP<'a>(
1582 Name: *const c_char,
1584 pub fn LLVMBuildFPTrunc<'a>(
1588 Name: *const c_char,
1590 pub fn LLVMBuildFPExt<'a>(
1594 Name: *const c_char,
1596 pub fn LLVMBuildPtrToInt<'a>(
1600 Name: *const c_char,
1602 pub fn LLVMBuildIntToPtr<'a>(
1606 Name: *const c_char,
1608 pub fn LLVMBuildBitCast<'a>(
1612 Name: *const c_char,
1614 pub fn LLVMBuildPointerCast<'a>(
1618 Name: *const c_char,
1620 pub fn LLVMRustBuildIntCast<'a>(
1628 pub fn LLVMBuildICmp<'a>(
1633 Name: *const c_char,
1635 pub fn LLVMBuildFCmp<'a>(
1640 Name: *const c_char,
1643 // Miscellaneous instructions
1644 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1645 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1646 pub fn LLVMRustBuildCall<'a>(
1650 Args: *const &'a Value,
1652 Bundle: Option<&OperandBundleDef<'a>>,
1654 pub fn LLVMRustBuildMemCpy<'a>(
1663 pub fn LLVMRustBuildMemMove<'a>(
1672 pub fn LLVMRustBuildMemSet<'a>(
1680 pub fn LLVMBuildSelect<'a>(
1685 Name: *const c_char,
1687 pub fn LLVMBuildVAArg<'a>(
1691 Name: *const c_char,
1693 pub fn LLVMBuildExtractElement<'a>(
1697 Name: *const c_char,
1699 pub fn LLVMBuildInsertElement<'a>(
1704 Name: *const c_char,
1706 pub fn LLVMBuildShuffleVector<'a>(
1711 Name: *const c_char,
1713 pub fn LLVMBuildExtractValue<'a>(
1717 Name: *const c_char,
1719 pub fn LLVMBuildInsertValue<'a>(
1724 Name: *const c_char,
1727 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1732 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1737 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1738 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1739 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1740 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1741 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1742 pub fn LLVMRustBuildVectorReduceMin<'a>(
1747 pub fn LLVMRustBuildVectorReduceMax<'a>(
1752 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1757 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1763 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1764 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1766 // Atomic Operations
1767 pub fn LLVMRustBuildAtomicLoad<'a>(
1769 ElementType: &'a Type,
1770 PointerVal: &'a Value,
1771 Name: *const c_char,
1772 Order: AtomicOrdering,
1775 pub fn LLVMRustBuildAtomicStore<'a>(
1779 Order: AtomicOrdering,
1782 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1787 Order: AtomicOrdering,
1788 FailureOrder: AtomicOrdering,
1792 pub fn LLVMBuildAtomicRMW<'a>(
1797 Order: AtomicOrdering,
1798 SingleThreaded: Bool,
1801 pub fn LLVMRustBuildAtomicFence(
1803 Order: AtomicOrdering,
1804 Scope: SynchronizationScope,
1807 /// Writes a module to the specified path. Returns 0 on success.
1808 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1810 /// Creates a pass manager.
1811 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1813 /// Creates a function-by-function pass manager
1814 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1816 /// Disposes a pass manager.
1817 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1819 /// Runs a pass manager on a module.
1820 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1822 pub fn LLVMInitializePasses();
1824 pub fn LLVMTimeTraceProfilerInitialize();
1826 pub fn LLVMTimeTraceProfilerFinishThread();
1828 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1830 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1832 pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1833 pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1834 pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold(
1835 PMB: &PassManagerBuilder,
1838 pub fn LLVMRustPassManagerBuilderPopulateModulePassManager(
1839 PMB: &PassManagerBuilder,
1840 PM: &PassManager<'_>,
1843 pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager(
1844 PMB: &PassManagerBuilder,
1845 PM: &PassManager<'_>,
1847 pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager(
1848 PMB: &PassManagerBuilder,
1849 PM: &PassManager<'_>,
1853 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1854 PMB: &PassManagerBuilder,
1855 PM: &PassManager<'_>,
1858 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1860 pub fn LLVMDisposeMessage(message: *mut c_char);
1862 pub fn LLVMIsMultithreaded() -> Bool;
1864 /// Returns a string describing the last error caused by an LLVMRust* call.
1865 pub fn LLVMRustGetLastError() -> *const c_char;
1867 /// Print the pass timings since static dtors aren't picking them up.
1868 pub fn LLVMRustPrintPassTimings();
1870 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1872 pub fn LLVMStructSetBody<'a>(
1874 ElementTypes: *const &'a Type,
1875 ElementCount: c_uint,
1879 /// Prepares inline assembly.
1880 pub fn LLVMRustInlineAsm(
1882 AsmString: *const c_char,
1883 AsmStringLen: size_t,
1884 Constraints: *const c_char,
1885 ConstraintsLen: size_t,
1888 Dialect: AsmDialect,
1891 pub fn LLVMRustInlineAsmVerify(
1893 Constraints: *const c_char,
1894 ConstraintsLen: size_t,
1897 #[allow(improper_ctypes)]
1898 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1899 Filenames: *const *const c_char,
1900 FilenamesLen: size_t,
1901 BufferOut: &RustString,
1904 #[allow(improper_ctypes)]
1905 pub fn LLVMRustCoverageWriteMappingToBuffer(
1906 VirtualFileMappingIDs: *const c_uint,
1907 NumVirtualFileMappingIDs: c_uint,
1908 Expressions: *const coverage_map::CounterExpression,
1909 NumExpressions: c_uint,
1910 MappingRegions: *const coverageinfo::CounterMappingRegion,
1911 NumMappingRegions: c_uint,
1912 BufferOut: &RustString,
1915 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1916 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1917 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1919 #[allow(improper_ctypes)]
1920 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1922 #[allow(improper_ctypes)]
1923 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1925 #[allow(improper_ctypes)]
1926 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1928 pub fn LLVMRustCoverageMappingVersion() -> u32;
1929 pub fn LLVMRustDebugMetadataVersion() -> u32;
1930 pub fn LLVMRustVersionMajor() -> u32;
1931 pub fn LLVMRustVersionMinor() -> u32;
1932 pub fn LLVMRustVersionPatch() -> u32;
1934 /// Add LLVM module flags.
1936 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1937 /// "compatible" means depends on the merge behaviors involved.
1938 pub fn LLVMRustAddModuleFlag(
1940 merge_behavior: LLVMModFlagBehavior,
1941 name: *const c_char,
1944 pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool;
1946 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1948 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1950 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1952 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1954 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1955 Builder: &DIBuilder<'a>,
1958 Producer: *const c_char,
1959 ProducerLen: size_t,
1961 Flags: *const c_char,
1963 SplitName: *const c_char,
1964 SplitNameLen: size_t,
1965 kind: DebugEmissionKind,
1967 SplitDebugInlining: bool,
1968 ) -> &'a DIDescriptor;
1970 pub fn LLVMRustDIBuilderCreateFile<'a>(
1971 Builder: &DIBuilder<'a>,
1972 Filename: *const c_char,
1973 FilenameLen: size_t,
1974 Directory: *const c_char,
1975 DirectoryLen: size_t,
1976 CSKind: ChecksumKind,
1977 Checksum: *const c_char,
1978 ChecksumLen: size_t,
1981 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1982 Builder: &DIBuilder<'a>,
1983 ParameterTypes: &'a DIArray,
1984 ) -> &'a DICompositeType;
1986 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1987 Builder: &DIBuilder<'a>,
1988 Scope: &'a DIDescriptor,
1989 Name: *const c_char,
1991 LinkageName: *const c_char,
1992 LinkageNameLen: size_t,
1999 MaybeFn: Option<&'a Value>,
2000 TParam: &'a DIArray,
2001 Decl: Option<&'a DIDescriptor>,
2002 ) -> &'a DISubprogram;
2004 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2005 Builder: &DIBuilder<'a>,
2006 Name: *const c_char,
2010 ) -> &'a DIBasicType;
2012 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
2013 Builder: &DIBuilder<'a>,
2014 Type: &'a DIBasicType,
2015 Name: *const c_char,
2019 Scope: Option<&'a DIScope>,
2020 ) -> &'a DIDerivedType;
2022 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2023 Builder: &DIBuilder<'a>,
2024 PointeeTy: &'a DIType,
2027 AddressSpace: c_uint,
2028 Name: *const c_char,
2030 ) -> &'a DIDerivedType;
2032 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2033 Builder: &DIBuilder<'a>,
2034 Scope: Option<&'a DIDescriptor>,
2035 Name: *const c_char,
2042 DerivedFrom: Option<&'a DIType>,
2043 Elements: &'a DIArray,
2044 RunTimeLang: c_uint,
2045 VTableHolder: Option<&'a DIType>,
2046 UniqueId: *const c_char,
2047 UniqueIdLen: size_t,
2048 ) -> &'a DICompositeType;
2050 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2051 Builder: &DIBuilder<'a>,
2052 Scope: &'a DIDescriptor,
2053 Name: *const c_char,
2062 ) -> &'a DIDerivedType;
2064 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2065 Builder: &DIBuilder<'a>,
2067 Name: *const c_char,
2074 Discriminant: Option<&'a Value>,
2079 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2080 Builder: &DIBuilder<'a>,
2085 ) -> &'a DILexicalBlock;
2087 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2088 Builder: &DIBuilder<'a>,
2091 ) -> &'a DILexicalBlock;
2093 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2094 Builder: &DIBuilder<'a>,
2095 Context: Option<&'a DIScope>,
2096 Name: *const c_char,
2098 LinkageName: *const c_char,
2099 LinkageNameLen: size_t,
2103 isLocalToUnit: bool,
2105 Decl: Option<&'a DIDescriptor>,
2107 ) -> &'a DIGlobalVariableExpression;
2109 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2110 Builder: &DIBuilder<'a>,
2112 Scope: &'a DIDescriptor,
2113 Name: *const c_char,
2118 AlwaysPreserve: bool,
2122 ) -> &'a DIVariable;
2124 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2125 Builder: &DIBuilder<'a>,
2129 Subscripts: &'a DIArray,
2132 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2133 Builder: &DIBuilder<'a>,
2136 ) -> &'a DISubrange;
2138 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2139 Builder: &DIBuilder<'a>,
2140 Ptr: *const Option<&'a DIDescriptor>,
2144 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2145 Builder: &DIBuilder<'a>,
2147 VarInfo: &'a DIVariable,
2148 AddrOps: *const u64,
2149 AddrOpsCount: c_uint,
2151 InsertAtEnd: &'a BasicBlock,
2154 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2155 Builder: &DIBuilder<'a>,
2156 Name: *const c_char,
2160 ) -> &'a DIEnumerator;
2162 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2163 Builder: &DIBuilder<'a>,
2165 Name: *const c_char,
2171 Elements: &'a DIArray,
2172 ClassType: &'a DIType,
2176 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2177 Builder: &DIBuilder<'a>,
2178 Scope: Option<&'a DIScope>,
2179 Name: *const c_char,
2186 Elements: Option<&'a DIArray>,
2187 RunTimeLang: c_uint,
2188 UniqueId: *const c_char,
2189 UniqueIdLen: size_t,
2192 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2193 Builder: &DIBuilder<'a>,
2195 Name: *const c_char,
2202 Discriminator: Option<&'a DIDerivedType>,
2203 Elements: &'a DIArray,
2204 UniqueId: *const c_char,
2205 UniqueIdLen: size_t,
2206 ) -> &'a DIDerivedType;
2208 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2210 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2211 Builder: &DIBuilder<'a>,
2212 Scope: Option<&'a DIScope>,
2213 Name: *const c_char,
2216 ) -> &'a DITemplateTypeParameter;
2218 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2219 Builder: &DIBuilder<'a>,
2220 Scope: Option<&'a DIScope>,
2221 Name: *const c_char,
2223 ExportSymbols: bool,
2224 ) -> &'a DINameSpace;
2226 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2227 Builder: &DIBuilder<'a>,
2228 CompositeType: &'a DIType,
2229 Elements: Option<&'a DIArray>,
2230 Params: Option<&'a DIArray>,
2233 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2237 InlinedAt: Option<&'a DILocation>,
2238 ) -> &'a DILocation;
2239 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2240 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2242 #[allow(improper_ctypes)]
2243 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2244 #[allow(improper_ctypes)]
2245 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2247 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2249 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
2250 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2251 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2252 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2253 pub fn LLVMRustCreateMemorySanitizerPass(
2254 TrackOrigins: c_int,
2256 ) -> &'static mut Pass;
2257 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2258 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2259 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2260 pub fn LLVMRustAddLastExtensionPasses(
2261 PMB: &PassManagerBuilder,
2262 Passes: *const &'static mut Pass,
2266 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2268 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2269 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2270 pub fn LLVMRustGetTargetFeature(
2273 Feature: &mut *const c_char,
2274 Desc: &mut *const c_char,
2277 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2278 pub fn LLVMRustCreateTargetMachine(
2279 Triple: *const c_char,
2281 Features: *const c_char,
2285 Level: CodeGenOptLevel,
2287 FunctionSections: bool,
2289 UniqueSectionNames: bool,
2290 TrapUnreachable: bool,
2293 EmitStackSizeSection: bool,
2294 RelaxELFRelocations: bool,
2296 SplitDwarfFile: *const c_char,
2297 ) -> Option<&'static mut TargetMachine>;
2298 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2299 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2300 PMB: &'a PassManagerBuilder,
2302 DisableSimplifyLibCalls: bool,
2304 pub fn LLVMRustConfigurePassManagerBuilder(
2305 PMB: &PassManagerBuilder,
2306 OptLevel: CodeGenOptLevel,
2307 MergeFunctions: bool,
2309 LoopVectorize: bool,
2310 PrepareForThinLTO: bool,
2311 PGOGenPath: *const c_char,
2312 PGOUsePath: *const c_char,
2313 PGOSampleUsePath: *const c_char,
2316 pub fn LLVMRustAddLibraryInfo<'a>(
2317 PM: &PassManager<'a>,
2319 DisableSimplifyLibCalls: bool,
2321 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2322 pub fn LLVMRustWriteOutputFile<'a>(
2323 T: &'a TargetMachine,
2324 PM: &PassManager<'a>,
2326 Output: *const c_char,
2327 DwoOutput: *const c_char,
2329 ) -> LLVMRustResult;
2330 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2332 TM: &'a TargetMachine,
2333 OptLevel: PassBuilderOptLevel,
2335 NoPrepopulatePasses: bool,
2337 UseThinLTOBuffers: bool,
2338 MergeFunctions: bool,
2341 LoopVectorize: bool,
2342 DisableSimplifyLibCalls: bool,
2343 EmitLifetimeMarkers: bool,
2344 SanitizerOptions: Option<&SanitizerOptions>,
2345 PGOGenPath: *const c_char,
2346 PGOUsePath: *const c_char,
2347 InstrumentCoverage: bool,
2348 InstrumentGCOV: bool,
2349 PGOSampleUsePath: *const c_char,
2350 DebugInfoForProfiling: bool,
2351 llvm_selfprofiler: *mut c_void,
2352 begin_callback: SelfProfileBeforePassCallback,
2353 end_callback: SelfProfileAfterPassCallback,
2354 ExtraPasses: *const c_char,
2355 ExtraPassesLen: size_t,
2356 LLVMPlugins: *const c_char,
2357 LLVMPluginsLen: size_t,
2358 ) -> LLVMRustResult;
2359 pub fn LLVMRustPrintModule(
2361 Output: *const c_char,
2362 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2363 ) -> LLVMRustResult;
2364 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2365 pub fn LLVMRustPrintPasses();
2366 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
2367 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2368 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2369 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2371 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2372 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2373 pub fn LLVMRustArchiveIteratorNext<'a>(
2374 AIR: &ArchiveIterator<'a>,
2375 ) -> Option<&'a mut ArchiveChild<'a>>;
2376 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2377 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2378 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2379 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2380 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2382 #[allow(improper_ctypes)]
2383 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2385 #[allow(improper_ctypes)]
2386 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2387 DI: &'a DiagnosticInfo,
2388 pass_name_out: &RustString,
2389 function_out: &mut Option<&'a Value>,
2390 loc_line_out: &mut c_uint,
2391 loc_column_out: &mut c_uint,
2392 loc_filename_out: &RustString,
2393 message_out: &RustString,
2396 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2397 DI: &'a DiagnosticInfo,
2398 level_out: &mut DiagnosticLevel,
2399 cookie_out: &mut c_uint,
2400 message_out: &mut Option<&'a Twine>,
2403 #[allow(improper_ctypes)]
2404 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2405 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2407 pub fn LLVMRustGetSMDiagnostic<'a>(
2408 DI: &'a DiagnosticInfo,
2409 cookie_out: &mut c_uint,
2410 ) -> &'a SMDiagnostic;
2412 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2414 H: InlineAsmDiagHandlerTy,
2418 #[allow(improper_ctypes)]
2419 pub fn LLVMRustUnpackSMDiagnostic(
2421 message_out: &RustString,
2422 buffer_out: &RustString,
2423 level_out: &mut DiagnosticLevel,
2424 loc_out: &mut c_uint,
2425 ranges_out: *mut c_uint,
2426 num_ranges: &mut usize,
2429 pub fn LLVMRustWriteArchive(
2432 Members: *const &RustArchiveMember<'_>,
2435 ) -> LLVMRustResult;
2436 pub fn LLVMRustArchiveMemberNew<'a>(
2437 Filename: *const c_char,
2438 Name: *const c_char,
2439 Child: Option<&ArchiveChild<'a>>,
2440 ) -> &'a mut RustArchiveMember<'a>;
2441 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2443 pub fn LLVMRustWriteImportLibrary(
2444 ImportName: *const c_char,
2445 Path: *const c_char,
2446 Exports: *const LLVMRustCOFFShortExport,
2450 ) -> LLVMRustResult;
2452 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2454 pub fn LLVMRustBuildOperandBundleDef<'a>(
2455 Name: *const c_char,
2456 Inputs: *const &'a Value,
2458 ) -> &'a mut OperandBundleDef<'a>;
2459 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2461 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2463 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2464 pub fn LLVMRustUnsetComdat(V: &Value);
2465 pub fn LLVMRustSetModulePICLevel(M: &Module);
2466 pub fn LLVMRustSetModulePIELevel(M: &Module);
2467 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2468 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2469 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2470 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2471 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2472 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2474 pub fn LLVMRustThinLTOBufferCreate(M: &Module, is_thin: bool) -> &'static mut ThinLTOBuffer;
2475 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2476 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2477 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2478 pub fn LLVMRustCreateThinLTOData(
2479 Modules: *const ThinLTOModule,
2481 PreservedSymbols: *const *const c_char,
2482 PreservedSymbolsLen: c_uint,
2483 ) -> Option<&'static mut ThinLTOData>;
2484 pub fn LLVMRustPrepareThinLTORename(
2487 Target: &TargetMachine,
2489 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2490 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2491 pub fn LLVMRustPrepareThinLTOImport(
2494 Target: &TargetMachine,
2496 pub fn LLVMRustGetThinLTOModuleImports(
2497 Data: *const ThinLTOData,
2498 ModuleNameCallback: ThinLTOModuleNameCallback,
2499 CallbackPayload: *mut c_void,
2501 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2502 pub fn LLVMRustParseBitcodeForLTO(
2506 Identifier: *const c_char,
2507 ) -> Option<&Module>;
2508 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2511 out_len: &mut usize,
2513 pub fn LLVMRustThinLTOGetDICompileUnit(
2515 CU1: &mut *mut c_void,
2516 CU2: &mut *mut c_void,
2518 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2520 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2521 pub fn LLVMRustLinkerAdd(
2522 linker: &Linker<'_>,
2523 bytecode: *const c_char,
2524 bytecode_len: usize,
2526 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2527 #[allow(improper_ctypes)]
2528 pub fn LLVMRustComputeLTOCacheKey(
2529 key_out: &RustString,
2530 mod_id: *const c_char,
2534 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2535 pub fn LLVMRustContextSetDiagnosticHandler(
2537 diagnostic_handler: Option<&DiagnosticHandler>,
2539 pub fn LLVMRustContextConfigureDiagnosticHandler(
2541 diagnostic_handler_callback: DiagnosticHandlerTy,
2542 diagnostic_handler_context: *mut c_void,
2543 remark_all_passes: bool,
2544 remark_passes: *const *const c_char,
2545 remark_passes_len: usize,
2548 #[allow(improper_ctypes)]
2549 pub fn LLVMRustGetMangledName(V: &Value, out: &RustString);