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