]> git.proxmox.com Git - rustc.git/blob - compiler/rustc_codegen_llvm/src/llvm/ffi.rs
New upstream version 1.50.0+dfsg1
[rustc.git] / compiler / rustc_codegen_llvm / src / llvm / ffi.rs
1 #![allow(non_camel_case_types)]
2 #![allow(non_upper_case_globals)]
3
4 use rustc_codegen_ssa::coverageinfo::map as coverage_map;
5
6 use super::debuginfo::{
7 DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
8 DIFile, DIFlags, DIGlobalVariableExpression, DILexicalBlock, DILocation, DINameSpace,
9 DISPFlags, DIScope, DISubprogram, DISubrange, DITemplateTypeParameter, DIType, DIVariable,
10 DebugEmissionKind,
11 };
12
13 use libc::{c_char, c_int, c_uint, size_t};
14 use libc::{c_ulonglong, c_void};
15
16 use std::marker::PhantomData;
17
18 use super::RustString;
19
20 pub type Bool = c_uint;
21
22 pub const True: Bool = 1 as Bool;
23 pub const False: Bool = 0 as Bool;
24
25 #[derive(Copy, Clone, PartialEq)]
26 #[repr(C)]
27 #[allow(dead_code)] // Variants constructed by C++.
28 pub enum LLVMRustResult {
29 Success,
30 Failure,
31 }
32 // Consts for the LLVM CallConv type, pre-cast to usize.
33
34 /// LLVM CallingConv::ID. Should we wrap this?
35 #[derive(Copy, Clone, PartialEq, Debug)]
36 #[repr(C)]
37 pub enum CallConv {
38 CCallConv = 0,
39 FastCallConv = 8,
40 ColdCallConv = 9,
41 X86StdcallCallConv = 64,
42 X86FastcallCallConv = 65,
43 ArmAapcsCallConv = 67,
44 Msp430Intr = 69,
45 X86_ThisCall = 70,
46 PtxKernel = 71,
47 X86_64_SysV = 78,
48 X86_64_Win64 = 79,
49 X86_VectorCall = 80,
50 X86_Intr = 83,
51 AvrNonBlockingInterrupt = 84,
52 AvrInterrupt = 85,
53 AmdGpuKernel = 91,
54 }
55
56 /// LLVMRustLinkage
57 #[derive(PartialEq)]
58 #[repr(C)]
59 pub enum Linkage {
60 ExternalLinkage = 0,
61 AvailableExternallyLinkage = 1,
62 LinkOnceAnyLinkage = 2,
63 LinkOnceODRLinkage = 3,
64 WeakAnyLinkage = 4,
65 WeakODRLinkage = 5,
66 AppendingLinkage = 6,
67 InternalLinkage = 7,
68 PrivateLinkage = 8,
69 ExternalWeakLinkage = 9,
70 CommonLinkage = 10,
71 }
72
73 // LLVMRustVisibility
74 #[repr(C)]
75 pub enum Visibility {
76 Default = 0,
77 Hidden = 1,
78 Protected = 2,
79 }
80
81 /// LLVMUnnamedAddr
82 #[repr(C)]
83 pub enum UnnamedAddr {
84 No,
85 Local,
86 Global,
87 }
88
89 /// LLVMDLLStorageClass
90 #[derive(Copy, Clone)]
91 #[repr(C)]
92 pub enum DLLStorageClass {
93 #[allow(dead_code)]
94 Default = 0,
95 DllImport = 1, // Function to be imported from DLL.
96 #[allow(dead_code)]
97 DllExport = 2, // Function to be accessible from DLL.
98 }
99
100 /// Matches LLVMRustAttribute in LLVMWrapper.h
101 /// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
102 /// though it is not ABI compatible (since it's a C++ enum)
103 #[repr(C)]
104 #[derive(Copy, Clone, Debug)]
105 pub enum Attribute {
106 AlwaysInline = 0,
107 ByVal = 1,
108 Cold = 2,
109 InlineHint = 3,
110 MinSize = 4,
111 Naked = 5,
112 NoAlias = 6,
113 NoCapture = 7,
114 NoInline = 8,
115 NonNull = 9,
116 NoRedZone = 10,
117 NoReturn = 11,
118 NoUnwind = 12,
119 OptimizeForSize = 13,
120 ReadOnly = 14,
121 SExt = 15,
122 StructRet = 16,
123 UWTable = 17,
124 ZExt = 18,
125 InReg = 19,
126 SanitizeThread = 20,
127 SanitizeAddress = 21,
128 SanitizeMemory = 22,
129 NonLazyBind = 23,
130 OptimizeNone = 24,
131 ReturnsTwice = 25,
132 ReadNone = 26,
133 InaccessibleMemOnly = 27,
134 }
135
136 /// LLVMIntPredicate
137 #[derive(Copy, Clone)]
138 #[repr(C)]
139 pub enum IntPredicate {
140 IntEQ = 32,
141 IntNE = 33,
142 IntUGT = 34,
143 IntUGE = 35,
144 IntULT = 36,
145 IntULE = 37,
146 IntSGT = 38,
147 IntSGE = 39,
148 IntSLT = 40,
149 IntSLE = 41,
150 }
151
152 impl IntPredicate {
153 pub fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
154 match intpre {
155 rustc_codegen_ssa::common::IntPredicate::IntEQ => IntPredicate::IntEQ,
156 rustc_codegen_ssa::common::IntPredicate::IntNE => IntPredicate::IntNE,
157 rustc_codegen_ssa::common::IntPredicate::IntUGT => IntPredicate::IntUGT,
158 rustc_codegen_ssa::common::IntPredicate::IntUGE => IntPredicate::IntUGE,
159 rustc_codegen_ssa::common::IntPredicate::IntULT => IntPredicate::IntULT,
160 rustc_codegen_ssa::common::IntPredicate::IntULE => IntPredicate::IntULE,
161 rustc_codegen_ssa::common::IntPredicate::IntSGT => IntPredicate::IntSGT,
162 rustc_codegen_ssa::common::IntPredicate::IntSGE => IntPredicate::IntSGE,
163 rustc_codegen_ssa::common::IntPredicate::IntSLT => IntPredicate::IntSLT,
164 rustc_codegen_ssa::common::IntPredicate::IntSLE => IntPredicate::IntSLE,
165 }
166 }
167 }
168
169 /// LLVMRealPredicate
170 #[derive(Copy, Clone)]
171 #[repr(C)]
172 pub enum RealPredicate {
173 RealPredicateFalse = 0,
174 RealOEQ = 1,
175 RealOGT = 2,
176 RealOGE = 3,
177 RealOLT = 4,
178 RealOLE = 5,
179 RealONE = 6,
180 RealORD = 7,
181 RealUNO = 8,
182 RealUEQ = 9,
183 RealUGT = 10,
184 RealUGE = 11,
185 RealULT = 12,
186 RealULE = 13,
187 RealUNE = 14,
188 RealPredicateTrue = 15,
189 }
190
191 impl RealPredicate {
192 pub fn from_generic(realpred: rustc_codegen_ssa::common::RealPredicate) -> Self {
193 match realpred {
194 rustc_codegen_ssa::common::RealPredicate::RealPredicateFalse => {
195 RealPredicate::RealPredicateFalse
196 }
197 rustc_codegen_ssa::common::RealPredicate::RealOEQ => RealPredicate::RealOEQ,
198 rustc_codegen_ssa::common::RealPredicate::RealOGT => RealPredicate::RealOGT,
199 rustc_codegen_ssa::common::RealPredicate::RealOGE => RealPredicate::RealOGE,
200 rustc_codegen_ssa::common::RealPredicate::RealOLT => RealPredicate::RealOLT,
201 rustc_codegen_ssa::common::RealPredicate::RealOLE => RealPredicate::RealOLE,
202 rustc_codegen_ssa::common::RealPredicate::RealONE => RealPredicate::RealONE,
203 rustc_codegen_ssa::common::RealPredicate::RealORD => RealPredicate::RealORD,
204 rustc_codegen_ssa::common::RealPredicate::RealUNO => RealPredicate::RealUNO,
205 rustc_codegen_ssa::common::RealPredicate::RealUEQ => RealPredicate::RealUEQ,
206 rustc_codegen_ssa::common::RealPredicate::RealUGT => RealPredicate::RealUGT,
207 rustc_codegen_ssa::common::RealPredicate::RealUGE => RealPredicate::RealUGE,
208 rustc_codegen_ssa::common::RealPredicate::RealULT => RealPredicate::RealULT,
209 rustc_codegen_ssa::common::RealPredicate::RealULE => RealPredicate::RealULE,
210 rustc_codegen_ssa::common::RealPredicate::RealUNE => RealPredicate::RealUNE,
211 rustc_codegen_ssa::common::RealPredicate::RealPredicateTrue => {
212 RealPredicate::RealPredicateTrue
213 }
214 }
215 }
216 }
217
218 /// LLVMTypeKind
219 #[derive(Copy, Clone, PartialEq, Debug)]
220 #[repr(C)]
221 pub enum TypeKind {
222 Void = 0,
223 Half = 1,
224 Float = 2,
225 Double = 3,
226 X86_FP80 = 4,
227 FP128 = 5,
228 PPC_FP128 = 6,
229 Label = 7,
230 Integer = 8,
231 Function = 9,
232 Struct = 10,
233 Array = 11,
234 Pointer = 12,
235 Vector = 13,
236 Metadata = 14,
237 X86_MMX = 15,
238 Token = 16,
239 ScalableVector = 17,
240 BFloat = 18,
241 }
242
243 impl TypeKind {
244 pub fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
245 match self {
246 TypeKind::Void => rustc_codegen_ssa::common::TypeKind::Void,
247 TypeKind::Half => rustc_codegen_ssa::common::TypeKind::Half,
248 TypeKind::Float => rustc_codegen_ssa::common::TypeKind::Float,
249 TypeKind::Double => rustc_codegen_ssa::common::TypeKind::Double,
250 TypeKind::X86_FP80 => rustc_codegen_ssa::common::TypeKind::X86_FP80,
251 TypeKind::FP128 => rustc_codegen_ssa::common::TypeKind::FP128,
252 TypeKind::PPC_FP128 => rustc_codegen_ssa::common::TypeKind::PPC_FP128,
253 TypeKind::Label => rustc_codegen_ssa::common::TypeKind::Label,
254 TypeKind::Integer => rustc_codegen_ssa::common::TypeKind::Integer,
255 TypeKind::Function => rustc_codegen_ssa::common::TypeKind::Function,
256 TypeKind::Struct => rustc_codegen_ssa::common::TypeKind::Struct,
257 TypeKind::Array => rustc_codegen_ssa::common::TypeKind::Array,
258 TypeKind::Pointer => rustc_codegen_ssa::common::TypeKind::Pointer,
259 TypeKind::Vector => rustc_codegen_ssa::common::TypeKind::Vector,
260 TypeKind::Metadata => rustc_codegen_ssa::common::TypeKind::Metadata,
261 TypeKind::X86_MMX => rustc_codegen_ssa::common::TypeKind::X86_MMX,
262 TypeKind::Token => rustc_codegen_ssa::common::TypeKind::Token,
263 TypeKind::ScalableVector => rustc_codegen_ssa::common::TypeKind::ScalableVector,
264 TypeKind::BFloat => rustc_codegen_ssa::common::TypeKind::BFloat,
265 }
266 }
267 }
268
269 /// LLVMAtomicRmwBinOp
270 #[derive(Copy, Clone)]
271 #[repr(C)]
272 pub enum AtomicRmwBinOp {
273 AtomicXchg = 0,
274 AtomicAdd = 1,
275 AtomicSub = 2,
276 AtomicAnd = 3,
277 AtomicNand = 4,
278 AtomicOr = 5,
279 AtomicXor = 6,
280 AtomicMax = 7,
281 AtomicMin = 8,
282 AtomicUMax = 9,
283 AtomicUMin = 10,
284 }
285
286 impl AtomicRmwBinOp {
287 pub fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
288 match op {
289 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXchg => AtomicRmwBinOp::AtomicXchg,
290 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAdd => AtomicRmwBinOp::AtomicAdd,
291 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicSub => AtomicRmwBinOp::AtomicSub,
292 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicAnd => AtomicRmwBinOp::AtomicAnd,
293 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicNand => AtomicRmwBinOp::AtomicNand,
294 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicOr => AtomicRmwBinOp::AtomicOr,
295 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicXor => AtomicRmwBinOp::AtomicXor,
296 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMax => AtomicRmwBinOp::AtomicMax,
297 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicMin => AtomicRmwBinOp::AtomicMin,
298 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMax => AtomicRmwBinOp::AtomicUMax,
299 rustc_codegen_ssa::common::AtomicRmwBinOp::AtomicUMin => AtomicRmwBinOp::AtomicUMin,
300 }
301 }
302 }
303
304 /// LLVMAtomicOrdering
305 #[derive(Copy, Clone)]
306 #[repr(C)]
307 pub enum AtomicOrdering {
308 #[allow(dead_code)]
309 NotAtomic = 0,
310 Unordered = 1,
311 Monotonic = 2,
312 // Consume = 3, // Not specified yet.
313 Acquire = 4,
314 Release = 5,
315 AcquireRelease = 6,
316 SequentiallyConsistent = 7,
317 }
318
319 impl AtomicOrdering {
320 pub fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
321 match ao {
322 rustc_codegen_ssa::common::AtomicOrdering::NotAtomic => AtomicOrdering::NotAtomic,
323 rustc_codegen_ssa::common::AtomicOrdering::Unordered => AtomicOrdering::Unordered,
324 rustc_codegen_ssa::common::AtomicOrdering::Monotonic => AtomicOrdering::Monotonic,
325 rustc_codegen_ssa::common::AtomicOrdering::Acquire => AtomicOrdering::Acquire,
326 rustc_codegen_ssa::common::AtomicOrdering::Release => AtomicOrdering::Release,
327 rustc_codegen_ssa::common::AtomicOrdering::AcquireRelease => {
328 AtomicOrdering::AcquireRelease
329 }
330 rustc_codegen_ssa::common::AtomicOrdering::SequentiallyConsistent => {
331 AtomicOrdering::SequentiallyConsistent
332 }
333 }
334 }
335 }
336
337 /// LLVMRustSynchronizationScope
338 #[derive(Copy, Clone)]
339 #[repr(C)]
340 pub enum SynchronizationScope {
341 SingleThread,
342 CrossThread,
343 }
344
345 impl SynchronizationScope {
346 pub fn from_generic(sc: rustc_codegen_ssa::common::SynchronizationScope) -> Self {
347 match sc {
348 rustc_codegen_ssa::common::SynchronizationScope::SingleThread => {
349 SynchronizationScope::SingleThread
350 }
351 rustc_codegen_ssa::common::SynchronizationScope::CrossThread => {
352 SynchronizationScope::CrossThread
353 }
354 }
355 }
356 }
357
358 /// LLVMRustFileType
359 #[derive(Copy, Clone)]
360 #[repr(C)]
361 pub enum FileType {
362 AssemblyFile,
363 ObjectFile,
364 }
365
366 /// LLVMMetadataType
367 #[derive(Copy, Clone)]
368 #[repr(C)]
369 pub enum MetadataType {
370 MD_dbg = 0,
371 MD_tbaa = 1,
372 MD_prof = 2,
373 MD_fpmath = 3,
374 MD_range = 4,
375 MD_tbaa_struct = 5,
376 MD_invariant_load = 6,
377 MD_alias_scope = 7,
378 MD_noalias = 8,
379 MD_nontemporal = 9,
380 MD_mem_parallel_loop_access = 10,
381 MD_nonnull = 11,
382 }
383
384 /// LLVMRustAsmDialect
385 #[derive(Copy, Clone)]
386 #[repr(C)]
387 pub enum AsmDialect {
388 Att,
389 Intel,
390 }
391
392 impl AsmDialect {
393 pub fn from_generic(asm: rustc_ast::LlvmAsmDialect) -> Self {
394 match asm {
395 rustc_ast::LlvmAsmDialect::Att => AsmDialect::Att,
396 rustc_ast::LlvmAsmDialect::Intel => AsmDialect::Intel,
397 }
398 }
399 }
400
401 /// LLVMRustCodeGenOptLevel
402 #[derive(Copy, Clone, PartialEq)]
403 #[repr(C)]
404 pub enum CodeGenOptLevel {
405 None,
406 Less,
407 Default,
408 Aggressive,
409 }
410
411 /// LLVMRustPassBuilderOptLevel
412 #[repr(C)]
413 pub enum PassBuilderOptLevel {
414 O0,
415 O1,
416 O2,
417 O3,
418 Os,
419 Oz,
420 }
421
422 /// LLVMRustOptStage
423 #[derive(PartialEq)]
424 #[repr(C)]
425 pub enum OptStage {
426 PreLinkNoLTO,
427 PreLinkThinLTO,
428 PreLinkFatLTO,
429 ThinLTO,
430 FatLTO,
431 }
432
433 /// LLVMRustSanitizerOptions
434 #[repr(C)]
435 pub struct SanitizerOptions {
436 pub sanitize_address: bool,
437 pub sanitize_address_recover: bool,
438 pub sanitize_memory: bool,
439 pub sanitize_memory_recover: bool,
440 pub sanitize_memory_track_origins: c_int,
441 pub sanitize_thread: bool,
442 }
443
444 /// LLVMRelocMode
445 #[derive(Copy, Clone, PartialEq)]
446 #[repr(C)]
447 pub enum RelocModel {
448 Static,
449 PIC,
450 DynamicNoPic,
451 ROPI,
452 RWPI,
453 ROPI_RWPI,
454 }
455
456 /// LLVMRustCodeModel
457 #[derive(Copy, Clone)]
458 #[repr(C)]
459 pub enum CodeModel {
460 Tiny,
461 Small,
462 Kernel,
463 Medium,
464 Large,
465 None,
466 }
467
468 /// LLVMRustDiagnosticKind
469 #[derive(Copy, Clone)]
470 #[repr(C)]
471 #[allow(dead_code)] // Variants constructed by C++.
472 pub enum DiagnosticKind {
473 Other,
474 InlineAsm,
475 StackSize,
476 DebugMetadataVersion,
477 SampleProfile,
478 OptimizationRemark,
479 OptimizationRemarkMissed,
480 OptimizationRemarkAnalysis,
481 OptimizationRemarkAnalysisFPCommute,
482 OptimizationRemarkAnalysisAliasing,
483 OptimizationRemarkOther,
484 OptimizationFailure,
485 PGOProfile,
486 Linker,
487 Unsupported,
488 }
489
490 /// LLVMRustDiagnosticLevel
491 #[derive(Copy, Clone)]
492 #[repr(C)]
493 #[allow(dead_code)] // Variants constructed by C++.
494 pub enum DiagnosticLevel {
495 Error,
496 Warning,
497 Note,
498 Remark,
499 }
500
501 /// LLVMRustArchiveKind
502 #[derive(Copy, Clone)]
503 #[repr(C)]
504 pub enum ArchiveKind {
505 K_GNU,
506 K_BSD,
507 K_DARWIN,
508 K_COFF,
509 }
510
511 /// LLVMRustPassKind
512 #[derive(Copy, Clone, PartialEq, Debug)]
513 #[repr(C)]
514 #[allow(dead_code)] // Variants constructed by C++.
515 pub enum PassKind {
516 Other,
517 Function,
518 Module,
519 }
520
521 /// LLVMRustThinLTOData
522 extern "C" {
523 pub type ThinLTOData;
524 }
525
526 /// LLVMRustThinLTOBuffer
527 extern "C" {
528 pub type ThinLTOBuffer;
529 }
530
531 // LLVMRustModuleNameCallback
532 pub type ThinLTOModuleNameCallback =
533 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
534
535 /// LLVMRustThinLTOModule
536 #[repr(C)]
537 pub struct ThinLTOModule {
538 pub identifier: *const c_char,
539 pub data: *const u8,
540 pub len: usize,
541 }
542
543 /// LLVMThreadLocalMode
544 #[derive(Copy, Clone)]
545 #[repr(C)]
546 pub enum ThreadLocalMode {
547 NotThreadLocal,
548 GeneralDynamic,
549 LocalDynamic,
550 InitialExec,
551 LocalExec,
552 }
553
554 /// LLVMRustChecksumKind
555 #[derive(Copy, Clone)]
556 #[repr(C)]
557 pub enum ChecksumKind {
558 None,
559 MD5,
560 SHA1,
561 SHA256,
562 }
563
564 extern "C" {
565 type Opaque;
566 }
567 #[repr(C)]
568 struct InvariantOpaque<'a> {
569 _marker: PhantomData<&'a mut &'a ()>,
570 _opaque: Opaque,
571 }
572
573 // Opaque pointer types
574 extern "C" {
575 pub type Module;
576 }
577 extern "C" {
578 pub type Context;
579 }
580 extern "C" {
581 pub type Type;
582 }
583 extern "C" {
584 pub type Value;
585 }
586 extern "C" {
587 pub type ConstantInt;
588 }
589 extern "C" {
590 pub type Metadata;
591 }
592 extern "C" {
593 pub type BasicBlock;
594 }
595 #[repr(C)]
596 pub struct Builder<'a>(InvariantOpaque<'a>);
597 extern "C" {
598 pub type MemoryBuffer;
599 }
600 #[repr(C)]
601 pub struct PassManager<'a>(InvariantOpaque<'a>);
602 extern "C" {
603 pub type PassManagerBuilder;
604 }
605 extern "C" {
606 pub type ObjectFile;
607 }
608 #[repr(C)]
609 pub struct SectionIterator<'a>(InvariantOpaque<'a>);
610 extern "C" {
611 pub type Pass;
612 }
613 extern "C" {
614 pub type TargetMachine;
615 }
616 extern "C" {
617 pub type Archive;
618 }
619 #[repr(C)]
620 pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
621 #[repr(C)]
622 pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
623 extern "C" {
624 pub type Twine;
625 }
626 extern "C" {
627 pub type DiagnosticInfo;
628 }
629 extern "C" {
630 pub type SMDiagnostic;
631 }
632 #[repr(C)]
633 pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
634 #[repr(C)]
635 pub struct OperandBundleDef<'a>(InvariantOpaque<'a>);
636 #[repr(C)]
637 pub struct Linker<'a>(InvariantOpaque<'a>);
638
639 pub type DiagnosticHandler = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
640 pub type InlineAsmDiagHandler = unsafe extern "C" fn(&SMDiagnostic, *const c_void, c_uint);
641
642 pub mod coverageinfo {
643 use super::coverage_map;
644
645 /// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/11.0-2020-10-12/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L206-L222)
646 #[derive(Copy, Clone, Debug)]
647 #[repr(C)]
648 pub enum RegionKind {
649 /// A CodeRegion associates some code with a counter
650 CodeRegion = 0,
651
652 /// An ExpansionRegion represents a file expansion region that associates
653 /// a source range with the expansion of a virtual source file, such as
654 /// for a macro instantiation or #include file.
655 ExpansionRegion = 1,
656
657 /// A SkippedRegion represents a source range with code that was skipped
658 /// by a preprocessor or similar means.
659 SkippedRegion = 2,
660
661 /// A GapRegion is like a CodeRegion, but its count is only set as the
662 /// line execution count when its the only region in the line.
663 GapRegion = 3,
664 }
665
666 /// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
667 /// coverage map, in accordance with the
668 /// [LLVM Code Coverage Mapping Format](https://github.com/rust-lang/llvm-project/blob/rustc/11.0-2020-10-12/llvm/docs/CoverageMappingFormat.rst#llvm-code-coverage-mapping-format).
669 /// The struct composes fields representing the `Counter` type and value(s) (injected counter
670 /// ID, or expression type and operands), the source file (an indirect index into a "filenames
671 /// array", encoded separately), and source location (start and end positions of the represented
672 /// code region).
673 ///
674 /// Aligns with [llvm::coverage::CounterMappingRegion](https://github.com/rust-lang/llvm-project/blob/rustc/11.0-2020-10-12/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L224-L227)
675 /// Important: The Rust struct layout (order and types of fields) must match its C++
676 /// counterpart.
677 #[derive(Copy, Clone, Debug)]
678 #[repr(C)]
679 pub struct CounterMappingRegion {
680 /// The counter type and type-dependent counter data, if any.
681 counter: coverage_map::Counter,
682
683 /// An indirect reference to the source filename. In the LLVM Coverage Mapping Format, the
684 /// file_id is an index into a function-specific `virtual_file_mapping` array of indexes
685 /// that, in turn, are used to look up the filename for this region.
686 file_id: u32,
687
688 /// If the `RegionKind` is an `ExpansionRegion`, the `expanded_file_id` can be used to find
689 /// the mapping regions created as a result of macro expansion, by checking if their file id
690 /// matches the expanded file id.
691 expanded_file_id: u32,
692
693 /// 1-based starting line of the mapping region.
694 start_line: u32,
695
696 /// 1-based starting column of the mapping region.
697 start_col: u32,
698
699 /// 1-based ending line of the mapping region.
700 end_line: u32,
701
702 /// 1-based ending column of the mapping region. If the high bit is set, the current
703 /// mapping region is a gap area.
704 end_col: u32,
705
706 kind: RegionKind,
707 }
708
709 impl CounterMappingRegion {
710 pub fn code_region(
711 counter: coverage_map::Counter,
712 file_id: u32,
713 start_line: u32,
714 start_col: u32,
715 end_line: u32,
716 end_col: u32,
717 ) -> Self {
718 Self {
719 counter,
720 file_id,
721 expanded_file_id: 0,
722 start_line,
723 start_col,
724 end_line,
725 end_col,
726 kind: RegionKind::CodeRegion,
727 }
728 }
729
730 pub fn expansion_region(
731 file_id: u32,
732 expanded_file_id: u32,
733 start_line: u32,
734 start_col: u32,
735 end_line: u32,
736 end_col: u32,
737 ) -> Self {
738 Self {
739 counter: coverage_map::Counter::zero(),
740 file_id,
741 expanded_file_id,
742 start_line,
743 start_col,
744 end_line,
745 end_col,
746 kind: RegionKind::ExpansionRegion,
747 }
748 }
749
750 pub fn skipped_region(
751 file_id: u32,
752 start_line: u32,
753 start_col: u32,
754 end_line: u32,
755 end_col: u32,
756 ) -> Self {
757 Self {
758 counter: coverage_map::Counter::zero(),
759 file_id,
760 expanded_file_id: 0,
761 start_line,
762 start_col,
763 end_line,
764 end_col,
765 kind: RegionKind::SkippedRegion,
766 }
767 }
768
769 pub fn gap_region(
770 counter: coverage_map::Counter,
771 file_id: u32,
772 start_line: u32,
773 start_col: u32,
774 end_line: u32,
775 end_col: u32,
776 ) -> Self {
777 Self {
778 counter,
779 file_id,
780 expanded_file_id: 0,
781 start_line,
782 start_col,
783 end_line,
784 end_col: ((1 as u32) << 31) | end_col,
785 kind: RegionKind::GapRegion,
786 }
787 }
788 }
789 }
790
791 pub mod debuginfo {
792 use super::{InvariantOpaque, Metadata};
793 use bitflags::bitflags;
794
795 #[repr(C)]
796 pub struct DIBuilder<'a>(InvariantOpaque<'a>);
797
798 pub type DIDescriptor = Metadata;
799 pub type DILocation = Metadata;
800 pub type DIScope = DIDescriptor;
801 pub type DIFile = DIScope;
802 pub type DILexicalBlock = DIScope;
803 pub type DISubprogram = DIScope;
804 pub type DINameSpace = DIScope;
805 pub type DIType = DIDescriptor;
806 pub type DIBasicType = DIType;
807 pub type DIDerivedType = DIType;
808 pub type DICompositeType = DIDerivedType;
809 pub type DIVariable = DIDescriptor;
810 pub type DIGlobalVariableExpression = DIDescriptor;
811 pub type DIArray = DIDescriptor;
812 pub type DISubrange = DIDescriptor;
813 pub type DIEnumerator = DIDescriptor;
814 pub type DITemplateTypeParameter = DIDescriptor;
815
816 // These values **must** match with LLVMRustDIFlags!!
817 bitflags! {
818 #[repr(transparent)]
819 #[derive(Default)]
820 pub struct DIFlags: u32 {
821 const FlagZero = 0;
822 const FlagPrivate = 1;
823 const FlagProtected = 2;
824 const FlagPublic = 3;
825 const FlagFwdDecl = (1 << 2);
826 const FlagAppleBlock = (1 << 3);
827 const FlagBlockByrefStruct = (1 << 4);
828 const FlagVirtual = (1 << 5);
829 const FlagArtificial = (1 << 6);
830 const FlagExplicit = (1 << 7);
831 const FlagPrototyped = (1 << 8);
832 const FlagObjcClassComplete = (1 << 9);
833 const FlagObjectPointer = (1 << 10);
834 const FlagVector = (1 << 11);
835 const FlagStaticMember = (1 << 12);
836 const FlagLValueReference = (1 << 13);
837 const FlagRValueReference = (1 << 14);
838 const FlagExternalTypeRef = (1 << 15);
839 const FlagIntroducedVirtual = (1 << 18);
840 const FlagBitField = (1 << 19);
841 const FlagNoReturn = (1 << 20);
842 }
843 }
844
845 // These values **must** match with LLVMRustDISPFlags!!
846 bitflags! {
847 #[repr(transparent)]
848 #[derive(Default)]
849 pub struct DISPFlags: u32 {
850 const SPFlagZero = 0;
851 const SPFlagVirtual = 1;
852 const SPFlagPureVirtual = 2;
853 const SPFlagLocalToUnit = (1 << 2);
854 const SPFlagDefinition = (1 << 3);
855 const SPFlagOptimized = (1 << 4);
856 const SPFlagMainSubprogram = (1 << 5);
857 }
858 }
859
860 /// LLVMRustDebugEmissionKind
861 #[derive(Copy, Clone)]
862 #[repr(C)]
863 pub enum DebugEmissionKind {
864 NoDebug,
865 FullDebug,
866 LineTablesOnly,
867 }
868
869 impl DebugEmissionKind {
870 pub fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
871 use rustc_session::config::DebugInfo;
872 match kind {
873 DebugInfo::None => DebugEmissionKind::NoDebug,
874 DebugInfo::Limited => DebugEmissionKind::LineTablesOnly,
875 DebugInfo::Full => DebugEmissionKind::FullDebug,
876 }
877 }
878 }
879 }
880
881 extern "C" {
882 pub type ModuleBuffer;
883 }
884
885 pub type SelfProfileBeforePassCallback =
886 unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
887 pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
888
889 extern "C" {
890 pub fn LLVMRustInstallFatalErrorHandler();
891
892 // Create and destroy contexts.
893 pub fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
894 pub fn LLVMContextDispose(C: &'static mut Context);
895 pub fn LLVMGetMDKindIDInContext(C: &Context, Name: *const c_char, SLen: c_uint) -> c_uint;
896
897 // Create modules.
898 pub fn LLVMModuleCreateWithNameInContext(ModuleID: *const c_char, C: &Context) -> &Module;
899 pub fn LLVMGetModuleContext(M: &Module) -> &Context;
900 pub fn LLVMCloneModule(M: &Module) -> &Module;
901
902 /// Data layout. See Module::getDataLayout.
903 pub fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
904 pub fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
905
906 /// See Module::setModuleInlineAsm.
907 pub fn LLVMSetModuleInlineAsm2(M: &Module, Asm: *const c_char, AsmLen: size_t);
908 pub fn LLVMRustAppendModuleInlineAsm(M: &Module, Asm: *const c_char, AsmLen: size_t);
909
910 /// See llvm::LLVMTypeKind::getTypeID.
911 pub fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
912
913 // Operations on integer types
914 pub fn LLVMInt1TypeInContext(C: &Context) -> &Type;
915 pub fn LLVMInt8TypeInContext(C: &Context) -> &Type;
916 pub fn LLVMInt16TypeInContext(C: &Context) -> &Type;
917 pub fn LLVMInt32TypeInContext(C: &Context) -> &Type;
918 pub fn LLVMInt64TypeInContext(C: &Context) -> &Type;
919 pub fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
920
921 pub fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
922
923 // Operations on real types
924 pub fn LLVMFloatTypeInContext(C: &Context) -> &Type;
925 pub fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
926
927 // Operations on function types
928 pub fn LLVMFunctionType(
929 ReturnType: &'a Type,
930 ParamTypes: *const &'a Type,
931 ParamCount: c_uint,
932 IsVarArg: Bool,
933 ) -> &'a Type;
934 pub fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
935 pub fn LLVMGetParamTypes(FunctionTy: &'a Type, Dest: *mut &'a Type);
936
937 // Operations on struct types
938 pub fn LLVMStructTypeInContext(
939 C: &'a Context,
940 ElementTypes: *const &'a Type,
941 ElementCount: c_uint,
942 Packed: Bool,
943 ) -> &'a Type;
944
945 // Operations on array, pointer, and vector types (sequence types)
946 pub fn LLVMRustArrayType(ElementType: &Type, ElementCount: u64) -> &Type;
947 pub fn LLVMPointerType(ElementType: &Type, AddressSpace: c_uint) -> &Type;
948 pub fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
949
950 pub fn LLVMGetElementType(Ty: &Type) -> &Type;
951 pub fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
952
953 // Operations on other types
954 pub fn LLVMVoidTypeInContext(C: &Context) -> &Type;
955 pub fn LLVMRustMetadataTypeInContext(C: &Context) -> &Type;
956
957 // Operations on all values
958 pub fn LLVMTypeOf(Val: &Value) -> &Type;
959 pub fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
960 pub fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
961 pub fn LLVMReplaceAllUsesWith(OldVal: &'a Value, NewVal: &'a Value);
962 pub fn LLVMSetMetadata(Val: &'a Value, KindID: c_uint, Node: &'a Value);
963
964 // Operations on constants of any type
965 pub fn LLVMConstNull(Ty: &Type) -> &Value;
966 pub fn LLVMGetUndef(Ty: &Type) -> &Value;
967
968 // Operations on metadata
969 pub fn LLVMMDStringInContext(C: &Context, Str: *const c_char, SLen: c_uint) -> &Value;
970 pub fn LLVMMDNodeInContext(C: &'a Context, Vals: *const &'a Value, Count: c_uint) -> &'a Value;
971 pub fn LLVMAddNamedMetadataOperand(M: &'a Module, Name: *const c_char, Val: &'a Value);
972
973 // Operations on scalar constants
974 pub fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
975 pub fn LLVMConstIntOfArbitraryPrecision(IntTy: &Type, Wn: c_uint, Ws: *const u64) -> &Value;
976 pub fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
977 pub fn LLVMConstIntGetZExtValue(ConstantVal: &ConstantInt) -> c_ulonglong;
978 pub fn LLVMRustConstInt128Get(
979 ConstantVal: &ConstantInt,
980 SExt: bool,
981 high: &mut u64,
982 low: &mut u64,
983 ) -> bool;
984
985 // Operations on composite constants
986 pub fn LLVMConstStringInContext(
987 C: &Context,
988 Str: *const c_char,
989 Length: c_uint,
990 DontNullTerminate: Bool,
991 ) -> &Value;
992 pub fn LLVMConstStructInContext(
993 C: &'a Context,
994 ConstantVals: *const &'a Value,
995 Count: c_uint,
996 Packed: Bool,
997 ) -> &'a Value;
998
999 pub fn LLVMConstArray(
1000 ElementTy: &'a Type,
1001 ConstantVals: *const &'a Value,
1002 Length: c_uint,
1003 ) -> &'a Value;
1004 pub fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
1005
1006 // Constant expressions
1007 pub fn LLVMConstInBoundsGEP(
1008 ConstantVal: &'a Value,
1009 ConstantIndices: *const &'a Value,
1010 NumIndices: c_uint,
1011 ) -> &'a Value;
1012 pub fn LLVMConstZExt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1013 pub fn LLVMConstPtrToInt(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1014 pub fn LLVMConstIntToPtr(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1015 pub fn LLVMConstBitCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1016 pub fn LLVMConstPointerCast(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
1017 pub fn LLVMConstExtractValue(
1018 AggConstant: &Value,
1019 IdxList: *const c_uint,
1020 NumIdx: c_uint,
1021 ) -> &Value;
1022
1023 // Operations on global variables, functions, and aliases (globals)
1024 pub fn LLVMIsDeclaration(Global: &Value) -> Bool;
1025 pub fn LLVMRustGetLinkage(Global: &Value) -> Linkage;
1026 pub fn LLVMRustSetLinkage(Global: &Value, RustLinkage: Linkage);
1027 pub fn LLVMSetSection(Global: &Value, Section: *const c_char);
1028 pub fn LLVMRustGetVisibility(Global: &Value) -> Visibility;
1029 pub fn LLVMRustSetVisibility(Global: &Value, Viz: Visibility);
1030 pub fn LLVMGetAlignment(Global: &Value) -> c_uint;
1031 pub fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
1032 pub fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
1033
1034 // Operations on global variables
1035 pub fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
1036 pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1037 pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
1038 pub fn LLVMRustGetOrInsertGlobal(
1039 M: &'a Module,
1040 Name: *const c_char,
1041 NameLen: size_t,
1042 T: &'a Type,
1043 ) -> &'a Value;
1044 pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value;
1045 pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
1046 pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
1047 pub fn LLVMDeleteGlobal(GlobalVar: &Value);
1048 pub fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
1049 pub fn LLVMSetInitializer(GlobalVar: &'a Value, ConstantVal: &'a Value);
1050 pub fn LLVMSetThreadLocal(GlobalVar: &Value, IsThreadLocal: Bool);
1051 pub fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
1052 pub fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
1053 pub fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
1054 pub fn LLVMRustGetNamedValue(
1055 M: &Module,
1056 Name: *const c_char,
1057 NameLen: size_t,
1058 ) -> Option<&Value>;
1059 pub fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
1060
1061 // Operations on functions
1062 pub fn LLVMRustGetOrInsertFunction(
1063 M: &'a Module,
1064 Name: *const c_char,
1065 NameLen: size_t,
1066 FunctionTy: &'a Type,
1067 ) -> &'a Value;
1068 pub fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
1069 pub fn LLVMRustAddAlignmentAttr(Fn: &Value, index: c_uint, bytes: u32);
1070 pub fn LLVMRustAddDereferenceableAttr(Fn: &Value, index: c_uint, bytes: u64);
1071 pub fn LLVMRustAddDereferenceableOrNullAttr(Fn: &Value, index: c_uint, bytes: u64);
1072 pub fn LLVMRustAddByValAttr(Fn: &Value, index: c_uint, ty: &Type);
1073 pub fn LLVMRustAddFunctionAttribute(Fn: &Value, index: c_uint, attr: Attribute);
1074 pub fn LLVMRustAddFunctionAttrStringValue(
1075 Fn: &Value,
1076 index: c_uint,
1077 Name: *const c_char,
1078 Value: *const c_char,
1079 );
1080 pub fn LLVMRustRemoveFunctionAttributes(Fn: &Value, index: c_uint, attr: Attribute);
1081
1082 // Operations on parameters
1083 pub fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
1084 pub fn LLVMCountParams(Fn: &Value) -> c_uint;
1085 pub fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
1086
1087 // Operations on basic blocks
1088 pub fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
1089 pub fn LLVMAppendBasicBlockInContext(
1090 C: &'a Context,
1091 Fn: &'a Value,
1092 Name: *const c_char,
1093 ) -> &'a BasicBlock;
1094 pub fn LLVMDeleteBasicBlock(BB: &BasicBlock);
1095
1096 // Operations on instructions
1097 pub fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
1098 pub fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
1099
1100 // Operations on call sites
1101 pub fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
1102 pub fn LLVMRustAddCallSiteAttribute(Instr: &Value, index: c_uint, attr: Attribute);
1103 pub fn LLVMRustAddAlignmentCallSiteAttr(Instr: &Value, index: c_uint, bytes: u32);
1104 pub fn LLVMRustAddDereferenceableCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
1105 pub fn LLVMRustAddDereferenceableOrNullCallSiteAttr(Instr: &Value, index: c_uint, bytes: u64);
1106 pub fn LLVMRustAddByValCallSiteAttr(Instr: &Value, index: c_uint, ty: &Type);
1107
1108 // Operations on load/store instructions (only)
1109 pub fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
1110
1111 // Operations on phi nodes
1112 pub fn LLVMAddIncoming(
1113 PhiNode: &'a Value,
1114 IncomingValues: *const &'a Value,
1115 IncomingBlocks: *const &'a BasicBlock,
1116 Count: c_uint,
1117 );
1118
1119 // Instruction builders
1120 pub fn LLVMCreateBuilderInContext(C: &'a Context) -> &'a mut Builder<'a>;
1121 pub fn LLVMPositionBuilderAtEnd(Builder: &Builder<'a>, Block: &'a BasicBlock);
1122 pub fn LLVMGetInsertBlock(Builder: &Builder<'a>) -> &'a BasicBlock;
1123 pub fn LLVMDisposeBuilder(Builder: &'a mut Builder<'a>);
1124
1125 // Metadata
1126 pub fn LLVMSetCurrentDebugLocation(Builder: &Builder<'a>, L: &'a Value);
1127
1128 // Terminators
1129 pub fn LLVMBuildRetVoid(B: &Builder<'a>) -> &'a Value;
1130 pub fn LLVMBuildRet(B: &Builder<'a>, V: &'a Value) -> &'a Value;
1131 pub fn LLVMBuildBr(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
1132 pub fn LLVMBuildCondBr(
1133 B: &Builder<'a>,
1134 If: &'a Value,
1135 Then: &'a BasicBlock,
1136 Else: &'a BasicBlock,
1137 ) -> &'a Value;
1138 pub fn LLVMBuildSwitch(
1139 B: &Builder<'a>,
1140 V: &'a Value,
1141 Else: &'a BasicBlock,
1142 NumCases: c_uint,
1143 ) -> &'a Value;
1144 pub fn LLVMRustBuildInvoke(
1145 B: &Builder<'a>,
1146 Fn: &'a Value,
1147 Args: *const &'a Value,
1148 NumArgs: c_uint,
1149 Then: &'a BasicBlock,
1150 Catch: &'a BasicBlock,
1151 Bundle: Option<&OperandBundleDef<'a>>,
1152 Name: *const c_char,
1153 ) -> &'a Value;
1154 pub fn LLVMBuildLandingPad(
1155 B: &Builder<'a>,
1156 Ty: &'a Type,
1157 PersFn: &'a Value,
1158 NumClauses: c_uint,
1159 Name: *const c_char,
1160 ) -> &'a Value;
1161 pub fn LLVMBuildResume(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
1162 pub fn LLVMBuildUnreachable(B: &Builder<'a>) -> &'a Value;
1163
1164 pub fn LLVMRustBuildCleanupPad(
1165 B: &Builder<'a>,
1166 ParentPad: Option<&'a Value>,
1167 ArgCnt: c_uint,
1168 Args: *const &'a Value,
1169 Name: *const c_char,
1170 ) -> Option<&'a Value>;
1171 pub fn LLVMRustBuildCleanupRet(
1172 B: &Builder<'a>,
1173 CleanupPad: &'a Value,
1174 UnwindBB: Option<&'a BasicBlock>,
1175 ) -> Option<&'a Value>;
1176 pub fn LLVMRustBuildCatchPad(
1177 B: &Builder<'a>,
1178 ParentPad: &'a Value,
1179 ArgCnt: c_uint,
1180 Args: *const &'a Value,
1181 Name: *const c_char,
1182 ) -> Option<&'a Value>;
1183 pub fn LLVMRustBuildCatchRet(
1184 B: &Builder<'a>,
1185 Pad: &'a Value,
1186 BB: &'a BasicBlock,
1187 ) -> Option<&'a Value>;
1188 pub fn LLVMRustBuildCatchSwitch(
1189 Builder: &Builder<'a>,
1190 ParentPad: Option<&'a Value>,
1191 BB: Option<&'a BasicBlock>,
1192 NumHandlers: c_uint,
1193 Name: *const c_char,
1194 ) -> Option<&'a Value>;
1195 pub fn LLVMRustAddHandler(CatchSwitch: &'a Value, Handler: &'a BasicBlock);
1196 pub fn LLVMSetPersonalityFn(Func: &'a Value, Pers: &'a Value);
1197
1198 // Add a case to the switch instruction
1199 pub fn LLVMAddCase(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
1200
1201 // Add a clause to the landing pad instruction
1202 pub fn LLVMAddClause(LandingPad: &'a Value, ClauseVal: &'a Value);
1203
1204 // Set the cleanup on a landing pad instruction
1205 pub fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
1206
1207 // Arithmetic
1208 pub fn LLVMBuildAdd(
1209 B: &Builder<'a>,
1210 LHS: &'a Value,
1211 RHS: &'a Value,
1212 Name: *const c_char,
1213 ) -> &'a Value;
1214 pub fn LLVMBuildFAdd(
1215 B: &Builder<'a>,
1216 LHS: &'a Value,
1217 RHS: &'a Value,
1218 Name: *const c_char,
1219 ) -> &'a Value;
1220 pub fn LLVMBuildSub(
1221 B: &Builder<'a>,
1222 LHS: &'a Value,
1223 RHS: &'a Value,
1224 Name: *const c_char,
1225 ) -> &'a Value;
1226 pub fn LLVMBuildFSub(
1227 B: &Builder<'a>,
1228 LHS: &'a Value,
1229 RHS: &'a Value,
1230 Name: *const c_char,
1231 ) -> &'a Value;
1232 pub fn LLVMBuildMul(
1233 B: &Builder<'a>,
1234 LHS: &'a Value,
1235 RHS: &'a Value,
1236 Name: *const c_char,
1237 ) -> &'a Value;
1238 pub fn LLVMBuildFMul(
1239 B: &Builder<'a>,
1240 LHS: &'a Value,
1241 RHS: &'a Value,
1242 Name: *const c_char,
1243 ) -> &'a Value;
1244 pub fn LLVMBuildUDiv(
1245 B: &Builder<'a>,
1246 LHS: &'a Value,
1247 RHS: &'a Value,
1248 Name: *const c_char,
1249 ) -> &'a Value;
1250 pub fn LLVMBuildExactUDiv(
1251 B: &Builder<'a>,
1252 LHS: &'a Value,
1253 RHS: &'a Value,
1254 Name: *const c_char,
1255 ) -> &'a Value;
1256 pub fn LLVMBuildSDiv(
1257 B: &Builder<'a>,
1258 LHS: &'a Value,
1259 RHS: &'a Value,
1260 Name: *const c_char,
1261 ) -> &'a Value;
1262 pub fn LLVMBuildExactSDiv(
1263 B: &Builder<'a>,
1264 LHS: &'a Value,
1265 RHS: &'a Value,
1266 Name: *const c_char,
1267 ) -> &'a Value;
1268 pub fn LLVMBuildFDiv(
1269 B: &Builder<'a>,
1270 LHS: &'a Value,
1271 RHS: &'a Value,
1272 Name: *const c_char,
1273 ) -> &'a Value;
1274 pub fn LLVMBuildURem(
1275 B: &Builder<'a>,
1276 LHS: &'a Value,
1277 RHS: &'a Value,
1278 Name: *const c_char,
1279 ) -> &'a Value;
1280 pub fn LLVMBuildSRem(
1281 B: &Builder<'a>,
1282 LHS: &'a Value,
1283 RHS: &'a Value,
1284 Name: *const c_char,
1285 ) -> &'a Value;
1286 pub fn LLVMBuildFRem(
1287 B: &Builder<'a>,
1288 LHS: &'a Value,
1289 RHS: &'a Value,
1290 Name: *const c_char,
1291 ) -> &'a Value;
1292 pub fn LLVMBuildShl(
1293 B: &Builder<'a>,
1294 LHS: &'a Value,
1295 RHS: &'a Value,
1296 Name: *const c_char,
1297 ) -> &'a Value;
1298 pub fn LLVMBuildLShr(
1299 B: &Builder<'a>,
1300 LHS: &'a Value,
1301 RHS: &'a Value,
1302 Name: *const c_char,
1303 ) -> &'a Value;
1304 pub fn LLVMBuildAShr(
1305 B: &Builder<'a>,
1306 LHS: &'a Value,
1307 RHS: &'a Value,
1308 Name: *const c_char,
1309 ) -> &'a Value;
1310 pub fn LLVMBuildNSWAdd(
1311 B: &Builder<'a>,
1312 LHS: &'a Value,
1313 RHS: &'a Value,
1314 Name: *const c_char,
1315 ) -> &'a Value;
1316 pub fn LLVMBuildNUWAdd(
1317 B: &Builder<'a>,
1318 LHS: &'a Value,
1319 RHS: &'a Value,
1320 Name: *const c_char,
1321 ) -> &'a Value;
1322 pub fn LLVMBuildNSWSub(
1323 B: &Builder<'a>,
1324 LHS: &'a Value,
1325 RHS: &'a Value,
1326 Name: *const c_char,
1327 ) -> &'a Value;
1328 pub fn LLVMBuildNUWSub(
1329 B: &Builder<'a>,
1330 LHS: &'a Value,
1331 RHS: &'a Value,
1332 Name: *const c_char,
1333 ) -> &'a Value;
1334 pub fn LLVMBuildNSWMul(
1335 B: &Builder<'a>,
1336 LHS: &'a Value,
1337 RHS: &'a Value,
1338 Name: *const c_char,
1339 ) -> &'a Value;
1340 pub fn LLVMBuildNUWMul(
1341 B: &Builder<'a>,
1342 LHS: &'a Value,
1343 RHS: &'a Value,
1344 Name: *const c_char,
1345 ) -> &'a Value;
1346 pub fn LLVMBuildAnd(
1347 B: &Builder<'a>,
1348 LHS: &'a Value,
1349 RHS: &'a Value,
1350 Name: *const c_char,
1351 ) -> &'a Value;
1352 pub fn LLVMBuildOr(
1353 B: &Builder<'a>,
1354 LHS: &'a Value,
1355 RHS: &'a Value,
1356 Name: *const c_char,
1357 ) -> &'a Value;
1358 pub fn LLVMBuildXor(
1359 B: &Builder<'a>,
1360 LHS: &'a Value,
1361 RHS: &'a Value,
1362 Name: *const c_char,
1363 ) -> &'a Value;
1364 pub fn LLVMBuildNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1365 pub fn LLVMBuildFNeg(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1366 pub fn LLVMBuildNot(B: &Builder<'a>, V: &'a Value, Name: *const c_char) -> &'a Value;
1367 pub fn LLVMRustSetHasUnsafeAlgebra(Instr: &Value);
1368
1369 // Memory
1370 pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1371 pub fn LLVMBuildArrayAlloca(
1372 B: &Builder<'a>,
1373 Ty: &'a Type,
1374 Val: &'a Value,
1375 Name: *const c_char,
1376 ) -> &'a Value;
1377 pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
1378
1379 pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
1380
1381 pub fn LLVMBuildGEP(
1382 B: &Builder<'a>,
1383 Pointer: &'a Value,
1384 Indices: *const &'a Value,
1385 NumIndices: c_uint,
1386 Name: *const c_char,
1387 ) -> &'a Value;
1388 pub fn LLVMBuildInBoundsGEP(
1389 B: &Builder<'a>,
1390 Pointer: &'a Value,
1391 Indices: *const &'a Value,
1392 NumIndices: c_uint,
1393 Name: *const c_char,
1394 ) -> &'a Value;
1395 pub fn LLVMBuildStructGEP(
1396 B: &Builder<'a>,
1397 Pointer: &'a Value,
1398 Idx: c_uint,
1399 Name: *const c_char,
1400 ) -> &'a Value;
1401
1402 // Casts
1403 pub fn LLVMBuildTrunc(
1404 B: &Builder<'a>,
1405 Val: &'a Value,
1406 DestTy: &'a Type,
1407 Name: *const c_char,
1408 ) -> &'a Value;
1409 pub fn LLVMBuildZExt(
1410 B: &Builder<'a>,
1411 Val: &'a Value,
1412 DestTy: &'a Type,
1413 Name: *const c_char,
1414 ) -> &'a Value;
1415 pub fn LLVMBuildSExt(
1416 B: &Builder<'a>,
1417 Val: &'a Value,
1418 DestTy: &'a Type,
1419 Name: *const c_char,
1420 ) -> &'a Value;
1421 pub fn LLVMBuildFPToUI(
1422 B: &Builder<'a>,
1423 Val: &'a Value,
1424 DestTy: &'a Type,
1425 Name: *const c_char,
1426 ) -> &'a Value;
1427 pub fn LLVMBuildFPToSI(
1428 B: &Builder<'a>,
1429 Val: &'a Value,
1430 DestTy: &'a Type,
1431 Name: *const c_char,
1432 ) -> &'a Value;
1433 pub fn LLVMBuildUIToFP(
1434 B: &Builder<'a>,
1435 Val: &'a Value,
1436 DestTy: &'a Type,
1437 Name: *const c_char,
1438 ) -> &'a Value;
1439 pub fn LLVMBuildSIToFP(
1440 B: &Builder<'a>,
1441 Val: &'a Value,
1442 DestTy: &'a Type,
1443 Name: *const c_char,
1444 ) -> &'a Value;
1445 pub fn LLVMBuildFPTrunc(
1446 B: &Builder<'a>,
1447 Val: &'a Value,
1448 DestTy: &'a Type,
1449 Name: *const c_char,
1450 ) -> &'a Value;
1451 pub fn LLVMBuildFPExt(
1452 B: &Builder<'a>,
1453 Val: &'a Value,
1454 DestTy: &'a Type,
1455 Name: *const c_char,
1456 ) -> &'a Value;
1457 pub fn LLVMBuildPtrToInt(
1458 B: &Builder<'a>,
1459 Val: &'a Value,
1460 DestTy: &'a Type,
1461 Name: *const c_char,
1462 ) -> &'a Value;
1463 pub fn LLVMBuildIntToPtr(
1464 B: &Builder<'a>,
1465 Val: &'a Value,
1466 DestTy: &'a Type,
1467 Name: *const c_char,
1468 ) -> &'a Value;
1469 pub fn LLVMBuildBitCast(
1470 B: &Builder<'a>,
1471 Val: &'a Value,
1472 DestTy: &'a Type,
1473 Name: *const c_char,
1474 ) -> &'a Value;
1475 pub fn LLVMBuildPointerCast(
1476 B: &Builder<'a>,
1477 Val: &'a Value,
1478 DestTy: &'a Type,
1479 Name: *const c_char,
1480 ) -> &'a Value;
1481 pub fn LLVMRustBuildIntCast(
1482 B: &Builder<'a>,
1483 Val: &'a Value,
1484 DestTy: &'a Type,
1485 IsSized: bool,
1486 ) -> &'a Value;
1487
1488 // Comparisons
1489 pub fn LLVMBuildICmp(
1490 B: &Builder<'a>,
1491 Op: c_uint,
1492 LHS: &'a Value,
1493 RHS: &'a Value,
1494 Name: *const c_char,
1495 ) -> &'a Value;
1496 pub fn LLVMBuildFCmp(
1497 B: &Builder<'a>,
1498 Op: c_uint,
1499 LHS: &'a Value,
1500 RHS: &'a Value,
1501 Name: *const c_char,
1502 ) -> &'a Value;
1503
1504 // Miscellaneous instructions
1505 pub fn LLVMBuildPhi(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
1506 pub fn LLVMRustGetInstrProfIncrementIntrinsic(M: &Module) -> &'a Value;
1507 pub fn LLVMRustBuildCall(
1508 B: &Builder<'a>,
1509 Fn: &'a Value,
1510 Args: *const &'a Value,
1511 NumArgs: c_uint,
1512 Bundle: Option<&OperandBundleDef<'a>>,
1513 ) -> &'a Value;
1514 pub fn LLVMRustBuildMemCpy(
1515 B: &Builder<'a>,
1516 Dst: &'a Value,
1517 DstAlign: c_uint,
1518 Src: &'a Value,
1519 SrcAlign: c_uint,
1520 Size: &'a Value,
1521 IsVolatile: bool,
1522 ) -> &'a Value;
1523 pub fn LLVMRustBuildMemMove(
1524 B: &Builder<'a>,
1525 Dst: &'a Value,
1526 DstAlign: c_uint,
1527 Src: &'a Value,
1528 SrcAlign: c_uint,
1529 Size: &'a Value,
1530 IsVolatile: bool,
1531 ) -> &'a Value;
1532 pub fn LLVMRustBuildMemSet(
1533 B: &Builder<'a>,
1534 Dst: &'a Value,
1535 DstAlign: c_uint,
1536 Val: &'a Value,
1537 Size: &'a Value,
1538 IsVolatile: bool,
1539 ) -> &'a Value;
1540 pub fn LLVMBuildSelect(
1541 B: &Builder<'a>,
1542 If: &'a Value,
1543 Then: &'a Value,
1544 Else: &'a Value,
1545 Name: *const c_char,
1546 ) -> &'a Value;
1547 pub fn LLVMBuildVAArg(
1548 B: &Builder<'a>,
1549 list: &'a Value,
1550 Ty: &'a Type,
1551 Name: *const c_char,
1552 ) -> &'a Value;
1553 pub fn LLVMBuildExtractElement(
1554 B: &Builder<'a>,
1555 VecVal: &'a Value,
1556 Index: &'a Value,
1557 Name: *const c_char,
1558 ) -> &'a Value;
1559 pub fn LLVMBuildInsertElement(
1560 B: &Builder<'a>,
1561 VecVal: &'a Value,
1562 EltVal: &'a Value,
1563 Index: &'a Value,
1564 Name: *const c_char,
1565 ) -> &'a Value;
1566 pub fn LLVMBuildShuffleVector(
1567 B: &Builder<'a>,
1568 V1: &'a Value,
1569 V2: &'a Value,
1570 Mask: &'a Value,
1571 Name: *const c_char,
1572 ) -> &'a Value;
1573 pub fn LLVMBuildExtractValue(
1574 B: &Builder<'a>,
1575 AggVal: &'a Value,
1576 Index: c_uint,
1577 Name: *const c_char,
1578 ) -> &'a Value;
1579 pub fn LLVMBuildInsertValue(
1580 B: &Builder<'a>,
1581 AggVal: &'a Value,
1582 EltVal: &'a Value,
1583 Index: c_uint,
1584 Name: *const c_char,
1585 ) -> &'a Value;
1586
1587 pub fn LLVMRustBuildVectorReduceFAdd(
1588 B: &Builder<'a>,
1589 Acc: &'a Value,
1590 Src: &'a Value,
1591 ) -> &'a Value;
1592 pub fn LLVMRustBuildVectorReduceFMul(
1593 B: &Builder<'a>,
1594 Acc: &'a Value,
1595 Src: &'a Value,
1596 ) -> &'a Value;
1597 pub fn LLVMRustBuildVectorReduceAdd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1598 pub fn LLVMRustBuildVectorReduceMul(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1599 pub fn LLVMRustBuildVectorReduceAnd(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1600 pub fn LLVMRustBuildVectorReduceOr(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1601 pub fn LLVMRustBuildVectorReduceXor(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
1602 pub fn LLVMRustBuildVectorReduceMin(
1603 B: &Builder<'a>,
1604 Src: &'a Value,
1605 IsSigned: bool,
1606 ) -> &'a Value;
1607 pub fn LLVMRustBuildVectorReduceMax(
1608 B: &Builder<'a>,
1609 Src: &'a Value,
1610 IsSigned: bool,
1611 ) -> &'a Value;
1612 pub fn LLVMRustBuildVectorReduceFMin(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1613 -> &'a Value;
1614 pub fn LLVMRustBuildVectorReduceFMax(B: &Builder<'a>, Src: &'a Value, IsNaN: bool)
1615 -> &'a Value;
1616
1617 pub fn LLVMRustBuildMinNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1618 pub fn LLVMRustBuildMaxNum(B: &Builder<'a>, LHS: &'a Value, LHS: &'a Value) -> &'a Value;
1619
1620 // Atomic Operations
1621 pub fn LLVMRustBuildAtomicLoad(
1622 B: &Builder<'a>,
1623 PointerVal: &'a Value,
1624 Name: *const c_char,
1625 Order: AtomicOrdering,
1626 ) -> &'a Value;
1627
1628 pub fn LLVMRustBuildAtomicStore(
1629 B: &Builder<'a>,
1630 Val: &'a Value,
1631 Ptr: &'a Value,
1632 Order: AtomicOrdering,
1633 ) -> &'a Value;
1634
1635 pub fn LLVMRustBuildAtomicCmpXchg(
1636 B: &Builder<'a>,
1637 LHS: &'a Value,
1638 CMP: &'a Value,
1639 RHS: &'a Value,
1640 Order: AtomicOrdering,
1641 FailureOrder: AtomicOrdering,
1642 Weak: Bool,
1643 ) -> &'a Value;
1644
1645 pub fn LLVMBuildAtomicRMW(
1646 B: &Builder<'a>,
1647 Op: AtomicRmwBinOp,
1648 LHS: &'a Value,
1649 RHS: &'a Value,
1650 Order: AtomicOrdering,
1651 SingleThreaded: Bool,
1652 ) -> &'a Value;
1653
1654 pub fn LLVMRustBuildAtomicFence(
1655 B: &Builder<'_>,
1656 Order: AtomicOrdering,
1657 Scope: SynchronizationScope,
1658 );
1659
1660 /// Writes a module to the specified path. Returns 0 on success.
1661 pub fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
1662
1663 /// Creates a pass manager.
1664 pub fn LLVMCreatePassManager() -> &'a mut PassManager<'a>;
1665
1666 /// Creates a function-by-function pass manager
1667 pub fn LLVMCreateFunctionPassManagerForModule(M: &'a Module) -> &'a mut PassManager<'a>;
1668
1669 /// Disposes a pass manager.
1670 pub fn LLVMDisposePassManager(PM: &'a mut PassManager<'a>);
1671
1672 /// Runs a pass manager on a module.
1673 pub fn LLVMRunPassManager(PM: &PassManager<'a>, M: &'a Module) -> Bool;
1674
1675 pub fn LLVMInitializePasses();
1676
1677 pub fn LLVMTimeTraceProfilerInitialize();
1678
1679 pub fn LLVMTimeTraceProfilerFinish(FileName: *const c_char);
1680
1681 pub fn LLVMAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>);
1682
1683 pub fn LLVMPassManagerBuilderCreate() -> &'static mut PassManagerBuilder;
1684 pub fn LLVMPassManagerBuilderDispose(PMB: &'static mut PassManagerBuilder);
1685 pub fn LLVMPassManagerBuilderSetSizeLevel(PMB: &PassManagerBuilder, Value: Bool);
1686 pub fn LLVMPassManagerBuilderSetDisableUnrollLoops(PMB: &PassManagerBuilder, Value: Bool);
1687 pub fn LLVMPassManagerBuilderUseInlinerWithThreshold(
1688 PMB: &PassManagerBuilder,
1689 threshold: c_uint,
1690 );
1691 pub fn LLVMPassManagerBuilderPopulateModulePassManager(
1692 PMB: &PassManagerBuilder,
1693 PM: &PassManager<'_>,
1694 );
1695
1696 pub fn LLVMPassManagerBuilderPopulateFunctionPassManager(
1697 PMB: &PassManagerBuilder,
1698 PM: &PassManager<'_>,
1699 );
1700 pub fn LLVMPassManagerBuilderPopulateLTOPassManager(
1701 PMB: &PassManagerBuilder,
1702 PM: &PassManager<'_>,
1703 Internalize: Bool,
1704 RunInliner: Bool,
1705 );
1706 pub fn LLVMRustPassManagerBuilderPopulateThinLTOPassManager(
1707 PMB: &PassManagerBuilder,
1708 PM: &PassManager<'_>,
1709 );
1710
1711 // Stuff that's in llvm-wrapper/ because it's not upstream yet.
1712
1713 /// Opens an object file.
1714 pub fn LLVMCreateObjectFile(
1715 MemBuf: &'static mut MemoryBuffer,
1716 ) -> Option<&'static mut ObjectFile>;
1717 /// Closes an object file.
1718 pub fn LLVMDisposeObjectFile(ObjFile: &'static mut ObjectFile);
1719
1720 /// Enumerates the sections in an object file.
1721 pub fn LLVMGetSections(ObjFile: &'a ObjectFile) -> &'a mut SectionIterator<'a>;
1722 /// Destroys a section iterator.
1723 pub fn LLVMDisposeSectionIterator(SI: &'a mut SectionIterator<'a>);
1724 /// Returns `true` if the section iterator is at the end of the section
1725 /// list:
1726 pub fn LLVMIsSectionIteratorAtEnd(ObjFile: &'a ObjectFile, SI: &SectionIterator<'a>) -> Bool;
1727 /// Moves the section iterator to point to the next section.
1728 pub fn LLVMMoveToNextSection(SI: &SectionIterator<'_>);
1729 /// Returns the current section size.
1730 pub fn LLVMGetSectionSize(SI: &SectionIterator<'_>) -> c_ulonglong;
1731 /// Returns the current section contents as a string buffer.
1732 pub fn LLVMGetSectionContents(SI: &SectionIterator<'_>) -> *const c_char;
1733
1734 /// Reads the given file and returns it as a memory buffer. Use
1735 /// LLVMDisposeMemoryBuffer() to get rid of it.
1736 pub fn LLVMRustCreateMemoryBufferWithContentsOfFile(
1737 Path: *const c_char,
1738 ) -> Option<&'static mut MemoryBuffer>;
1739
1740 pub fn LLVMStartMultithreaded() -> Bool;
1741
1742 /// Returns a string describing the last error caused by an LLVMRust* call.
1743 pub fn LLVMRustGetLastError() -> *const c_char;
1744
1745 /// Print the pass timings since static dtors aren't picking them up.
1746 pub fn LLVMRustPrintPassTimings();
1747
1748 pub fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
1749
1750 pub fn LLVMStructSetBody(
1751 StructTy: &'a Type,
1752 ElementTypes: *const &'a Type,
1753 ElementCount: c_uint,
1754 Packed: Bool,
1755 );
1756
1757 /// Prepares inline assembly.
1758 pub fn LLVMRustInlineAsm(
1759 Ty: &Type,
1760 AsmString: *const c_char,
1761 AsmStringLen: size_t,
1762 Constraints: *const c_char,
1763 ConstraintsLen: size_t,
1764 SideEffects: Bool,
1765 AlignStack: Bool,
1766 Dialect: AsmDialect,
1767 ) -> &Value;
1768 pub fn LLVMRustInlineAsmVerify(
1769 Ty: &Type,
1770 Constraints: *const c_char,
1771 ConstraintsLen: size_t,
1772 ) -> bool;
1773
1774 #[allow(improper_ctypes)]
1775 pub fn LLVMRustCoverageWriteFilenamesSectionToBuffer(
1776 Filenames: *const *const c_char,
1777 FilenamesLen: size_t,
1778 BufferOut: &RustString,
1779 );
1780
1781 #[allow(improper_ctypes)]
1782 pub fn LLVMRustCoverageWriteMappingToBuffer(
1783 VirtualFileMappingIDs: *const c_uint,
1784 NumVirtualFileMappingIDs: c_uint,
1785 Expressions: *const coverage_map::CounterExpression,
1786 NumExpressions: c_uint,
1787 MappingRegions: *mut coverageinfo::CounterMappingRegion,
1788 NumMappingRegions: c_uint,
1789 BufferOut: &RustString,
1790 );
1791
1792 pub fn LLVMRustCoverageCreatePGOFuncNameVar(F: &'a Value, FuncName: *const c_char)
1793 -> &'a Value;
1794 pub fn LLVMRustCoverageHashCString(StrVal: *const c_char) -> u64;
1795 pub fn LLVMRustCoverageHashByteArray(Bytes: *const c_char, NumBytes: size_t) -> u64;
1796
1797 #[allow(improper_ctypes)]
1798 pub fn LLVMRustCoverageWriteMapSectionNameToString(M: &Module, Str: &RustString);
1799
1800 #[allow(improper_ctypes)]
1801 pub fn LLVMRustCoverageWriteFuncSectionNameToString(M: &Module, Str: &RustString);
1802
1803 #[allow(improper_ctypes)]
1804 pub fn LLVMRustCoverageWriteMappingVarNameToString(Str: &RustString);
1805
1806 pub fn LLVMRustCoverageMappingVersion() -> u32;
1807 pub fn LLVMRustDebugMetadataVersion() -> u32;
1808 pub fn LLVMRustVersionMajor() -> u32;
1809 pub fn LLVMRustVersionMinor() -> u32;
1810
1811 pub fn LLVMRustAddModuleFlag(M: &Module, name: *const c_char, value: u32);
1812
1813 pub fn LLVMRustMetadataAsValue(C: &'a Context, MD: &'a Metadata) -> &'a Value;
1814
1815 pub fn LLVMRustDIBuilderCreate(M: &'a Module) -> &'a mut DIBuilder<'a>;
1816
1817 pub fn LLVMRustDIBuilderDispose(Builder: &'a mut DIBuilder<'a>);
1818
1819 pub fn LLVMRustDIBuilderFinalize(Builder: &DIBuilder<'_>);
1820
1821 pub fn LLVMRustDIBuilderCreateCompileUnit(
1822 Builder: &DIBuilder<'a>,
1823 Lang: c_uint,
1824 File: &'a DIFile,
1825 Producer: *const c_char,
1826 ProducerLen: size_t,
1827 isOptimized: bool,
1828 Flags: *const c_char,
1829 RuntimeVer: c_uint,
1830 SplitName: *const c_char,
1831 SplitNameLen: size_t,
1832 kind: DebugEmissionKind,
1833 DWOId: u64,
1834 SplitDebugInlining: bool,
1835 ) -> &'a DIDescriptor;
1836
1837 pub fn LLVMRustDIBuilderCreateFile(
1838 Builder: &DIBuilder<'a>,
1839 Filename: *const c_char,
1840 FilenameLen: size_t,
1841 Directory: *const c_char,
1842 DirectoryLen: size_t,
1843 CSKind: ChecksumKind,
1844 Checksum: *const c_char,
1845 ChecksumLen: size_t,
1846 ) -> &'a DIFile;
1847
1848 pub fn LLVMRustDIBuilderCreateSubroutineType(
1849 Builder: &DIBuilder<'a>,
1850 ParameterTypes: &'a DIArray,
1851 ) -> &'a DICompositeType;
1852
1853 pub fn LLVMRustDIBuilderCreateFunction(
1854 Builder: &DIBuilder<'a>,
1855 Scope: &'a DIDescriptor,
1856 Name: *const c_char,
1857 NameLen: size_t,
1858 LinkageName: *const c_char,
1859 LinkageNameLen: size_t,
1860 File: &'a DIFile,
1861 LineNo: c_uint,
1862 Ty: &'a DIType,
1863 ScopeLine: c_uint,
1864 Flags: DIFlags,
1865 SPFlags: DISPFlags,
1866 MaybeFn: Option<&'a Value>,
1867 TParam: &'a DIArray,
1868 Decl: Option<&'a DIDescriptor>,
1869 ) -> &'a DISubprogram;
1870
1871 pub fn LLVMRustDIBuilderCreateBasicType(
1872 Builder: &DIBuilder<'a>,
1873 Name: *const c_char,
1874 NameLen: size_t,
1875 SizeInBits: u64,
1876 Encoding: c_uint,
1877 ) -> &'a DIBasicType;
1878
1879 pub fn LLVMRustDIBuilderCreateTypedef(
1880 Builder: &DIBuilder<'a>,
1881 Type: &'a DIBasicType,
1882 Name: *const c_char,
1883 NameLen: size_t,
1884 File: &'a DIFile,
1885 LineNo: c_uint,
1886 Scope: Option<&'a DIScope>,
1887 ) -> &'a DIDerivedType;
1888
1889 pub fn LLVMRustDIBuilderCreatePointerType(
1890 Builder: &DIBuilder<'a>,
1891 PointeeTy: &'a DIType,
1892 SizeInBits: u64,
1893 AlignInBits: u32,
1894 AddressSpace: c_uint,
1895 Name: *const c_char,
1896 NameLen: size_t,
1897 ) -> &'a DIDerivedType;
1898
1899 pub fn LLVMRustDIBuilderCreateStructType(
1900 Builder: &DIBuilder<'a>,
1901 Scope: Option<&'a DIDescriptor>,
1902 Name: *const c_char,
1903 NameLen: size_t,
1904 File: &'a DIFile,
1905 LineNumber: c_uint,
1906 SizeInBits: u64,
1907 AlignInBits: u32,
1908 Flags: DIFlags,
1909 DerivedFrom: Option<&'a DIType>,
1910 Elements: &'a DIArray,
1911 RunTimeLang: c_uint,
1912 VTableHolder: Option<&'a DIType>,
1913 UniqueId: *const c_char,
1914 UniqueIdLen: size_t,
1915 ) -> &'a DICompositeType;
1916
1917 pub fn LLVMRustDIBuilderCreateMemberType(
1918 Builder: &DIBuilder<'a>,
1919 Scope: &'a DIDescriptor,
1920 Name: *const c_char,
1921 NameLen: size_t,
1922 File: &'a DIFile,
1923 LineNo: c_uint,
1924 SizeInBits: u64,
1925 AlignInBits: u32,
1926 OffsetInBits: u64,
1927 Flags: DIFlags,
1928 Ty: &'a DIType,
1929 ) -> &'a DIDerivedType;
1930
1931 pub fn LLVMRustDIBuilderCreateVariantMemberType(
1932 Builder: &DIBuilder<'a>,
1933 Scope: &'a DIScope,
1934 Name: *const c_char,
1935 NameLen: size_t,
1936 File: &'a DIFile,
1937 LineNumber: c_uint,
1938 SizeInBits: u64,
1939 AlignInBits: u32,
1940 OffsetInBits: u64,
1941 Discriminant: Option<&'a Value>,
1942 Flags: DIFlags,
1943 Ty: &'a DIType,
1944 ) -> &'a DIType;
1945
1946 pub fn LLVMRustDIBuilderCreateLexicalBlock(
1947 Builder: &DIBuilder<'a>,
1948 Scope: &'a DIScope,
1949 File: &'a DIFile,
1950 Line: c_uint,
1951 Col: c_uint,
1952 ) -> &'a DILexicalBlock;
1953
1954 pub fn LLVMRustDIBuilderCreateLexicalBlockFile(
1955 Builder: &DIBuilder<'a>,
1956 Scope: &'a DIScope,
1957 File: &'a DIFile,
1958 ) -> &'a DILexicalBlock;
1959
1960 pub fn LLVMRustDIBuilderCreateStaticVariable(
1961 Builder: &DIBuilder<'a>,
1962 Context: Option<&'a DIScope>,
1963 Name: *const c_char,
1964 NameLen: size_t,
1965 LinkageName: *const c_char,
1966 LinkageNameLen: size_t,
1967 File: &'a DIFile,
1968 LineNo: c_uint,
1969 Ty: &'a DIType,
1970 isLocalToUnit: bool,
1971 Val: &'a Value,
1972 Decl: Option<&'a DIDescriptor>,
1973 AlignInBits: u32,
1974 ) -> &'a DIGlobalVariableExpression;
1975
1976 pub fn LLVMRustDIBuilderCreateVariable(
1977 Builder: &DIBuilder<'a>,
1978 Tag: c_uint,
1979 Scope: &'a DIDescriptor,
1980 Name: *const c_char,
1981 NameLen: size_t,
1982 File: &'a DIFile,
1983 LineNo: c_uint,
1984 Ty: &'a DIType,
1985 AlwaysPreserve: bool,
1986 Flags: DIFlags,
1987 ArgNo: c_uint,
1988 AlignInBits: u32,
1989 ) -> &'a DIVariable;
1990
1991 pub fn LLVMRustDIBuilderCreateArrayType(
1992 Builder: &DIBuilder<'a>,
1993 Size: u64,
1994 AlignInBits: u32,
1995 Ty: &'a DIType,
1996 Subscripts: &'a DIArray,
1997 ) -> &'a DIType;
1998
1999 pub fn LLVMRustDIBuilderGetOrCreateSubrange(
2000 Builder: &DIBuilder<'a>,
2001 Lo: i64,
2002 Count: i64,
2003 ) -> &'a DISubrange;
2004
2005 pub fn LLVMRustDIBuilderGetOrCreateArray(
2006 Builder: &DIBuilder<'a>,
2007 Ptr: *const Option<&'a DIDescriptor>,
2008 Count: c_uint,
2009 ) -> &'a DIArray;
2010
2011 pub fn LLVMRustDIBuilderInsertDeclareAtEnd(
2012 Builder: &DIBuilder<'a>,
2013 Val: &'a Value,
2014 VarInfo: &'a DIVariable,
2015 AddrOps: *const i64,
2016 AddrOpsCount: c_uint,
2017 DL: &'a DILocation,
2018 InsertAtEnd: &'a BasicBlock,
2019 ) -> &'a Value;
2020
2021 pub fn LLVMRustDIBuilderCreateEnumerator(
2022 Builder: &DIBuilder<'a>,
2023 Name: *const c_char,
2024 NameLen: size_t,
2025 Value: i64,
2026 IsUnsigned: bool,
2027 ) -> &'a DIEnumerator;
2028
2029 pub fn LLVMRustDIBuilderCreateEnumerationType(
2030 Builder: &DIBuilder<'a>,
2031 Scope: &'a DIScope,
2032 Name: *const c_char,
2033 NameLen: size_t,
2034 File: &'a DIFile,
2035 LineNumber: c_uint,
2036 SizeInBits: u64,
2037 AlignInBits: u32,
2038 Elements: &'a DIArray,
2039 ClassType: &'a DIType,
2040 IsScoped: bool,
2041 ) -> &'a DIType;
2042
2043 pub fn LLVMRustDIBuilderCreateUnionType(
2044 Builder: &DIBuilder<'a>,
2045 Scope: &'a DIScope,
2046 Name: *const c_char,
2047 NameLen: size_t,
2048 File: &'a DIFile,
2049 LineNumber: c_uint,
2050 SizeInBits: u64,
2051 AlignInBits: u32,
2052 Flags: DIFlags,
2053 Elements: Option<&'a DIArray>,
2054 RunTimeLang: c_uint,
2055 UniqueId: *const c_char,
2056 UniqueIdLen: size_t,
2057 ) -> &'a DIType;
2058
2059 pub fn LLVMRustDIBuilderCreateVariantPart(
2060 Builder: &DIBuilder<'a>,
2061 Scope: &'a DIScope,
2062 Name: *const c_char,
2063 NameLen: size_t,
2064 File: &'a DIFile,
2065 LineNo: c_uint,
2066 SizeInBits: u64,
2067 AlignInBits: u32,
2068 Flags: DIFlags,
2069 Discriminator: Option<&'a DIDerivedType>,
2070 Elements: &'a DIArray,
2071 UniqueId: *const c_char,
2072 UniqueIdLen: size_t,
2073 ) -> &'a DIDerivedType;
2074
2075 pub fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
2076
2077 pub fn LLVMRustDIBuilderCreateTemplateTypeParameter(
2078 Builder: &DIBuilder<'a>,
2079 Scope: Option<&'a DIScope>,
2080 Name: *const c_char,
2081 NameLen: size_t,
2082 Ty: &'a DIType,
2083 ) -> &'a DITemplateTypeParameter;
2084
2085 pub fn LLVMRustDIBuilderCreateNameSpace(
2086 Builder: &DIBuilder<'a>,
2087 Scope: Option<&'a DIScope>,
2088 Name: *const c_char,
2089 NameLen: size_t,
2090 ExportSymbols: bool,
2091 ) -> &'a DINameSpace;
2092
2093 pub fn LLVMRustDICompositeTypeReplaceArrays(
2094 Builder: &DIBuilder<'a>,
2095 CompositeType: &'a DIType,
2096 Elements: Option<&'a DIArray>,
2097 Params: Option<&'a DIArray>,
2098 );
2099
2100 pub fn LLVMRustDIBuilderCreateDebugLocation(
2101 Context: &'a Context,
2102 Line: c_uint,
2103 Column: c_uint,
2104 Scope: &'a DIScope,
2105 InlinedAt: Option<&'a DILocation>,
2106 ) -> &'a DILocation;
2107 pub fn LLVMRustDIBuilderCreateOpDeref() -> i64;
2108 pub fn LLVMRustDIBuilderCreateOpPlusUconst() -> i64;
2109
2110 #[allow(improper_ctypes)]
2111 pub fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
2112 #[allow(improper_ctypes)]
2113 pub fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
2114
2115 pub fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
2116
2117 pub fn LLVMRustPassKind(Pass: &Pass) -> PassKind;
2118 pub fn LLVMRustFindAndCreatePass(Pass: *const c_char) -> Option<&'static mut Pass>;
2119 pub fn LLVMRustCreateAddressSanitizerFunctionPass(Recover: bool) -> &'static mut Pass;
2120 pub fn LLVMRustCreateModuleAddressSanitizerPass(Recover: bool) -> &'static mut Pass;
2121 pub fn LLVMRustCreateMemorySanitizerPass(
2122 TrackOrigins: c_int,
2123 Recover: bool,
2124 ) -> &'static mut Pass;
2125 pub fn LLVMRustCreateThreadSanitizerPass() -> &'static mut Pass;
2126 pub fn LLVMRustAddPass(PM: &PassManager<'_>, Pass: &'static mut Pass);
2127 pub fn LLVMRustAddLastExtensionPasses(
2128 PMB: &PassManagerBuilder,
2129 Passes: *const &'static mut Pass,
2130 NumPasses: size_t,
2131 );
2132
2133 pub fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
2134
2135 pub fn LLVMRustPrintTargetCPUs(T: &TargetMachine);
2136 pub fn LLVMRustPrintTargetFeatures(T: &TargetMachine);
2137
2138 pub fn LLVMRustGetHostCPUName(len: *mut usize) -> *const c_char;
2139 pub fn LLVMRustCreateTargetMachine(
2140 Triple: *const c_char,
2141 CPU: *const c_char,
2142 Features: *const c_char,
2143 Abi: *const c_char,
2144 Model: CodeModel,
2145 Reloc: RelocModel,
2146 Level: CodeGenOptLevel,
2147 UseSoftFP: bool,
2148 FunctionSections: bool,
2149 DataSections: bool,
2150 TrapUnreachable: bool,
2151 Singlethread: bool,
2152 AsmComments: bool,
2153 EmitStackSizeSection: bool,
2154 RelaxELFRelocations: bool,
2155 UseInitArray: bool,
2156 SplitDwarfFile: *const c_char,
2157 ) -> Option<&'static mut TargetMachine>;
2158 pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
2159 pub fn LLVMRustAddBuilderLibraryInfo(
2160 PMB: &'a PassManagerBuilder,
2161 M: &'a Module,
2162 DisableSimplifyLibCalls: bool,
2163 );
2164 pub fn LLVMRustConfigurePassManagerBuilder(
2165 PMB: &PassManagerBuilder,
2166 OptLevel: CodeGenOptLevel,
2167 MergeFunctions: bool,
2168 SLPVectorize: bool,
2169 LoopVectorize: bool,
2170 PrepareForThinLTO: bool,
2171 PGOGenPath: *const c_char,
2172 PGOUsePath: *const c_char,
2173 );
2174 pub fn LLVMRustAddLibraryInfo(
2175 PM: &PassManager<'a>,
2176 M: &'a Module,
2177 DisableSimplifyLibCalls: bool,
2178 );
2179 pub fn LLVMRustRunFunctionPassManager(PM: &PassManager<'a>, M: &'a Module);
2180 pub fn LLVMRustWriteOutputFile(
2181 T: &'a TargetMachine,
2182 PM: &PassManager<'a>,
2183 M: &'a Module,
2184 Output: *const c_char,
2185 DwoOutput: *const c_char,
2186 FileType: FileType,
2187 ) -> LLVMRustResult;
2188 pub fn LLVMRustOptimizeWithNewPassManager(
2189 M: &'a Module,
2190 TM: &'a TargetMachine,
2191 OptLevel: PassBuilderOptLevel,
2192 OptStage: OptStage,
2193 NoPrepopulatePasses: bool,
2194 VerifyIR: bool,
2195 UseThinLTOBuffers: bool,
2196 MergeFunctions: bool,
2197 UnrollLoops: bool,
2198 SLPVectorize: bool,
2199 LoopVectorize: bool,
2200 DisableSimplifyLibCalls: bool,
2201 EmitLifetimeMarkers: bool,
2202 SanitizerOptions: Option<&SanitizerOptions>,
2203 PGOGenPath: *const c_char,
2204 PGOUsePath: *const c_char,
2205 llvm_selfprofiler: *mut c_void,
2206 begin_callback: SelfProfileBeforePassCallback,
2207 end_callback: SelfProfileAfterPassCallback,
2208 );
2209 pub fn LLVMRustPrintModule(
2210 M: &'a Module,
2211 Output: *const c_char,
2212 Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
2213 ) -> LLVMRustResult;
2214 pub fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
2215 pub fn LLVMRustPrintPasses();
2216 pub fn LLVMRustGetInstructionCount(M: &Module) -> u32;
2217 pub fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
2218 pub fn LLVMRustAddAlwaysInlinePass(P: &PassManagerBuilder, AddLifetimes: bool);
2219 pub fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
2220 pub fn LLVMRustMarkAllFunctionsNounwind(M: &Module);
2221
2222 pub fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
2223 pub fn LLVMRustArchiveIteratorNew(AR: &'a Archive) -> &'a mut ArchiveIterator<'a>;
2224 pub fn LLVMRustArchiveIteratorNext(
2225 AIR: &ArchiveIterator<'a>,
2226 ) -> Option<&'a mut ArchiveChild<'a>>;
2227 pub fn LLVMRustArchiveChildName(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2228 pub fn LLVMRustArchiveChildData(ACR: &ArchiveChild<'_>, size: &mut size_t) -> *const c_char;
2229 pub fn LLVMRustArchiveChildFree(ACR: &'a mut ArchiveChild<'a>);
2230 pub fn LLVMRustArchiveIteratorFree(AIR: &'a mut ArchiveIterator<'a>);
2231 pub fn LLVMRustDestroyArchive(AR: &'static mut Archive);
2232
2233 #[allow(improper_ctypes)]
2234 pub fn LLVMRustGetSectionName(
2235 SI: &SectionIterator<'_>,
2236 data: &mut Option<std::ptr::NonNull<c_char>>,
2237 ) -> size_t;
2238
2239 #[allow(improper_ctypes)]
2240 pub fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
2241
2242 pub fn LLVMContextSetDiagnosticHandler(
2243 C: &Context,
2244 Handler: DiagnosticHandler,
2245 DiagnosticContext: *mut c_void,
2246 );
2247
2248 #[allow(improper_ctypes)]
2249 pub fn LLVMRustUnpackOptimizationDiagnostic(
2250 DI: &'a DiagnosticInfo,
2251 pass_name_out: &RustString,
2252 function_out: &mut Option<&'a Value>,
2253 loc_line_out: &mut c_uint,
2254 loc_column_out: &mut c_uint,
2255 loc_filename_out: &RustString,
2256 message_out: &RustString,
2257 );
2258
2259 pub fn LLVMRustUnpackInlineAsmDiagnostic(
2260 DI: &'a DiagnosticInfo,
2261 level_out: &mut DiagnosticLevel,
2262 cookie_out: &mut c_uint,
2263 message_out: &mut Option<&'a Twine>,
2264 instruction_out: &mut Option<&'a Value>,
2265 );
2266
2267 #[allow(improper_ctypes)]
2268 pub fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
2269 pub fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
2270
2271 pub fn LLVMRustSetInlineAsmDiagnosticHandler(
2272 C: &Context,
2273 H: InlineAsmDiagHandler,
2274 CX: *mut c_void,
2275 );
2276
2277 #[allow(improper_ctypes)]
2278 pub fn LLVMRustUnpackSMDiagnostic(
2279 d: &SMDiagnostic,
2280 message_out: &RustString,
2281 buffer_out: &RustString,
2282 level_out: &mut DiagnosticLevel,
2283 loc_out: &mut c_uint,
2284 ranges_out: *mut c_uint,
2285 num_ranges: &mut usize,
2286 ) -> bool;
2287
2288 pub fn LLVMRustWriteArchive(
2289 Dst: *const c_char,
2290 NumMembers: size_t,
2291 Members: *const &RustArchiveMember<'_>,
2292 WriteSymbtab: bool,
2293 Kind: ArchiveKind,
2294 ) -> LLVMRustResult;
2295 pub fn LLVMRustArchiveMemberNew(
2296 Filename: *const c_char,
2297 Name: *const c_char,
2298 Child: Option<&ArchiveChild<'a>>,
2299 ) -> &'a mut RustArchiveMember<'a>;
2300 pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
2301
2302 pub fn LLVMRustSetDataLayoutFromTargetMachine(M: &'a Module, TM: &'a TargetMachine);
2303
2304 pub fn LLVMRustBuildOperandBundleDef(
2305 Name: *const c_char,
2306 Inputs: *const &'a Value,
2307 NumInputs: c_uint,
2308 ) -> &'a mut OperandBundleDef<'a>;
2309 pub fn LLVMRustFreeOperandBundleDef(Bundle: &'a mut OperandBundleDef<'a>);
2310
2311 pub fn LLVMRustPositionBuilderAtStart(B: &Builder<'a>, BB: &'a BasicBlock);
2312
2313 pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char, NameLen: size_t);
2314 pub fn LLVMRustUnsetComdat(V: &Value);
2315 pub fn LLVMRustSetModulePICLevel(M: &Module);
2316 pub fn LLVMRustSetModulePIELevel(M: &Module);
2317 pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
2318 pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
2319 pub fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
2320 pub fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
2321 pub fn LLVMRustModuleCost(M: &Module) -> u64;
2322
2323 pub fn LLVMRustThinLTOBufferCreate(M: &Module) -> &'static mut ThinLTOBuffer;
2324 pub fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
2325 pub fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
2326 pub fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
2327 pub fn LLVMRustCreateThinLTOData(
2328 Modules: *const ThinLTOModule,
2329 NumModules: c_uint,
2330 PreservedSymbols: *const *const c_char,
2331 PreservedSymbolsLen: c_uint,
2332 ) -> Option<&'static mut ThinLTOData>;
2333 pub fn LLVMRustPrepareThinLTORename(
2334 Data: &ThinLTOData,
2335 Module: &Module,
2336 Target: &TargetMachine,
2337 ) -> bool;
2338 pub fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
2339 pub fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
2340 pub fn LLVMRustPrepareThinLTOImport(
2341 Data: &ThinLTOData,
2342 Module: &Module,
2343 Target: &TargetMachine,
2344 ) -> bool;
2345 pub fn LLVMRustGetThinLTOModuleImports(
2346 Data: *const ThinLTOData,
2347 ModuleNameCallback: ThinLTOModuleNameCallback,
2348 CallbackPayload: *mut c_void,
2349 );
2350 pub fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
2351 pub fn LLVMRustParseBitcodeForLTO(
2352 Context: &Context,
2353 Data: *const u8,
2354 len: usize,
2355 Identifier: *const c_char,
2356 ) -> Option<&Module>;
2357 pub fn LLVMRustGetBitcodeSliceFromObjectData(
2358 Data: *const u8,
2359 len: usize,
2360 out_len: &mut usize,
2361 ) -> *const u8;
2362 pub fn LLVMRustThinLTOGetDICompileUnit(
2363 M: &Module,
2364 CU1: &mut *mut c_void,
2365 CU2: &mut *mut c_void,
2366 );
2367 pub fn LLVMRustThinLTOPatchDICompileUnit(M: &Module, CU: *mut c_void);
2368
2369 pub fn LLVMRustLinkerNew(M: &'a Module) -> &'a mut Linker<'a>;
2370 pub fn LLVMRustLinkerAdd(
2371 linker: &Linker<'_>,
2372 bytecode: *const c_char,
2373 bytecode_len: usize,
2374 ) -> bool;
2375 pub fn LLVMRustLinkerFree(linker: &'a mut Linker<'a>);
2376 #[allow(improper_ctypes)]
2377 pub fn LLVMRustComputeLTOCacheKey(
2378 key_out: &RustString,
2379 mod_id: *const c_char,
2380 data: &ThinLTOData,
2381 );
2382 }