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