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 {
572 // LLVMRustThinLTOData
574 pub type ThinLTOData;
577 // LLVMRustThinLTOBuffer
579 pub type ThinLTOBuffer;
582 /// LLVMRustThinLTOModule
584 pub struct ThinLTOModule {
585 pub identifier: *const c_char,
590 /// LLVMThreadLocalMode
591 #[derive(Copy, Clone)]
593 pub enum ThreadLocalMode {
601 /// LLVMRustChecksumKind
602 #[derive(Copy, Clone)]
604 pub enum ChecksumKind {
615 struct InvariantOpaque<'a> {
616 _marker: PhantomData<&'a mut &'a ()>,
620 // Opaque pointer types
634 pub type ConstantInt;
646 pub struct Builder<'a>(InvariantOpaque<'a>);
648 pub struct PassManager<'a>(InvariantOpaque<'a>);
650 pub type PassManagerBuilder;
656 pub type TargetMachine;
662 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
664 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
669 pub type DiagnosticInfo;
672 pub type SMDiagnostic;
675 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
677 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
679 pub struct Linker<'a>(InvariantOpaque<'a>);
682 pub type DiagnosticHandler;
685 pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
686 pub type InlineAsmDiagHandlerTy = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
688 pub mod coverageinfo {
689 use super::coverage_map;
691 /// 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)
692 #[derive(Copy, Clone, Debug)]
694 pub enum RegionKind {
695 /// A CodeRegion associates some code with a counter
698 /// An ExpansionRegion represents a file expansion region that associates
699 /// a source range with the expansion of a virtual source file, such as
700 /// for a macro instantiation or #include file.
703 /// A SkippedRegion represents a source range with code that was skipped
704 /// by a preprocessor or similar means.
707 /// A GapRegion is like a CodeRegion, but its count is only set as the
708 /// line execution count when its the only region in the line.
711 /// A BranchRegion represents leaf-level boolean expressions and is
712 /// associated with two counters, each representing the number of times the
713 /// expression evaluates to true or false.
717 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
718 /// coverage map, in accordance with the
719 /// [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).
720 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
721 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
722 /// array", encoded separately), and source location (start and end positions of the represented
725 /// Matches LLVMRustCounterMappingRegion.
726 #[derive(Copy, Clone, Debug)]
728 pub struct CounterMappingRegion {
729 /// The counter type and type-dependent counter data, if any.
730 counter: coverage_map::Counter,
732 /// If the `RegionKind` is a `BranchRegion`, this represents the counter
733 /// for the false branch of the region.
734 false_counter: coverage_map::Counter,
736 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
737 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
738 /// that, in turn, are used to look up the filename for this region.
741 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
742 /// the mapping regions created as a result of macro expansion, by checking if their file id
743 /// matches the expanded file id.
744 expanded_file_id: u32,
746 /// 1-based starting line of the mapping region.
749 /// 1-based starting column of the mapping region.
752 /// 1-based ending line of the mapping region.
755 /// 1-based ending column of the mapping region. If the high bit is set, the current
756 /// mapping region is a gap area.
762 impl CounterMappingRegion {
763 pub(crate) fn code_region(
764 counter: coverage_map::Counter,
773 false_counter: coverage_map::Counter::zero(),
780 kind: RegionKind::CodeRegion,
784 // This function might be used in the future; the LLVM API is still evolving, as is coverage
787 pub(crate) fn branch_region(
788 counter: coverage_map::Counter,
789 false_counter: coverage_map::Counter,
805 kind: RegionKind::BranchRegion,
809 // This function might be used in the future; the LLVM API is still evolving, as is coverage
812 pub(crate) fn expansion_region(
814 expanded_file_id: u32,
821 counter: coverage_map::Counter::zero(),
822 false_counter: coverage_map::Counter::zero(),
829 kind: RegionKind::ExpansionRegion,
833 // This function might be used in the future; the LLVM API is still evolving, as is coverage
836 pub(crate) fn skipped_region(
844 counter: coverage_map::Counter::zero(),
845 false_counter: coverage_map::Counter::zero(),
852 kind: RegionKind::SkippedRegion,
856 // This function might be used in the future; the LLVM API is still evolving, as is coverage
859 pub(crate) fn gap_region(
860 counter: coverage_map::Counter,
869 false_counter: coverage_map::Counter::zero(),
875 end_col: (1_u32 << 31) | end_col,
876 kind: RegionKind::GapRegion,
883 use super::{InvariantOpaque, Metadata};
884 use bitflags::bitflags;
887 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
889 pub type DIDescriptor = Metadata;
890 pub type DILocation = Metadata;
891 pub type DIScope = DIDescriptor;
892 pub type DIFile = DIScope;
893 pub type DILexicalBlock = DIScope;
894 pub type DISubprogram = DIScope;
895 pub type DINameSpace = DIScope;
896 pub type DIType = DIDescriptor;
897 pub type DIBasicType = DIType;
898 pub type DIDerivedType = DIType;
899 pub type DICompositeType = DIDerivedType;
900 pub type DIVariable = DIDescriptor;
901 pub type DIGlobalVariableExpression = DIDescriptor;
902 pub type DIArray = DIDescriptor;
903 pub type DISubrange = DIDescriptor;
904 pub type DIEnumerator = DIDescriptor;
905 pub type DITemplateTypeParameter = DIDescriptor;
907 // These values **must** match with LLVMRustDIFlags!!
911 pub struct DIFlags: u32 {
913 const FlagPrivate = 1;
914 const FlagProtected = 2;
915 const FlagPublic = 3;
916 const FlagFwdDecl = (1 << 2);
917 const FlagAppleBlock = (1 << 3);
918 const FlagBlockByrefStruct = (1 << 4);
919 const FlagVirtual = (1 << 5);
920 const FlagArtificial = (1 << 6);
921 const FlagExplicit = (1 << 7);
922 const FlagPrototyped = (1 << 8);
923 const FlagObjcClassComplete = (1 << 9);
924 const FlagObjectPointer = (1 << 10);
925 const FlagVector = (1 << 11);
926 const FlagStaticMember = (1 << 12);
927 const FlagLValueReference = (1 << 13);
928 const FlagRValueReference = (1 << 14);
929 const FlagExternalTypeRef = (1 << 15);
930 const FlagIntroducedVirtual = (1 << 18);
931 const FlagBitField = (1 << 19);
932 const FlagNoReturn = (1 << 20);
936 // These values **must** match with LLVMRustDISPFlags!!
940 pub struct DISPFlags: u32 {
941 const SPFlagZero = 0;
942 const SPFlagVirtual = 1;
943 const SPFlagPureVirtual = 2;
944 const SPFlagLocalToUnit = (1 << 2);
945 const SPFlagDefinition = (1 << 3);
946 const SPFlagOptimized = (1 << 4);
947 const SPFlagMainSubprogram = (1 << 5);
951 /// LLVMRustDebugEmissionKind
952 #[derive(Copy, Clone)]
954 pub enum DebugEmissionKind {
960 impl DebugEmissionKind {
961 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
962 use rustc_session::config::DebugInfo;
964 DebugInfo::None => DebugEmissionKind::NoDebug,
965 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
966 DebugInfo::Full => DebugEmissionKind::FullDebug,
973 pub type ModuleBuffer;
976 pub type SelfProfileBeforePassCallback =
977 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
978 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
981 pub fn LLVMRustInstallFatalErrorHandler();
982 pub fn LLVMRustDisableSystemDialogsOnCrash();
984 // Create and destroy contexts.
985 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
986 pub fn LLVMContextDispose(C: &'static mut Context);
987 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
990 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
991 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
992 pub fn LLVMCloneModule(M: &Module) -> &Module;
994 /// Data layout. See Module::getDataLayout.
995 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
996 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
998 /// See Module::setModuleInlineAsm.
999 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
1001 /// See llvm::LLVMTypeKind::getTypeID.
1002 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1004 // Operations on integer types
1005 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1006 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1007 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1008 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1009 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1010 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1012 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1014 // Operations on real types
1015 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1016 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1018 // Operations on function types
1019 pub fn LLVMFunctionType<'a>(
1020 ReturnType: &'a Type,
1021 ParamTypes: *const &'a Type,
1025 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1026 pub fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1028 // Operations on struct types
1029 pub fn LLVMStructTypeInContext<'a>(
1031 ElementTypes: *const &'a Type,
1032 ElementCount: c_uint,
1036 // Operations on array, pointer, and vector types (sequence types)
1037 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
1038 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
1039 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1041 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
1042 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1044 // Operations on other types
1045 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1046 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
1048 // Operations on all values
1049 pub fn LLVMTypeOf(Val: &Value) -> &Type;
1050 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1051 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1052 pub fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1053 pub fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
1054 pub fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1055 pub fn LLVMRustGlobalAddMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1056 pub fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1058 // Operations on constants of any type
1059 pub fn LLVMConstNull(Ty: &Type) -> &Value;
1060 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
1062 // Operations on metadata
1063 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
1064 pub fn LLVMMDNodeInContext<'a>(
1066 Vals: *const &'a Value,
1069 pub fn LLVMMDNodeInContext2<'a>(
1071 Vals: *const &'a Metadata,
1074 pub fn LLVMAddNamedMetadataOperand<'a>(M: &'a Module, Name: *const c_char, Val: &'a Value);
1076 // Operations on scalar constants
1077 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1078 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
1079 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1080 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
1081 pub fn LLVMRustConstInt128Get(
1082 ConstantVal: &ConstantInt,
1088 // Operations on composite constants
1089 pub fn LLVMConstStringInContext(
1093 DontNullTerminate: Bool,
1095 pub fn LLVMConstStructInContext<'a>(
1097 ConstantVals: *const &'a Value,
1102 pub fn LLVMConstArray<'a>(
1103 ElementTy: &'a Type,
1104 ConstantVals: *const &'a Value,
1107 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1109 // Constant expressions
1110 pub fn LLVMRustConstInBoundsGEP2<'a>(
1112 ConstantVal: &'a Value,
1113 ConstantIndices: *const &'a Value,
1116 pub fn LLVMConstZExt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1117 pub fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1118 pub fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1119 pub fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1120 pub fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1121 pub fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1123 // Operations on global variables, functions, and aliases (globals)
1124 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1125 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1126 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1127 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1128 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1129 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1130 pub fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1131 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1132 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1133 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1135 // Operations on global variables
1136 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1137 pub fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1138 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1139 pub fn LLVMRustGetOrInsertGlobal<'a>(
1141 Name: *const c_char,
1145 pub fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1146 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1147 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1148 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1149 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1150 pub fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1151 pub fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1152 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1153 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1154 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1155 pub fn LLVMRustGetNamedValue(
1157 Name: *const c_char,
1159 ) -> Option<&Value>;
1160 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1162 // Operations on attributes
1163 pub fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
1164 pub fn LLVMCreateStringAttribute(
1166 Name: *const c_char,
1168 Value: *const c_char,
1171 pub fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
1172 pub fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
1173 pub fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
1174 pub fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1175 pub fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1176 pub fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1178 // Operations on functions
1179 pub fn LLVMRustGetOrInsertFunction<'a>(
1181 Name: *const c_char,
1183 FunctionTy: &'a Type,
1185 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1186 pub fn LLVMRustAddFunctionAttributes<'a>(
1189 Attrs: *const &'a Attribute,
1193 // Operations on parameters
1194 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1195 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1196 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1198 // Operations on basic blocks
1199 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1200 pub fn LLVMAppendBasicBlockInContext<'a>(
1203 Name: *const c_char,
1204 ) -> &'a BasicBlock;
1206 // Operations on instructions
1207 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1208 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1210 // Operations on call sites
1211 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1212 pub fn LLVMRustAddCallSiteAttributes<'a>(
1215 Attrs: *const &'a Attribute,
1219 // Operations on load/store instructions (only)
1220 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1222 // Operations on phi nodes
1223 pub fn LLVMAddIncoming<'a>(
1225 IncomingValues: *const &'a Value,
1226 IncomingBlocks: *const &'a BasicBlock,
1230 // Instruction builders
1231 pub fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1232 pub fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1233 pub fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1234 pub fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1237 pub fn LLVMSetCurrentDebugLocation<'a>(Builder: &Builder<'a>, L: &'a Value);
1240 pub fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1241 pub fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1242 pub fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1243 pub fn LLVMBuildCondBr<'a>(
1246 Then: &'a BasicBlock,
1247 Else: &'a BasicBlock,
1249 pub fn LLVMBuildSwitch<'a>(
1252 Else: &'a BasicBlock,
1255 pub fn LLVMRustBuildInvoke<'a>(
1259 Args: *const &'a Value,
1261 Then: &'a BasicBlock,
1262 Catch: &'a BasicBlock,
1263 Bundle: Option<&OperandBundleDef<'a>>,
1264 Name: *const c_char,
1266 pub fn LLVMBuildLandingPad<'a>(
1269 PersFn: Option<&'a Value>,
1271 Name: *const c_char,
1273 pub fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1274 pub fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1276 pub fn LLVMRustBuildCleanupPad<'a>(
1278 ParentPad: Option<&'a Value>,
1280 Args: *const &'a Value,
1281 Name: *const c_char,
1282 ) -> Option<&'a Value>;
1283 pub fn LLVMRustBuildCleanupRet<'a>(
1285 CleanupPad: &'a Value,
1286 UnwindBB: Option<&'a BasicBlock>,
1287 ) -> Option<&'a Value>;
1288 pub fn LLVMRustBuildCatchPad<'a>(
1290 ParentPad: &'a Value,
1292 Args: *const &'a Value,
1293 Name: *const c_char,
1294 ) -> Option<&'a Value>;
1295 pub fn LLVMRustBuildCatchRet<'a>(
1299 ) -> Option<&'a Value>;
1300 pub fn LLVMRustBuildCatchSwitch<'a>(
1301 Builder: &Builder<'a>,
1302 ParentPad: Option<&'a Value>,
1303 BB: Option<&'a BasicBlock>,
1304 NumHandlers: c_uint,
1305 Name: *const c_char,
1306 ) -> Option<&'a Value>;
1307 pub fn LLVMRustAddHandler<'a>(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1308 pub fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1310 // Add a case to the switch instruction
1311 pub fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1313 // Add a clause to the landing pad instruction
1314 pub fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1316 // Set the cleanup on a landing pad instruction
1317 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1320 pub fn LLVMBuildAdd<'a>(
1324 Name: *const c_char,
1326 pub fn LLVMBuildFAdd<'a>(
1330 Name: *const c_char,
1332 pub fn LLVMBuildSub<'a>(
1336 Name: *const c_char,
1338 pub fn LLVMBuildFSub<'a>(
1342 Name: *const c_char,
1344 pub fn LLVMBuildMul<'a>(
1348 Name: *const c_char,
1350 pub fn LLVMBuildFMul<'a>(
1354 Name: *const c_char,
1356 pub fn LLVMBuildUDiv<'a>(
1360 Name: *const c_char,
1362 pub fn LLVMBuildExactUDiv<'a>(
1366 Name: *const c_char,
1368 pub fn LLVMBuildSDiv<'a>(
1372 Name: *const c_char,
1374 pub fn LLVMBuildExactSDiv<'a>(
1378 Name: *const c_char,
1380 pub fn LLVMBuildFDiv<'a>(
1384 Name: *const c_char,
1386 pub fn LLVMBuildURem<'a>(
1390 Name: *const c_char,
1392 pub fn LLVMBuildSRem<'a>(
1396 Name: *const c_char,
1398 pub fn LLVMBuildFRem<'a>(
1402 Name: *const c_char,
1404 pub fn LLVMBuildShl<'a>(
1408 Name: *const c_char,
1410 pub fn LLVMBuildLShr<'a>(
1414 Name: *const c_char,
1416 pub fn LLVMBuildAShr<'a>(
1420 Name: *const c_char,
1422 pub fn LLVMBuildNSWAdd<'a>(
1426 Name: *const c_char,
1428 pub fn LLVMBuildNUWAdd<'a>(
1432 Name: *const c_char,
1434 pub fn LLVMBuildNSWSub<'a>(
1438 Name: *const c_char,
1440 pub fn LLVMBuildNUWSub<'a>(
1444 Name: *const c_char,
1446 pub fn LLVMBuildNSWMul<'a>(
1450 Name: *const c_char,
1452 pub fn LLVMBuildNUWMul<'a>(
1456 Name: *const c_char,
1458 pub fn LLVMBuildAnd<'a>(
1462 Name: *const c_char,
1464 pub fn LLVMBuildOr<'a>(
1468 Name: *const c_char,
1470 pub fn LLVMBuildXor<'a>(
1474 Name: *const c_char,
1476 pub fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1477 pub fn LLVMBuildFNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1478 pub fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1479 pub fn LLVMRustSetFastMath(Instr: &Value);
1482 pub fn LLVMBuildAlloca<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1483 pub fn LLVMBuildArrayAlloca<'a>(
1487 Name: *const c_char,
1489 pub fn LLVMBuildLoad2<'a>(
1492 PointerVal: &'a Value,
1493 Name: *const c_char,
1496 pub fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1498 pub fn LLVMBuildGEP2<'a>(
1502 Indices: *const &'a Value,
1504 Name: *const c_char,
1506 pub fn LLVMBuildInBoundsGEP2<'a>(
1510 Indices: *const &'a Value,
1512 Name: *const c_char,
1514 pub fn LLVMBuildStructGEP2<'a>(
1519 Name: *const c_char,
1523 pub fn LLVMBuildTrunc<'a>(
1527 Name: *const c_char,
1529 pub fn LLVMBuildZExt<'a>(
1533 Name: *const c_char,
1535 pub fn LLVMBuildSExt<'a>(
1539 Name: *const c_char,
1541 pub fn LLVMBuildFPToUI<'a>(
1545 Name: *const c_char,
1547 pub fn LLVMBuildFPToSI<'a>(
1551 Name: *const c_char,
1553 pub fn LLVMBuildUIToFP<'a>(
1557 Name: *const c_char,
1559 pub fn LLVMBuildSIToFP<'a>(
1563 Name: *const c_char,
1565 pub fn LLVMBuildFPTrunc<'a>(
1569 Name: *const c_char,
1571 pub fn LLVMBuildFPExt<'a>(
1575 Name: *const c_char,
1577 pub fn LLVMBuildPtrToInt<'a>(
1581 Name: *const c_char,
1583 pub fn LLVMBuildIntToPtr<'a>(
1587 Name: *const c_char,
1589 pub fn LLVMBuildBitCast<'a>(
1593 Name: *const c_char,
1595 pub fn LLVMBuildPointerCast<'a>(
1599 Name: *const c_char,
1601 pub fn LLVMRustBuildIntCast<'a>(
1609 pub fn LLVMBuildICmp<'a>(
1614 Name: *const c_char,
1616 pub fn LLVMBuildFCmp<'a>(
1621 Name: *const c_char,
1624 // Miscellaneous instructions
1625 pub fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1626 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &Value;
1627 pub fn LLVMRustBuildCall<'a>(
1631 Args: *const &'a Value,
1633 Bundle: Option<&OperandBundleDef<'a>>,
1635 pub fn LLVMRustBuildMemCpy<'a>(
1644 pub fn LLVMRustBuildMemMove<'a>(
1653 pub fn LLVMRustBuildMemSet<'a>(
1661 pub fn LLVMBuildSelect<'a>(
1666 Name: *const c_char,
1668 pub fn LLVMBuildVAArg<'a>(
1672 Name: *const c_char,
1674 pub fn LLVMBuildExtractElement<'a>(
1678 Name: *const c_char,
1680 pub fn LLVMBuildInsertElement<'a>(
1685 Name: *const c_char,
1687 pub fn LLVMBuildShuffleVector<'a>(
1692 Name: *const c_char,
1694 pub fn LLVMBuildExtractValue<'a>(
1698 Name: *const c_char,
1700 pub fn LLVMBuildInsertValue<'a>(
1705 Name: *const c_char,
1708 pub fn LLVMRustBuildVectorReduceFAdd<'a>(
1713 pub fn LLVMRustBuildVectorReduceFMul<'a>(
1718 pub fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1719 pub fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1720 pub fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1721 pub fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1722 pub fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1723 pub fn LLVMRustBuildVectorReduceMin<'a>(
1728 pub fn LLVMRustBuildVectorReduceMax<'a>(
1733 pub fn LLVMRustBuildVectorReduceFMin<'a>(
1738 pub fn LLVMRustBuildVectorReduceFMax<'a>(
1744 pub fn LLVMRustBuildMinNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1745 pub fn LLVMRustBuildMaxNum<'a>(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1747 // Atomic Operations
1748 pub fn LLVMRustBuildAtomicLoad<'a>(
1750 ElementType: &'a Type,
1751 PointerVal: &'a Value,
1752 Name: *const c_char,
1753 Order: AtomicOrdering,
1756 pub fn LLVMRustBuildAtomicStore<'a>(
1760 Order: AtomicOrdering,
1763 pub fn LLVMRustBuildAtomicCmpXchg<'a>(
1768 Order: AtomicOrdering,
1769 FailureOrder: AtomicOrdering,
1773 pub fn LLVMBuildAtomicRMW<'a>(
1778 Order: AtomicOrdering,
1779 SingleThreaded: Bool,
1782 pub fn LLVMRustBuildAtomicFence(
1784 Order: AtomicOrdering,
1785 Scope: SynchronizationScope,
1788 /// Writes a module to the specified path. Returns 0 on success.
1789 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1791 /// Creates a pass manager.
1792 pub fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1794 /// Creates a function-by-function pass manager
1795 pub fn LLVMCreateFunctionPassManagerForModule(M: &Module) -> &mut PassManager<'_>;
1797 /// Disposes a pass manager.
1798 pub fn LLVMDisposePassManager<'a>(PM: &'a mut PassManager<'a>);
1800 /// Runs a pass manager on a module.
1801 pub fn LLVMRunPassManager<'a>(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1803 pub fn LLVMInitializePasses();
1805 pub fn LLVMTimeTraceProfilerInitialize();
1807 pub fn LLVMTimeTraceProfilerFinishThread();
1809 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1811 pub fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1813 pub fn LLVMRustPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1814 pub fn LLVMRustPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1815 pub fn LLVMRustPassManagerBuilderUseInlinerWithThreshold(
1816 PMB: &PassManagerBuilder,
1819 pub fn LLVMRustPassManagerBuilderPopulateModulePassManager(
1820 PMB: &PassManagerBuilder,
1821 PM: &PassManager<'_>,
1824 pub fn LLVMRustPassManagerBuilderPopulateFunctionPassManager(
1825 PMB: &PassManagerBuilder,
1826 PM: &PassManager<'_>,
1828 pub fn LLVMRustPassManagerBuilderPopulateLTOPassManager(
1829 PMB: &PassManagerBuilder,
1830 PM: &PassManager<'_>,
1834 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1835 PMB: &PassManagerBuilder,
1836 PM: &PassManager<'_>,
1839 pub fn LLVMGetHostCPUFeatures() -> *mut c_char;
1841 pub fn LLVMDisposeMessage(message: *mut c_char);
1843 pub fn LLVMIsMultithreaded() -> Bool;
1845 /// Returns a string describing the last error caused by an LLVMRust* call.
1846 pub fn LLVMRustGetLastError() -> *const c_char;
1848 /// Print the pass timings since static dtors aren't picking them up.
1849 pub fn LLVMRustPrintPassTimings();
1851 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1853 pub fn LLVMStructSetBody<'a>(
1855 ElementTypes: *const &'a Type,
1856 ElementCount: c_uint,
1860 /// Prepares inline assembly.
1861 pub fn LLVMRustInlineAsm(
1863 AsmString: *const c_char,
1864 AsmStringLen: size_t,
1865 Constraints: *const c_char,
1866 ConstraintsLen: size_t,
1869 Dialect: AsmDialect,
1872 pub fn LLVMRustInlineAsmVerify(
1874 Constraints: *const c_char,
1875 ConstraintsLen: size_t,
1878 #[allow(improper_ctypes)]
1879 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1880 Filenames: *const *const c_char,
1881 FilenamesLen: size_t,
1882 BufferOut: &RustString,
1885 #[allow(improper_ctypes)]
1886 pub fn LLVMRustCoverageWriteMappingToBuffer(
1887 VirtualFileMappingIDs: *const c_uint,
1888 NumVirtualFileMappingIDs: c_uint,
1889 Expressions: *const coverage_map::CounterExpression,
1890 NumExpressions: c_uint,
1891 MappingRegions: *const coverageinfo::CounterMappingRegion,
1892 NumMappingRegions: c_uint,
1893 BufferOut: &RustString,
1896 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &Value, FuncName: *const c_char) -> &Value;
1897 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1898 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1900 #[allow(improper_ctypes)]
1901 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1903 #[allow(improper_ctypes)]
1904 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1906 #[allow(improper_ctypes)]
1907 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1909 pub fn LLVMRustCoverageMappingVersion() -> u32;
1910 pub fn LLVMRustDebugMetadataVersion() -> u32;
1911 pub fn LLVMRustVersionMajor() -> u32;
1912 pub fn LLVMRustVersionMinor() -> u32;
1913 pub fn LLVMRustVersionPatch() -> u32;
1915 /// Add LLVM module flags.
1917 /// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
1918 /// "compatible" means depends on the merge behaviors involved.
1919 pub fn LLVMRustAddModuleFlag(
1921 merge_behavior: LLVMModFlagBehavior,
1922 name: *const c_char,
1925 pub fn LLVMRustHasModuleFlag(M: &Module, name: *const c_char, len: size_t) -> bool;
1927 pub fn LLVMRustMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1929 pub fn LLVMRustDIBuilderCreate(M: &Module) -> &mut DIBuilder<'_>;
1931 pub fn LLVMRustDIBuilderDispose<'a>(Builder: &'a mut DIBuilder<'a>);
1933 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1935 pub fn LLVMRustDIBuilderCreateCompileUnit<'a>(
1936 Builder: &DIBuilder<'a>,
1939 Producer: *const c_char,
1940 ProducerLen: size_t,
1942 Flags: *const c_char,
1944 SplitName: *const c_char,
1945 SplitNameLen: size_t,
1946 kind: DebugEmissionKind,
1948 SplitDebugInlining: bool,
1949 ) -> &'a DIDescriptor;
1951 pub fn LLVMRustDIBuilderCreateFile<'a>(
1952 Builder: &DIBuilder<'a>,
1953 Filename: *const c_char,
1954 FilenameLen: size_t,
1955 Directory: *const c_char,
1956 DirectoryLen: size_t,
1957 CSKind: ChecksumKind,
1958 Checksum: *const c_char,
1959 ChecksumLen: size_t,
1962 pub fn LLVMRustDIBuilderCreateSubroutineType<'a>(
1963 Builder: &DIBuilder<'a>,
1964 ParameterTypes: &'a DIArray,
1965 ) -> &'a DICompositeType;
1967 pub fn LLVMRustDIBuilderCreateFunction<'a>(
1968 Builder: &DIBuilder<'a>,
1969 Scope: &'a DIDescriptor,
1970 Name: *const c_char,
1972 LinkageName: *const c_char,
1973 LinkageNameLen: size_t,
1980 MaybeFn: Option<&'a Value>,
1981 TParam: &'a DIArray,
1982 Decl: Option<&'a DIDescriptor>,
1983 ) -> &'a DISubprogram;
1985 pub fn LLVMRustDIBuilderCreateBasicType<'a>(
1986 Builder: &DIBuilder<'a>,
1987 Name: *const c_char,
1991 ) -> &'a DIBasicType;
1993 pub fn LLVMRustDIBuilderCreateTypedef<'a>(
1994 Builder: &DIBuilder<'a>,
1995 Type: &'a DIBasicType,
1996 Name: *const c_char,
2000 Scope: Option<&'a DIScope>,
2001 ) -> &'a DIDerivedType;
2003 pub fn LLVMRustDIBuilderCreatePointerType<'a>(
2004 Builder: &DIBuilder<'a>,
2005 PointeeTy: &'a DIType,
2008 AddressSpace: c_uint,
2009 Name: *const c_char,
2011 ) -> &'a DIDerivedType;
2013 pub fn LLVMRustDIBuilderCreateStructType<'a>(
2014 Builder: &DIBuilder<'a>,
2015 Scope: Option<&'a DIDescriptor>,
2016 Name: *const c_char,
2023 DerivedFrom: Option<&'a DIType>,
2024 Elements: &'a DIArray,
2025 RunTimeLang: c_uint,
2026 VTableHolder: Option<&'a DIType>,
2027 UniqueId: *const c_char,
2028 UniqueIdLen: size_t,
2029 ) -> &'a DICompositeType;
2031 pub fn LLVMRustDIBuilderCreateMemberType<'a>(
2032 Builder: &DIBuilder<'a>,
2033 Scope: &'a DIDescriptor,
2034 Name: *const c_char,
2043 ) -> &'a DIDerivedType;
2045 pub fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2046 Builder: &DIBuilder<'a>,
2048 Name: *const c_char,
2055 Discriminant: Option<&'a Value>,
2060 pub fn LLVMRustDIBuilderCreateLexicalBlock<'a>(
2061 Builder: &DIBuilder<'a>,
2066 ) -> &'a DILexicalBlock;
2068 pub fn LLVMRustDIBuilderCreateLexicalBlockFile<'a>(
2069 Builder: &DIBuilder<'a>,
2072 ) -> &'a DILexicalBlock;
2074 pub fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2075 Builder: &DIBuilder<'a>,
2076 Context: Option<&'a DIScope>,
2077 Name: *const c_char,
2079 LinkageName: *const c_char,
2080 LinkageNameLen: size_t,
2084 isLocalToUnit: bool,
2086 Decl: Option<&'a DIDescriptor>,
2088 ) -> &'a DIGlobalVariableExpression;
2090 pub fn LLVMRustDIBuilderCreateVariable<'a>(
2091 Builder: &DIBuilder<'a>,
2093 Scope: &'a DIDescriptor,
2094 Name: *const c_char,
2099 AlwaysPreserve: bool,
2103 ) -> &'a DIVariable;
2105 pub fn LLVMRustDIBuilderCreateArrayType<'a>(
2106 Builder: &DIBuilder<'a>,
2110 Subscripts: &'a DIArray,
2113 pub fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2114 Builder: &DIBuilder<'a>,
2117 ) -> &'a DISubrange;
2119 pub fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2120 Builder: &DIBuilder<'a>,
2121 Ptr: *const Option<&'a DIDescriptor>,
2125 pub fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2126 Builder: &DIBuilder<'a>,
2128 VarInfo: &'a DIVariable,
2129 AddrOps: *const u64,
2130 AddrOpsCount: c_uint,
2132 InsertAtEnd: &'a BasicBlock,
2135 pub fn LLVMRustDIBuilderCreateEnumerator<'a>(
2136 Builder: &DIBuilder<'a>,
2137 Name: *const c_char,
2141 ) -> &'a DIEnumerator;
2143 pub fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2144 Builder: &DIBuilder<'a>,
2146 Name: *const c_char,
2152 Elements: &'a DIArray,
2153 ClassType: &'a DIType,
2157 pub fn LLVMRustDIBuilderCreateUnionType<'a>(
2158 Builder: &DIBuilder<'a>,
2159 Scope: Option<&'a DIScope>,
2160 Name: *const c_char,
2167 Elements: Option<&'a DIArray>,
2168 RunTimeLang: c_uint,
2169 UniqueId: *const c_char,
2170 UniqueIdLen: size_t,
2173 pub fn LLVMRustDIBuilderCreateVariantPart<'a>(
2174 Builder: &DIBuilder<'a>,
2176 Name: *const c_char,
2183 Discriminator: Option<&'a DIDerivedType>,
2184 Elements: &'a DIArray,
2185 UniqueId: *const c_char,
2186 UniqueIdLen: size_t,
2187 ) -> &'a DIDerivedType;
2189 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2191 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2192 Builder: &DIBuilder<'a>,
2193 Scope: Option<&'a DIScope>,
2194 Name: *const c_char,
2197 ) -> &'a DITemplateTypeParameter;
2199 pub fn LLVMRustDIBuilderCreateNameSpace<'a>(
2200 Builder: &DIBuilder<'a>,
2201 Scope: Option<&'a DIScope>,
2202 Name: *const c_char,
2204 ExportSymbols: bool,
2205 ) -> &'a DINameSpace;
2207 pub fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2208 Builder: &DIBuilder<'a>,
2209 CompositeType: &'a DIType,
2210 Elements: Option<&'a DIArray>,
2211 Params: Option<&'a DIArray>,
2214 pub fn LLVMRustDIBuilderCreateDebugLocation<'a>(
2218 InlinedAt: Option<&'a DILocation>,
2219 ) -> &'a DILocation;
2220 pub fn LLVMRustDIBuilderCreateOpDeref() -> u64;
2221 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> u64;
2223 #[allow(improper_ctypes)]
2224 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2225 #[allow(improper_ctypes)]
2226 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2228 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2230 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2231 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2232 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2233 pub fn LLVMRustCreateMemorySanitizerPass(
2234 TrackOrigins: c_int,
2236 ) -> &'static mut Pass;
2237 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2238 pub fn LLVMRustCreateHWAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2239 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2240 pub fn LLVMRustAddLastExtensionPasses(
2241 PMB: &PassManagerBuilder,
2242 Passes: *const &'static mut Pass,
2246 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2248 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2249 pub fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2250 pub fn LLVMRustGetTargetFeature(
2253 Feature: &mut *const c_char,
2254 Desc: &mut *const c_char,
2257 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2258 pub fn LLVMRustCreateTargetMachine(
2259 Triple: *const c_char,
2261 Features: *const c_char,
2265 Level: CodeGenOptLevel,
2267 FunctionSections: bool,
2269 UniqueSectionNames: bool,
2270 TrapUnreachable: bool,
2273 EmitStackSizeSection: bool,
2274 RelaxELFRelocations: bool,
2276 SplitDwarfFile: *const c_char,
2277 ) -> Option<&'static mut TargetMachine>;
2278 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2279 pub fn LLVMRustAddBuilderLibraryInfo<'a>(
2280 PMB: &'a PassManagerBuilder,
2282 DisableSimplifyLibCalls: bool,
2284 pub fn LLVMRustConfigurePassManagerBuilder(
2285 PMB: &PassManagerBuilder,
2286 OptLevel: CodeGenOptLevel,
2287 MergeFunctions: bool,
2289 LoopVectorize: bool,
2290 PrepareForThinLTO: bool,
2291 PGOGenPath: *const c_char,
2292 PGOUsePath: *const c_char,
2293 PGOSampleUsePath: *const c_char,
2296 pub fn LLVMRustAddLibraryInfo<'a>(
2297 PM: &PassManager<'a>,
2299 DisableSimplifyLibCalls: bool,
2301 pub fn LLVMRustRunFunctionPassManager<'a>(PM: &PassManager<'a>, M: &'a Module);
2302 pub fn LLVMRustWriteOutputFile<'a>(
2303 T: &'a TargetMachine,
2304 PM: &PassManager<'a>,
2306 Output: *const c_char,
2307 DwoOutput: *const c_char,
2309 ) -> LLVMRustResult;
2310 pub fn LLVMRustOptimizeWithNewPassManager<'a>(
2312 TM: &'a TargetMachine,
2313 OptLevel: PassBuilderOptLevel,
2315 NoPrepopulatePasses: bool,
2317 UseThinLTOBuffers: bool,
2318 MergeFunctions: bool,
2321 LoopVectorize: bool,
2322 DisableSimplifyLibCalls: bool,
2323 EmitLifetimeMarkers: bool,
2324 SanitizerOptions: Option<&SanitizerOptions>,
2325 PGOGenPath: *const c_char,
2326 PGOUsePath: *const c_char,
2327 InstrumentCoverage: bool,
2328 InstrumentGCOV: bool,
2329 PGOSampleUsePath: *const c_char,
2330 DebugInfoForProfiling: bool,
2331 llvm_selfprofiler: *mut c_void,
2332 begin_callback: SelfProfileBeforePassCallback,
2333 end_callback: SelfProfileAfterPassCallback,
2334 ExtraPasses: *const c_char,
2335 ExtraPassesLen: size_t,
2336 LLVMPlugins: *const c_char,
2337 LLVMPluginsLen: size_t,
2338 ) -> LLVMRustResult;
2339 pub fn LLVMRustPrintModule(
2341 Output: *const c_char,
2342 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2343 ) -> LLVMRustResult;
2344 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2345 pub fn LLVMRustPrintPasses();
2346 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2347 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2348 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2350 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2351 pub fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2352 pub fn LLVMRustArchiveIteratorNext<'a>(
2353 AIR: &ArchiveIterator<'a>,
2354 ) -> Option<&'a mut ArchiveChild<'a>>;
2355 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2356 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2357 pub fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2358 pub fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2359 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2361 #[allow(improper_ctypes)]
2362 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2364 #[allow(improper_ctypes)]
2365 pub fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2366 DI: &'a DiagnosticInfo,
2367 pass_name_out: &RustString,
2368 function_out: &mut Option<&'a Value>,
2369 loc_line_out: &mut c_uint,
2370 loc_column_out: &mut c_uint,
2371 loc_filename_out: &RustString,
2372 message_out: &RustString,
2375 pub fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2376 DI: &'a DiagnosticInfo,
2377 level_out: &mut DiagnosticLevel,
2378 cookie_out: &mut c_uint,
2379 message_out: &mut Option<&'a Twine>,
2382 #[allow(improper_ctypes)]
2383 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2384 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2386 pub fn LLVMRustGetSMDiagnostic<'a>(
2387 DI: &'a DiagnosticInfo,
2388 cookie_out: &mut c_uint,
2389 ) -> &'a SMDiagnostic;
2391 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2393 H: InlineAsmDiagHandlerTy,
2397 #[allow(improper_ctypes)]
2398 pub fn LLVMRustUnpackSMDiagnostic(
2400 message_out: &RustString,
2401 buffer_out: &RustString,
2402 level_out: &mut DiagnosticLevel,
2403 loc_out: &mut c_uint,
2404 ranges_out: *mut c_uint,
2405 num_ranges: &mut usize,
2408 pub fn LLVMRustWriteArchive(
2411 Members: *const &RustArchiveMember<'_>,
2414 ) -> LLVMRustResult;
2415 pub fn LLVMRustArchiveMemberNew<'a>(
2416 Filename: *const c_char,
2417 Name: *const c_char,
2418 Child: Option<&ArchiveChild<'a>>,
2419 ) -> &'a mut RustArchiveMember<'a>;
2420 pub fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2422 pub fn LLVMRustWriteImportLibrary(
2423 ImportName: *const c_char,
2424 Path: *const c_char,
2425 Exports: *const LLVMRustCOFFShortExport,
2429 ) -> LLVMRustResult;
2431 pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2433 pub fn LLVMRustBuildOperandBundleDef<'a>(
2434 Name: *const c_char,
2435 Inputs: *const &'a Value,
2437 ) -> &'a mut OperandBundleDef<'a>;
2438 pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
2440 pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2442 pub fn LLVMRustSetComdat<'a>(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2443 pub fn LLVMRustSetModulePICLevel(M: &Module);
2444 pub fn LLVMRustSetModulePIELevel(M: &Module);
2445 pub fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2446 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2447 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2448 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2449 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2450 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2452 pub fn LLVMRustThinLTOBufferCreate(M: &Module, is_thin: bool) -> &'static mut ThinLTOBuffer;
2453 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2454 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2455 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2456 pub fn LLVMRustCreateThinLTOData(
2457 Modules: *const ThinLTOModule,
2459 PreservedSymbols: *const *const c_char,
2460 PreservedSymbolsLen: c_uint,
2461 ) -> Option<&'static mut ThinLTOData>;
2462 pub fn LLVMRustPrepareThinLTORename(
2465 Target: &TargetMachine,
2467 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2468 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2469 pub fn LLVMRustPrepareThinLTOImport(
2472 Target: &TargetMachine,
2474 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2475 pub fn LLVMRustParseBitcodeForLTO(
2479 Identifier: *const c_char,
2480 ) -> Option<&Module>;
2481 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2484 out_len: &mut usize,
2486 pub fn LLVMRustThinLTOGetDICompileUnit(
2488 CU1: &mut *mut c_void,
2489 CU2: &mut *mut c_void,
2491 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2493 pub fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2494 pub fn LLVMRustLinkerAdd(
2495 linker: &Linker<'_>,
2496 bytecode: *const c_char,
2497 bytecode_len: usize,
2499 pub fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2500 #[allow(improper_ctypes)]
2501 pub fn LLVMRustComputeLTOCacheKey(
2502 key_out: &RustString,
2503 mod_id: *const c_char,
2507 pub fn LLVMRustContextGetDiagnosticHandler(Context: &Context) -> Option<&DiagnosticHandler>;
2508 pub fn LLVMRustContextSetDiagnosticHandler(
2510 diagnostic_handler: Option<&DiagnosticHandler>,
2512 pub fn LLVMRustContextConfigureDiagnosticHandler(
2514 diagnostic_handler_callback: DiagnosticHandlerTy,
2515 diagnostic_handler_context: *mut c_void,
2516 remark_all_passes: bool,
2517 remark_passes: *const *const c_char,
2518 remark_passes_len: usize,
2521 #[allow(improper_ctypes)]
2522 pub fn LLVMRustGetMangledName(V: &Value, out: &RustString);