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