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,
197 AllocatedPointer = 38,
202 #[derive(Copy, Clone)]
204 pub enum IntPredicate {
218 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
220 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
221 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
222 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
223 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
224 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
225 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
226 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
227 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
228 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
229 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
234 /// LLVMRealPredicate
235 #[derive(Copy, Clone)]
237 pub enum RealPredicate {
238 RealPredicateFalse = 0,
253 RealPredicateTrue = 15,
257 pub fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
259 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
260 RealPredicate::RealPredicateFalse
262 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
263 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
264 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
265 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
266 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
267 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
268 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
269 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
270 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
271 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
272 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
273 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
274 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
275 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
276 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
277 RealPredicate::RealPredicateTrue
284 #[derive(Copy, Clone, PartialEq, Debug)]
310 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
312 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
313 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
314 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
315 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
316 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
317 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
318 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
319 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
320 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
321 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
322 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
323 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
324 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
325 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
326 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
327 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
328 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
329 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
330 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
331 TypeKind::X86_AMX => rustc_codegen_ssa::common::TypeKind::X86_AMX,
336 /// LLVMAtomicRmwBinOp
337 #[derive(Copy, Clone)]
339 pub enum AtomicRmwBinOp {
353 impl AtomicRmwBinOp {
354 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
356 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
357 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
358 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
359 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
360 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
361 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
362 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
363 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
364 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
365 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
366 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
371 /// LLVMAtomicOrdering
372 #[derive(Copy, Clone)]
374 pub enum AtomicOrdering {
379 // Consume = 3, // Not specified yet.
383 SequentiallyConsistent = 7,
386 impl AtomicOrdering {
387 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
389 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
390 rustc_codegen_ssa::common::AtomicOrdering::Relaxed => AtomicOrdering::Monotonic,
391 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
392 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
393 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
394 AtomicOrdering::AcquireRelease
396 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
397 AtomicOrdering::SequentiallyConsistent
403 /// LLVMRustSynchronizationScope
404 #[derive(Copy, Clone)]
406 pub enum SynchronizationScope {
411 impl SynchronizationScope {
412 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
414 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
415 SynchronizationScope::SingleThread
417 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
418 SynchronizationScope::CrossThread
425 #[derive(Copy, Clone)]
433 #[derive(Copy, Clone)]
435 pub enum MetadataType {
442 MD_invariant_load = 6,
446 MD_mem_parallel_loop_access = 10,
450 MD_vcall_visibility = 28,
454 /// LLVMRustAsmDialect
455 #[derive(Copy, Clone, PartialEq)]
457 pub enum AsmDialect {
462 /// LLVMRustCodeGenOptLevel
463 #[derive(Copy, Clone, PartialEq)]
465 pub enum CodeGenOptLevel {
472 /// LLVMRustPassBuilderOptLevel
474 pub enum PassBuilderOptLevel {
494 /// LLVMRustSanitizerOptions
496 pub struct SanitizerOptions {
497 pub sanitize_address: bool,
498 pub sanitize_address_recover: bool,
499 pub sanitize_memory: bool,
500 pub sanitize_memory_recover: bool,
501 pub sanitize_memory_track_origins: c_int,
502 pub sanitize_thread: bool,
503 pub sanitize_hwaddress: bool,
504 pub sanitize_hwaddress_recover: bool,
508 #[derive(Copy, Clone, PartialEq)]
510 pub enum RelocModel {
519 /// LLVMRustCodeModel
520 #[derive(Copy, Clone)]
531 /// LLVMRustDiagnosticKind
532 #[derive(Copy, Clone)]
534 #[allow(dead_code)] // Variants constructed by C++.
535 pub enum DiagnosticKind {
539 DebugMetadataVersion,
542 OptimizationRemarkMissed,
543 OptimizationRemarkAnalysis,
544 OptimizationRemarkAnalysisFPCommute,
545 OptimizationRemarkAnalysisAliasing,
546 OptimizationRemarkOther,
554 /// LLVMRustDiagnosticLevel
555 #[derive(Copy, Clone)]
557 #[allow(dead_code)] // Variants constructed by C++.
558 pub enum DiagnosticLevel {
565 /// LLVMRustArchiveKind
566 #[derive(Copy, Clone)]
568 pub enum ArchiveKind {
575 // LLVMRustThinLTOData
577 pub type ThinLTOData;
580 // LLVMRustThinLTOBuffer
582 pub type ThinLTOBuffer;
585 /// LLVMRustThinLTOModule
587 pub struct ThinLTOModule {
588 pub identifier: *const c_char,
593 /// LLVMThreadLocalMode
594 #[derive(Copy, Clone)]
596 pub enum ThreadLocalMode {
604 /// LLVMRustChecksumKind
605 #[derive(Copy, Clone)]
607 pub enum ChecksumKind {
618 struct InvariantOpaque<'a> {
619 _marker: PhantomData<&'a mut &'a ()>,
623 // Opaque pointer types
637 pub type ConstantInt;
649 pub struct Builder<'a>(InvariantOpaque<'a>);
651 pub struct PassManager<'a>(InvariantOpaque<'a>);
653 pub type PassManagerBuilder;
659 pub type TargetMachine;
665 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
667 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
672 pub type DiagnosticInfo;
675 pub type SMDiagnostic;
678 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
680 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
682 pub struct Linker<'a>(InvariantOpaque<'a>);
685 pub type DiagnosticHandler;
688 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
689 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
691 pub mod coverageinfo {
692 use super::coverage_map;
694 /// 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)
695 #[derive(Copy, Clone, Debug)]
697 pub enum RegionKind {
698 /// A CodeRegion associates some code with a counter
701 /// An ExpansionRegion represents a file expansion region that associates
702 /// a source range with the expansion of a virtual source file, such as
703 /// for a macro instantiation or #include file.
706 /// A SkippedRegion represents a source range with code that was skipped
707 /// by a preprocessor or similar means.
710 /// A GapRegion is like a CodeRegion, but its count is only set as the
711 /// line execution count when its the only region in the line.
714 /// A BranchRegion represents leaf-level boolean expressions and is
715 /// associated with two counters, each representing the number of times the
716 /// expression evaluates to true or false.
720 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
721 /// coverage map, in accordance with the
722 /// [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).
723 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
724 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
725 /// array", encoded separately), and source location (start and end positions of the represented
728 /// Matches LLVMRustCounterMappingRegion.
729 #[derive(Copy, Clone, Debug)]
731 pub struct CounterMappingRegion {
732 /// The counter type and type-dependent counter data, if any.
733 counter: coverage_map::Counter,
735 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
736 /// for the false branch of the region.
737 false_counter: coverage_map::Counter,
739 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
740 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
741 /// that, in turn, are used to look up the filename for this region.
744 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
745 /// the mapping regions created as a result of macro expansion, by checking if their file id
746 /// matches the expanded file id.
747 expanded_file_id: u32,
749 /// 1-based starting line of the mapping region.
752 /// 1-based starting column of the mapping region.
755 /// 1-based ending line of the mapping region.
758 /// 1-based ending column of the mapping region. If the high bit is set, the current
759 /// mapping region is a gap area.
765 impl CounterMappingRegion {
766 pub(crate) fn code_region(
767 counter: coverage_map::Counter,
776 false_counter: coverage_map::Counter::zero(),
783 kind: RegionKind::CodeRegion,
787 // This function might be used in the future; the LLVM API is still evolving, as is coverage
790 pub(crate) fn branch_region(
791 counter: coverage_map::Counter,
792 false_counter: coverage_map::Counter,
808 kind: RegionKind::BranchRegion,
812 // This function might be used in the future; the LLVM API is still evolving, as is coverage
815 pub(crate) fn expansion_region(
817 expanded_file_id: u32,
824 counter: coverage_map::Counter::zero(),
825 false_counter: coverage_map::Counter::zero(),
832 kind: RegionKind::ExpansionRegion,
836 // This function might be used in the future; the LLVM API is still evolving, as is coverage
839 pub(crate) fn skipped_region(
847 counter: coverage_map::Counter::zero(),
848 false_counter: coverage_map::Counter::zero(),
855 kind: RegionKind::SkippedRegion,
859 // This function might be used in the future; the LLVM API is still evolving, as is coverage
862 pub(crate) fn gap_region(
863 counter: coverage_map::Counter,
872 false_counter: coverage_map::Counter::zero(),
878 end_col: (1_u32 << 31) | end_col,
879 kind: RegionKind::GapRegion,
886 use super::{InvariantOpaque, Metadata};
887 use bitflags::bitflags;
890 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
892 pub type DIDescriptor = Metadata;
893 pub type DILocation = Metadata;
894 pub type DIScope = DIDescriptor;
895 pub type DIFile = DIScope;
896 pub type DILexicalBlock = DIScope;
897 pub type DISubprogram = DIScope;
898 pub type DINameSpace = DIScope;
899 pub type DIType = DIDescriptor;
900 pub type DIBasicType = DIType;
901 pub type DIDerivedType = DIType;
902 pub type DICompositeType = DIDerivedType;
903 pub type DIVariable = DIDescriptor;
904 pub type DIGlobalVariableExpression = DIDescriptor;
905 pub type DIArray = DIDescriptor;
906 pub type DISubrange = DIDescriptor;
907 pub type DIEnumerator = DIDescriptor;
908 pub type DITemplateTypeParameter = DIDescriptor;
910 // These values **must** match with LLVMRustDIFlags!!
914 pub struct DIFlags: u32 {
916 const FlagPrivate = 1;
917 const FlagProtected = 2;
918 const FlagPublic = 3;
919 const FlagFwdDecl = (1 << 2);
920 const FlagAppleBlock = (1 << 3);
921 const FlagBlockByrefStruct = (1 << 4);
922 const FlagVirtual = (1 << 5);
923 const FlagArtificial = (1 << 6);
924 const FlagExplicit = (1 << 7);
925 const FlagPrototyped = (1 << 8);
926 const FlagObjcClassComplete = (1 << 9);
927 const FlagObjectPointer = (1 << 10);
928 const FlagVector = (1 << 11);
929 const FlagStaticMember = (1 << 12);
930 const FlagLValueReference = (1 << 13);
931 const FlagRValueReference = (1 << 14);
932 const FlagExternalTypeRef = (1 << 15);
933 const FlagIntroducedVirtual = (1 << 18);
934 const FlagBitField = (1 << 19);
935 const FlagNoReturn = (1 << 20);
939 // These values **must** match with LLVMRustDISPFlags!!
943 pub struct DISPFlags: u32 {
944 const SPFlagZero = 0;
945 const SPFlagVirtual = 1;
946 const SPFlagPureVirtual = 2;
947 const SPFlagLocalToUnit = (1 << 2);
948 const SPFlagDefinition = (1 << 3);
949 const SPFlagOptimized = (1 << 4);
950 const SPFlagMainSubprogram = (1 << 5);
954 /// LLVMRustDebugEmissionKind
955 #[derive(Copy, Clone)]
957 pub enum DebugEmissionKind {
963 impl DebugEmissionKind {
964 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
965 use rustc_session::config::DebugInfo;
967 DebugInfo::None => DebugEmissionKind::NoDebug,
968 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
969 DebugInfo::Full => DebugEmissionKind::FullDebug,
975 use bitflags::bitflags;
976 // These values **must** match with LLVMRustAllocKindFlags
980 pub struct AllocKindFlags : u64 {
983 const Realloc = 1 << 1;
985 const Uninitialized = 1 << 3;
986 const Zeroed = 1 << 4;
987 const Aligned = 1 << 5;
992 pub type ModuleBuffer;
995 pub type SelfProfileBeforePassCallback =
996 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
997 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
1000 pub fn LLVMRustInstallFatalErrorHandler();
1001 pub fn LLVMRustDisableSystemDialogsOnCrash();
1003 // Create and destroy contexts.
1004 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1005 pub fn LLVMContextDispose(C: &'static mut Context);
1006 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
1009 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
1010 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
1011 pub fn LLVMCloneModule(M: &Module) -> &Module;
1013 /// Data layout. See Module::getDataLayout.
1014 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1015 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1017 /// See Module::setModuleInlineAsm.
1018 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1020 /// See llvm::LLVMTypeKind::getTypeID.
1021 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1023 // Operations on integer types
1024 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1025 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1026 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1027 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1028 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1029 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1031 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1033 // Operations on real types
1034 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1035 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1037 // Operations on function types
1038 pub fn LLVMFunctionType<'a>(
1039 ReturnType: &'a Type,
1040 ParamTypes: *const &'a Type,
1044 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1045 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1047 // Operations on struct types
1048 pub fn LLVMStructTypeInContext<'a>(
1050 ElementTypes: *const &'a Type,
1051 ElementCount: c_uint,
1055 // Operations on array, pointer, and vector types (sequence types)
1056 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1057 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1058 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1060 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1061 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1063 // Operations on other types
1064 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1065 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1067 // Operations on all values
1068 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1069 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1070 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1071 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1072 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1073 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1074 pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1075 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1077 // Operations on constants of any type
1078 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1079 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1081 // Operations on metadata
1082 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1083 pub fn LLVMMDNodeInContext<'a>(
1085 Vals: *const &'a Value,
1088 pub fn LLVMMDNodeInContext2<'a>(
1090 Vals: *const &'a Metadata,
1093 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1095 // Operations on scalar constants
1096 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1097 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1098 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1099 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1100 pub fn LLVMRustConstInt128Get(
1101 ConstantVal: &ConstantInt,
1107 // Operations on composite constants
1108 pub fn LLVMConstStringInContext(
1112 DontNullTerminate: Bool,
1114 pub fn LLVMConstStructInContext<'a>(
1116 ConstantVals: *const &'a Value,
1121 pub fn LLVMConstArray<'a>(
1122 ElementTy: &'a Type,
1123 ConstantVals: *const &'a Value,
1126 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1128 // Constant expressions
1129 pub fn LLVMRustConstInBoundsGEP2<'a>(
1131 ConstantVal: &'a Value,
1132 ConstantIndices: *const &'a Value,
1135 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1136 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1137 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1138 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1139 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1140 pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1142 // Operations on global variables, functions, and aliases (globals)
1143 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1144 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1145 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1146 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1147 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1148 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1149 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1150 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1151 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1152 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1154 // Operations on global variables
1155 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1156 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1157 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1158 pub fn LLVMRustGetOrInsertGlobal<'a>(
1160 Name: *const c_char,
1164 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1165 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1166 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1167 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1168 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1169 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1170 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> 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 LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1196 pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1197 pub fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute;
1198 pub fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute;
1200 // Operations on functions
1201 pub fn LLVMRustGetOrInsertFunction<'a>(
1203 Name: *const c_char,
1205 FunctionTy: &'a Type,
1207 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1208 pub fn LLVMRustAddFunctionAttributes<'a>(
1211 Attrs: *const &'a Attribute,
1215 // Operations on parameters
1216 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1217 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1218 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1220 // Operations on basic blocks
1221 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1222 pub fn LLVMAppendBasicBlockInContext<'a>(
1225 Name: *const c_char,
1226 ) -> &'a BasicBlock;
1228 // Operations on instructions
1229 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1230 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1232 // Operations on call sites
1233 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1234 pub fn LLVMRustAddCallSiteAttributes<'a>(
1237 Attrs: *const &'a Attribute,
1241 // Operations on load/store instructions (only)
1242 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1244 // Operations on phi nodes
1245 pub fn LLVMAddIncoming<'a>(
1247 IncomingValues: *const &'a Value,
1248 IncomingBlocks: *const &'a BasicBlock,
1252 // Instruction builders
1253 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1254 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1255 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1256 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1259 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1262 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1263 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1264 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1265 pub fn LLVMBuildCondBr<'a>(
1268 Then: &'a BasicBlock,
1269 Else: &'a BasicBlock,
1271 pub fn LLVMBuildSwitch<'a>(
1274 Else: &'a BasicBlock,
1277 pub fn LLVMRustBuildInvoke<'a>(
1281 Args: *const &'a Value,
1283 Then: &'a BasicBlock,
1284 Catch: &'a BasicBlock,
1285 Bundle: Option<&OperandBundleDef<'a>>,
1286 Name: *const c_char,
1288 pub fn LLVMBuildLandingPad<'a>(
1291 PersFn: Option<&'a Value>,
1293 Name: *const c_char,
1295 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1296 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1298 pub fn LLVMRustBuildCleanupPad<'a>(
1300 ParentPad: Option<&'a Value>,
1302 Args: *const &'a Value,
1303 Name: *const c_char,
1304 ) -> Option<&'a Value>;
1305 pub fn LLVMRustBuildCleanupRet<'a>(
1307 CleanupPad: &'a Value,
1308 UnwindBB: Option<&'a BasicBlock>,
1309 ) -> Option<&'a Value>;
1310 pub fn LLVMRustBuildCatchPad<'a>(
1312 ParentPad: &'a Value,
1314 Args: *const &'a Value,
1315 Name: *const c_char,
1316 ) -> Option<&'a Value>;
1317 pub fn LLVMRustBuildCatchRet<'a>(
1321 ) -> Option<&'a Value>;
1322 pub fn LLVMRustBuildCatchSwitch<'a>(
1323 Builder: &Builder<'a>,
1324 ParentPad: Option<&'a Value>,
1325 BB: Option<&'a BasicBlock>,
1326 NumHandlers: c_uint,
1327 Name: *const c_char,
1328 ) -> Option<&'a Value>;
1329 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1330 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1332 // Add a case to the switch instruction
1333 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1335 // Add a clause to the landing pad instruction
1336 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1338 // Set the cleanup on a landing pad instruction
1339 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1342 pub fn LLVMBuildAdd<'a>(
1346 Name: *const c_char,
1348 pub fn LLVMBuildFAdd<'a>(
1352 Name: *const c_char,
1354 pub fn LLVMBuildSub<'a>(
1358 Name: *const c_char,
1360 pub fn LLVMBuildFSub<'a>(
1364 Name: *const c_char,
1366 pub fn LLVMBuildMul<'a>(
1370 Name: *const c_char,
1372 pub fn LLVMBuildFMul<'a>(
1376 Name: *const c_char,
1378 pub fn LLVMBuildUDiv<'a>(
1382 Name: *const c_char,
1384 pub fn LLVMBuildExactUDiv<'a>(
1388 Name: *const c_char,
1390 pub fn LLVMBuildSDiv<'a>(
1394 Name: *const c_char,
1396 pub fn LLVMBuildExactSDiv<'a>(
1400 Name: *const c_char,
1402 pub fn LLVMBuildFDiv<'a>(
1406 Name: *const c_char,
1408 pub fn LLVMBuildURem<'a>(
1412 Name: *const c_char,
1414 pub fn LLVMBuildSRem<'a>(
1418 Name: *const c_char,
1420 pub fn LLVMBuildFRem<'a>(
1424 Name: *const c_char,
1426 pub fn LLVMBuildShl<'a>(
1430 Name: *const c_char,
1432 pub fn LLVMBuildLShr<'a>(
1436 Name: *const c_char,
1438 pub fn LLVMBuildAShr<'a>(
1442 Name: *const c_char,
1444 pub fn LLVMBuildNSWAdd<'a>(
1448 Name: *const c_char,
1450 pub fn LLVMBuildNUWAdd<'a>(
1454 Name: *const c_char,
1456 pub fn LLVMBuildNSWSub<'a>(
1460 Name: *const c_char,
1462 pub fn LLVMBuildNUWSub<'a>(
1466 Name: *const c_char,
1468 pub fn LLVMBuildNSWMul<'a>(
1472 Name: *const c_char,
1474 pub fn LLVMBuildNUWMul<'a>(
1478 Name: *const c_char,
1480 pub fn LLVMBuildAnd<'a>(
1484 Name: *const c_char,
1486 pub fn LLVMBuildOr<'a>(
1490 Name: *const c_char,
1492 pub fn LLVMBuildXor<'a>(
1496 Name: *const c_char,
1498 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1499 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1500 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1501 pub fn LLVMRustSetFastMath(Instr: &Value);
1504 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1505 pub fn LLVMBuildArrayAlloca<'a>(
1509 Name: *const c_char,
1511 pub fn LLVMBuildLoad2<'a>(
1514 PointerVal: &'a Value,
1515 Name: *const c_char,
1518 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1520 pub fn LLVMBuildGEP2<'a>(
1524 Indices: *const &'a Value,
1526 Name: *const c_char,
1528 pub fn LLVMBuildInBoundsGEP2<'a>(
1532 Indices: *const &'a Value,
1534 Name: *const c_char,
1536 pub fn LLVMBuildStructGEP2<'a>(
1541 Name: *const c_char,
1545 pub fn LLVMBuildTrunc<'a>(
1549 Name: *const c_char,
1551 pub fn LLVMBuildZExt<'a>(
1555 Name: *const c_char,
1557 pub fn LLVMBuildSExt<'a>(
1561 Name: *const c_char,
1563 pub fn LLVMBuildFPToUI<'a>(
1567 Name: *const c_char,
1569 pub fn LLVMBuildFPToSI<'a>(
1573 Name: *const c_char,
1575 pub fn LLVMBuildUIToFP<'a>(
1579 Name: *const c_char,
1581 pub fn LLVMBuildSIToFP<'a>(
1585 Name: *const c_char,
1587 pub fn LLVMBuildFPTrunc<'a>(
1591 Name: *const c_char,
1593 pub fn LLVMBuildFPExt<'a>(
1597 Name: *const c_char,
1599 pub fn LLVMBuildPtrToInt<'a>(
1603 Name: *const c_char,
1605 pub fn LLVMBuildIntToPtr<'a>(
1609 Name: *const c_char,
1611 pub fn LLVMBuildBitCast<'a>(
1615 Name: *const c_char,
1617 pub fn LLVMBuildPointerCast<'a>(
1621 Name: *const c_char,
1623 pub fn LLVMRustBuildIntCast<'a>(
1631 pub fn LLVMBuildICmp<'a>(
1636 Name: *const c_char,
1638 pub fn LLVMBuildFCmp<'a>(
1643 Name: *const c_char,
1646 // Miscellaneous instructions
1647 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1648 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1649 pub fn LLVMRustBuildCall<'a>(
1653 Args: *const &'a Value,
1655 Bundle: Option<&OperandBundleDef<'a>>,
1657 pub fn LLVMRustBuildMemCpy<'a>(
1666 pub fn LLVMRustBuildMemMove<'a>(
1675 pub fn LLVMRustBuildMemSet<'a>(
1683 pub fn LLVMBuildSelect<'a>(
1688 Name: *const c_char,
1690 pub fn LLVMBuildVAArg<'a>(
1694 Name: *const c_char,
1696 pub fn LLVMBuildExtractElement<'a>(
1700 Name: *const c_char,
1702 pub fn LLVMBuildInsertElement<'a>(
1707 Name: *const c_char,
1709 pub fn LLVMBuildShuffleVector<'a>(
1714 Name: *const c_char,
1716 pub fn LLVMBuildExtractValue<'a>(
1720 Name: *const c_char,
1722 pub fn LLVMBuildInsertValue<'a>(
1727 Name: *const c_char,
1730 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1735 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1740 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1741 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1742 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1743 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1744 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1745 pub fn LLVMRustBuildVectorReduceMin<'a>(
1750 pub fn LLVMRustBuildVectorReduceMax<'a>(
1755 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1760 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1766 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1767 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1769 // Atomic Operations
1770 pub fn LLVMRustBuildAtomicLoad<'a>(
1772 ElementType: &'a Type,
1773 PointerVal: &'a Value,
1774 Name: *const c_char,
1775 Order: AtomicOrdering,
1778 pub fn LLVMRustBuildAtomicStore<'a>(
1782 Order: AtomicOrdering,
1785 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1790 Order: AtomicOrdering,
1791 FailureOrder: AtomicOrdering,
1795 pub fn LLVMBuildAtomicRMW<'a>(
1800 Order: AtomicOrdering,
1801 SingleThreaded: Bool,
1804 pub fn LLVMRustBuildAtomicFence(
1806 Order: AtomicOrdering,
1807 Scope: SynchronizationScope,
1810 /// Writes a module to the specified path. Returns 0 on success.
1811 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1813 /// Creates a pass manager.
1814 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1816 /// Creates a function-by-function pass manager
1817 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1819 /// Disposes a pass manager.
1820 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1822 /// Runs a pass manager on a module.
1823 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1825 pub fn LLVMInitializePasses();
1827 pub fn LLVMTimeTraceProfilerInitialize();
1829 pub fn LLVMTimeTraceProfilerFinishThread();
1831 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1833 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1835 pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1836 pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1837 pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold(
1838 PMB: &PassManagerBuilder,
1841 pub fn LLVMRustPassManagerBuilderPopulateModulePassManager(
1842 PMB: &PassManagerBuilder,
1843 PM: &PassManager<'_>,
1846 pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager(
1847 PMB: &PassManagerBuilder,
1848 PM: &PassManager<'_>,
1850 pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager(
1851 PMB: &PassManagerBuilder,
1852 PM: &PassManager<'_>,
1856 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1857 PMB: &PassManagerBuilder,
1858 PM: &PassManager<'_>,
1861 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1863 pub fn LLVMDisposeMessage(message: *mut c_char);
1865 pub fn LLVMIsMultithreaded() -> Bool;
1867 /// Returns a string describing the last error caused by an LLVMRust* call.
1868 pub fn LLVMRustGetLastError() -> *const c_char;
1870 /// Print the pass timings since static dtors aren't picking them up.
1871 pub fn LLVMRustPrintPassTimings();
1873 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1875 pub fn LLVMStructSetBody<'a>(
1877 ElementTypes: *const &'a Type,
1878 ElementCount: c_uint,
1882 /// Prepares inline assembly.
1883 pub fn LLVMRustInlineAsm(
1885 AsmString: *const c_char,
1886 AsmStringLen: size_t,
1887 Constraints: *const c_char,
1888 ConstraintsLen: size_t,
1891 Dialect: AsmDialect,
1894 pub fn LLVMRustInlineAsmVerify(
1896 Constraints: *const c_char,
1897 ConstraintsLen: size_t,
1900 #[allow(improper_ctypes)]
1901 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1902 Filenames: *const *const c_char,
1903 FilenamesLen: size_t,
1904 BufferOut: &RustString,
1907 #[allow(improper_ctypes)]
1908 pub fn LLVMRustCoverageWriteMappingToBuffer(
1909 VirtualFileMappingIDs: *const c_uint,
1910 NumVirtualFileMappingIDs: c_uint,
1911 Expressions: *const coverage_map::CounterExpression,
1912 NumExpressions: c_uint,
1913 MappingRegions: *const coverageinfo::CounterMappingRegion,
1914 NumMappingRegions: c_uint,
1915 BufferOut: &RustString,
1918 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1919 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1920 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1922 #[allow(improper_ctypes)]
1923 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1925 #[allow(improper_ctypes)]
1926 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1928 #[allow(improper_ctypes)]
1929 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1931 pub fn LLVMRustCoverageMappingVersion() -> u32;
1932 pub fn LLVMRustDebugMetadataVersion() -> u32;
1933 pub fn LLVMRustVersionMajor() -> u32;
1934 pub fn LLVMRustVersionMinor() -> u32;
1935 pub fn LLVMRustVersionPatch() -> u32;
1937 /// Add LLVM module flags.
1939 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1940 /// "compatible" means depends on the merge behaviors involved.
1941 pub fn LLVMRustAddModuleFlag(
1943 merge_behavior: LLVMModFlagBehavior,
1944 name: *const c_char,
1947 pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool;
1949 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1951 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1953 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1955 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1957 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1958 Builder: &DIBuilder<'a>,
1961 Producer: *const c_char,
1962 ProducerLen: size_t,
1964 Flags: *const c_char,
1966 SplitName: *const c_char,
1967 SplitNameLen: size_t,
1968 kind: DebugEmissionKind,
1970 SplitDebugInlining: bool,
1971 ) -> &'a DIDescriptor;
1973 pub fn LLVMRustDIBuilderCreateFile<'a>(
1974 Builder: &DIBuilder<'a>,
1975 Filename: *const c_char,
1976 FilenameLen: size_t,
1977 Directory: *const c_char,
1978 DirectoryLen: size_t,
1979 CSKind: ChecksumKind,
1980 Checksum: *const c_char,
1981 ChecksumLen: size_t,
1984 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1985 Builder: &DIBuilder<'a>,
1986 ParameterTypes: &'a DIArray,
1987 ) -> &'a DICompositeType;
1989 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1990 Builder: &DIBuilder<'a>,
1991 Scope: &'a DIDescriptor,
1992 Name: *const c_char,
1994 LinkageName: *const c_char,
1995 LinkageNameLen: size_t,
2002 MaybeFn: Option<&'a Value>,
2003 TParam: &'a DIArray,
2004 Decl: Option<&'a DIDescriptor>,
2005 ) -> &'a DISubprogram;
2007 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
2008 Builder: &DIBuilder<'a>,
2009 Name: *const c_char,
2013 ) -> &'a DIBasicType;
2015 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
2016 Builder: &DIBuilder<'a>,
2017 Type: &'a DIBasicType,
2018 Name: *const c_char,
2022 Scope: Option<&'a DIScope>,
2023 ) -> &'a DIDerivedType;
2025 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2026 Builder: &DIBuilder<'a>,
2027 PointeeTy: &'a DIType,
2030 AddressSpace: c_uint,
2031 Name: *const c_char,
2033 ) -> &'a DIDerivedType;
2035 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2036 Builder: &DIBuilder<'a>,
2037 Scope: Option<&'a DIDescriptor>,
2038 Name: *const c_char,
2045 DerivedFrom: Option<&'a DIType>,
2046 Elements: &'a DIArray,
2047 RunTimeLang: c_uint,
2048 VTableHolder: Option<&'a DIType>,
2049 UniqueId: *const c_char,
2050 UniqueIdLen: size_t,
2051 ) -> &'a DICompositeType;
2053 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2054 Builder: &DIBuilder<'a>,
2055 Scope: &'a DIDescriptor,
2056 Name: *const c_char,
2065 ) -> &'a DIDerivedType;
2067 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2068 Builder: &DIBuilder<'a>,
2070 Name: *const c_char,
2077 Discriminant: Option<&'a Value>,
2082 pub fn LLVMRustDIBuilderCreateStaticMemberType<'a>(
2083 Builder: &DIBuilder<'a>,
2084 Scope: &'a DIDescriptor,
2085 Name: *const c_char,
2091 val: Option<&'a Value>,
2093 ) -> &'a DIDerivedType;
2095 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2096 Builder: &DIBuilder<'a>,
2101 ) -> &'a DILexicalBlock;
2103 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2104 Builder: &DIBuilder<'a>,
2107 ) -> &'a DILexicalBlock;
2109 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2110 Builder: &DIBuilder<'a>,
2111 Context: Option<&'a DIScope>,
2112 Name: *const c_char,
2114 LinkageName: *const c_char,
2115 LinkageNameLen: size_t,
2119 isLocalToUnit: bool,
2121 Decl: Option<&'a DIDescriptor>,
2123 ) -> &'a DIGlobalVariableExpression;
2125 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2126 Builder: &DIBuilder<'a>,
2128 Scope: &'a DIDescriptor,
2129 Name: *const c_char,
2134 AlwaysPreserve: bool,
2138 ) -> &'a DIVariable;
2140 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2141 Builder: &DIBuilder<'a>,
2145 Subscripts: &'a DIArray,
2148 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2149 Builder: &DIBuilder<'a>,
2152 ) -> &'a DISubrange;
2154 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2155 Builder: &DIBuilder<'a>,
2156 Ptr: *const Option<&'a DIDescriptor>,
2160 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2161 Builder: &DIBuilder<'a>,
2163 VarInfo: &'a DIVariable,
2164 AddrOps: *const u64,
2165 AddrOpsCount: c_uint,
2167 InsertAtEnd: &'a BasicBlock,
2170 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2171 Builder: &DIBuilder<'a>,
2172 Name: *const c_char,
2176 ) -> &'a DIEnumerator;
2178 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2179 Builder: &DIBuilder<'a>,
2181 Name: *const c_char,
2187 Elements: &'a DIArray,
2188 ClassType: &'a DIType,
2192 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2193 Builder: &DIBuilder<'a>,
2194 Scope: Option<&'a DIScope>,
2195 Name: *const c_char,
2202 Elements: Option<&'a DIArray>,
2203 RunTimeLang: c_uint,
2204 UniqueId: *const c_char,
2205 UniqueIdLen: size_t,
2208 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2209 Builder: &DIBuilder<'a>,
2211 Name: *const c_char,
2218 Discriminator: Option<&'a DIDerivedType>,
2219 Elements: &'a DIArray,
2220 UniqueId: *const c_char,
2221 UniqueIdLen: size_t,
2222 ) -> &'a DIDerivedType;
2224 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2226 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2227 Builder: &DIBuilder<'a>,
2228 Scope: Option<&'a DIScope>,
2229 Name: *const c_char,
2232 ) -> &'a DITemplateTypeParameter;
2234 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2235 Builder: &DIBuilder<'a>,
2236 Scope: Option<&'a DIScope>,
2237 Name: *const c_char,
2239 ExportSymbols: bool,
2240 ) -> &'a DINameSpace;
2242 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2243 Builder: &DIBuilder<'a>,
2244 CompositeType: &'a DIType,
2245 Elements: Option<&'a DIArray>,
2246 Params: Option<&'a DIArray>,
2249 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2253 InlinedAt: Option<&'a DILocation>,
2254 ) -> &'a DILocation;
2255 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2256 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2258 #[allow(improper_ctypes)]
2259 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2260 #[allow(improper_ctypes)]
2261 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2263 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2265 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2266 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2267 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2268 pub fn LLVMRustCreateMemorySanitizerPass(
2269 TrackOrigins: c_int,
2271 ) -> &'static mut Pass;
2272 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2273 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2274 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2275 pub fn LLVMRustAddLastExtensionPasses(
2276 PMB: &PassManagerBuilder,
2277 Passes: *const &'static mut Pass,
2281 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2283 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2284 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2285 pub fn LLVMRustGetTargetFeature(
2288 Feature: &mut *const c_char,
2289 Desc: &mut *const c_char,
2292 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2293 pub fn LLVMRustCreateTargetMachine(
2294 Triple: *const c_char,
2296 Features: *const c_char,
2300 Level: CodeGenOptLevel,
2302 FunctionSections: bool,
2304 UniqueSectionNames: bool,
2305 TrapUnreachable: bool,
2308 EmitStackSizeSection: bool,
2309 RelaxELFRelocations: bool,
2311 SplitDwarfFile: *const c_char,
2312 ) -> Option<&'static mut TargetMachine>;
2313 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2314 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2315 PMB: &'a PassManagerBuilder,
2317 DisableSimplifyLibCalls: bool,
2319 pub fn LLVMRustConfigurePassManagerBuilder(
2320 PMB: &PassManagerBuilder,
2321 OptLevel: CodeGenOptLevel,
2322 MergeFunctions: bool,
2324 LoopVectorize: bool,
2325 PrepareForThinLTO: bool,
2326 PGOGenPath: *const c_char,
2327 PGOUsePath: *const c_char,
2328 PGOSampleUsePath: *const c_char,
2331 pub fn LLVMRustAddLibraryInfo<'a>(
2332 PM: &PassManager<'a>,
2334 DisableSimplifyLibCalls: bool,
2336 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2337 pub fn LLVMRustWriteOutputFile<'a>(
2338 T: &'a TargetMachine,
2339 PM: &PassManager<'a>,
2341 Output: *const c_char,
2342 DwoOutput: *const c_char,
2344 ) -> LLVMRustResult;
2345 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2347 TM: &'a TargetMachine,
2348 OptLevel: PassBuilderOptLevel,
2350 NoPrepopulatePasses: bool,
2352 UseThinLTOBuffers: bool,
2353 MergeFunctions: bool,
2356 LoopVectorize: bool,
2357 DisableSimplifyLibCalls: bool,
2358 EmitLifetimeMarkers: bool,
2359 SanitizerOptions: Option<&SanitizerOptions>,
2360 PGOGenPath: *const c_char,
2361 PGOUsePath: *const c_char,
2362 InstrumentCoverage: bool,
2363 InstrProfileOutput: *const c_char,
2364 InstrumentGCOV: bool,
2365 PGOSampleUsePath: *const c_char,
2366 DebugInfoForProfiling: bool,
2367 llvm_selfprofiler: *mut c_void,
2368 begin_callback: SelfProfileBeforePassCallback,
2369 end_callback: SelfProfileAfterPassCallback,
2370 ExtraPasses: *const c_char,
2371 ExtraPassesLen: size_t,
2372 LLVMPlugins: *const c_char,
2373 LLVMPluginsLen: size_t,
2374 ) -> LLVMRustResult;
2375 pub fn LLVMRustPrintModule(
2377 Output: *const c_char,
2378 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2379 ) -> LLVMRustResult;
2380 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2381 pub fn LLVMRustPrintPasses();
2382 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2383 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2384 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2386 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2387 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2388 pub fn LLVMRustArchiveIteratorNext<'a>(
2389 AIR: &ArchiveIterator<'a>,
2390 ) -> Option<&'a mut ArchiveChild<'a>>;
2391 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2392 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2393 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2394 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2396 #[allow(improper_ctypes)]
2397 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2399 #[allow(improper_ctypes)]
2400 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2401 DI: &'a DiagnosticInfo,
2402 pass_name_out: &RustString,
2403 function_out: &mut Option<&'a Value>,
2404 loc_line_out: &mut c_uint,
2405 loc_column_out: &mut c_uint,
2406 loc_filename_out: &RustString,
2407 message_out: &RustString,
2410 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2411 DI: &'a DiagnosticInfo,
2412 level_out: &mut DiagnosticLevel,
2413 cookie_out: &mut c_uint,
2414 message_out: &mut Option<&'a Twine>,
2417 #[allow(improper_ctypes)]
2418 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2419 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2421 pub fn LLVMRustGetSMDiagnostic<'a>(
2422 DI: &'a DiagnosticInfo,
2423 cookie_out: &mut c_uint,
2424 ) -> &'a SMDiagnostic;
2426 #[allow(improper_ctypes)]
2427 pub fn LLVMRustUnpackSMDiagnostic(
2429 message_out: &RustString,
2430 buffer_out: &RustString,
2431 level_out: &mut DiagnosticLevel,
2432 loc_out: &mut c_uint,
2433 ranges_out: *mut c_uint,
2434 num_ranges: &mut usize,
2437 pub fn LLVMRustWriteArchive(
2440 Members: *const &RustArchiveMember<'_>,
2443 ) -> LLVMRustResult;
2444 pub fn LLVMRustArchiveMemberNew<'a>(
2445 Filename: *const c_char,
2446 Name: *const c_char,
2447 Child: Option<&ArchiveChild<'a>>,
2448 ) -> &'a mut RustArchiveMember<'a>;
2449 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2451 pub fn LLVMRustWriteImportLibrary(
2452 ImportName: *const c_char,
2453 Path: *const c_char,
2454 Exports: *const LLVMRustCOFFShortExport,
2458 ) -> LLVMRustResult;
2460 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2462 pub fn LLVMRustBuildOperandBundleDef<'a>(
2463 Name: *const c_char,
2464 Inputs: *const &'a Value,
2466 ) -> &'a mut OperandBundleDef<'a>;
2467 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2469 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2471 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2472 pub fn LLVMRustSetModulePICLevel(M: &Module);
2473 pub fn LLVMRustSetModulePIELevel(M: &Module);
2474 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2475 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2476 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2477 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2478 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2479 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2481 pub fn LLVMRustThinLTOBufferCreate(M: &Module, is_thin: bool) -> &'static mut ThinLTOBuffer;
2482 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2483 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2484 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2485 pub fn LLVMRustCreateThinLTOData(
2486 Modules: *const ThinLTOModule,
2488 PreservedSymbols: *const *const c_char,
2489 PreservedSymbolsLen: c_uint,
2490 ) -> Option<&'static mut ThinLTOData>;
2491 pub fn LLVMRustPrepareThinLTORename(
2494 Target: &TargetMachine,
2496 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2497 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2498 pub fn LLVMRustPrepareThinLTOImport(
2501 Target: &TargetMachine,
2503 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2504 pub fn LLVMRustParseBitcodeForLTO(
2508 Identifier: *const c_char,
2509 ) -> Option<&Module>;
2510 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2513 out_len: &mut usize,
2515 pub fn LLVMRustThinLTOGetDICompileUnit(
2517 CU1: &mut *mut c_void,
2518 CU2: &mut *mut c_void,
2520 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2522 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2523 pub fn LLVMRustLinkerAdd(
2524 linker: &Linker<'_>,
2525 bytecode: *const c_char,
2526 bytecode_len: usize,
2528 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2529 #[allow(improper_ctypes)]
2530 pub fn LLVMRustComputeLTOCacheKey(
2531 key_out: &RustString,
2532 mod_id: *const c_char,
2536 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2537 pub fn LLVMRustContextSetDiagnosticHandler(
2539 diagnostic_handler: Option<&DiagnosticHandler>,
2541 pub fn LLVMRustContextConfigureDiagnosticHandler(
2543 diagnostic_handler_callback: DiagnosticHandlerTy,
2544 diagnostic_handler_context: *mut c_void,
2545 remark_all_passes: bool,
2546 remark_passes: *const *const c_char,
2547 remark_passes_len: usize,
2550 #[allow(improper_ctypes)]
2551 pub fn LLVMRustGetMangledName(V: &Value, out: &RustString);
2553 pub fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;