1#![allow(non_camel_case_types)]
14#![allow(non_upper_case_globals)]
15
16use std::fmt::Debug;
17use std::marker::PhantomData;
18use std::num::NonZero;
19use std::ptr;
20
21use bitflags::bitflags;
22use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_void, size_t};
23use rustc_macros::TryFromU32;
24use rustc_target::spec::SymbolVisibility;
25
26use super::RustString;
27use super::debuginfo::{
28 DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
29 DIFile, DIFlags, DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
30 DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
31};
32use crate::llvm;
33
34pub(crate) type Bool = c_int;
37
38pub(crate) const True: Bool = 1 as Bool;
39pub(crate) const False: Bool = 0 as Bool;
40
41#[repr(transparent)]
48pub(crate) struct RawEnum<T> {
49 value: u32,
50 _rust_side_type: PhantomData<fn() -> T>,
52}
53
54impl<T: TryFrom<u32>> RawEnum<T> {
55 #[track_caller]
56 pub(crate) fn to_rust(self) -> T
57 where
58 T::Error: Debug,
59 {
60 T::try_from(self.value).expect("enum value returned by LLVM should be known")
62 }
63}
64
65#[derive(Copy, Clone, PartialEq)]
66#[repr(C)]
67#[allow(dead_code)] pub(crate) enum LLVMRustResult {
69 Success,
70 Failure,
71}
72
73#[derive(Copy, Clone, PartialEq)]
86#[repr(C)]
87pub(crate) enum ModuleFlagMergeBehavior {
88 Error = 1,
89 Warning = 2,
90 Require = 3,
91 Override = 4,
92 Append = 5,
93 AppendUnique = 6,
94 Max = 7,
95 Min = 8,
96}
97
98#[derive(Copy, Clone, PartialEq, Debug)]
101#[repr(C)]
102#[allow(dead_code)]
103pub(crate) enum TailCallKind {
104 None = 0,
105 Tail = 1,
106 MustTail = 2,
107 NoTail = 3,
108}
109
110#[derive(Copy, Clone, PartialEq, Debug, TryFromU32)]
114#[repr(C)]
115pub(crate) enum CallConv {
116 CCallConv = 0,
117 FastCallConv = 8,
118 ColdCallConv = 9,
119 PreserveMost = 14,
120 PreserveAll = 15,
121 Tail = 18,
122 X86StdcallCallConv = 64,
123 X86FastcallCallConv = 65,
124 ArmAapcsCallConv = 67,
125 Msp430Intr = 69,
126 X86_ThisCall = 70,
127 PtxKernel = 71,
128 X86_64_SysV = 78,
129 X86_64_Win64 = 79,
130 X86_VectorCall = 80,
131 X86_Intr = 83,
132 AvrNonBlockingInterrupt = 84,
133 AvrInterrupt = 85,
134 AmdgpuKernel = 91,
135}
136
137#[derive(Copy, Clone, PartialEq, TryFromU32)]
139#[repr(C)]
140pub(crate) enum Linkage {
141 ExternalLinkage = 0,
142 AvailableExternallyLinkage = 1,
143 LinkOnceAnyLinkage = 2,
144 LinkOnceODRLinkage = 3,
145 #[deprecated = "marked obsolete by LLVM"]
146 LinkOnceODRAutoHideLinkage = 4,
147 WeakAnyLinkage = 5,
148 WeakODRLinkage = 6,
149 AppendingLinkage = 7,
150 InternalLinkage = 8,
151 PrivateLinkage = 9,
152 #[deprecated = "marked obsolete by LLVM"]
153 DLLImportLinkage = 10,
154 #[deprecated = "marked obsolete by LLVM"]
155 DLLExportLinkage = 11,
156 ExternalWeakLinkage = 12,
157 #[deprecated = "marked obsolete by LLVM"]
158 GhostLinkage = 13,
159 CommonLinkage = 14,
160 LinkerPrivateLinkage = 15,
161 LinkerPrivateWeakLinkage = 16,
162}
163
164#[repr(C)]
166#[derive(Copy, Clone, PartialEq, TryFromU32)]
167pub(crate) enum Visibility {
168 Default = 0,
169 Hidden = 1,
170 Protected = 2,
171}
172
173impl Visibility {
174 pub(crate) fn from_generic(visibility: SymbolVisibility) -> Self {
175 match visibility {
176 SymbolVisibility::Hidden => Visibility::Hidden,
177 SymbolVisibility::Protected => Visibility::Protected,
178 SymbolVisibility::Interposable => Visibility::Default,
179 }
180 }
181}
182
183#[repr(C)]
185pub(crate) enum UnnamedAddr {
186 No,
187 #[expect(dead_code)]
188 Local,
189 Global,
190}
191
192#[derive(Copy, Clone)]
194#[repr(C)]
195pub(crate) enum DLLStorageClass {
196 #[allow(dead_code)]
197 Default = 0,
198 DllImport = 1, #[allow(dead_code)]
200 DllExport = 2, }
202
203#[repr(C)]
207#[derive(Copy, Clone, Debug)]
208#[expect(dead_code, reason = "Some variants are unused, but are kept to match the C++")]
209pub(crate) enum AttributeKind {
210 AlwaysInline = 0,
211 ByVal = 1,
212 Cold = 2,
213 InlineHint = 3,
214 MinSize = 4,
215 Naked = 5,
216 NoAlias = 6,
217 NoCapture = 7,
218 NoInline = 8,
219 NonNull = 9,
220 NoRedZone = 10,
221 NoReturn = 11,
222 NoUnwind = 12,
223 OptimizeForSize = 13,
224 ReadOnly = 14,
225 SExt = 15,
226 StructRet = 16,
227 UWTable = 17,
228 ZExt = 18,
229 InReg = 19,
230 SanitizeThread = 20,
231 SanitizeAddress = 21,
232 SanitizeMemory = 22,
233 NonLazyBind = 23,
234 OptimizeNone = 24,
235 ReadNone = 26,
236 SanitizeHWAddress = 28,
237 WillReturn = 29,
238 StackProtectReq = 30,
239 StackProtectStrong = 31,
240 StackProtect = 32,
241 NoUndef = 33,
242 SanitizeMemTag = 34,
243 NoCfCheck = 35,
244 ShadowCallStack = 36,
245 AllocSize = 37,
246 AllocatedPointer = 38,
247 AllocAlign = 39,
248 SanitizeSafeStack = 40,
249 FnRetThunkExtern = 41,
250 Writable = 42,
251 DeadOnUnwind = 43,
252 DeadOnReturn = 44,
253}
254
255#[derive(Copy, Clone)]
257#[repr(C)]
258pub(crate) enum IntPredicate {
259 IntEQ = 32,
260 IntNE = 33,
261 IntUGT = 34,
262 IntUGE = 35,
263 IntULT = 36,
264 IntULE = 37,
265 IntSGT = 38,
266 IntSGE = 39,
267 IntSLT = 40,
268 IntSLE = 41,
269}
270
271impl IntPredicate {
272 pub(crate) fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
273 use rustc_codegen_ssa::common::IntPredicate as Common;
274 match intpre {
275 Common::IntEQ => Self::IntEQ,
276 Common::IntNE => Self::IntNE,
277 Common::IntUGT => Self::IntUGT,
278 Common::IntUGE => Self::IntUGE,
279 Common::IntULT => Self::IntULT,
280 Common::IntULE => Self::IntULE,
281 Common::IntSGT => Self::IntSGT,
282 Common::IntSGE => Self::IntSGE,
283 Common::IntSLT => Self::IntSLT,
284 Common::IntSLE => Self::IntSLE,
285 }
286 }
287}
288
289#[derive(Copy, Clone)]
291#[repr(C)]
292pub(crate) enum RealPredicate {
293 RealPredicateFalse = 0,
294 RealOEQ = 1,
295 RealOGT = 2,
296 RealOGE = 3,
297 RealOLT = 4,
298 RealOLE = 5,
299 RealONE = 6,
300 RealORD = 7,
301 RealUNO = 8,
302 RealUEQ = 9,
303 RealUGT = 10,
304 RealUGE = 11,
305 RealULT = 12,
306 RealULE = 13,
307 RealUNE = 14,
308 RealPredicateTrue = 15,
309}
310
311impl RealPredicate {
312 pub(crate) fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
313 use rustc_codegen_ssa::common::RealPredicate as Common;
314 match realp {
315 Common::RealPredicateFalse => Self::RealPredicateFalse,
316 Common::RealOEQ => Self::RealOEQ,
317 Common::RealOGT => Self::RealOGT,
318 Common::RealOGE => Self::RealOGE,
319 Common::RealOLT => Self::RealOLT,
320 Common::RealOLE => Self::RealOLE,
321 Common::RealONE => Self::RealONE,
322 Common::RealORD => Self::RealORD,
323 Common::RealUNO => Self::RealUNO,
324 Common::RealUEQ => Self::RealUEQ,
325 Common::RealUGT => Self::RealUGT,
326 Common::RealUGE => Self::RealUGE,
327 Common::RealULT => Self::RealULT,
328 Common::RealULE => Self::RealULE,
329 Common::RealUNE => Self::RealUNE,
330 Common::RealPredicateTrue => Self::RealPredicateTrue,
331 }
332 }
333}
334
335#[derive(Copy, Clone, PartialEq, Debug)]
337#[repr(C)]
338#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM-C")]
339pub(crate) enum TypeKind {
340 Void = 0,
341 Half = 1,
342 Float = 2,
343 Double = 3,
344 X86_FP80 = 4,
345 FP128 = 5,
346 PPC_FP128 = 6,
347 Label = 7,
348 Integer = 8,
349 Function = 9,
350 Struct = 10,
351 Array = 11,
352 Pointer = 12,
353 Vector = 13,
354 Metadata = 14,
355 Token = 16,
356 ScalableVector = 17,
357 BFloat = 18,
358 X86_AMX = 19,
359}
360
361impl TypeKind {
362 pub(crate) fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
363 use rustc_codegen_ssa::common::TypeKind as Common;
364 match self {
365 Self::Void => Common::Void,
366 Self::Half => Common::Half,
367 Self::Float => Common::Float,
368 Self::Double => Common::Double,
369 Self::X86_FP80 => Common::X86_FP80,
370 Self::FP128 => Common::FP128,
371 Self::PPC_FP128 => Common::PPC_FP128,
372 Self::Label => Common::Label,
373 Self::Integer => Common::Integer,
374 Self::Function => Common::Function,
375 Self::Struct => Common::Struct,
376 Self::Array => Common::Array,
377 Self::Pointer => Common::Pointer,
378 Self::Vector => Common::Vector,
379 Self::Metadata => Common::Metadata,
380 Self::Token => Common::Token,
381 Self::ScalableVector => Common::ScalableVector,
382 Self::BFloat => Common::BFloat,
383 Self::X86_AMX => Common::X86_AMX,
384 }
385 }
386}
387
388#[derive(Copy, Clone)]
390#[repr(C)]
391pub(crate) enum AtomicRmwBinOp {
392 AtomicXchg = 0,
393 AtomicAdd = 1,
394 AtomicSub = 2,
395 AtomicAnd = 3,
396 AtomicNand = 4,
397 AtomicOr = 5,
398 AtomicXor = 6,
399 AtomicMax = 7,
400 AtomicMin = 8,
401 AtomicUMax = 9,
402 AtomicUMin = 10,
403}
404
405impl AtomicRmwBinOp {
406 pub(crate) fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
407 use rustc_codegen_ssa::common::AtomicRmwBinOp as Common;
408 match op {
409 Common::AtomicXchg => Self::AtomicXchg,
410 Common::AtomicAdd => Self::AtomicAdd,
411 Common::AtomicSub => Self::AtomicSub,
412 Common::AtomicAnd => Self::AtomicAnd,
413 Common::AtomicNand => Self::AtomicNand,
414 Common::AtomicOr => Self::AtomicOr,
415 Common::AtomicXor => Self::AtomicXor,
416 Common::AtomicMax => Self::AtomicMax,
417 Common::AtomicMin => Self::AtomicMin,
418 Common::AtomicUMax => Self::AtomicUMax,
419 Common::AtomicUMin => Self::AtomicUMin,
420 }
421 }
422}
423
424#[derive(Copy, Clone)]
426#[repr(C)]
427pub(crate) enum AtomicOrdering {
428 #[allow(dead_code)]
429 NotAtomic = 0,
430 #[allow(dead_code)]
431 Unordered = 1,
432 Monotonic = 2,
433 Acquire = 4,
435 Release = 5,
436 AcquireRelease = 6,
437 SequentiallyConsistent = 7,
438}
439
440impl AtomicOrdering {
441 pub(crate) fn from_generic(ao: rustc_middle::ty::AtomicOrdering) -> Self {
442 use rustc_middle::ty::AtomicOrdering as Common;
443 match ao {
444 Common::Relaxed => Self::Monotonic,
445 Common::Acquire => Self::Acquire,
446 Common::Release => Self::Release,
447 Common::AcqRel => Self::AcquireRelease,
448 Common::SeqCst => Self::SequentiallyConsistent,
449 }
450 }
451}
452
453#[derive(Copy, Clone)]
455#[repr(C)]
456pub(crate) enum FileType {
457 AssemblyFile,
458 ObjectFile,
459}
460
461#[derive(Copy, Clone)]
463#[repr(C)]
464#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM-C")]
465pub(crate) enum MetadataType {
466 MD_dbg = 0,
467 MD_tbaa = 1,
468 MD_prof = 2,
469 MD_fpmath = 3,
470 MD_range = 4,
471 MD_tbaa_struct = 5,
472 MD_invariant_load = 6,
473 MD_alias_scope = 7,
474 MD_noalias = 8,
475 MD_nontemporal = 9,
476 MD_mem_parallel_loop_access = 10,
477 MD_nonnull = 11,
478 MD_unpredictable = 15,
479 MD_align = 17,
480 MD_type = 19,
481 MD_vcall_visibility = 28,
482 MD_noundef = 29,
483 MD_kcfi_type = 36,
484}
485
486#[derive(Copy, Clone, PartialEq)]
488#[repr(C)]
489pub(crate) enum AsmDialect {
490 Att,
491 Intel,
492}
493
494#[derive(Copy, Clone, PartialEq)]
496#[repr(C)]
497pub(crate) enum CodeGenOptLevel {
498 None,
499 Less,
500 Default,
501 Aggressive,
502}
503
504#[repr(C)]
506pub(crate) enum PassBuilderOptLevel {
507 O0,
508 O1,
509 O2,
510 O3,
511 Os,
512 Oz,
513}
514
515#[derive(PartialEq)]
517#[repr(C)]
518pub(crate) enum OptStage {
519 PreLinkNoLTO,
520 PreLinkThinLTO,
521 PreLinkFatLTO,
522 ThinLTO,
523 FatLTO,
524}
525
526#[repr(C)]
528pub(crate) struct SanitizerOptions {
529 pub sanitize_address: bool,
530 pub sanitize_address_recover: bool,
531 pub sanitize_cfi: bool,
532 pub sanitize_dataflow: bool,
533 pub sanitize_dataflow_abilist: *const *const c_char,
534 pub sanitize_dataflow_abilist_len: size_t,
535 pub sanitize_kcfi: bool,
536 pub sanitize_memory: bool,
537 pub sanitize_memory_recover: bool,
538 pub sanitize_memory_track_origins: c_int,
539 pub sanitize_thread: bool,
540 pub sanitize_hwaddress: bool,
541 pub sanitize_hwaddress_recover: bool,
542 pub sanitize_kernel_address: bool,
543 pub sanitize_kernel_address_recover: bool,
544}
545
546#[derive(Copy, Clone, PartialEq)]
548#[repr(C)]
549pub(crate) enum RelocModel {
550 Static,
551 PIC,
552 DynamicNoPic,
553 ROPI,
554 RWPI,
555 ROPI_RWPI,
556}
557
558#[derive(Copy, Clone, PartialEq)]
560#[repr(C)]
561pub(crate) enum FloatAbi {
562 Default,
563 Soft,
564 Hard,
565}
566
567#[derive(Copy, Clone)]
569#[repr(C)]
570pub(crate) enum CodeModel {
571 Tiny,
572 Small,
573 Kernel,
574 Medium,
575 Large,
576 None,
577}
578
579#[derive(Copy, Clone)]
581#[repr(C)]
582#[allow(dead_code)] pub(crate) enum DiagnosticKind {
584 Other,
585 InlineAsm,
586 StackSize,
587 DebugMetadataVersion,
588 SampleProfile,
589 OptimizationRemark,
590 OptimizationRemarkMissed,
591 OptimizationRemarkAnalysis,
592 OptimizationRemarkAnalysisFPCommute,
593 OptimizationRemarkAnalysisAliasing,
594 OptimizationRemarkOther,
595 OptimizationFailure,
596 PGOProfile,
597 Linker,
598 Unsupported,
599 SrcMgr,
600}
601
602#[derive(Copy, Clone)]
604#[repr(C)]
605#[allow(dead_code)] pub(crate) enum DiagnosticLevel {
607 Error,
608 Warning,
609 Note,
610 Remark,
611}
612
613#[derive(Copy, Clone)]
615#[repr(C)]
616pub(crate) enum ArchiveKind {
617 K_GNU,
618 K_BSD,
619 K_DARWIN,
620 K_COFF,
621 K_AIXBIG,
622}
623
624unsafe extern "C" {
625 pub(crate) type ThinLTOData;
627
628 pub(crate) type ThinLTOBuffer;
630}
631
632#[repr(C)]
634pub(crate) struct ThinLTOModule {
635 pub identifier: *const c_char,
636 pub data: *const u8,
637 pub len: usize,
638}
639
640#[derive(Copy, Clone)]
642#[repr(C)]
643pub(crate) enum ThreadLocalMode {
644 #[expect(dead_code)]
645 NotThreadLocal,
646 GeneralDynamic,
647 LocalDynamic,
648 InitialExec,
649 LocalExec,
650}
651
652#[derive(Copy, Clone)]
654#[repr(C)]
655pub(crate) enum ChecksumKind {
656 None,
657 MD5,
658 SHA1,
659 SHA256,
660}
661
662#[derive(Copy, Clone)]
664#[repr(C)]
665pub(crate) enum MemoryEffects {
666 None,
667 ReadOnly,
668 InaccessibleMemOnly,
669}
670
671#[derive(Copy, Clone, PartialEq, Eq)]
673#[repr(C)]
674#[expect(dead_code, reason = "Some variants are unused, but are kept to match LLVM-C")]
675pub(crate) enum Opcode {
676 Ret = 1,
677 Br = 2,
678 Switch = 3,
679 IndirectBr = 4,
680 Invoke = 5,
681 Unreachable = 7,
682 CallBr = 67,
683 FNeg = 66,
684 Add = 8,
685 FAdd = 9,
686 Sub = 10,
687 FSub = 11,
688 Mul = 12,
689 FMul = 13,
690 UDiv = 14,
691 SDiv = 15,
692 FDiv = 16,
693 URem = 17,
694 SRem = 18,
695 FRem = 19,
696 Shl = 20,
697 LShr = 21,
698 AShr = 22,
699 And = 23,
700 Or = 24,
701 Xor = 25,
702 Alloca = 26,
703 Load = 27,
704 Store = 28,
705 GetElementPtr = 29,
706 Trunc = 30,
707 ZExt = 31,
708 SExt = 32,
709 FPToUI = 33,
710 FPToSI = 34,
711 UIToFP = 35,
712 SIToFP = 36,
713 FPTrunc = 37,
714 FPExt = 38,
715 PtrToInt = 39,
716 IntToPtr = 40,
717 BitCast = 41,
718 AddrSpaceCast = 60,
719 ICmp = 42,
720 FCmp = 43,
721 PHI = 44,
722 Call = 45,
723 Select = 46,
724 UserOp1 = 47,
725 UserOp2 = 48,
726 VAArg = 49,
727 ExtractElement = 50,
728 InsertElement = 51,
729 ShuffleVector = 52,
730 ExtractValue = 53,
731 InsertValue = 54,
732 Freeze = 68,
733 Fence = 55,
734 AtomicCmpXchg = 56,
735 AtomicRMW = 57,
736 Resume = 58,
737 LandingPad = 59,
738 CleanupRet = 61,
739 CatchRet = 62,
740 CatchPad = 63,
741 CleanupPad = 64,
742 CatchSwitch = 65,
743}
744
745unsafe extern "C" {
746 type Opaque;
747}
748#[repr(C)]
749struct InvariantOpaque<'a> {
750 _marker: PhantomData<&'a mut &'a ()>,
751 _opaque: Opaque,
752}
753
754unsafe extern "C" {
756 pub(crate) type Module;
757 pub(crate) type Context;
758 pub(crate) type Type;
759 pub(crate) type Value;
760 pub(crate) type ConstantInt;
761 pub(crate) type Attribute;
762 pub(crate) type Metadata;
763 pub(crate) type BasicBlock;
764 pub(crate) type Comdat;
765}
766#[repr(C)]
767pub(crate) struct Builder<'a>(InvariantOpaque<'a>);
768#[repr(C)]
769pub(crate) struct PassManager<'a>(InvariantOpaque<'a>);
770unsafe extern "C" {
771 pub type TargetMachine;
772 pub(crate) type Archive;
773}
774#[repr(C)]
775pub(crate) struct ArchiveIterator<'a>(InvariantOpaque<'a>);
776#[repr(C)]
777pub(crate) struct ArchiveChild<'a>(InvariantOpaque<'a>);
778unsafe extern "C" {
779 pub(crate) type Twine;
780 pub(crate) type DiagnosticInfo;
781 pub(crate) type SMDiagnostic;
782}
783#[repr(C)]
784pub(crate) struct RustArchiveMember<'a>(InvariantOpaque<'a>);
785#[repr(C)]
787pub(crate) struct OperandBundle<'a>(InvariantOpaque<'a>);
788#[repr(C)]
789pub(crate) struct Linker<'a>(InvariantOpaque<'a>);
790
791unsafe extern "C" {
792 pub(crate) type DiagnosticHandler;
793}
794
795pub(crate) type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
796
797pub(crate) mod debuginfo {
798 use std::ptr;
799
800 use bitflags::bitflags;
801
802 use super::{InvariantOpaque, Metadata};
803 use crate::llvm::{self, Module};
804
805 #[repr(C)]
814 pub(crate) struct DIBuilder<'ll>(InvariantOpaque<'ll>);
815
816 pub(crate) struct DIBuilderBox<'ll> {
820 raw: ptr::NonNull<DIBuilder<'ll>>,
821 }
822
823 impl<'ll> DIBuilderBox<'ll> {
824 pub(crate) fn new(llmod: &'ll Module) -> Self {
825 let raw = unsafe { llvm::LLVMCreateDIBuilder(llmod) };
826 let raw = ptr::NonNull::new(raw).unwrap();
827 Self { raw }
828 }
829
830 pub(crate) fn as_ref(&self) -> &DIBuilder<'ll> {
831 unsafe { self.raw.as_ref() }
834 }
835 }
836
837 impl<'ll> Drop for DIBuilderBox<'ll> {
838 fn drop(&mut self) {
839 unsafe { llvm::LLVMDisposeDIBuilder(self.raw) };
840 }
841 }
842
843 pub(crate) type DIDescriptor = Metadata;
844 pub(crate) type DILocation = Metadata;
845 pub(crate) type DIScope = DIDescriptor;
846 pub(crate) type DIFile = DIScope;
847 pub(crate) type DILexicalBlock = DIScope;
848 pub(crate) type DISubprogram = DIScope;
849 pub(crate) type DIType = DIDescriptor;
850 pub(crate) type DIBasicType = DIType;
851 pub(crate) type DIDerivedType = DIType;
852 pub(crate) type DICompositeType = DIDerivedType;
853 pub(crate) type DIVariable = DIDescriptor;
854 pub(crate) type DIGlobalVariableExpression = DIDescriptor;
855 pub(crate) type DIArray = DIDescriptor;
856 pub(crate) type DISubrange = DIDescriptor;
857 pub(crate) type DIEnumerator = DIDescriptor;
858 pub(crate) type DITemplateTypeParameter = DIDescriptor;
859
860 bitflags! {
861 #[repr(transparent)]
866 #[derive(Clone, Copy, Default)]
867 pub(crate) struct DIFlags: u32 {
868 const FlagZero = 0;
869 const FlagPrivate = 1;
870 const FlagProtected = 2;
871 const FlagPublic = 3;
872 const FlagFwdDecl = (1 << 2);
873 const FlagAppleBlock = (1 << 3);
874 const FlagReservedBit4 = (1 << 4);
875 const FlagVirtual = (1 << 5);
876 const FlagArtificial = (1 << 6);
877 const FlagExplicit = (1 << 7);
878 const FlagPrototyped = (1 << 8);
879 const FlagObjcClassComplete = (1 << 9);
880 const FlagObjectPointer = (1 << 10);
881 const FlagVector = (1 << 11);
882 const FlagStaticMember = (1 << 12);
883 const FlagLValueReference = (1 << 13);
884 const FlagRValueReference = (1 << 14);
885 const FlagReserved = (1 << 15);
886 const FlagSingleInheritance = (1 << 16);
887 const FlagMultipleInheritance = (2 << 16);
888 const FlagVirtualInheritance = (3 << 16);
889 const FlagIntroducedVirtual = (1 << 18);
890 const FlagBitField = (1 << 19);
891 const FlagNoReturn = (1 << 20);
892 const FlagTypePassByValue = (1 << 22);
894 const FlagTypePassByReference = (1 << 23);
895 const FlagEnumClass = (1 << 24);
896 const FlagThunk = (1 << 25);
897 const FlagNonTrivial = (1 << 26);
898 const FlagBigEndian = (1 << 27);
899 const FlagLittleEndian = (1 << 28);
900 }
901 }
902
903 bitflags! {
905 #[repr(transparent)]
906 #[derive(Clone, Copy, Default)]
907 pub(crate) struct DISPFlags: u32 {
908 const SPFlagZero = 0;
909 const SPFlagVirtual = 1;
910 const SPFlagPureVirtual = 2;
911 const SPFlagLocalToUnit = (1 << 2);
912 const SPFlagDefinition = (1 << 3);
913 const SPFlagOptimized = (1 << 4);
914 const SPFlagMainSubprogram = (1 << 5);
915 }
916 }
917
918 #[derive(Copy, Clone)]
920 #[repr(C)]
921 pub(crate) enum DebugEmissionKind {
922 NoDebug,
923 FullDebug,
924 LineTablesOnly,
925 DebugDirectivesOnly,
926 }
927
928 impl DebugEmissionKind {
929 pub(crate) fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
930 use rustc_session::config::DebugInfo;
941 match kind {
942 DebugInfo::None => DebugEmissionKind::NoDebug,
943 DebugInfo::LineDirectivesOnly => DebugEmissionKind::DebugDirectivesOnly,
944 DebugInfo::LineTablesOnly => DebugEmissionKind::LineTablesOnly,
945 DebugInfo::Limited | DebugInfo::Full => DebugEmissionKind::FullDebug,
946 }
947 }
948 }
949
950 #[derive(Clone, Copy)]
952 #[repr(C)]
953 pub(crate) enum DebugNameTableKind {
954 Default,
955 #[expect(dead_code)]
956 Gnu,
957 None,
958 }
959}
960
961bitflags! {
963 #[repr(transparent)]
964 #[derive(Default)]
965 pub(crate) struct AllocKindFlags : u64 {
966 const Unknown = 0;
967 const Alloc = 1;
968 const Realloc = 1 << 1;
969 const Free = 1 << 2;
970 const Uninitialized = 1 << 3;
971 const Zeroed = 1 << 4;
972 const Aligned = 1 << 5;
973 }
974}
975
976bitflags! {
978 #[repr(transparent)]
979 #[derive(Default)]
980 pub struct GEPNoWrapFlags : c_uint {
981 const InBounds = 1 << 0;
982 const NUSW = 1 << 1;
983 const NUW = 1 << 2;
984 }
985}
986
987unsafe extern "C" {
988 pub(crate) type ModuleBuffer;
989}
990
991pub(crate) type SelfProfileBeforePassCallback =
992 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
993pub(crate) type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
994
995pub(crate) type GetSymbolsCallback =
996 unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void;
997pub(crate) type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void;
998
999#[derive(Copy, Clone)]
1000#[repr(transparent)]
1001pub(crate) struct MetadataKindId(c_uint);
1002
1003impl From<MetadataType> for MetadataKindId {
1004 fn from(value: MetadataType) -> Self {
1005 Self(value as c_uint)
1006 }
1007}
1008
1009unsafe extern "C" {
1010 pub(crate) fn LLVMContextDispose(C: &'static mut Context);
1012 pub(crate) fn LLVMGetMDKindIDInContext(
1013 C: &Context,
1014 Name: *const c_char,
1015 SLen: c_uint,
1016 ) -> MetadataKindId;
1017
1018 pub(crate) fn LLVMModuleCreateWithNameInContext(
1020 ModuleID: *const c_char,
1021 C: &Context,
1022 ) -> &Module;
1023 pub(crate) safe fn LLVMCloneModule(M: &Module) -> &Module;
1024
1025 pub(crate) fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
1027 pub(crate) fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
1028
1029 pub(crate) fn LLVMAppendModuleInlineAsm(
1031 M: &Module,
1032 Asm: *const c_uchar, Len: size_t,
1034 );
1035
1036 pub(crate) fn LLVMGetInlineAsm<'ll>(
1038 Ty: &'ll Type,
1039 AsmString: *const c_uchar, AsmStringSize: size_t,
1041 Constraints: *const c_uchar, ConstraintsSize: size_t,
1043 HasSideEffects: llvm::Bool,
1044 IsAlignStack: llvm::Bool,
1045 Dialect: AsmDialect,
1046 CanThrow: llvm::Bool,
1047 ) -> &'ll Value;
1048
1049 pub(crate) fn LLVMInt1TypeInContext(C: &Context) -> &Type;
1051 pub(crate) fn LLVMInt8TypeInContext(C: &Context) -> &Type;
1052 pub(crate) fn LLVMInt16TypeInContext(C: &Context) -> &Type;
1053 pub(crate) fn LLVMInt32TypeInContext(C: &Context) -> &Type;
1054 pub(crate) fn LLVMInt64TypeInContext(C: &Context) -> &Type;
1055 pub(crate) fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
1056
1057 pub(crate) fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
1058
1059 pub(crate) fn LLVMHalfTypeInContext(C: &Context) -> &Type;
1061 pub(crate) fn LLVMFloatTypeInContext(C: &Context) -> &Type;
1062 pub(crate) fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
1063 pub(crate) fn LLVMFP128TypeInContext(C: &Context) -> &Type;
1064
1065 pub(crate) fn LLVMFunctionType<'a>(
1067 ReturnType: &'a Type,
1068 ParamTypes: *const &'a Type,
1069 ParamCount: c_uint,
1070 IsVarArg: Bool,
1071 ) -> &'a Type;
1072 pub(crate) fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
1073 pub(crate) fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
1074
1075 pub(crate) fn LLVMStructTypeInContext<'a>(
1077 C: &'a Context,
1078 ElementTypes: *const &'a Type,
1079 ElementCount: c_uint,
1080 Packed: Bool,
1081 ) -> &'a Type;
1082
1083 pub(crate) fn LLVMPointerTypeInContext(C: &Context, AddressSpace: c_uint) -> &Type;
1085 pub(crate) fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
1086
1087 pub(crate) fn LLVMGetElementType(Ty: &Type) -> &Type;
1088 pub(crate) fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
1089
1090 pub(crate) fn LLVMVoidTypeInContext(C: &Context) -> &Type;
1092
1093 pub(crate) fn LLVMTypeOf(Val: &Value) -> &Type;
1095 pub(crate) fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
1096 pub(crate) fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
1097 pub(crate) fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
1098 pub(crate) safe fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: MetadataKindId, Node: &'a Value);
1099 pub(crate) fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
1100 pub(crate) safe fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
1101
1102 pub(crate) fn LLVMConstNull(Ty: &Type) -> &Value;
1104 pub(crate) fn LLVMGetUndef(Ty: &Type) -> &Value;
1105 pub(crate) fn LLVMGetPoison(Ty: &Type) -> &Value;
1106
1107 pub(crate) fn LLVMMDStringInContext2(
1109 C: &Context,
1110 Str: *const c_char,
1111 SLen: size_t,
1112 ) -> &Metadata;
1113 pub(crate) fn LLVMMDNodeInContext2<'a>(
1114 C: &'a Context,
1115 Vals: *const &'a Metadata,
1116 Count: size_t,
1117 ) -> &'a Metadata;
1118 pub(crate) fn LLVMAddNamedMetadataOperand<'a>(
1119 M: &'a Module,
1120 Name: *const c_char,
1121 Val: &'a Value,
1122 );
1123
1124 pub(crate) fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
1126 pub(crate) fn LLVMConstIntOfArbitraryPrecision(
1127 IntTy: &Type,
1128 Wn: c_uint,
1129 Ws: *const u64,
1130 ) -> &Value;
1131 pub(crate) fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
1132
1133 pub(crate) fn LLVMConstArray2<'a>(
1135 ElementTy: &'a Type,
1136 ConstantVals: *const &'a Value,
1137 Length: u64,
1138 ) -> &'a Value;
1139 pub(crate) fn LLVMArrayType2(ElementType: &Type, ElementCount: u64) -> &Type;
1140 pub(crate) fn LLVMConstStringInContext2(
1141 C: &Context,
1142 Str: *const c_char,
1143 Length: size_t,
1144 DontNullTerminate: Bool,
1145 ) -> &Value;
1146 pub(crate) fn LLVMConstStructInContext<'a>(
1147 C: &'a Context,
1148 ConstantVals: *const &'a Value,
1149 Count: c_uint,
1150 Packed: Bool,
1151 ) -> &'a Value;
1152 pub(crate) fn LLVMConstNamedStruct<'a>(
1153 StructTy: &'a Type,
1154 ConstantVals: *const &'a Value,
1155 Count: c_uint,
1156 ) -> &'a Value;
1157 pub(crate) fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1158
1159 pub(crate) fn LLVMConstInBoundsGEP2<'a>(
1161 ty: &'a Type,
1162 ConstantVal: &'a Value,
1163 ConstantIndices: *const &'a Value,
1164 NumIndices: c_uint,
1165 ) -> &'a Value;
1166 pub(crate) fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1167 pub(crate) fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1168 pub(crate) fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1169 pub(crate) fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1170 pub(crate) fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
1171 pub(crate) fn LLVMGetConstOpcode(ConstantVal: &Value) -> Opcode;
1172 pub(crate) fn LLVMIsAConstantExpr(Val: &Value) -> Option<&Value>;
1173
1174 pub(crate) fn LLVMIsDeclaration(Global: &Value) -> Bool;
1176 pub(crate) fn LLVMGetLinkage(Global: &Value) -> RawEnum<Linkage>;
1177 pub(crate) fn LLVMSetLinkage(Global: &Value, RustLinkage: Linkage);
1178 pub(crate) fn LLVMSetSection(Global: &Value, Section: *const c_char);
1179 pub(crate) fn LLVMGetVisibility(Global: &Value) -> RawEnum<Visibility>;
1180 pub(crate) fn LLVMSetVisibility(Global: &Value, Viz: Visibility);
1181 pub(crate) fn LLVMGetAlignment(Global: &Value) -> c_uint;
1182 pub(crate) fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1183 pub(crate) fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1184 pub(crate) fn LLVMGlobalGetValueType(Global: &Value) -> &Type;
1185
1186 pub(crate) safe fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1188 pub(crate) fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1189 pub(crate) fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1190 pub(crate) fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1191 pub(crate) fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1192 pub(crate) fn LLVMDeleteGlobal(GlobalVar: &Value);
1193 pub(crate) safe fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1194 pub(crate) fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
1195 pub(crate) safe fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
1196 pub(crate) fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1197 pub(crate) safe fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1198 pub(crate) safe fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1199 pub(crate) safe fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1200 pub(crate) safe fn LLVMRustSetTailCallKind(CallInst: &Value, Kind: TailCallKind);
1201
1202 pub(crate) fn LLVMCreateStringAttribute(
1204 C: &Context,
1205 Name: *const c_char,
1206 NameLen: c_uint,
1207 Value: *const c_char,
1208 ValueLen: c_uint,
1209 ) -> &Attribute;
1210
1211 pub(crate) fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1213
1214 pub(crate) fn LLVMLookupIntrinsicID(Name: *const c_char, NameLen: size_t) -> c_uint;
1216 pub(crate) fn LLVMGetIntrinsicDeclaration<'a>(
1217 Mod: &'a Module,
1218 ID: NonZero<c_uint>,
1219 ParamTypes: *const &'a Type,
1220 ParamCount: size_t,
1221 ) -> &'a Value;
1222
1223 pub(crate) fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1225 pub(crate) safe fn LLVMCountParams(Fn: &Value) -> c_uint;
1226 pub(crate) fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1227
1228 pub(crate) fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1230 pub(crate) fn LLVMAppendBasicBlockInContext<'a>(
1231 C: &'a Context,
1232 Fn: &'a Value,
1233 Name: *const c_char,
1234 ) -> &'a BasicBlock;
1235
1236 pub(crate) fn LLVMGetInstructionParent(Inst: &Value) -> &BasicBlock;
1238 pub(crate) fn LLVMGetCalledValue(CallInst: &Value) -> Option<&Value>;
1239 pub(crate) fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1240 pub(crate) fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1241 pub(crate) fn LLVMGetOperand(Val: &Value, Index: c_uint) -> Option<&Value>;
1242
1243 pub(crate) fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1245
1246 pub(crate) fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1248
1249 pub(crate) fn LLVMAddIncoming<'a>(
1251 PhiNode: &'a Value,
1252 IncomingValues: *const &'a Value,
1253 IncomingBlocks: *const &'a BasicBlock,
1254 Count: c_uint,
1255 );
1256
1257 pub(crate) fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
1259 pub(crate) fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
1260 pub(crate) fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
1261 pub(crate) fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
1262
1263 pub(crate) fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
1265 pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
1266
1267 pub(crate) safe fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
1269 pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1270 pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1271 pub(crate) fn LLVMBuildCondBr<'a>(
1272 B: &Builder<'a>,
1273 If: &'a Value,
1274 Then: &'a BasicBlock,
1275 Else: &'a BasicBlock,
1276 ) -> &'a Value;
1277 pub(crate) fn LLVMBuildSwitch<'a>(
1278 B: &Builder<'a>,
1279 V: &'a Value,
1280 Else: &'a BasicBlock,
1281 NumCases: c_uint,
1282 ) -> &'a Value;
1283 pub(crate) fn LLVMBuildLandingPad<'a>(
1284 B: &Builder<'a>,
1285 Ty: &'a Type,
1286 PersFn: Option<&'a Value>,
1287 NumClauses: c_uint,
1288 Name: *const c_char,
1289 ) -> &'a Value;
1290 pub(crate) fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1291 pub(crate) fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
1292
1293 pub(crate) fn LLVMBuildCleanupPad<'a>(
1294 B: &Builder<'a>,
1295 ParentPad: Option<&'a Value>,
1296 Args: *const &'a Value,
1297 NumArgs: c_uint,
1298 Name: *const c_char,
1299 ) -> Option<&'a Value>;
1300 pub(crate) fn LLVMBuildCleanupRet<'a>(
1301 B: &Builder<'a>,
1302 CleanupPad: &'a Value,
1303 BB: Option<&'a BasicBlock>,
1304 ) -> Option<&'a Value>;
1305 pub(crate) fn LLVMBuildCatchPad<'a>(
1306 B: &Builder<'a>,
1307 ParentPad: &'a Value,
1308 Args: *const &'a Value,
1309 NumArgs: c_uint,
1310 Name: *const c_char,
1311 ) -> Option<&'a Value>;
1312 pub(crate) fn LLVMBuildCatchRet<'a>(
1313 B: &Builder<'a>,
1314 CatchPad: &'a Value,
1315 BB: &'a BasicBlock,
1316 ) -> Option<&'a Value>;
1317 pub(crate) fn LLVMBuildCatchSwitch<'a>(
1318 Builder: &Builder<'a>,
1319 ParentPad: Option<&'a Value>,
1320 UnwindBB: Option<&'a BasicBlock>,
1321 NumHandlers: c_uint,
1322 Name: *const c_char,
1323 ) -> Option<&'a Value>;
1324 pub(crate) fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
1325 pub(crate) fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
1326
1327 pub(crate) fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1329
1330 pub(crate) fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
1332
1333 pub(crate) fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1335
1336 pub(crate) fn LLVMBuildAdd<'a>(
1338 B: &Builder<'a>,
1339 LHS: &'a Value,
1340 RHS: &'a Value,
1341 Name: *const c_char,
1342 ) -> &'a Value;
1343 pub(crate) fn LLVMBuildFAdd<'a>(
1344 B: &Builder<'a>,
1345 LHS: &'a Value,
1346 RHS: &'a Value,
1347 Name: *const c_char,
1348 ) -> &'a Value;
1349 pub(crate) fn LLVMBuildSub<'a>(
1350 B: &Builder<'a>,
1351 LHS: &'a Value,
1352 RHS: &'a Value,
1353 Name: *const c_char,
1354 ) -> &'a Value;
1355 pub(crate) fn LLVMBuildFSub<'a>(
1356 B: &Builder<'a>,
1357 LHS: &'a Value,
1358 RHS: &'a Value,
1359 Name: *const c_char,
1360 ) -> &'a Value;
1361 pub(crate) fn LLVMBuildMul<'a>(
1362 B: &Builder<'a>,
1363 LHS: &'a Value,
1364 RHS: &'a Value,
1365 Name: *const c_char,
1366 ) -> &'a Value;
1367 pub(crate) fn LLVMBuildFMul<'a>(
1368 B: &Builder<'a>,
1369 LHS: &'a Value,
1370 RHS: &'a Value,
1371 Name: *const c_char,
1372 ) -> &'a Value;
1373 pub(crate) fn LLVMBuildUDiv<'a>(
1374 B: &Builder<'a>,
1375 LHS: &'a Value,
1376 RHS: &'a Value,
1377 Name: *const c_char,
1378 ) -> &'a Value;
1379 pub(crate) fn LLVMBuildExactUDiv<'a>(
1380 B: &Builder<'a>,
1381 LHS: &'a Value,
1382 RHS: &'a Value,
1383 Name: *const c_char,
1384 ) -> &'a Value;
1385 pub(crate) fn LLVMBuildSDiv<'a>(
1386 B: &Builder<'a>,
1387 LHS: &'a Value,
1388 RHS: &'a Value,
1389 Name: *const c_char,
1390 ) -> &'a Value;
1391 pub(crate) fn LLVMBuildExactSDiv<'a>(
1392 B: &Builder<'a>,
1393 LHS: &'a Value,
1394 RHS: &'a Value,
1395 Name: *const c_char,
1396 ) -> &'a Value;
1397 pub(crate) fn LLVMBuildFDiv<'a>(
1398 B: &Builder<'a>,
1399 LHS: &'a Value,
1400 RHS: &'a Value,
1401 Name: *const c_char,
1402 ) -> &'a Value;
1403 pub(crate) fn LLVMBuildURem<'a>(
1404 B: &Builder<'a>,
1405 LHS: &'a Value,
1406 RHS: &'a Value,
1407 Name: *const c_char,
1408 ) -> &'a Value;
1409 pub(crate) fn LLVMBuildSRem<'a>(
1410 B: &Builder<'a>,
1411 LHS: &'a Value,
1412 RHS: &'a Value,
1413 Name: *const c_char,
1414 ) -> &'a Value;
1415 pub(crate) fn LLVMBuildFRem<'a>(
1416 B: &Builder<'a>,
1417 LHS: &'a Value,
1418 RHS: &'a Value,
1419 Name: *const c_char,
1420 ) -> &'a Value;
1421 pub(crate) fn LLVMBuildShl<'a>(
1422 B: &Builder<'a>,
1423 LHS: &'a Value,
1424 RHS: &'a Value,
1425 Name: *const c_char,
1426 ) -> &'a Value;
1427 pub(crate) fn LLVMBuildLShr<'a>(
1428 B: &Builder<'a>,
1429 LHS: &'a Value,
1430 RHS: &'a Value,
1431 Name: *const c_char,
1432 ) -> &'a Value;
1433 pub(crate) fn LLVMBuildAShr<'a>(
1434 B: &Builder<'a>,
1435 LHS: &'a Value,
1436 RHS: &'a Value,
1437 Name: *const c_char,
1438 ) -> &'a Value;
1439 pub(crate) fn LLVMBuildNSWAdd<'a>(
1440 B: &Builder<'a>,
1441 LHS: &'a Value,
1442 RHS: &'a Value,
1443 Name: *const c_char,
1444 ) -> &'a Value;
1445 pub(crate) fn LLVMBuildNUWAdd<'a>(
1446 B: &Builder<'a>,
1447 LHS: &'a Value,
1448 RHS: &'a Value,
1449 Name: *const c_char,
1450 ) -> &'a Value;
1451 pub(crate) fn LLVMBuildNSWSub<'a>(
1452 B: &Builder<'a>,
1453 LHS: &'a Value,
1454 RHS: &'a Value,
1455 Name: *const c_char,
1456 ) -> &'a Value;
1457 pub(crate) fn LLVMBuildNUWSub<'a>(
1458 B: &Builder<'a>,
1459 LHS: &'a Value,
1460 RHS: &'a Value,
1461 Name: *const c_char,
1462 ) -> &'a Value;
1463 pub(crate) fn LLVMBuildNSWMul<'a>(
1464 B: &Builder<'a>,
1465 LHS: &'a Value,
1466 RHS: &'a Value,
1467 Name: *const c_char,
1468 ) -> &'a Value;
1469 pub(crate) fn LLVMBuildNUWMul<'a>(
1470 B: &Builder<'a>,
1471 LHS: &'a Value,
1472 RHS: &'a Value,
1473 Name: *const c_char,
1474 ) -> &'a Value;
1475 pub(crate) fn LLVMBuildAnd<'a>(
1476 B: &Builder<'a>,
1477 LHS: &'a Value,
1478 RHS: &'a Value,
1479 Name: *const c_char,
1480 ) -> &'a Value;
1481 pub(crate) fn LLVMBuildOr<'a>(
1482 B: &Builder<'a>,
1483 LHS: &'a Value,
1484 RHS: &'a Value,
1485 Name: *const c_char,
1486 ) -> &'a Value;
1487 pub(crate) fn LLVMBuildXor<'a>(
1488 B: &Builder<'a>,
1489 LHS: &'a Value,
1490 RHS: &'a Value,
1491 Name: *const c_char,
1492 ) -> &'a Value;
1493 pub(crate) fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1494 -> &'a Value;
1495 pub(crate) fn LLVMBuildFNeg<'a>(
1496 B: &Builder<'a>,
1497 V: &'a Value,
1498 Name: *const c_char,
1499 ) -> &'a Value;
1500 pub(crate) fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
1501 -> &'a Value;
1502
1503 pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool);
1505 pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool);
1506 pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool);
1507
1508 pub(crate) fn LLVMBuildAlloca<'a>(
1510 B: &Builder<'a>,
1511 Ty: &'a Type,
1512 Name: *const c_char,
1513 ) -> &'a Value;
1514 pub(crate) fn LLVMBuildLoad2<'a>(
1515 B: &Builder<'a>,
1516 Ty: &'a Type,
1517 PointerVal: &'a Value,
1518 Name: *const c_char,
1519 ) -> &'a Value;
1520
1521 pub(crate) fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1522
1523 pub(crate) fn LLVMBuildGEPWithNoWrapFlags<'a>(
1524 B: &Builder<'a>,
1525 Ty: &'a Type,
1526 Pointer: &'a Value,
1527 Indices: *const &'a Value,
1528 NumIndices: c_uint,
1529 Name: *const c_char,
1530 Flags: GEPNoWrapFlags,
1531 ) -> &'a Value;
1532
1533 pub(crate) fn LLVMBuildTrunc<'a>(
1535 B: &Builder<'a>,
1536 Val: &'a Value,
1537 DestTy: &'a Type,
1538 Name: *const c_char,
1539 ) -> &'a Value;
1540 pub(crate) fn LLVMBuildZExt<'a>(
1541 B: &Builder<'a>,
1542 Val: &'a Value,
1543 DestTy: &'a Type,
1544 Name: *const c_char,
1545 ) -> &'a Value;
1546 pub(crate) fn LLVMBuildSExt<'a>(
1547 B: &Builder<'a>,
1548 Val: &'a Value,
1549 DestTy: &'a Type,
1550 Name: *const c_char,
1551 ) -> &'a Value;
1552 pub(crate) fn LLVMBuildFPToUI<'a>(
1553 B: &Builder<'a>,
1554 Val: &'a Value,
1555 DestTy: &'a Type,
1556 Name: *const c_char,
1557 ) -> &'a Value;
1558 pub(crate) fn LLVMBuildFPToSI<'a>(
1559 B: &Builder<'a>,
1560 Val: &'a Value,
1561 DestTy: &'a Type,
1562 Name: *const c_char,
1563 ) -> &'a Value;
1564 pub(crate) fn LLVMBuildUIToFP<'a>(
1565 B: &Builder<'a>,
1566 Val: &'a Value,
1567 DestTy: &'a Type,
1568 Name: *const c_char,
1569 ) -> &'a Value;
1570 pub(crate) fn LLVMBuildSIToFP<'a>(
1571 B: &Builder<'a>,
1572 Val: &'a Value,
1573 DestTy: &'a Type,
1574 Name: *const c_char,
1575 ) -> &'a Value;
1576 pub(crate) fn LLVMBuildFPTrunc<'a>(
1577 B: &Builder<'a>,
1578 Val: &'a Value,
1579 DestTy: &'a Type,
1580 Name: *const c_char,
1581 ) -> &'a Value;
1582 pub(crate) fn LLVMBuildFPExt<'a>(
1583 B: &Builder<'a>,
1584 Val: &'a Value,
1585 DestTy: &'a Type,
1586 Name: *const c_char,
1587 ) -> &'a Value;
1588 pub(crate) fn LLVMBuildPtrToInt<'a>(
1589 B: &Builder<'a>,
1590 Val: &'a Value,
1591 DestTy: &'a Type,
1592 Name: *const c_char,
1593 ) -> &'a Value;
1594 pub(crate) fn LLVMBuildIntToPtr<'a>(
1595 B: &Builder<'a>,
1596 Val: &'a Value,
1597 DestTy: &'a Type,
1598 Name: *const c_char,
1599 ) -> &'a Value;
1600 pub(crate) fn LLVMBuildBitCast<'a>(
1601 B: &Builder<'a>,
1602 Val: &'a Value,
1603 DestTy: &'a Type,
1604 Name: *const c_char,
1605 ) -> &'a Value;
1606 pub(crate) fn LLVMBuildPointerCast<'a>(
1607 B: &Builder<'a>,
1608 Val: &'a Value,
1609 DestTy: &'a Type,
1610 Name: *const c_char,
1611 ) -> &'a Value;
1612 pub(crate) fn LLVMBuildIntCast2<'a>(
1613 B: &Builder<'a>,
1614 Val: &'a Value,
1615 DestTy: &'a Type,
1616 IsSigned: Bool,
1617 Name: *const c_char,
1618 ) -> &'a Value;
1619
1620 pub(crate) fn LLVMBuildICmp<'a>(
1622 B: &Builder<'a>,
1623 Op: c_uint,
1624 LHS: &'a Value,
1625 RHS: &'a Value,
1626 Name: *const c_char,
1627 ) -> &'a Value;
1628 pub(crate) fn LLVMBuildFCmp<'a>(
1629 B: &Builder<'a>,
1630 Op: c_uint,
1631 LHS: &'a Value,
1632 RHS: &'a Value,
1633 Name: *const c_char,
1634 ) -> &'a Value;
1635
1636 pub(crate) fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char)
1638 -> &'a Value;
1639 pub(crate) fn LLVMBuildSelect<'a>(
1640 B: &Builder<'a>,
1641 If: &'a Value,
1642 Then: &'a Value,
1643 Else: &'a Value,
1644 Name: *const c_char,
1645 ) -> &'a Value;
1646 pub(crate) fn LLVMBuildVAArg<'a>(
1647 B: &Builder<'a>,
1648 list: &'a Value,
1649 Ty: &'a Type,
1650 Name: *const c_char,
1651 ) -> &'a Value;
1652 pub(crate) fn LLVMBuildExtractElement<'a>(
1653 B: &Builder<'a>,
1654 VecVal: &'a Value,
1655 Index: &'a Value,
1656 Name: *const c_char,
1657 ) -> &'a Value;
1658 pub(crate) fn LLVMBuildInsertElement<'a>(
1659 B: &Builder<'a>,
1660 VecVal: &'a Value,
1661 EltVal: &'a Value,
1662 Index: &'a Value,
1663 Name: *const c_char,
1664 ) -> &'a Value;
1665 pub(crate) fn LLVMBuildShuffleVector<'a>(
1666 B: &Builder<'a>,
1667 V1: &'a Value,
1668 V2: &'a Value,
1669 Mask: &'a Value,
1670 Name: *const c_char,
1671 ) -> &'a Value;
1672 pub(crate) fn LLVMBuildExtractValue<'a>(
1673 B: &Builder<'a>,
1674 AggVal: &'a Value,
1675 Index: c_uint,
1676 Name: *const c_char,
1677 ) -> &'a Value;
1678 pub(crate) fn LLVMBuildInsertValue<'a>(
1679 B: &Builder<'a>,
1680 AggVal: &'a Value,
1681 EltVal: &'a Value,
1682 Index: c_uint,
1683 Name: *const c_char,
1684 ) -> &'a Value;
1685
1686 pub(crate) fn LLVMBuildAtomicCmpXchg<'a>(
1688 B: &Builder<'a>,
1689 LHS: &'a Value,
1690 CMP: &'a Value,
1691 RHS: &'a Value,
1692 Order: AtomicOrdering,
1693 FailureOrder: AtomicOrdering,
1694 SingleThreaded: Bool,
1695 ) -> &'a Value;
1696
1697 pub(crate) fn LLVMSetWeak(CmpXchgInst: &Value, IsWeak: Bool);
1698
1699 pub(crate) fn LLVMBuildAtomicRMW<'a>(
1700 B: &Builder<'a>,
1701 Op: AtomicRmwBinOp,
1702 LHS: &'a Value,
1703 RHS: &'a Value,
1704 Order: AtomicOrdering,
1705 SingleThreaded: Bool,
1706 ) -> &'a Value;
1707
1708 pub(crate) fn LLVMBuildFence<'a>(
1709 B: &Builder<'a>,
1710 Order: AtomicOrdering,
1711 SingleThreaded: Bool,
1712 Name: *const c_char,
1713 ) -> &'a Value;
1714
1715 pub(crate) fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1717
1718 pub(crate) fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
1720
1721 pub(crate) fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
1722
1723 pub(crate) fn LLVMGetHostCPUFeatures() -> *mut c_char;
1724
1725 pub(crate) fn LLVMDisposeMessage(message: *mut c_char);
1726
1727 pub(crate) fn LLVMIsMultithreaded() -> Bool;
1728
1729 pub(crate) fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1730
1731 pub(crate) fn LLVMStructSetBody<'a>(
1732 StructTy: &'a Type,
1733 ElementTypes: *const &'a Type,
1734 ElementCount: c_uint,
1735 Packed: Bool,
1736 );
1737
1738 pub(crate) safe fn LLVMMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1739
1740 pub(crate) safe fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
1741
1742 pub(crate) fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
1743
1744 pub(crate) fn LLVMGetOrInsertComdat(M: &Module, Name: *const c_char) -> &Comdat;
1745 pub(crate) fn LLVMSetComdat(V: &Value, C: &Comdat);
1746
1747 pub(crate) fn LLVMCreateOperandBundle(
1748 Tag: *const c_char,
1749 TagLen: size_t,
1750 Args: *const &'_ Value,
1751 NumArgs: c_uint,
1752 ) -> *mut OperandBundle<'_>;
1753 pub(crate) fn LLVMDisposeOperandBundle(Bundle: ptr::NonNull<OperandBundle<'_>>);
1754
1755 pub(crate) fn LLVMBuildCallWithOperandBundles<'a>(
1756 B: &Builder<'a>,
1757 Ty: &'a Type,
1758 Fn: &'a Value,
1759 Args: *const &'a Value,
1760 NumArgs: c_uint,
1761 Bundles: *const &OperandBundle<'a>,
1762 NumBundles: c_uint,
1763 Name: *const c_char,
1764 ) -> &'a Value;
1765 pub(crate) fn LLVMBuildInvokeWithOperandBundles<'a>(
1766 B: &Builder<'a>,
1767 Ty: &'a Type,
1768 Fn: &'a Value,
1769 Args: *const &'a Value,
1770 NumArgs: c_uint,
1771 Then: &'a BasicBlock,
1772 Catch: &'a BasicBlock,
1773 Bundles: *const &OperandBundle<'a>,
1774 NumBundles: c_uint,
1775 Name: *const c_char,
1776 ) -> &'a Value;
1777 pub(crate) fn LLVMBuildCallBr<'a>(
1778 B: &Builder<'a>,
1779 Ty: &'a Type,
1780 Fn: &'a Value,
1781 DefaultDest: &'a BasicBlock,
1782 IndirectDests: *const &'a BasicBlock,
1783 NumIndirectDests: c_uint,
1784 Args: *const &'a Value,
1785 NumArgs: c_uint,
1786 Bundles: *const &OperandBundle<'a>,
1787 NumBundles: c_uint,
1788 Name: *const c_char,
1789 ) -> &'a Value;
1790}
1791
1792unsafe extern "C" {
1799 pub(crate) fn LLVMCreateDIBuilder<'ll>(M: &'ll Module) -> *mut DIBuilder<'ll>;
1800 pub(crate) fn LLVMDisposeDIBuilder<'ll>(Builder: ptr::NonNull<DIBuilder<'ll>>);
1801
1802 pub(crate) fn LLVMDIBuilderFinalize<'ll>(Builder: &DIBuilder<'ll>);
1803
1804 pub(crate) fn LLVMDIBuilderCreateNameSpace<'ll>(
1805 Builder: &DIBuilder<'ll>,
1806 ParentScope: Option<&'ll Metadata>,
1807 Name: *const c_uchar, NameLen: size_t,
1809 ExportSymbols: llvm::Bool,
1810 ) -> &'ll Metadata;
1811
1812 pub(crate) fn LLVMDIBuilderCreateLexicalBlock<'ll>(
1813 Builder: &DIBuilder<'ll>,
1814 Scope: &'ll Metadata,
1815 File: &'ll Metadata,
1816 Line: c_uint,
1817 Column: c_uint,
1818 ) -> &'ll Metadata;
1819
1820 pub(crate) fn LLVMDIBuilderCreateLexicalBlockFile<'ll>(
1821 Builder: &DIBuilder<'ll>,
1822 Scope: &'ll Metadata,
1823 File: &'ll Metadata,
1824 Discriminator: c_uint, ) -> &'ll Metadata;
1826
1827 pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
1828 Ctx: &'ll Context,
1829 Line: c_uint,
1830 Column: c_uint,
1831 Scope: &'ll Metadata,
1832 InlinedAt: Option<&'ll Metadata>,
1833 ) -> &'ll Metadata;
1834}
1835
1836#[link(name = "llvm-wrapper", kind = "static")]
1837unsafe extern "C" {
1838 pub(crate) fn LLVMRustInstallErrorHandlers();
1839 pub(crate) fn LLVMRustDisableSystemDialogsOnCrash();
1840
1841 pub(crate) fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
1843
1844 pub(crate) fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
1846
1847 pub(crate) fn LLVMRustGlobalAddMetadata<'a>(
1849 Val: &'a Value,
1850 KindID: c_uint,
1851 Metadata: &'a Metadata,
1852 );
1853 pub(crate) fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
1854
1855 pub(crate) fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool;
1857 pub(crate) fn LLVMRustConstInt128Get(
1858 ConstantVal: &ConstantInt,
1859 SExt: bool,
1860 high: &mut u64,
1861 low: &mut u64,
1862 ) -> bool;
1863
1864 pub(crate) fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
1866
1867 pub(crate) fn LLVMRustGetOrInsertGlobal<'a>(
1869 M: &'a Module,
1870 Name: *const c_char,
1871 NameLen: size_t,
1872 T: &'a Type,
1873 ) -> &'a Value;
1874 pub(crate) fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
1875 pub(crate) fn LLVMRustGetNamedValue(
1876 M: &Module,
1877 Name: *const c_char,
1878 NameLen: size_t,
1879 ) -> Option<&Value>;
1880
1881 pub(crate) fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
1883 pub(crate) fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
1884 pub(crate) fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
1885 pub(crate) fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
1886 pub(crate) fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1887 pub(crate) fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1888 pub(crate) fn LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
1889 pub(crate) fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
1890 pub(crate) fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute;
1891 pub(crate) fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute;
1892 pub(crate) fn LLVMRustCreateMemoryEffectsAttr(
1893 C: &Context,
1894 effects: MemoryEffects,
1895 ) -> &Attribute;
1896 pub(crate) fn LLVMRustCreateRangeAttribute(
1897 C: &Context,
1898 num_bits: c_uint,
1899 lower_words: *const u64,
1900 upper_words: *const u64,
1901 ) -> &Attribute;
1902
1903 pub(crate) fn LLVMRustGetOrInsertFunction<'a>(
1905 M: &'a Module,
1906 Name: *const c_char,
1907 NameLen: size_t,
1908 FunctionTy: &'a Type,
1909 ) -> &'a Value;
1910 pub(crate) fn LLVMRustAddFunctionAttributes<'a>(
1911 Fn: &'a Value,
1912 index: c_uint,
1913 Attrs: *const &'a Attribute,
1914 AttrsLen: size_t,
1915 );
1916
1917 pub(crate) fn LLVMRustAddCallSiteAttributes<'a>(
1919 Instr: &'a Value,
1920 index: c_uint,
1921 Attrs: *const &'a Attribute,
1922 AttrsLen: size_t,
1923 );
1924
1925 pub(crate) fn LLVMRustSetFastMath(Instr: &Value);
1926 pub(crate) fn LLVMRustSetAlgebraicMath(Instr: &Value);
1927 pub(crate) fn LLVMRustSetAllowReassoc(Instr: &Value);
1928
1929 pub(crate) fn LLVMRustBuildMemCpy<'a>(
1931 B: &Builder<'a>,
1932 Dst: &'a Value,
1933 DstAlign: c_uint,
1934 Src: &'a Value,
1935 SrcAlign: c_uint,
1936 Size: &'a Value,
1937 IsVolatile: bool,
1938 ) -> &'a Value;
1939 pub(crate) fn LLVMRustBuildMemMove<'a>(
1940 B: &Builder<'a>,
1941 Dst: &'a Value,
1942 DstAlign: c_uint,
1943 Src: &'a Value,
1944 SrcAlign: c_uint,
1945 Size: &'a Value,
1946 IsVolatile: bool,
1947 ) -> &'a Value;
1948 pub(crate) fn LLVMRustBuildMemSet<'a>(
1949 B: &Builder<'a>,
1950 Dst: &'a Value,
1951 DstAlign: c_uint,
1952 Val: &'a Value,
1953 Size: &'a Value,
1954 IsVolatile: bool,
1955 ) -> &'a Value;
1956
1957 pub(crate) fn LLVMRustBuildVectorReduceFAdd<'a>(
1958 B: &Builder<'a>,
1959 Acc: &'a Value,
1960 Src: &'a Value,
1961 ) -> &'a Value;
1962 pub(crate) fn LLVMRustBuildVectorReduceFMul<'a>(
1963 B: &Builder<'a>,
1964 Acc: &'a Value,
1965 Src: &'a Value,
1966 ) -> &'a Value;
1967 pub(crate) fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1968 pub(crate) fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1969 pub(crate) fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1970 pub(crate) fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1971 pub(crate) fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1972 pub(crate) fn LLVMRustBuildVectorReduceMin<'a>(
1973 B: &Builder<'a>,
1974 Src: &'a Value,
1975 IsSigned: bool,
1976 ) -> &'a Value;
1977 pub(crate) fn LLVMRustBuildVectorReduceMax<'a>(
1978 B: &Builder<'a>,
1979 Src: &'a Value,
1980 IsSigned: bool,
1981 ) -> &'a Value;
1982 pub(crate) fn LLVMRustBuildVectorReduceFMin<'a>(
1983 B: &Builder<'a>,
1984 Src: &'a Value,
1985 IsNaN: bool,
1986 ) -> &'a Value;
1987 pub(crate) fn LLVMRustBuildVectorReduceFMax<'a>(
1988 B: &Builder<'a>,
1989 Src: &'a Value,
1990 IsNaN: bool,
1991 ) -> &'a Value;
1992
1993 pub(crate) fn LLVMRustBuildMinNum<'a>(
1994 B: &Builder<'a>,
1995 LHS: &'a Value,
1996 RHS: &'a Value,
1997 ) -> &'a Value;
1998 pub(crate) fn LLVMRustBuildMaxNum<'a>(
1999 B: &Builder<'a>,
2000 LHS: &'a Value,
2001 RHS: &'a Value,
2002 ) -> &'a Value;
2003
2004 pub(crate) fn LLVMRustBuildAtomicLoad<'a>(
2006 B: &Builder<'a>,
2007 ElementType: &'a Type,
2008 PointerVal: &'a Value,
2009 Name: *const c_char,
2010 Order: AtomicOrdering,
2011 ) -> &'a Value;
2012
2013 pub(crate) fn LLVMRustBuildAtomicStore<'a>(
2014 B: &Builder<'a>,
2015 Val: &'a Value,
2016 Ptr: &'a Value,
2017 Order: AtomicOrdering,
2018 ) -> &'a Value;
2019
2020 pub(crate) fn LLVMRustTimeTraceProfilerInitialize();
2021
2022 pub(crate) fn LLVMRustTimeTraceProfilerFinishThread();
2023
2024 pub(crate) fn LLVMRustTimeTraceProfilerFinish(FileName: *const c_char);
2025
2026 pub(crate) fn LLVMRustGetLastError() -> *const c_char;
2028
2029 pub(crate) fn LLVMRustPrintPassTimings(OutStr: &RustString);
2031
2032 pub(crate) fn LLVMRustPrintStatistics(OutStr: &RustString);
2034
2035 pub(crate) fn LLVMRustInlineAsmVerify(
2036 Ty: &Type,
2037 Constraints: *const c_uchar, ConstraintsLen: size_t,
2039 ) -> bool;
2040
2041 pub(crate) fn LLVMRustCoverageWriteFilenamesToBuffer(
2042 Filenames: *const *const c_char,
2043 FilenamesLen: size_t,
2044 Lengths: *const size_t,
2045 LengthsLen: size_t,
2046 BufferOut: &RustString,
2047 );
2048
2049 pub(crate) fn LLVMRustCoverageWriteFunctionMappingsToBuffer(
2050 VirtualFileMappingIDs: *const c_uint,
2051 NumVirtualFileMappingIDs: size_t,
2052 Expressions: *const crate::coverageinfo::ffi::CounterExpression,
2053 NumExpressions: size_t,
2054 CodeRegions: *const crate::coverageinfo::ffi::CodeRegion,
2055 NumCodeRegions: size_t,
2056 ExpansionRegions: *const crate::coverageinfo::ffi::ExpansionRegion,
2057 NumExpansionRegions: size_t,
2058 BranchRegions: *const crate::coverageinfo::ffi::BranchRegion,
2059 NumBranchRegions: size_t,
2060 BufferOut: &RustString,
2061 );
2062
2063 pub(crate) fn LLVMRustCoverageCreatePGOFuncNameVar(
2064 F: &Value,
2065 FuncName: *const c_char,
2066 FuncNameLen: size_t,
2067 ) -> &Value;
2068 pub(crate) fn LLVMRustCoverageHashBytes(Bytes: *const c_char, NumBytes: size_t) -> u64;
2069
2070 pub(crate) fn LLVMRustCoverageWriteCovmapSectionNameToString(M: &Module, OutStr: &RustString);
2071
2072 pub(crate) fn LLVMRustCoverageWriteCovfunSectionNameToString(M: &Module, OutStr: &RustString);
2073
2074 pub(crate) fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
2075
2076 pub(crate) fn LLVMRustCoverageMappingVersion() -> u32;
2077 pub(crate) fn LLVMRustDebugMetadataVersion() -> u32;
2078 pub(crate) fn LLVMRustVersionMajor() -> u32;
2079 pub(crate) fn LLVMRustVersionMinor() -> u32;
2080 pub(crate) fn LLVMRustVersionPatch() -> u32;
2081
2082 pub(crate) fn LLVMRustAddModuleFlagU32(
2087 M: &Module,
2088 MergeBehavior: ModuleFlagMergeBehavior,
2089 Name: *const c_char,
2090 NameLen: size_t,
2091 Value: u32,
2092 );
2093
2094 pub(crate) fn LLVMRustAddModuleFlagString(
2095 M: &Module,
2096 MergeBehavior: ModuleFlagMergeBehavior,
2097 Name: *const c_char,
2098 NameLen: size_t,
2099 Value: *const c_char,
2100 ValueLen: size_t,
2101 );
2102
2103 pub(crate) fn LLVMRustDIBuilderCreateCompileUnit<'a>(
2104 Builder: &DIBuilder<'a>,
2105 Lang: c_uint,
2106 File: &'a DIFile,
2107 Producer: *const c_char,
2108 ProducerLen: size_t,
2109 isOptimized: bool,
2110 Flags: *const c_char,
2111 RuntimeVer: c_uint,
2112 SplitName: *const c_char,
2113 SplitNameLen: size_t,
2114 kind: DebugEmissionKind,
2115 DWOId: u64,
2116 SplitDebugInlining: bool,
2117 DebugNameTableKind: DebugNameTableKind,
2118 ) -> &'a DIDescriptor;
2119
2120 pub(crate) fn LLVMRustDIBuilderCreateFile<'a>(
2121 Builder: &DIBuilder<'a>,
2122 Filename: *const c_char,
2123 FilenameLen: size_t,
2124 Directory: *const c_char,
2125 DirectoryLen: size_t,
2126 CSKind: ChecksumKind,
2127 Checksum: *const c_char,
2128 ChecksumLen: size_t,
2129 Source: *const c_char,
2130 SourceLen: size_t,
2131 ) -> &'a DIFile;
2132
2133 pub(crate) fn LLVMRustDIBuilderCreateSubroutineType<'a>(
2134 Builder: &DIBuilder<'a>,
2135 ParameterTypes: &'a DIArray,
2136 ) -> &'a DICompositeType;
2137
2138 pub(crate) fn LLVMRustDIBuilderCreateFunction<'a>(
2139 Builder: &DIBuilder<'a>,
2140 Scope: &'a DIDescriptor,
2141 Name: *const c_char,
2142 NameLen: size_t,
2143 LinkageName: *const c_char,
2144 LinkageNameLen: size_t,
2145 File: &'a DIFile,
2146 LineNo: c_uint,
2147 Ty: &'a DIType,
2148 ScopeLine: c_uint,
2149 Flags: DIFlags,
2150 SPFlags: DISPFlags,
2151 MaybeFn: Option<&'a Value>,
2152 TParam: &'a DIArray,
2153 Decl: Option<&'a DIDescriptor>,
2154 ) -> &'a DISubprogram;
2155
2156 pub(crate) fn LLVMRustDIBuilderCreateMethod<'a>(
2157 Builder: &DIBuilder<'a>,
2158 Scope: &'a DIDescriptor,
2159 Name: *const c_char,
2160 NameLen: size_t,
2161 LinkageName: *const c_char,
2162 LinkageNameLen: size_t,
2163 File: &'a DIFile,
2164 LineNo: c_uint,
2165 Ty: &'a DIType,
2166 Flags: DIFlags,
2167 SPFlags: DISPFlags,
2168 TParam: &'a DIArray,
2169 ) -> &'a DISubprogram;
2170
2171 pub(crate) fn LLVMRustDIBuilderCreateBasicType<'a>(
2172 Builder: &DIBuilder<'a>,
2173 Name: *const c_char,
2174 NameLen: size_t,
2175 SizeInBits: u64,
2176 Encoding: c_uint,
2177 ) -> &'a DIBasicType;
2178
2179 pub(crate) fn LLVMRustDIBuilderCreateTypedef<'a>(
2180 Builder: &DIBuilder<'a>,
2181 Type: &'a DIBasicType,
2182 Name: *const c_char,
2183 NameLen: size_t,
2184 File: &'a DIFile,
2185 LineNo: c_uint,
2186 Scope: Option<&'a DIScope>,
2187 ) -> &'a DIDerivedType;
2188
2189 pub(crate) fn LLVMRustDIBuilderCreatePointerType<'a>(
2190 Builder: &DIBuilder<'a>,
2191 PointeeTy: &'a DIType,
2192 SizeInBits: u64,
2193 AlignInBits: u32,
2194 AddressSpace: c_uint,
2195 Name: *const c_char,
2196 NameLen: size_t,
2197 ) -> &'a DIDerivedType;
2198
2199 pub(crate) fn LLVMRustDIBuilderCreateStructType<'a>(
2200 Builder: &DIBuilder<'a>,
2201 Scope: Option<&'a DIDescriptor>,
2202 Name: *const c_char,
2203 NameLen: size_t,
2204 File: &'a DIFile,
2205 LineNumber: c_uint,
2206 SizeInBits: u64,
2207 AlignInBits: u32,
2208 Flags: DIFlags,
2209 DerivedFrom: Option<&'a DIType>,
2210 Elements: &'a DIArray,
2211 RunTimeLang: c_uint,
2212 VTableHolder: Option<&'a DIType>,
2213 UniqueId: *const c_char,
2214 UniqueIdLen: size_t,
2215 ) -> &'a DICompositeType;
2216
2217 pub(crate) fn LLVMRustDIBuilderCreateMemberType<'a>(
2218 Builder: &DIBuilder<'a>,
2219 Scope: &'a DIDescriptor,
2220 Name: *const c_char,
2221 NameLen: size_t,
2222 File: &'a DIFile,
2223 LineNo: c_uint,
2224 SizeInBits: u64,
2225 AlignInBits: u32,
2226 OffsetInBits: u64,
2227 Flags: DIFlags,
2228 Ty: &'a DIType,
2229 ) -> &'a DIDerivedType;
2230
2231 pub(crate) fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
2232 Builder: &DIBuilder<'a>,
2233 Scope: &'a DIScope,
2234 Name: *const c_char,
2235 NameLen: size_t,
2236 File: &'a DIFile,
2237 LineNumber: c_uint,
2238 SizeInBits: u64,
2239 AlignInBits: u32,
2240 OffsetInBits: u64,
2241 Discriminant: Option<&'a Value>,
2242 Flags: DIFlags,
2243 Ty: &'a DIType,
2244 ) -> &'a DIType;
2245
2246 pub(crate) fn LLVMRustDIBuilderCreateStaticMemberType<'a>(
2247 Builder: &DIBuilder<'a>,
2248 Scope: &'a DIDescriptor,
2249 Name: *const c_char,
2250 NameLen: size_t,
2251 File: &'a DIFile,
2252 LineNo: c_uint,
2253 Ty: &'a DIType,
2254 Flags: DIFlags,
2255 val: Option<&'a Value>,
2256 AlignInBits: u32,
2257 ) -> &'a DIDerivedType;
2258
2259 pub(crate) fn LLVMRustDIBuilderCreateQualifiedType<'a>(
2260 Builder: &DIBuilder<'a>,
2261 Tag: c_uint,
2262 Type: &'a DIType,
2263 ) -> &'a DIDerivedType;
2264
2265 pub(crate) fn LLVMRustDIBuilderCreateStaticVariable<'a>(
2266 Builder: &DIBuilder<'a>,
2267 Context: Option<&'a DIScope>,
2268 Name: *const c_char,
2269 NameLen: size_t,
2270 LinkageName: *const c_char,
2271 LinkageNameLen: size_t,
2272 File: &'a DIFile,
2273 LineNo: c_uint,
2274 Ty: &'a DIType,
2275 isLocalToUnit: bool,
2276 Val: &'a Value,
2277 Decl: Option<&'a DIDescriptor>,
2278 AlignInBits: u32,
2279 ) -> &'a DIGlobalVariableExpression;
2280
2281 pub(crate) fn LLVMRustDIBuilderCreateVariable<'a>(
2282 Builder: &DIBuilder<'a>,
2283 Tag: c_uint,
2284 Scope: &'a DIDescriptor,
2285 Name: *const c_char,
2286 NameLen: size_t,
2287 File: &'a DIFile,
2288 LineNo: c_uint,
2289 Ty: &'a DIType,
2290 AlwaysPreserve: bool,
2291 Flags: DIFlags,
2292 ArgNo: c_uint,
2293 AlignInBits: u32,
2294 ) -> &'a DIVariable;
2295
2296 pub(crate) fn LLVMRustDIBuilderCreateArrayType<'a>(
2297 Builder: &DIBuilder<'a>,
2298 Size: u64,
2299 AlignInBits: u32,
2300 Ty: &'a DIType,
2301 Subscripts: &'a DIArray,
2302 ) -> &'a DIType;
2303
2304 pub(crate) fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
2305 Builder: &DIBuilder<'a>,
2306 Lo: i64,
2307 Count: i64,
2308 ) -> &'a DISubrange;
2309
2310 pub(crate) fn LLVMRustDIBuilderGetOrCreateArray<'a>(
2311 Builder: &DIBuilder<'a>,
2312 Ptr: *const Option<&'a DIDescriptor>,
2313 Count: c_uint,
2314 ) -> &'a DIArray;
2315
2316 pub(crate) fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
2317 Builder: &DIBuilder<'a>,
2318 Val: &'a Value,
2319 VarInfo: &'a DIVariable,
2320 AddrOps: *const u64,
2321 AddrOpsCount: c_uint,
2322 DL: &'a DILocation,
2323 InsertAtEnd: &'a BasicBlock,
2324 );
2325
2326 pub(crate) fn LLVMRustDIBuilderCreateEnumerator<'a>(
2327 Builder: &DIBuilder<'a>,
2328 Name: *const c_char,
2329 NameLen: size_t,
2330 Value: *const u64,
2331 SizeInBits: c_uint,
2332 IsUnsigned: bool,
2333 ) -> &'a DIEnumerator;
2334
2335 pub(crate) fn LLVMRustDIBuilderCreateEnumerationType<'a>(
2336 Builder: &DIBuilder<'a>,
2337 Scope: &'a DIScope,
2338 Name: *const c_char,
2339 NameLen: size_t,
2340 File: &'a DIFile,
2341 LineNumber: c_uint,
2342 SizeInBits: u64,
2343 AlignInBits: u32,
2344 Elements: &'a DIArray,
2345 ClassType: &'a DIType,
2346 IsScoped: bool,
2347 ) -> &'a DIType;
2348
2349 pub(crate) fn LLVMRustDIBuilderCreateUnionType<'a>(
2350 Builder: &DIBuilder<'a>,
2351 Scope: Option<&'a DIScope>,
2352 Name: *const c_char,
2353 NameLen: size_t,
2354 File: &'a DIFile,
2355 LineNumber: c_uint,
2356 SizeInBits: u64,
2357 AlignInBits: u32,
2358 Flags: DIFlags,
2359 Elements: Option<&'a DIArray>,
2360 RunTimeLang: c_uint,
2361 UniqueId: *const c_char,
2362 UniqueIdLen: size_t,
2363 ) -> &'a DIType;
2364
2365 pub(crate) fn LLVMRustDIBuilderCreateVariantPart<'a>(
2366 Builder: &DIBuilder<'a>,
2367 Scope: &'a DIScope,
2368 Name: *const c_char,
2369 NameLen: size_t,
2370 File: &'a DIFile,
2371 LineNo: c_uint,
2372 SizeInBits: u64,
2373 AlignInBits: u32,
2374 Flags: DIFlags,
2375 Discriminator: Option<&'a DIDerivedType>,
2376 Elements: &'a DIArray,
2377 UniqueId: *const c_char,
2378 UniqueIdLen: size_t,
2379 ) -> &'a DIDerivedType;
2380
2381 pub(crate) fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
2382 Builder: &DIBuilder<'a>,
2383 Scope: Option<&'a DIScope>,
2384 Name: *const c_char,
2385 NameLen: size_t,
2386 Ty: &'a DIType,
2387 ) -> &'a DITemplateTypeParameter;
2388
2389 pub(crate) fn LLVMRustDICompositeTypeReplaceArrays<'a>(
2390 Builder: &DIBuilder<'a>,
2391 CompositeType: &'a DIType,
2392 Elements: Option<&'a DIArray>,
2393 Params: Option<&'a DIArray>,
2394 );
2395
2396 pub(crate) fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
2397 Location: &'a DILocation,
2398 BD: c_uint,
2399 ) -> Option<&'a DILocation>;
2400
2401 pub(crate) fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2402 pub(crate) fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2403
2404 pub(crate) fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2405
2406 pub(crate) fn LLVMRustPrintTargetCPUs(TM: &TargetMachine, OutStr: &RustString);
2407 pub(crate) fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
2408 pub(crate) fn LLVMRustGetTargetFeature(
2409 T: &TargetMachine,
2410 Index: size_t,
2411 Feature: &mut *const c_char,
2412 Desc: &mut *const c_char,
2413 );
2414
2415 pub(crate) fn LLVMRustGetHostCPUName(LenOut: &mut size_t) -> *const u8;
2416
2417 pub(crate) fn LLVMRustCreateTargetMachine(
2420 Triple: *const c_char,
2421 CPU: *const c_char,
2422 Features: *const c_char,
2423 Abi: *const c_char,
2424 Model: CodeModel,
2425 Reloc: RelocModel,
2426 Level: CodeGenOptLevel,
2427 FloatABIType: FloatAbi,
2428 FunctionSections: bool,
2429 DataSections: bool,
2430 UniqueSectionNames: bool,
2431 TrapUnreachable: bool,
2432 Singlethread: bool,
2433 VerboseAsm: bool,
2434 EmitStackSizeSection: bool,
2435 RelaxELFRelocations: bool,
2436 UseInitArray: bool,
2437 SplitDwarfFile: *const c_char,
2438 OutputObjFile: *const c_char,
2439 DebugInfoCompression: *const c_char,
2440 UseEmulatedTls: bool,
2441 ArgsCstrBuff: *const c_char,
2442 ArgsCstrBuffLen: usize,
2443 UseWasmEH: bool,
2444 ) -> *mut TargetMachine;
2445
2446 pub(crate) fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
2447 pub(crate) fn LLVMRustAddLibraryInfo<'a>(
2448 PM: &PassManager<'a>,
2449 M: &'a Module,
2450 DisableSimplifyLibCalls: bool,
2451 );
2452 pub(crate) fn LLVMRustWriteOutputFile<'a>(
2453 T: &'a TargetMachine,
2454 PM: *mut PassManager<'a>,
2455 M: &'a Module,
2456 Output: *const c_char,
2457 DwoOutput: *const c_char,
2458 FileType: FileType,
2459 VerifyIR: bool,
2460 ) -> LLVMRustResult;
2461 pub(crate) fn LLVMRustOptimize<'a>(
2462 M: &'a Module,
2463 TM: &'a TargetMachine,
2464 OptLevel: PassBuilderOptLevel,
2465 OptStage: OptStage,
2466 IsLinkerPluginLTO: bool,
2467 NoPrepopulatePasses: bool,
2468 VerifyIR: bool,
2469 LintIR: bool,
2470 ThinLTOBuffer: Option<&mut *mut ThinLTOBuffer>,
2471 EmitThinLTO: bool,
2472 EmitThinLTOSummary: bool,
2473 MergeFunctions: bool,
2474 UnrollLoops: bool,
2475 SLPVectorize: bool,
2476 LoopVectorize: bool,
2477 DisableSimplifyLibCalls: bool,
2478 EmitLifetimeMarkers: bool,
2479 RunEnzyme: bool,
2480 PrintBeforeEnzyme: bool,
2481 PrintAfterEnzyme: bool,
2482 PrintPasses: bool,
2483 SanitizerOptions: Option<&SanitizerOptions>,
2484 PGOGenPath: *const c_char,
2485 PGOUsePath: *const c_char,
2486 InstrumentCoverage: bool,
2487 InstrProfileOutput: *const c_char,
2488 PGOSampleUsePath: *const c_char,
2489 DebugInfoForProfiling: bool,
2490 llvm_selfprofiler: *mut c_void,
2491 begin_callback: SelfProfileBeforePassCallback,
2492 end_callback: SelfProfileAfterPassCallback,
2493 ExtraPasses: *const c_char,
2494 ExtraPassesLen: size_t,
2495 LLVMPlugins: *const c_char,
2496 LLVMPluginsLen: size_t,
2497 ) -> LLVMRustResult;
2498 pub(crate) fn LLVMRustPrintModule(
2499 M: &Module,
2500 Output: *const c_char,
2501 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2502 ) -> LLVMRustResult;
2503 pub(crate) fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2504 pub(crate) fn LLVMRustPrintPasses();
2505 pub(crate) fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2506 pub(crate) fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2507
2508 pub(crate) fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2509 pub(crate) fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
2510 pub(crate) fn LLVMRustArchiveIteratorNext<'a>(
2511 AIR: &ArchiveIterator<'a>,
2512 ) -> Option<&'a mut ArchiveChild<'a>>;
2513 pub(crate) fn LLVMRustArchiveChildName(
2514 ACR: &ArchiveChild<'_>,
2515 size: &mut size_t,
2516 ) -> *const c_char;
2517 pub(crate) fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
2518 pub(crate) fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
2519 pub(crate) fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2520
2521 pub(crate) fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2522
2523 pub(crate) fn LLVMRustUnpackOptimizationDiagnostic<'a>(
2524 DI: &'a DiagnosticInfo,
2525 pass_name_out: &RustString,
2526 function_out: &mut Option<&'a Value>,
2527 loc_line_out: &mut c_uint,
2528 loc_column_out: &mut c_uint,
2529 loc_filename_out: &RustString,
2530 message_out: &RustString,
2531 );
2532
2533 pub(crate) fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
2534 DI: &'a DiagnosticInfo,
2535 level_out: &mut DiagnosticLevel,
2536 cookie_out: &mut u64,
2537 message_out: &mut Option<&'a Twine>,
2538 );
2539
2540 pub(crate) fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2541 pub(crate) fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2542
2543 pub(crate) fn LLVMRustGetSMDiagnostic<'a>(
2544 DI: &'a DiagnosticInfo,
2545 cookie_out: &mut u64,
2546 ) -> &'a SMDiagnostic;
2547
2548 pub(crate) fn LLVMRustUnpackSMDiagnostic(
2549 d: &SMDiagnostic,
2550 message_out: &RustString,
2551 buffer_out: &RustString,
2552 level_out: &mut DiagnosticLevel,
2553 loc_out: &mut c_uint,
2554 ranges_out: *mut c_uint,
2555 num_ranges: &mut usize,
2556 ) -> bool;
2557
2558 pub(crate) fn LLVMRustWriteArchive(
2559 Dst: *const c_char,
2560 NumMembers: size_t,
2561 Members: *const &RustArchiveMember<'_>,
2562 WriteSymbtab: bool,
2563 Kind: ArchiveKind,
2564 isEC: bool,
2565 ) -> LLVMRustResult;
2566 pub(crate) fn LLVMRustArchiveMemberNew<'a>(
2567 Filename: *const c_char,
2568 Name: *const c_char,
2569 Child: Option<&ArchiveChild<'a>>,
2570 ) -> &'a mut RustArchiveMember<'a>;
2571 pub(crate) fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
2572
2573 pub(crate) fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
2574
2575 pub(crate) fn LLVMRustPositionBuilderPastAllocas<'a>(B: &Builder<'a>, Fn: &'a Value);
2576 pub(crate) fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
2577
2578 pub(crate) fn LLVMRustSetModulePICLevel(M: &Module);
2579 pub(crate) fn LLVMRustSetModulePIELevel(M: &Module);
2580 pub(crate) fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
2581 pub(crate) fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2582 pub(crate) fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2583 pub(crate) fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2584 pub(crate) fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2585 pub(crate) fn LLVMRustModuleCost(M: &Module) -> u64;
2586 pub(crate) fn LLVMRustModuleInstructionStats(M: &Module, Str: &RustString);
2587
2588 pub(crate) fn LLVMRustThinLTOBufferCreate(
2589 M: &Module,
2590 is_thin: bool,
2591 emit_summary: bool,
2592 ) -> &'static mut ThinLTOBuffer;
2593 pub(crate) fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2594 pub(crate) fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2595 pub(crate) fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2596 pub(crate) fn LLVMRustThinLTOBufferThinLinkDataPtr(M: &ThinLTOBuffer) -> *const c_char;
2597 pub(crate) fn LLVMRustThinLTOBufferThinLinkDataLen(M: &ThinLTOBuffer) -> size_t;
2598 pub(crate) fn LLVMRustCreateThinLTOData(
2599 Modules: *const ThinLTOModule,
2600 NumModules: size_t,
2601 PreservedSymbols: *const *const c_char,
2602 PreservedSymbolsLen: size_t,
2603 ) -> Option<&'static mut ThinLTOData>;
2604 pub(crate) fn LLVMRustPrepareThinLTORename(
2605 Data: &ThinLTOData,
2606 Module: &Module,
2607 Target: &TargetMachine,
2608 );
2609 pub(crate) fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2610 pub(crate) fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2611 pub(crate) fn LLVMRustPrepareThinLTOImport(
2612 Data: &ThinLTOData,
2613 Module: &Module,
2614 Target: &TargetMachine,
2615 ) -> bool;
2616 pub(crate) fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2617 pub(crate) fn LLVMRustParseBitcodeForLTO(
2618 Context: &Context,
2619 Data: *const u8,
2620 len: usize,
2621 Identifier: *const c_char,
2622 ) -> Option<&Module>;
2623
2624 pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
2625 pub(crate) fn LLVMRustLinkerAdd(
2626 linker: &Linker<'_>,
2627 bytecode: *const c_char,
2628 bytecode_len: usize,
2629 ) -> bool;
2630 pub(crate) fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
2631 pub(crate) fn LLVMRustComputeLTOCacheKey(
2632 key_out: &RustString,
2633 mod_id: *const c_char,
2634 data: &ThinLTOData,
2635 );
2636
2637 pub(crate) fn LLVMRustContextGetDiagnosticHandler(
2638 Context: &Context,
2639 ) -> Option<&DiagnosticHandler>;
2640 pub(crate) fn LLVMRustContextSetDiagnosticHandler(
2641 context: &Context,
2642 diagnostic_handler: Option<&DiagnosticHandler>,
2643 );
2644 pub(crate) fn LLVMRustContextConfigureDiagnosticHandler(
2645 context: &Context,
2646 diagnostic_handler_callback: DiagnosticHandlerTy,
2647 diagnostic_handler_context: *mut c_void,
2648 remark_all_passes: bool,
2649 remark_passes: *const *const c_char,
2650 remark_passes_len: usize,
2651 remark_file: *const c_char,
2652 pgo_available: bool,
2653 );
2654
2655 pub(crate) fn LLVMRustGetMangledName(V: &Value, out: &RustString);
2656
2657 pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;
2658
2659 pub(crate) fn LLVMRustLLVMHasZlibCompressionForDebugSymbols() -> bool;
2660
2661 pub(crate) fn LLVMRustLLVMHasZstdCompressionForDebugSymbols() -> bool;
2662
2663 pub(crate) fn LLVMRustGetSymbols(
2664 buf_ptr: *const u8,
2665 buf_len: usize,
2666 state: *mut c_void,
2667 callback: GetSymbolsCallback,
2668 error_callback: GetSymbolsErrorCallback,
2669 ) -> *mut c_void;
2670
2671 pub(crate) fn LLVMRustIs64BitSymbolicFile(buf_ptr: *const u8, buf_len: usize) -> bool;
2672
2673 pub(crate) fn LLVMRustIsECObject(buf_ptr: *const u8, buf_len: usize) -> bool;
2674
2675 pub(crate) fn LLVMRustSetNoSanitizeAddress(Global: &Value);
2676 pub(crate) fn LLVMRustSetNoSanitizeHWAddress(Global: &Value);
2677}