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