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