2024-12-12 09:41:01 +00:00
|
|
|
//! Bindings to the LLVM-C API (`LLVM*`), and to our own `extern "C"` wrapper
|
|
|
|
//! functions around the unstable LLVM C++ API (`LLVMRust*`).
|
|
|
|
//!
|
|
|
|
//! ## Passing pointer/length strings as `*const c_uchar`
|
|
|
|
//!
|
|
|
|
//! Normally it's a good idea for Rust-side bindings to match the corresponding
|
|
|
|
//! C-side function declarations as closely as possible. But when passing `&str`
|
|
|
|
//! or `&[u8]` data as a pointer/length pair, it's more convenient to declare
|
|
|
|
//! the Rust-side pointer as `*const c_uchar` instead of `*const c_char`.
|
|
|
|
//! Both pointer types have the same ABI, and using `*const c_uchar` avoids
|
|
|
|
//! the need for an extra cast from `*const u8` on the Rust side.
|
|
|
|
|
2019-07-23 17:34:17 +00:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
|
2024-10-25 12:34:10 +00:00
|
|
|
use std::fmt::Debug;
|
2018-07-16 13:02:31 +00:00
|
|
|
use std::marker::PhantomData;
|
2024-10-28 06:25:40 +00:00
|
|
|
use std::ptr;
|
2024-07-28 22:13:50 +00:00
|
|
|
|
2025-02-01 02:43:30 +00:00
|
|
|
use bitflags::bitflags;
|
|
|
|
use libc::{c_char, c_int, c_uchar, c_uint, c_ulonglong, c_void, size_t};
|
2024-10-25 11:06:29 +00:00
|
|
|
use rustc_macros::TryFromU32;
|
2024-09-30 22:55:10 +00:00
|
|
|
use rustc_target::spec::SymbolVisibility;
|
2024-07-28 22:13:50 +00:00
|
|
|
|
2018-07-13 11:43:12 +00:00
|
|
|
use super::RustString;
|
2018-05-29 17:41:36 +00:00
|
|
|
use super::debuginfo::{
|
2018-07-04 13:36:49 +00:00
|
|
|
DIArray, DIBasicType, DIBuilder, DICompositeType, DIDerivedType, DIDescriptor, DIEnumerator,
|
2025-02-01 02:55:44 +00:00
|
|
|
DIFile, DIFlags, DIGlobalVariableExpression, DILocation, DISPFlags, DIScope, DISubprogram,
|
|
|
|
DISubrange, DITemplateTypeParameter, DIType, DIVariable, DebugEmissionKind, DebugNameTableKind,
|
2018-05-29 17:41:36 +00:00
|
|
|
};
|
2025-02-01 02:43:30 +00:00
|
|
|
use crate::llvm;
|
2016-08-02 21:25:19 +00:00
|
|
|
|
2024-12-12 09:54:33 +00:00
|
|
|
/// In the LLVM-C API, boolean values are passed as `typedef int LLVMBool`,
|
|
|
|
/// which has a different ABI from Rust or C++ `bool`.
|
|
|
|
pub type Bool = c_int;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
|
|
|
pub const True: Bool = 1 as Bool;
|
|
|
|
pub const False: Bool = 0 as Bool;
|
|
|
|
|
2024-10-25 12:34:10 +00:00
|
|
|
/// Wrapper for a raw enum value returned from LLVM's C APIs.
|
|
|
|
///
|
|
|
|
/// For C enums returned by LLVM, it's risky to use a Rust enum as the return
|
|
|
|
/// type, because it would be UB if a later version of LLVM adds a new enum
|
|
|
|
/// value and returns it. Instead, return this raw wrapper, then convert to the
|
|
|
|
/// Rust-side enum explicitly.
|
|
|
|
#[repr(transparent)]
|
|
|
|
pub struct RawEnum<T> {
|
|
|
|
value: u32,
|
|
|
|
/// We don't own or consume a `T`, but we can produce one.
|
|
|
|
_rust_side_type: PhantomData<fn() -> T>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<T: TryFrom<u32>> RawEnum<T> {
|
|
|
|
#[track_caller]
|
|
|
|
pub(crate) fn to_rust(self) -> T
|
|
|
|
where
|
|
|
|
T::Error: Debug,
|
|
|
|
{
|
|
|
|
// If this fails, the Rust-side enum is out of sync with LLVM's enum.
|
|
|
|
T::try_from(self.value).expect("enum value returned by LLVM should be known")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2018-07-10 15:00:02 +00:00
|
|
|
#[allow(dead_code)] // Variants constructed by C++.
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum LLVMRustResult {
|
|
|
|
Success,
|
|
|
|
Failure,
|
|
|
|
}
|
2021-03-08 20:42:54 +00:00
|
|
|
|
2024-10-29 02:38:17 +00:00
|
|
|
/// Must match the layout of `LLVMRustModuleFlagMergeBehavior`.
|
2022-01-19 14:51:59 +00:00
|
|
|
///
|
|
|
|
/// When merging modules (e.g. during LTO), their metadata flags are combined. Conflicts are
|
|
|
|
/// resolved according to the merge behaviors specified here. Flags differing only in merge
|
|
|
|
/// behavior are still considered to be in conflict.
|
|
|
|
///
|
|
|
|
/// In order for Rust-C LTO to work, we must specify behaviors compatible with Clang. Notably,
|
|
|
|
/// 'Error' and 'Warning' cannot be mixed for a given flag.
|
2024-10-29 02:38:17 +00:00
|
|
|
///
|
|
|
|
/// There is a stable LLVM-C version of this enum (`LLVMModuleFlagBehavior`),
|
|
|
|
/// but as of LLVM 19 it does not support all of the enum values in the unstable
|
|
|
|
/// C++ API.
|
2022-01-19 14:51:59 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
#[repr(C)]
|
2024-10-29 02:38:17 +00:00
|
|
|
pub enum ModuleFlagMergeBehavior {
|
2022-01-19 14:51:59 +00:00
|
|
|
Error = 1,
|
|
|
|
Warning = 2,
|
|
|
|
Require = 3,
|
|
|
|
Override = 4,
|
|
|
|
Append = 5,
|
|
|
|
AppendUnique = 6,
|
|
|
|
Max = 7,
|
2022-12-20 03:06:30 +00:00
|
|
|
Min = 8,
|
2022-01-19 14:51:59 +00:00
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
// Consts for the LLVM CallConv type, pre-cast to usize.
|
|
|
|
|
|
|
|
/// LLVM CallingConv::ID. Should we wrap this?
|
2023-08-27 00:42:59 +00:00
|
|
|
///
|
|
|
|
/// See <https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/IR/CallingConv.h>
|
2025-01-01 20:42:45 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq, Debug, TryFromU32)]
|
2016-08-02 20:10:10 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub enum CallConv {
|
|
|
|
CCallConv = 0,
|
|
|
|
FastCallConv = 8,
|
|
|
|
ColdCallConv = 9,
|
2023-08-27 00:42:59 +00:00
|
|
|
PreserveMost = 14,
|
|
|
|
PreserveAll = 15,
|
|
|
|
Tail = 18,
|
2016-08-02 20:10:10 +00:00
|
|
|
X86StdcallCallConv = 64,
|
|
|
|
X86FastcallCallConv = 65,
|
2016-11-16 22:33:23 +00:00
|
|
|
ArmAapcsCallConv = 67,
|
2016-12-19 04:45:20 +00:00
|
|
|
Msp430Intr = 69,
|
2017-05-17 13:40:46 +00:00
|
|
|
X86_ThisCall = 70,
|
2016-12-22 21:24:29 +00:00
|
|
|
PtxKernel = 71,
|
2016-06-27 00:34:02 +00:00
|
|
|
X86_64_SysV = 78,
|
2016-08-02 20:10:10 +00:00
|
|
|
X86_64_Win64 = 79,
|
2016-10-22 13:07:35 +00:00
|
|
|
X86_VectorCall = 80,
|
2017-02-14 20:39:42 +00:00
|
|
|
X86_Intr = 83,
|
2016-05-06 13:32:10 +00:00
|
|
|
AvrNonBlockingInterrupt = 84,
|
|
|
|
AvrInterrupt = 85,
|
2025-01-02 21:42:10 +00:00
|
|
|
AmdgpuKernel = 91,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2024-10-25 11:06:29 +00:00
|
|
|
/// Must match the layout of `LLVMLinkage`.
|
|
|
|
#[derive(Copy, Clone, PartialEq, TryFromU32)]
|
2016-08-02 20:10:10 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub enum Linkage {
|
|
|
|
ExternalLinkage = 0,
|
|
|
|
AvailableExternallyLinkage = 1,
|
|
|
|
LinkOnceAnyLinkage = 2,
|
|
|
|
LinkOnceODRLinkage = 3,
|
2024-10-25 11:06:29 +00:00
|
|
|
#[deprecated = "marked obsolete by LLVM"]
|
|
|
|
LinkOnceODRAutoHideLinkage = 4,
|
|
|
|
WeakAnyLinkage = 5,
|
|
|
|
WeakODRLinkage = 6,
|
|
|
|
AppendingLinkage = 7,
|
|
|
|
InternalLinkage = 8,
|
|
|
|
PrivateLinkage = 9,
|
|
|
|
#[deprecated = "marked obsolete by LLVM"]
|
|
|
|
DLLImportLinkage = 10,
|
|
|
|
#[deprecated = "marked obsolete by LLVM"]
|
|
|
|
DLLExportLinkage = 11,
|
|
|
|
ExternalWeakLinkage = 12,
|
|
|
|
#[deprecated = "marked obsolete by LLVM"]
|
|
|
|
GhostLinkage = 13,
|
|
|
|
CommonLinkage = 14,
|
|
|
|
LinkerPrivateLinkage = 15,
|
|
|
|
LinkerPrivateWeakLinkage = 16,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2024-10-25 11:26:15 +00:00
|
|
|
/// Must match the layout of `LLVMVisibility`.
|
2016-11-28 22:44:51 +00:00
|
|
|
#[repr(C)]
|
2024-10-25 11:26:15 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq, TryFromU32)]
|
2016-11-28 22:44:51 +00:00
|
|
|
pub enum Visibility {
|
|
|
|
Default = 0,
|
|
|
|
Hidden = 1,
|
|
|
|
Protected = 2,
|
|
|
|
}
|
|
|
|
|
2024-09-30 22:55:10 +00:00
|
|
|
impl Visibility {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(visibility: SymbolVisibility) -> Self {
|
2024-09-30 22:55:10 +00:00
|
|
|
match visibility {
|
|
|
|
SymbolVisibility::Hidden => Visibility::Hidden,
|
|
|
|
SymbolVisibility::Protected => Visibility::Protected,
|
|
|
|
SymbolVisibility::Interposable => Visibility::Default,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-11 00:00:00 +00:00
|
|
|
/// LLVMUnnamedAddr
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum UnnamedAddr {
|
|
|
|
No,
|
|
|
|
Local,
|
|
|
|
Global,
|
|
|
|
}
|
|
|
|
|
2016-08-02 21:25:19 +00:00
|
|
|
/// LLVMDLLStorageClass
|
2016-08-02 20:10:10 +00:00
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub enum DLLStorageClass {
|
2018-07-10 15:00:02 +00:00
|
|
|
#[allow(dead_code)]
|
2016-10-22 13:07:35 +00:00
|
|
|
Default = 0,
|
|
|
|
DllImport = 1, // Function to be imported from DLL.
|
2018-07-10 15:00:02 +00:00
|
|
|
#[allow(dead_code)]
|
2016-10-22 13:07:35 +00:00
|
|
|
DllExport = 2, // Function to be accessible from DLL.
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2024-11-04 01:11:01 +00:00
|
|
|
/// Must match the layout of `LLVMRustAttributeKind`.
|
2016-11-16 22:36:08 +00:00
|
|
|
/// Semantically a subset of the C++ enum llvm::Attribute::AttrKind,
|
|
|
|
/// though it is not ABI compatible (since it's a C++ enum)
|
|
|
|
#[repr(C)]
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
2022-02-21 16:19:16 +00:00
|
|
|
pub enum AttributeKind {
|
2016-11-16 22:36:08 +00:00
|
|
|
AlwaysInline = 0,
|
|
|
|
ByVal = 1,
|
|
|
|
Cold = 2,
|
|
|
|
InlineHint = 3,
|
|
|
|
MinSize = 4,
|
|
|
|
Naked = 5,
|
|
|
|
NoAlias = 6,
|
|
|
|
NoCapture = 7,
|
|
|
|
NoInline = 8,
|
|
|
|
NonNull = 9,
|
|
|
|
NoRedZone = 10,
|
|
|
|
NoReturn = 11,
|
|
|
|
NoUnwind = 12,
|
|
|
|
OptimizeForSize = 13,
|
|
|
|
ReadOnly = 14,
|
|
|
|
SExt = 15,
|
|
|
|
StructRet = 16,
|
|
|
|
UWTable = 17,
|
|
|
|
ZExt = 18,
|
2016-12-21 18:42:10 +00:00
|
|
|
InReg = 19,
|
2016-12-30 04:28:11 +00:00
|
|
|
SanitizeThread = 20,
|
2017-02-03 23:58:47 +00:00
|
|
|
SanitizeAddress = 21,
|
2016-12-30 04:28:11 +00:00
|
|
|
SanitizeMemory = 22,
|
2018-09-26 16:19:55 +00:00
|
|
|
NonLazyBind = 23,
|
2018-10-27 12:29:06 +00:00
|
|
|
OptimizeNone = 24,
|
2020-02-17 21:36:01 +00:00
|
|
|
ReadNone = 26,
|
2021-01-23 02:32:38 +00:00
|
|
|
SanitizeHWAddress = 28,
|
2021-02-20 16:02:23 +00:00
|
|
|
WillReturn = 29,
|
add rustc option for using LLVM stack smash protection
LLVM has built-in heuristics for adding stack canaries to functions. These
heuristics can be selected with LLVM function attributes. This patch adds a
rustc option `-Z stack-protector={none,basic,strong,all}` which controls the use
of these attributes. This gives rustc the same stack smash protection support as
clang offers through options `-fno-stack-protector`, `-fstack-protector`,
`-fstack-protector-strong`, and `-fstack-protector-all`. The protection this can
offer is demonstrated in test/ui/abi/stack-protector.rs. This fills a gap in the
current list of rustc exploit
mitigations (https://doc.rust-lang.org/rustc/exploit-mitigations.html),
originally discussed in #15179.
Stack smash protection adds runtime overhead and is therefore still off by
default, but now users have the option to trade performance for security as they
see fit. An example use case is adding Rust code in an existing C/C++ code base
compiled with stack smash protection. Without the ability to add stack smash
protection to the Rust code, the code base artifacts could be exploitable in
ways not possible if the code base remained pure C/C++.
Stack smash protection support is present in LLVM for almost all the current
tier 1/tier 2 targets: see
test/assembly/stack-protector/stack-protector-target-support.rs. The one
exception is nvptx64-nvidia-cuda. This patch follows clang's example, and adds a
warning message printed if stack smash protection is used with this target (see
test/ui/stack-protector/warn-stack-protector-unsupported.rs). Support for tier 3
targets has not been checked.
Since the heuristics are applied at the LLVM level, the heuristics are expected
to add stack smash protection to a fraction of functions comparable to C/C++.
Some experiments demonstrating how Rust code is affected by the different
heuristics can be found in
test/assembly/stack-protector/stack-protector-heuristics-effect.rs. There is
potential for better heuristics using Rust-specific safety information. For
example it might be reasonable to skip stack smash protection in functions which
transitively only use safe Rust code, or which uses only a subset of functions
the user declares safe (such as anything under `std.*`). Such alternative
heuristics could be added at a later point.
LLVM also offers a "safestack" sanitizer as an alternative way to guard against
stack smashing (see #26612). This could possibly also be included as a
stack-protection heuristic. An alternative is to add it as a sanitizer (#39699).
This is what clang does: safestack is exposed with option
`-fsanitize=safe-stack`.
The options are only supported by the LLVM backend, but as with other codegen
options it is visible in the main codegen option help menu. The heuristic names
"basic", "strong", and "all" are hopefully sufficiently generic to be usable in
other backends as well.
Reviewed-by: Nikita Popov <nikic@php.net>
Extra commits during review:
- [address-review] make the stack-protector option unstable
- [address-review] reduce detail level of stack-protector option help text
- [address-review] correct grammar in comment
- [address-review] use compiler flag to avoid merging functions in test
- [address-review] specify min LLVM version in fortanix stack-protector test
Only for Fortanix test, since this target specifically requests the
`--x86-experimental-lvi-inline-asm-hardening` flag.
- [address-review] specify required LLVM components in stack-protector tests
- move stack protector option enum closer to other similar option enums
- rustc_interface/tests: sort debug option list in tracking hash test
- add an explicit `none` stack-protector option
Revert "set LLVM requirements for all stack protector support test revisions"
This reverts commit a49b74f92a4e7d701d6f6cf63d207a8aff2e0f68.
2021-04-06 19:37:49 +00:00
|
|
|
StackProtectReq = 30,
|
|
|
|
StackProtectStrong = 31,
|
|
|
|
StackProtect = 32,
|
2022-02-05 06:00:37 +00:00
|
|
|
NoUndef = 33,
|
2021-12-03 21:11:13 +00:00
|
|
|
SanitizeMemTag = 34,
|
2022-07-07 02:07:52 +00:00
|
|
|
NoCfCheck = 35,
|
2022-06-17 18:14:58 +00:00
|
|
|
ShadowCallStack = 36,
|
2022-03-21 19:30:54 +00:00
|
|
|
AllocSize = 37,
|
|
|
|
AllocatedPointer = 38,
|
|
|
|
AllocAlign = 39,
|
2023-05-19 23:30:15 +00:00
|
|
|
SanitizeSafeStack = 40,
|
2023-10-18 14:58:17 +00:00
|
|
|
FnRetThunkExtern = 41,
|
2024-02-19 14:02:49 +00:00
|
|
|
Writable = 42,
|
|
|
|
DeadOnUnwind = 43,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// LLVMIntPredicate
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum IntPredicate {
|
|
|
|
IntEQ = 32,
|
|
|
|
IntNE = 33,
|
|
|
|
IntUGT = 34,
|
|
|
|
IntUGE = 35,
|
|
|
|
IntULT = 36,
|
|
|
|
IntULE = 37,
|
|
|
|
IntSGT = 38,
|
|
|
|
IntSGE = 39,
|
|
|
|
IntSLT = 40,
|
|
|
|
IntSLE = 41,
|
|
|
|
}
|
|
|
|
|
2018-08-21 14:31:36 +00:00
|
|
|
impl IntPredicate {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(intpre: rustc_codegen_ssa::common::IntPredicate) -> Self {
|
2024-09-18 04:07:12 +00:00
|
|
|
use rustc_codegen_ssa::common::IntPredicate as Common;
|
2018-08-20 16:16:51 +00:00
|
|
|
match intpre {
|
2024-09-18 04:07:12 +00:00
|
|
|
Common::IntEQ => Self::IntEQ,
|
|
|
|
Common::IntNE => Self::IntNE,
|
|
|
|
Common::IntUGT => Self::IntUGT,
|
|
|
|
Common::IntUGE => Self::IntUGE,
|
|
|
|
Common::IntULT => Self::IntULT,
|
|
|
|
Common::IntULE => Self::IntULE,
|
|
|
|
Common::IntSGT => Self::IntSGT,
|
|
|
|
Common::IntSGE => Self::IntSGE,
|
|
|
|
Common::IntSLT => Self::IntSLT,
|
|
|
|
Common::IntSLE => Self::IntSLE,
|
2018-08-20 16:16:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMRealPredicate
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum RealPredicate {
|
|
|
|
RealPredicateFalse = 0,
|
|
|
|
RealOEQ = 1,
|
|
|
|
RealOGT = 2,
|
|
|
|
RealOGE = 3,
|
|
|
|
RealOLT = 4,
|
|
|
|
RealOLE = 5,
|
|
|
|
RealONE = 6,
|
|
|
|
RealORD = 7,
|
|
|
|
RealUNO = 8,
|
|
|
|
RealUEQ = 9,
|
|
|
|
RealUGT = 10,
|
|
|
|
RealUGE = 11,
|
|
|
|
RealULT = 12,
|
|
|
|
RealULE = 13,
|
|
|
|
RealUNE = 14,
|
|
|
|
RealPredicateTrue = 15,
|
|
|
|
}
|
|
|
|
|
2021-10-12 00:00:00 +00:00
|
|
|
impl RealPredicate {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(realp: rustc_codegen_ssa::common::RealPredicate) -> Self {
|
2024-09-18 04:07:12 +00:00
|
|
|
use rustc_codegen_ssa::common::RealPredicate as Common;
|
2021-10-12 00:00:00 +00:00
|
|
|
match realp {
|
2024-09-18 04:07:12 +00:00
|
|
|
Common::RealPredicateFalse => Self::RealPredicateFalse,
|
|
|
|
Common::RealOEQ => Self::RealOEQ,
|
|
|
|
Common::RealOGT => Self::RealOGT,
|
|
|
|
Common::RealOGE => Self::RealOGE,
|
|
|
|
Common::RealOLT => Self::RealOLT,
|
|
|
|
Common::RealOLE => Self::RealOLE,
|
|
|
|
Common::RealONE => Self::RealONE,
|
|
|
|
Common::RealORD => Self::RealORD,
|
|
|
|
Common::RealUNO => Self::RealUNO,
|
|
|
|
Common::RealUEQ => Self::RealUEQ,
|
|
|
|
Common::RealUGT => Self::RealUGT,
|
|
|
|
Common::RealUGE => Self::RealUGE,
|
|
|
|
Common::RealULT => Self::RealULT,
|
|
|
|
Common::RealULE => Self::RealULE,
|
|
|
|
Common::RealUNE => Self::RealUNE,
|
|
|
|
Common::RealPredicateTrue => Self::RealPredicateTrue,
|
2021-10-12 00:00:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 21:25:19 +00:00
|
|
|
/// LLVMTypeKind
|
2016-08-02 20:10:10 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq, Debug)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum TypeKind {
|
2016-10-22 13:07:35 +00:00
|
|
|
Void = 0,
|
|
|
|
Half = 1,
|
|
|
|
Float = 2,
|
|
|
|
Double = 3,
|
|
|
|
X86_FP80 = 4,
|
|
|
|
FP128 = 5,
|
2018-09-28 10:18:03 +00:00
|
|
|
PPC_FP128 = 6,
|
2016-10-22 13:07:35 +00:00
|
|
|
Label = 7,
|
|
|
|
Integer = 8,
|
|
|
|
Function = 9,
|
|
|
|
Struct = 10,
|
|
|
|
Array = 11,
|
|
|
|
Pointer = 12,
|
|
|
|
Vector = 13,
|
|
|
|
Metadata = 14,
|
|
|
|
Token = 16,
|
2020-06-26 01:52:41 +00:00
|
|
|
ScalableVector = 17,
|
|
|
|
BFloat = 18,
|
2020-11-03 21:47:16 +00:00
|
|
|
X86_AMX = 19,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2018-09-07 20:25:50 +00:00
|
|
|
impl TypeKind {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn to_generic(self) -> rustc_codegen_ssa::common::TypeKind {
|
2024-09-18 04:07:12 +00:00
|
|
|
use rustc_codegen_ssa::common::TypeKind as Common;
|
2018-09-07 20:25:50 +00:00
|
|
|
match self {
|
2024-09-18 04:07:12 +00:00
|
|
|
Self::Void => Common::Void,
|
|
|
|
Self::Half => Common::Half,
|
|
|
|
Self::Float => Common::Float,
|
|
|
|
Self::Double => Common::Double,
|
|
|
|
Self::X86_FP80 => Common::X86_FP80,
|
|
|
|
Self::FP128 => Common::FP128,
|
|
|
|
Self::PPC_FP128 => Common::PPC_FP128,
|
|
|
|
Self::Label => Common::Label,
|
|
|
|
Self::Integer => Common::Integer,
|
|
|
|
Self::Function => Common::Function,
|
|
|
|
Self::Struct => Common::Struct,
|
|
|
|
Self::Array => Common::Array,
|
|
|
|
Self::Pointer => Common::Pointer,
|
|
|
|
Self::Vector => Common::Vector,
|
|
|
|
Self::Metadata => Common::Metadata,
|
|
|
|
Self::Token => Common::Token,
|
|
|
|
Self::ScalableVector => Common::ScalableVector,
|
|
|
|
Self::BFloat => Common::BFloat,
|
|
|
|
Self::X86_AMX => Common::X86_AMX,
|
2018-09-07 20:25:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMAtomicRmwBinOp
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum AtomicRmwBinOp {
|
|
|
|
AtomicXchg = 0,
|
2016-10-22 13:07:35 +00:00
|
|
|
AtomicAdd = 1,
|
|
|
|
AtomicSub = 2,
|
|
|
|
AtomicAnd = 3,
|
2016-08-02 20:10:10 +00:00
|
|
|
AtomicNand = 4,
|
2016-10-22 13:07:35 +00:00
|
|
|
AtomicOr = 5,
|
|
|
|
AtomicXor = 6,
|
|
|
|
AtomicMax = 7,
|
|
|
|
AtomicMin = 8,
|
2016-08-02 20:10:10 +00:00
|
|
|
AtomicUMax = 9,
|
|
|
|
AtomicUMin = 10,
|
|
|
|
}
|
|
|
|
|
2018-08-21 15:54:12 +00:00
|
|
|
impl AtomicRmwBinOp {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(op: rustc_codegen_ssa::common::AtomicRmwBinOp) -> Self {
|
2024-09-18 04:07:12 +00:00
|
|
|
use rustc_codegen_ssa::common::AtomicRmwBinOp as Common;
|
2018-08-21 15:54:12 +00:00
|
|
|
match op {
|
2024-09-18 04:07:12 +00:00
|
|
|
Common::AtomicXchg => Self::AtomicXchg,
|
|
|
|
Common::AtomicAdd => Self::AtomicAdd,
|
|
|
|
Common::AtomicSub => Self::AtomicSub,
|
|
|
|
Common::AtomicAnd => Self::AtomicAnd,
|
|
|
|
Common::AtomicNand => Self::AtomicNand,
|
|
|
|
Common::AtomicOr => Self::AtomicOr,
|
|
|
|
Common::AtomicXor => Self::AtomicXor,
|
|
|
|
Common::AtomicMax => Self::AtomicMax,
|
|
|
|
Common::AtomicMin => Self::AtomicMin,
|
|
|
|
Common::AtomicUMax => Self::AtomicUMax,
|
|
|
|
Common::AtomicUMin => Self::AtomicUMin,
|
2018-08-21 15:54:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMAtomicOrdering
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum AtomicOrdering {
|
2018-07-10 15:00:02 +00:00
|
|
|
#[allow(dead_code)]
|
2016-08-02 20:10:10 +00:00
|
|
|
NotAtomic = 0,
|
|
|
|
Unordered = 1,
|
|
|
|
Monotonic = 2,
|
|
|
|
// Consume = 3, // Not specified yet.
|
|
|
|
Acquire = 4,
|
|
|
|
Release = 5,
|
|
|
|
AcquireRelease = 6,
|
2016-10-22 13:07:35 +00:00
|
|
|
SequentiallyConsistent = 7,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2018-08-21 16:08:20 +00:00
|
|
|
impl AtomicOrdering {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(ao: rustc_codegen_ssa::common::AtomicOrdering) -> Self {
|
2024-09-18 04:07:12 +00:00
|
|
|
use rustc_codegen_ssa::common::AtomicOrdering as Common;
|
2018-08-21 16:08:20 +00:00
|
|
|
match ao {
|
2024-09-18 04:07:12 +00:00
|
|
|
Common::Unordered => Self::Unordered,
|
|
|
|
Common::Relaxed => Self::Monotonic,
|
|
|
|
Common::Acquire => Self::Acquire,
|
|
|
|
Common::Release => Self::Release,
|
|
|
|
Common::AcquireRelease => Self::AcquireRelease,
|
|
|
|
Common::SequentiallyConsistent => Self::SequentiallyConsistent,
|
2018-08-21 16:08:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMRustFileType
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum FileType {
|
|
|
|
AssemblyFile,
|
|
|
|
ObjectFile,
|
|
|
|
}
|
|
|
|
|
2016-09-01 18:52:33 +00:00
|
|
|
/// LLVMMetadataType
|
2016-08-02 20:10:10 +00:00
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum MetadataType {
|
|
|
|
MD_dbg = 0,
|
|
|
|
MD_tbaa = 1,
|
|
|
|
MD_prof = 2,
|
|
|
|
MD_fpmath = 3,
|
|
|
|
MD_range = 4,
|
|
|
|
MD_tbaa_struct = 5,
|
|
|
|
MD_invariant_load = 6,
|
|
|
|
MD_alias_scope = 7,
|
|
|
|
MD_noalias = 8,
|
|
|
|
MD_nontemporal = 9,
|
|
|
|
MD_mem_parallel_loop_access = 10,
|
|
|
|
MD_nonnull = 11,
|
2024-07-26 18:36:21 +00:00
|
|
|
MD_unpredictable = 15,
|
2022-02-16 04:45:09 +00:00
|
|
|
MD_align = 17,
|
2021-10-07 22:33:13 +00:00
|
|
|
MD_type = 19,
|
2022-04-21 13:02:54 +00:00
|
|
|
MD_vcall_visibility = 28,
|
2022-02-12 19:01:33 +00:00
|
|
|
MD_noundef = 29,
|
2022-11-22 05:29:00 +00:00
|
|
|
MD_kcfi_type = 36,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2016-08-02 21:25:19 +00:00
|
|
|
/// LLVMRustAsmDialect
|
2022-01-12 00:00:00 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum AsmDialect {
|
2016-08-02 21:25:19 +00:00
|
|
|
Att,
|
|
|
|
Intel,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// LLVMRustCodeGenOptLevel
|
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum CodeGenOptLevel {
|
|
|
|
None,
|
|
|
|
Less,
|
|
|
|
Default,
|
|
|
|
Aggressive,
|
|
|
|
}
|
|
|
|
|
2020-01-05 18:16:58 +00:00
|
|
|
/// LLVMRustPassBuilderOptLevel
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum PassBuilderOptLevel {
|
|
|
|
O0,
|
|
|
|
O1,
|
|
|
|
O2,
|
|
|
|
O3,
|
|
|
|
Os,
|
|
|
|
Oz,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// LLVMRustOptStage
|
|
|
|
#[derive(PartialEq)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum OptStage {
|
|
|
|
PreLinkNoLTO,
|
|
|
|
PreLinkThinLTO,
|
|
|
|
PreLinkFatLTO,
|
|
|
|
ThinLTO,
|
|
|
|
FatLTO,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// LLVMRustSanitizerOptions
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct SanitizerOptions {
|
|
|
|
pub sanitize_address: bool,
|
2020-06-14 00:00:00 +00:00
|
|
|
pub sanitize_address_recover: bool,
|
2023-07-11 23:19:42 +00:00
|
|
|
pub sanitize_cfi: bool,
|
2024-02-01 21:16:30 +00:00
|
|
|
pub sanitize_dataflow: bool,
|
|
|
|
pub sanitize_dataflow_abilist: *const *const c_char,
|
|
|
|
pub sanitize_dataflow_abilist_len: size_t,
|
2023-07-11 23:19:42 +00:00
|
|
|
pub sanitize_kcfi: bool,
|
2020-06-14 00:00:00 +00:00
|
|
|
pub sanitize_memory: bool,
|
|
|
|
pub sanitize_memory_recover: bool,
|
2020-01-05 18:16:58 +00:00
|
|
|
pub sanitize_memory_track_origins: c_int,
|
2020-06-14 00:00:00 +00:00
|
|
|
pub sanitize_thread: bool,
|
2021-01-23 02:32:38 +00:00
|
|
|
pub sanitize_hwaddress: bool,
|
|
|
|
pub sanitize_hwaddress_recover: bool,
|
2022-09-11 23:36:19 +00:00
|
|
|
pub sanitize_kernel_address: bool,
|
|
|
|
pub sanitize_kernel_address_recover: bool,
|
2020-01-05 18:16:58 +00:00
|
|
|
}
|
|
|
|
|
2024-12-30 17:10:59 +00:00
|
|
|
/// LLVMRustRelocModel
|
2016-08-02 20:10:10 +00:00
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
#[repr(C)]
|
2020-04-23 17:49:00 +00:00
|
|
|
pub enum RelocModel {
|
2017-04-28 22:21:59 +00:00
|
|
|
Static,
|
|
|
|
PIC,
|
|
|
|
DynamicNoPic,
|
|
|
|
ROPI,
|
|
|
|
RWPI,
|
|
|
|
ROPI_RWPI,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2024-12-30 17:10:59 +00:00
|
|
|
/// LLVMRustFloatABI
|
|
|
|
#[derive(Copy, Clone, PartialEq)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum FloatAbi {
|
|
|
|
Default,
|
|
|
|
Soft,
|
|
|
|
Hard,
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMRustCodeModel
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum CodeModel {
|
2020-05-07 00:34:27 +00:00
|
|
|
Tiny,
|
2016-08-02 20:10:10 +00:00
|
|
|
Small,
|
|
|
|
Kernel,
|
|
|
|
Medium,
|
|
|
|
Large,
|
2018-01-23 01:01:36 +00:00
|
|
|
None,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/// LLVMRustDiagnosticKind
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2018-07-10 15:00:02 +00:00
|
|
|
#[allow(dead_code)] // Variants constructed by C++.
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum DiagnosticKind {
|
|
|
|
Other,
|
|
|
|
InlineAsm,
|
|
|
|
StackSize,
|
|
|
|
DebugMetadataVersion,
|
|
|
|
SampleProfile,
|
|
|
|
OptimizationRemark,
|
|
|
|
OptimizationRemarkMissed,
|
|
|
|
OptimizationRemarkAnalysis,
|
|
|
|
OptimizationRemarkAnalysisFPCommute,
|
|
|
|
OptimizationRemarkAnalysisAliasing,
|
|
|
|
OptimizationRemarkOther,
|
|
|
|
OptimizationFailure,
|
2018-03-12 17:11:59 +00:00
|
|
|
PGOProfile,
|
2018-07-17 23:20:51 +00:00
|
|
|
Linker,
|
2020-09-29 11:20:56 +00:00
|
|
|
Unsupported,
|
2021-07-28 19:31:47 +00:00
|
|
|
SrcMgr,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2020-06-09 13:37:59 +00:00
|
|
|
/// LLVMRustDiagnosticLevel
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
#[repr(C)]
|
|
|
|
#[allow(dead_code)] // Variants constructed by C++.
|
|
|
|
pub enum DiagnosticLevel {
|
|
|
|
Error,
|
|
|
|
Warning,
|
|
|
|
Note,
|
|
|
|
Remark,
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// LLVMRustArchiveKind
|
|
|
|
#[derive(Copy, Clone)]
|
2016-08-02 21:25:19 +00:00
|
|
|
#[repr(C)]
|
2016-08-02 20:10:10 +00:00
|
|
|
pub enum ArchiveKind {
|
|
|
|
K_GNU,
|
|
|
|
K_BSD,
|
2020-02-12 11:06:14 +00:00
|
|
|
K_DARWIN,
|
2016-08-02 20:10:10 +00:00
|
|
|
K_COFF,
|
2023-01-11 03:27:29 +00:00
|
|
|
K_AIXBIG,
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
2016-08-02 21:25:19 +00:00
|
|
|
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2024-09-18 04:09:48 +00:00
|
|
|
// LLVMRustThinLTOData
|
2018-06-27 10:12:47 +00:00
|
|
|
pub type ThinLTOData;
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
|
2024-09-18 04:09:48 +00:00
|
|
|
// LLVMRustThinLTOBuffer
|
2018-06-27 10:12:47 +00:00
|
|
|
pub type ThinLTOBuffer;
|
|
|
|
}
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
|
|
|
|
/// LLVMRustThinLTOModule
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct ThinLTOModule {
|
|
|
|
pub identifier: *const c_char,
|
|
|
|
pub data: *const u8,
|
|
|
|
pub len: usize,
|
|
|
|
}
|
|
|
|
|
2017-10-31 18:24:04 +00:00
|
|
|
/// LLVMThreadLocalMode
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum ThreadLocalMode {
|
|
|
|
NotThreadLocal,
|
|
|
|
GeneralDynamic,
|
|
|
|
LocalDynamic,
|
|
|
|
InitialExec,
|
|
|
|
LocalExec,
|
|
|
|
}
|
|
|
|
|
2020-03-31 05:17:15 +00:00
|
|
|
/// LLVMRustChecksumKind
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum ChecksumKind {
|
|
|
|
None,
|
|
|
|
MD5,
|
|
|
|
SHA1,
|
2020-10-13 15:41:06 +00:00
|
|
|
SHA256,
|
2020-03-31 05:17:15 +00:00
|
|
|
}
|
|
|
|
|
2022-11-04 16:20:42 +00:00
|
|
|
/// LLVMRustMemoryEffects
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum MemoryEffects {
|
|
|
|
None,
|
|
|
|
ReadOnly,
|
|
|
|
InaccessibleMemOnly,
|
|
|
|
}
|
|
|
|
|
Cast global variables to default address space
Pointers for variables all need to be in the same address space for
correct compilation. Therefore ensure that even if a global variable is
created in a different address space, it is casted to the default
address space before its value is used.
This is necessary for the amdgpu target and others where the default
address space for global variables is not 0.
For example `core` does not compile in debug mode when not casting the
address space to the default one because it tries to emit the following
(simplified) LLVM IR, containing a type mismatch:
```llvm
@alloc_0 = addrspace(1) constant <{ [6 x i8] }> <{ [6 x i8] c"bit.rs" }>, align 1
@alloc_1 = addrspace(1) constant <{ ptr }> <{ ptr addrspace(1) @alloc_0 }>, align 8
; ^ here a struct containing a `ptr` is needed, but it is created using a `ptr addrspace(1)`
```
For this to compile, we need to insert a constant `addrspacecast` before
we use a global variable:
```llvm
@alloc_0 = addrspace(1) constant <{ [6 x i8] }> <{ [6 x i8] c"bit.rs" }>, align 1
@alloc_1 = addrspace(1) constant <{ ptr }> <{ ptr addrspacecast (ptr addrspace(1) @alloc_0 to ptr) }>, align 8
```
As vtables are global variables as well, they are also created with an
`addrspacecast`. In the SSA backend, after a vtable global is created,
metadata is added to it. To add metadata, we need the non-casted global
variable. Therefore we strip away an addrspacecast if there is one, to
get the underlying global.
2025-01-02 12:10:11 +00:00
|
|
|
/// LLVMOpcode
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum Opcode {
|
|
|
|
Ret = 1,
|
|
|
|
Br = 2,
|
|
|
|
Switch = 3,
|
|
|
|
IndirectBr = 4,
|
|
|
|
Invoke = 5,
|
|
|
|
Unreachable = 7,
|
|
|
|
CallBr = 67,
|
|
|
|
FNeg = 66,
|
|
|
|
Add = 8,
|
|
|
|
FAdd = 9,
|
|
|
|
Sub = 10,
|
|
|
|
FSub = 11,
|
|
|
|
Mul = 12,
|
|
|
|
FMul = 13,
|
|
|
|
UDiv = 14,
|
|
|
|
SDiv = 15,
|
|
|
|
FDiv = 16,
|
|
|
|
URem = 17,
|
|
|
|
SRem = 18,
|
|
|
|
FRem = 19,
|
|
|
|
Shl = 20,
|
|
|
|
LShr = 21,
|
|
|
|
AShr = 22,
|
|
|
|
And = 23,
|
|
|
|
Or = 24,
|
|
|
|
Xor = 25,
|
|
|
|
Alloca = 26,
|
|
|
|
Load = 27,
|
|
|
|
Store = 28,
|
|
|
|
GetElementPtr = 29,
|
|
|
|
Trunc = 30,
|
|
|
|
ZExt = 31,
|
|
|
|
SExt = 32,
|
|
|
|
FPToUI = 33,
|
|
|
|
FPToSI = 34,
|
|
|
|
UIToFP = 35,
|
|
|
|
SIToFP = 36,
|
|
|
|
FPTrunc = 37,
|
|
|
|
FPExt = 38,
|
|
|
|
PtrToInt = 39,
|
|
|
|
IntToPtr = 40,
|
|
|
|
BitCast = 41,
|
|
|
|
AddrSpaceCast = 60,
|
|
|
|
ICmp = 42,
|
|
|
|
FCmp = 43,
|
|
|
|
PHI = 44,
|
|
|
|
Call = 45,
|
|
|
|
Select = 46,
|
|
|
|
UserOp1 = 47,
|
|
|
|
UserOp2 = 48,
|
|
|
|
VAArg = 49,
|
|
|
|
ExtractElement = 50,
|
|
|
|
InsertElement = 51,
|
|
|
|
ShuffleVector = 52,
|
|
|
|
ExtractValue = 53,
|
|
|
|
InsertValue = 54,
|
|
|
|
Freeze = 68,
|
|
|
|
Fence = 55,
|
|
|
|
AtomicCmpXchg = 56,
|
|
|
|
AtomicRMW = 57,
|
|
|
|
Resume = 58,
|
|
|
|
LandingPad = 59,
|
|
|
|
CleanupRet = 61,
|
|
|
|
CatchRet = 62,
|
|
|
|
CatchPad = 63,
|
|
|
|
CleanupPad = 64,
|
|
|
|
CatchSwitch = 65,
|
|
|
|
}
|
|
|
|
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2018-07-16 13:02:31 +00:00
|
|
|
type Opaque;
|
|
|
|
}
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
2018-07-16 13:02:31 +00:00
|
|
|
struct InvariantOpaque<'a> {
|
|
|
|
_marker: PhantomData<&'a mut &'a ()>,
|
|
|
|
_opaque: Opaque,
|
|
|
|
}
|
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
// Opaque pointer types
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2018-06-27 14:57:25 +00:00
|
|
|
pub type Module;
|
|
|
|
pub type Context;
|
2018-07-02 14:52:53 +00:00
|
|
|
pub type Type;
|
2018-07-05 10:38:44 +00:00
|
|
|
pub type Value;
|
2019-10-13 10:19:14 +00:00
|
|
|
pub type ConstantInt;
|
2022-02-21 16:19:16 +00:00
|
|
|
pub type Attribute;
|
2018-07-04 13:36:49 +00:00
|
|
|
pub type Metadata;
|
2018-07-05 10:38:44 +00:00
|
|
|
pub type BasicBlock;
|
2024-10-18 07:31:28 +00:00
|
|
|
pub type Comdat;
|
2018-07-05 10:38:44 +00:00
|
|
|
}
|
2018-07-17 15:33:09 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct Builder<'a>(InvariantOpaque<'a>);
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
2018-07-17 11:17:47 +00:00
|
|
|
pub struct PassManager<'a>(InvariantOpaque<'a>);
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2018-06-27 14:57:25 +00:00
|
|
|
pub type TargetMachine;
|
2018-07-05 10:38:44 +00:00
|
|
|
pub type Archive;
|
|
|
|
}
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
2018-07-17 11:31:06 +00:00
|
|
|
pub struct ArchiveIterator<'a>(InvariantOpaque<'a>);
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct ArchiveChild<'a>(InvariantOpaque<'a>);
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2018-07-05 10:38:44 +00:00
|
|
|
pub type Twine;
|
|
|
|
pub type DiagnosticInfo;
|
|
|
|
pub type SMDiagnostic;
|
|
|
|
}
|
2018-07-17 13:00:10 +00:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct RustArchiveMember<'a>(InvariantOpaque<'a>);
|
2024-10-28 06:25:40 +00:00
|
|
|
/// Opaque pointee of `LLVMOperandBundleRef`.
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
2024-10-28 06:25:40 +00:00
|
|
|
pub(crate) struct OperandBundle<'a>(InvariantOpaque<'a>);
|
2018-07-17 12:02:11 +00:00
|
|
|
#[repr(C)]
|
2018-07-17 11:26:22 +00:00
|
|
|
pub struct Linker<'a>(InvariantOpaque<'a>);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2021-11-12 00:00:00 +00:00
|
|
|
pub type DiagnosticHandler;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub type DiagnosticHandlerTy = unsafe extern "C" fn(&DiagnosticInfo, *mut c_void);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
|
|
|
pub mod debuginfo {
|
2025-01-31 05:29:09 +00:00
|
|
|
use std::ptr;
|
|
|
|
|
2019-10-22 15:51:35 +00:00
|
|
|
use bitflags::bitflags;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2018-07-17 15:45:33 +00:00
|
|
|
use super::{InvariantOpaque, Metadata};
|
2025-01-31 05:29:09 +00:00
|
|
|
use crate::llvm::{self, Module};
|
2024-07-28 22:13:50 +00:00
|
|
|
|
2025-01-31 05:29:09 +00:00
|
|
|
/// Opaque target type for references to an LLVM debuginfo builder.
|
|
|
|
///
|
|
|
|
/// `&'_ DIBuilder<'ll>` corresponds to `LLVMDIBuilderRef`, which is the
|
|
|
|
/// LLVM-C wrapper for `DIBuilder *`.
|
|
|
|
///
|
|
|
|
/// Debuginfo builders are created and destroyed during codegen, so the
|
|
|
|
/// builder reference typically has a shorter lifetime than the LLVM
|
|
|
|
/// session (`'ll`) that it participates in.
|
2018-07-17 15:45:33 +00:00
|
|
|
#[repr(C)]
|
2025-01-31 05:29:09 +00:00
|
|
|
pub struct DIBuilder<'ll>(InvariantOpaque<'ll>);
|
|
|
|
|
|
|
|
/// Owning pointer to a `DIBuilder<'ll>` that will dispose of the builder
|
|
|
|
/// when dropped. Use `.as_ref()` to get the underlying `&DIBuilder`
|
|
|
|
/// needed for debuginfo FFI calls.
|
|
|
|
pub(crate) struct DIBuilderBox<'ll> {
|
|
|
|
raw: ptr::NonNull<DIBuilder<'ll>>,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'ll> DIBuilderBox<'ll> {
|
|
|
|
pub(crate) fn new(llmod: &'ll Module) -> Self {
|
|
|
|
let raw = unsafe { llvm::LLVMCreateDIBuilder(llmod) };
|
|
|
|
let raw = ptr::NonNull::new(raw).unwrap();
|
|
|
|
Self { raw }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub(crate) fn as_ref(&self) -> &DIBuilder<'ll> {
|
|
|
|
// SAFETY: This is an owning pointer, so `&DIBuilder` is valid
|
|
|
|
// for as long as `&self` is.
|
|
|
|
unsafe { self.raw.as_ref() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'ll> Drop for DIBuilderBox<'ll> {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe { llvm::LLVMDisposeDIBuilder(self.raw) };
|
|
|
|
}
|
|
|
|
}
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2018-07-04 13:36:49 +00:00
|
|
|
pub type DIDescriptor = Metadata;
|
2020-02-10 20:52:20 +00:00
|
|
|
pub type DILocation = Metadata;
|
2018-07-04 13:36:49 +00:00
|
|
|
pub type DIScope = DIDescriptor;
|
2016-08-02 20:10:10 +00:00
|
|
|
pub type DIFile = DIScope;
|
|
|
|
pub type DILexicalBlock = DIScope;
|
|
|
|
pub type DISubprogram = DIScope;
|
2018-07-04 13:36:49 +00:00
|
|
|
pub type DIType = DIDescriptor;
|
2016-08-02 20:10:10 +00:00
|
|
|
pub type DIBasicType = DIType;
|
|
|
|
pub type DIDerivedType = DIType;
|
|
|
|
pub type DICompositeType = DIDerivedType;
|
|
|
|
pub type DIVariable = DIDescriptor;
|
2018-09-14 16:06:45 +00:00
|
|
|
pub type DIGlobalVariableExpression = DIDescriptor;
|
2018-07-04 13:36:49 +00:00
|
|
|
pub type DIArray = DIDescriptor;
|
2016-08-02 20:10:10 +00:00
|
|
|
pub type DISubrange = DIDescriptor;
|
|
|
|
pub type DIEnumerator = DIDescriptor;
|
|
|
|
pub type DITemplateTypeParameter = DIDescriptor;
|
|
|
|
|
2016-11-18 22:15:14 +00:00
|
|
|
bitflags! {
|
2024-12-07 11:27:23 +00:00
|
|
|
/// Must match the layout of `LLVMDIFlags` in the LLVM-C API.
|
|
|
|
///
|
|
|
|
/// Each value declared here must also be covered by the static
|
|
|
|
/// assertions in `RustWrapper.cpp` used by `fromRust(LLVMDIFlags)`.
|
2019-06-16 00:53:33 +00:00
|
|
|
#[repr(transparent)]
|
2023-12-30 16:09:02 +00:00
|
|
|
#[derive(Clone, Copy, Default)]
|
2019-06-01 12:21:38 +00:00
|
|
|
pub struct DIFlags: u32 {
|
2017-09-08 19:08:01 +00:00
|
|
|
const FlagZero = 0;
|
|
|
|
const FlagPrivate = 1;
|
|
|
|
const FlagProtected = 2;
|
|
|
|
const FlagPublic = 3;
|
|
|
|
const FlagFwdDecl = (1 << 2);
|
|
|
|
const FlagAppleBlock = (1 << 3);
|
2024-12-07 11:27:23 +00:00
|
|
|
const FlagReservedBit4 = (1 << 4);
|
2017-09-08 19:08:01 +00:00
|
|
|
const FlagVirtual = (1 << 5);
|
|
|
|
const FlagArtificial = (1 << 6);
|
|
|
|
const FlagExplicit = (1 << 7);
|
|
|
|
const FlagPrototyped = (1 << 8);
|
|
|
|
const FlagObjcClassComplete = (1 << 9);
|
|
|
|
const FlagObjectPointer = (1 << 10);
|
|
|
|
const FlagVector = (1 << 11);
|
|
|
|
const FlagStaticMember = (1 << 12);
|
|
|
|
const FlagLValueReference = (1 << 13);
|
|
|
|
const FlagRValueReference = (1 << 14);
|
2024-12-07 11:27:23 +00:00
|
|
|
const FlagReserved = (1 << 15);
|
|
|
|
const FlagSingleInheritance = (1 << 16);
|
|
|
|
const FlagMultipleInheritance = (2 << 16);
|
|
|
|
const FlagVirtualInheritance = (3 << 16);
|
2018-01-20 20:32:33 +00:00
|
|
|
const FlagIntroducedVirtual = (1 << 18);
|
|
|
|
const FlagBitField = (1 << 19);
|
|
|
|
const FlagNoReturn = (1 << 20);
|
2024-12-07 11:27:23 +00:00
|
|
|
// The bit at (1 << 21) is unused, but was `LLVMDIFlagMainSubprogram`.
|
|
|
|
const FlagTypePassByValue = (1 << 22);
|
|
|
|
const FlagTypePassByReference = (1 << 23);
|
|
|
|
const FlagEnumClass = (1 << 24);
|
|
|
|
const FlagThunk = (1 << 25);
|
|
|
|
const FlagNonTrivial = (1 << 26);
|
|
|
|
const FlagBigEndian = (1 << 27);
|
|
|
|
const FlagLittleEndian = (1 << 28);
|
2016-11-18 22:15:14 +00:00
|
|
|
}
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
2019-01-16 17:59:03 +00:00
|
|
|
|
|
|
|
// These values **must** match with LLVMRustDISPFlags!!
|
|
|
|
bitflags! {
|
2019-06-16 00:53:33 +00:00
|
|
|
#[repr(transparent)]
|
2023-12-30 16:09:02 +00:00
|
|
|
#[derive(Clone, Copy, Default)]
|
2019-06-01 12:21:38 +00:00
|
|
|
pub struct DISPFlags: u32 {
|
2019-01-16 17:59:03 +00:00
|
|
|
const SPFlagZero = 0;
|
|
|
|
const SPFlagVirtual = 1;
|
|
|
|
const SPFlagPureVirtual = 2;
|
|
|
|
const SPFlagLocalToUnit = (1 << 2);
|
|
|
|
const SPFlagDefinition = (1 << 3);
|
|
|
|
const SPFlagOptimized = (1 << 4);
|
2019-04-04 20:05:41 +00:00
|
|
|
const SPFlagMainSubprogram = (1 << 5);
|
2019-01-16 17:59:03 +00:00
|
|
|
}
|
|
|
|
}
|
2019-01-22 21:01:14 +00:00
|
|
|
|
|
|
|
/// LLVMRustDebugEmissionKind
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum DebugEmissionKind {
|
|
|
|
NoDebug,
|
|
|
|
FullDebug,
|
|
|
|
LineTablesOnly,
|
2021-04-06 20:00:35 +00:00
|
|
|
DebugDirectivesOnly,
|
2019-01-22 21:01:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl DebugEmissionKind {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn from_generic(kind: rustc_session::config::DebugInfo) -> Self {
|
2021-09-03 17:00:39 +00:00
|
|
|
// We should be setting LLVM's emission kind to `LineTablesOnly` if
|
|
|
|
// we are compiling with "limited" debuginfo. However, some of the
|
|
|
|
// existing tools relied on slightly more debuginfo being generated than
|
|
|
|
// would be the case with `LineTablesOnly`, and we did not want to break
|
|
|
|
// these tools in a "drive-by fix", without a good idea or plan about
|
|
|
|
// what limited debuginfo should exactly look like. So for now we are
|
|
|
|
// instead adding a new debuginfo option "line-tables-only" so as to
|
|
|
|
// not break anything and to allow users to have 'limited' debug info.
|
|
|
|
//
|
|
|
|
// See https://github.com/rust-lang/rust/issues/60020 for details.
|
2020-03-11 11:49:08 +00:00
|
|
|
use rustc_session::config::DebugInfo;
|
2019-01-22 21:01:14 +00:00
|
|
|
match kind {
|
|
|
|
DebugInfo::None => DebugEmissionKind::NoDebug,
|
2021-04-06 20:00:35 +00:00
|
|
|
DebugInfo::LineDirectivesOnly => DebugEmissionKind::DebugDirectivesOnly,
|
|
|
|
DebugInfo::LineTablesOnly => DebugEmissionKind::LineTablesOnly,
|
|
|
|
DebugInfo::Limited | DebugInfo::Full => DebugEmissionKind::FullDebug,
|
2019-01-22 21:01:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-11-16 04:07:37 +00:00
|
|
|
|
|
|
|
/// LLVMRustDebugNameTableKind
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub enum DebugNameTableKind {
|
|
|
|
Default,
|
|
|
|
Gnu,
|
|
|
|
None,
|
|
|
|
}
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|
|
|
|
|
2022-03-21 19:30:54 +00:00
|
|
|
// These values **must** match with LLVMRustAllocKindFlags
|
|
|
|
bitflags! {
|
|
|
|
#[repr(transparent)]
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct AllocKindFlags : u64 {
|
|
|
|
const Unknown = 0;
|
|
|
|
const Alloc = 1;
|
|
|
|
const Realloc = 1 << 1;
|
|
|
|
const Free = 1 << 2;
|
|
|
|
const Uninitialized = 1 << 3;
|
|
|
|
const Zeroed = 1 << 4;
|
|
|
|
const Aligned = 1 << 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2018-06-27 10:12:47 +00:00
|
|
|
pub type ModuleBuffer;
|
|
|
|
}
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2020-02-11 21:37:16 +00:00
|
|
|
pub type SelfProfileBeforePassCallback =
|
|
|
|
unsafe extern "C" fn(*mut c_void, *const c_char, *const c_char);
|
|
|
|
pub type SelfProfileAfterPassCallback = unsafe extern "C" fn(*mut c_void);
|
|
|
|
|
2022-05-28 10:43:51 +00:00
|
|
|
pub type GetSymbolsCallback = unsafe extern "C" fn(*mut c_void, *const c_char) -> *mut c_void;
|
|
|
|
pub type GetSymbolsErrorCallback = unsafe extern "C" fn(*const c_char) -> *mut c_void;
|
|
|
|
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2016-10-22 13:07:35 +00:00
|
|
|
// Create and destroy contexts.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMContextDispose(C: &'static mut Context);
|
|
|
|
pub(crate) fn LLVMGetMDKindIDInContext(
|
|
|
|
C: &Context,
|
|
|
|
Name: *const c_char,
|
|
|
|
SLen: c_uint,
|
|
|
|
) -> c_uint;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2018-06-27 14:57:25 +00:00
|
|
|
// Create modules.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMModuleCreateWithNameInContext(
|
|
|
|
ModuleID: *const c_char,
|
|
|
|
C: &Context,
|
|
|
|
) -> &Module;
|
|
|
|
pub(crate) fn LLVMCloneModule(M: &Module) -> &Module;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
|
|
|
/// Data layout. See Module::getDataLayout.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetDataLayoutStr(M: &Module) -> *const c_char;
|
|
|
|
pub(crate) fn LLVMSetDataLayout(M: &Module, Triple: *const c_char);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
|
|
|
/// See Module::setModuleInlineAsm.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAppendModuleInlineAsm(M: &Module, Asm: *const c_char, Len: size_t);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on integer types
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMInt1TypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMInt8TypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMInt16TypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMInt32TypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMInt64TypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMIntTypeInContext(C: &Context, NumBits: c_uint) -> &Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetIntTypeWidth(IntegerTy: &Type) -> c_uint;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on real types
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMHalfTypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMFloatTypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMDoubleTypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMFP128TypeInContext(C: &Context) -> &Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on function types
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMFunctionType<'a>(
|
2018-07-02 14:52:53 +00:00
|
|
|
ReturnType: &'a Type,
|
|
|
|
ParamTypes: *const &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
ParamCount: c_uint,
|
|
|
|
IsVarArg: Bool,
|
2018-07-02 14:52:53 +00:00
|
|
|
) -> &'a Type;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMCountParamTypes(FunctionTy: &Type) -> c_uint;
|
|
|
|
pub(crate) fn LLVMGetParamTypes<'a>(FunctionTy: &'a Type, Dest: *mut &'a Type);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on struct types
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMStructTypeInContext<'a>(
|
2018-07-02 14:52:53 +00:00
|
|
|
C: &'a Context,
|
|
|
|
ElementTypes: *const &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
ElementCount: c_uint,
|
|
|
|
Packed: Bool,
|
2018-07-02 14:52:53 +00:00
|
|
|
) -> &'a Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on array, pointer, and vector types (sequence types)
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMPointerTypeInContext(C: &Context, AddressSpace: c_uint) -> &Type;
|
|
|
|
pub(crate) fn LLVMVectorType(ElementType: &Type, ElementCount: c_uint) -> &Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetElementType(Ty: &Type) -> &Type;
|
|
|
|
pub(crate) fn LLVMGetVectorSize(VectorTy: &Type) -> c_uint;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on other types
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMVoidTypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMTokenTypeInContext(C: &Context) -> &Type;
|
|
|
|
pub(crate) fn LLVMMetadataTypeInContext(C: &Context) -> &Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on all values
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsUndef(Val: &Value) -> Bool;
|
|
|
|
pub(crate) fn LLVMTypeOf(Val: &Value) -> &Type;
|
|
|
|
pub(crate) fn LLVMGetValueName2(Val: &Value, Length: *mut size_t) -> *const c_char;
|
|
|
|
pub(crate) fn LLVMSetValueName2(Val: &Value, Name: *const c_char, NameLen: size_t);
|
|
|
|
pub(crate) fn LLVMReplaceAllUsesWith<'a>(OldVal: &'a Value, NewVal: &'a Value);
|
|
|
|
pub(crate) fn LLVMSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Node: &'a Value);
|
|
|
|
pub(crate) fn LLVMGlobalSetMetadata<'a>(Val: &'a Value, KindID: c_uint, Metadata: &'a Metadata);
|
|
|
|
pub(crate) fn LLVMValueAsMetadata(Node: &Value) -> &Metadata;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on constants of any type
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstNull(Ty: &Type) -> &Value;
|
|
|
|
pub(crate) fn LLVMGetUndef(Ty: &Type) -> &Value;
|
|
|
|
pub(crate) fn LLVMGetPoison(Ty: &Type) -> &Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on metadata
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMMDStringInContext2(
|
|
|
|
C: &Context,
|
|
|
|
Str: *const c_char,
|
|
|
|
SLen: size_t,
|
|
|
|
) -> &Metadata;
|
|
|
|
pub(crate) fn LLVMMDNodeInContext2<'a>(
|
2022-04-21 13:02:54 +00:00
|
|
|
C: &'a Context,
|
|
|
|
Vals: *const &'a Metadata,
|
|
|
|
Count: size_t,
|
|
|
|
) -> &'a Metadata;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddNamedMetadataOperand<'a>(
|
|
|
|
M: &'a Module,
|
|
|
|
Name: *const c_char,
|
|
|
|
Val: &'a Value,
|
|
|
|
);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on scalar constants
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstInt(IntTy: &Type, N: c_ulonglong, SignExtend: Bool) -> &Value;
|
|
|
|
pub(crate) fn LLVMConstIntOfArbitraryPrecision(
|
|
|
|
IntTy: &Type,
|
|
|
|
Wn: c_uint,
|
|
|
|
Ws: *const u64,
|
|
|
|
) -> &Value;
|
|
|
|
pub(crate) fn LLVMConstReal(RealTy: &Type, N: f64) -> &Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on composite constants
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstArray2<'a>(
|
2024-03-04 21:17:23 +00:00
|
|
|
ElementTy: &'a Type,
|
|
|
|
ConstantVals: *const &'a Value,
|
|
|
|
Length: u64,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMArrayType2(ElementType: &Type, ElementCount: u64) -> &Type;
|
|
|
|
pub(crate) fn LLVMConstStringInContext2(
|
2018-06-27 14:57:25 +00:00
|
|
|
C: &Context,
|
2016-08-02 20:10:10 +00:00
|
|
|
Str: *const c_char,
|
2024-03-04 21:17:23 +00:00
|
|
|
Length: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
DontNullTerminate: Bool,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstStructInContext<'a>(
|
2018-07-10 10:28:39 +00:00
|
|
|
C: &'a Context,
|
|
|
|
ConstantVals: *const &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Count: c_uint,
|
|
|
|
Packed: Bool,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstVector(ScalarConstantVals: *const &Value, Size: c_uint) -> &Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Constant expressions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstInBoundsGEP2<'a>(
|
2021-07-31 00:00:00 +00:00
|
|
|
ty: &'a Type,
|
2018-07-10 10:28:39 +00:00
|
|
|
ConstantVal: &'a Value,
|
|
|
|
ConstantIndices: *const &'a Value,
|
2018-01-16 08:31:48 +00:00
|
|
|
NumIndices: c_uint,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMConstPtrToInt<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMConstIntToPtr<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMConstBitCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMConstPointerCast<'a>(ConstantVal: &'a Value, ToType: &'a Type) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMGetAggregateElement(ConstantVal: &Value, Idx: c_uint) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMGetConstOpcode(ConstantVal: &Value) -> Opcode;
|
|
|
|
pub(crate) fn LLVMIsAConstantExpr(Val: &Value) -> Option<&Value>;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on global variables, functions, and aliases (globals)
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsDeclaration(Global: &Value) -> Bool;
|
|
|
|
pub(crate) fn LLVMGetLinkage(Global: &Value) -> RawEnum<Linkage>;
|
|
|
|
pub(crate) fn LLVMSetLinkage(Global: &Value, RustLinkage: Linkage);
|
|
|
|
pub(crate) fn LLVMSetSection(Global: &Value, Section: *const c_char);
|
|
|
|
pub(crate) fn LLVMGetVisibility(Global: &Value) -> RawEnum<Visibility>;
|
|
|
|
pub(crate) fn LLVMSetVisibility(Global: &Value, Viz: Visibility);
|
|
|
|
pub(crate) fn LLVMGetAlignment(Global: &Value) -> c_uint;
|
|
|
|
pub(crate) fn LLVMSetAlignment(Global: &Value, Bytes: c_uint);
|
|
|
|
pub(crate) fn LLVMSetDLLStorageClass(V: &Value, C: DLLStorageClass);
|
|
|
|
pub(crate) fn LLVMGlobalGetValueType(Global: &Value) -> &Type;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on global variables
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsAGlobalVariable(GlobalVar: &Value) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMAddGlobal<'a>(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMDeleteGlobal(GlobalVar: &Value);
|
|
|
|
pub(crate) fn LLVMGetInitializer(GlobalVar: &Value) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMSetInitializer<'a>(GlobalVar: &'a Value, ConstantVal: &'a Value);
|
|
|
|
pub(crate) fn LLVMIsThreadLocal(GlobalVar: &Value) -> Bool;
|
|
|
|
pub(crate) fn LLVMSetThreadLocalMode(GlobalVar: &Value, Mode: ThreadLocalMode);
|
|
|
|
pub(crate) fn LLVMIsGlobalConstant(GlobalVar: &Value) -> Bool;
|
|
|
|
pub(crate) fn LLVMSetGlobalConstant(GlobalVar: &Value, IsConstant: Bool);
|
|
|
|
pub(crate) fn LLVMSetTailCall(CallInst: &Value, IsTailCall: Bool);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2022-02-21 16:19:16 +00:00
|
|
|
// Operations on attributes
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMCreateStringAttribute(
|
2022-02-21 16:19:16 +00:00
|
|
|
C: &Context,
|
|
|
|
Name: *const c_char,
|
2022-03-03 00:00:00 +00:00
|
|
|
NameLen: c_uint,
|
2022-02-21 16:19:16 +00:00
|
|
|
Value: *const c_char,
|
2022-03-03 00:00:00 +00:00
|
|
|
ValueLen: c_uint,
|
2022-02-21 16:19:16 +00:00
|
|
|
) -> &Attribute;
|
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on functions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetFunctionCallConv(Fn: &Value, CC: c_uint);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on parameters
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsAArgument(Val: &Value) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMCountParams(Fn: &Value) -> c_uint;
|
|
|
|
pub(crate) fn LLVMGetParam(Fn: &Value, Index: c_uint) -> &Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on basic blocks
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetBasicBlockParent(BB: &BasicBlock) -> &Value;
|
|
|
|
pub(crate) fn LLVMAppendBasicBlockInContext<'a>(
|
2018-07-10 10:28:39 +00:00
|
|
|
C: &'a Context,
|
|
|
|
Fn: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 11:34:34 +00:00
|
|
|
) -> &'a BasicBlock;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on instructions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsAInstruction(Val: &Value) -> Option<&Value>;
|
|
|
|
pub(crate) fn LLVMGetFirstBasicBlock(Fn: &Value) -> &BasicBlock;
|
|
|
|
pub(crate) fn LLVMGetOperand(Val: &Value, Index: c_uint) -> Option<&Value>;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on call sites
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetInstructionCallConv(Instr: &Value, CC: c_uint);
|
2016-10-22 13:07:35 +00:00
|
|
|
|
|
|
|
// Operations on load/store instructions (only)
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetVolatile(MemoryAccessInst: &Value, volatile: Bool);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Operations on phi nodes
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddIncoming<'a>(
|
2018-07-10 10:28:39 +00:00
|
|
|
PhiNode: &'a Value,
|
|
|
|
IncomingValues: *const &'a Value,
|
2018-07-10 11:34:34 +00:00
|
|
|
IncomingBlocks: *const &'a BasicBlock,
|
2016-08-02 20:10:10 +00:00
|
|
|
Count: c_uint,
|
|
|
|
);
|
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Instruction builders
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMCreateBuilderInContext(C: &Context) -> &mut Builder<'_>;
|
|
|
|
pub(crate) fn LLVMPositionBuilderAtEnd<'a>(Builder: &Builder<'a>, Block: &'a BasicBlock);
|
|
|
|
pub(crate) fn LLVMGetInsertBlock<'a>(Builder: &Builder<'a>) -> &'a BasicBlock;
|
|
|
|
pub(crate) fn LLVMDisposeBuilder<'a>(Builder: &'a mut Builder<'a>);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Metadata
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetCurrentDebugLocation2<'a>(Builder: &Builder<'a>, Loc: *const Metadata);
|
|
|
|
pub(crate) fn LLVMGetCurrentDebugLocation2<'a>(Builder: &Builder<'a>) -> Option<&'a Metadata>;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Terminators
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildRetVoid<'a>(B: &Builder<'a>) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildRet<'a>(B: &Builder<'a>, V: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildBr<'a>(B: &Builder<'a>, Dest: &'a BasicBlock) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildCondBr<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
If: &'a Value,
|
2018-07-10 11:34:34 +00:00
|
|
|
Then: &'a BasicBlock,
|
|
|
|
Else: &'a BasicBlock,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSwitch<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
V: &'a Value,
|
2018-07-10 11:34:34 +00:00
|
|
|
Else: &'a BasicBlock,
|
2016-08-02 20:10:10 +00:00
|
|
|
NumCases: c_uint,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildLandingPad<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-03 12:49:43 +00:00
|
|
|
Ty: &'a Type,
|
2021-07-07 00:00:00 +00:00
|
|
|
PersFn: Option<&'a Value>,
|
2017-12-08 09:53:46 +00:00
|
|
|
NumClauses: c_uint,
|
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildResume<'a>(B: &Builder<'a>, Exn: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildUnreachable<'a>(B: &Builder<'a>) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildCleanupPad<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
ParentPad: Option<&'a Value>,
|
|
|
|
Args: *const &'a Value,
|
2023-04-03 12:12:21 +00:00
|
|
|
NumArgs: c_uint,
|
2016-10-22 13:07:35 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> Option<&'a Value>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildCleanupRet<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
CleanupPad: &'a Value,
|
2023-04-03 12:12:21 +00:00
|
|
|
BB: Option<&'a BasicBlock>,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> Option<&'a Value>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildCatchPad<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
ParentPad: &'a Value,
|
|
|
|
Args: *const &'a Value,
|
2023-04-03 12:12:21 +00:00
|
|
|
NumArgs: c_uint,
|
2016-10-22 13:07:35 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> Option<&'a Value>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildCatchRet<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2023-04-03 12:12:21 +00:00
|
|
|
CatchPad: &'a Value,
|
2018-07-17 15:26:58 +00:00
|
|
|
BB: &'a BasicBlock,
|
|
|
|
) -> Option<&'a Value>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildCatchSwitch<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
Builder: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
ParentPad: Option<&'a Value>,
|
2023-04-03 12:12:21 +00:00
|
|
|
UnwindBB: Option<&'a BasicBlock>,
|
2016-08-02 20:10:10 +00:00
|
|
|
NumHandlers: c_uint,
|
2016-10-22 13:07:35 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> Option<&'a Value>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddHandler<'a>(CatchSwitch: &'a Value, Dest: &'a BasicBlock);
|
|
|
|
pub(crate) fn LLVMSetPersonalityFn<'a>(Func: &'a Value, Pers: &'a Value);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Add a case to the switch instruction
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddCase<'a>(Switch: &'a Value, OnVal: &'a Value, Dest: &'a BasicBlock);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Add a clause to the landing pad instruction
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddClause<'a>(LandingPad: &'a Value, ClauseVal: &'a Value);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Set the cleanup on a landing pad instruction
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetCleanup(LandingPad: &Value, Val: Bool);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Arithmetic
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAdd<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFAdd<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSub<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFSub<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildMul<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFMul<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildUDiv<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildExactUDiv<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
Introduce unsafe offset_from on pointers
Adds intrinsics::exact_div to take advantage of the unsafe, which reduces the implementation from
```asm
sub rcx, rdx
mov rax, rcx
sar rax, 63
shr rax, 62
lea rax, [rax + rcx]
sar rax, 2
ret
```
down to
```asm
sub rcx, rdx
sar rcx, 2
mov rax, rcx
ret
```
(for `*const i32`)
2018-03-23 08:30:23 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSDiv<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildExactSDiv<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFDiv<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildURem<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSRem<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFRem<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildShl<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildLShr<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAShr<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNSWAdd<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNUWAdd<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNSWSub<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNUWSub<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNSWMul<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNUWMul<'a>(
|
2019-06-03 10:59:17 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAnd<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildOr<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildXor<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildNeg<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
|
|
|
|
-> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildFNeg<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
V: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildNot<'a>(B: &Builder<'a>, V: &'a Value, Name: *const c_char)
|
|
|
|
-> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-01-20 08:00:44 +00:00
|
|
|
// Extra flags on arithmetic
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetIsDisjoint(Instr: &Value, IsDisjoint: Bool);
|
2025-02-05 11:43:54 +00:00
|
|
|
pub(crate) fn LLVMSetNUW(ArithInst: &Value, HasNUW: Bool);
|
|
|
|
pub(crate) fn LLVMSetNSW(ArithInst: &Value, HasNSW: Bool);
|
2025-01-20 08:00:44 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Memory
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAlloca<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildArrayAlloca<'a>(
|
2018-05-28 15:07:23 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
Val: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildLoad2<'a>(
|
2021-07-04 16:53:04 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
PointerVal: &'a Value,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildStore<'a>(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildGEP2<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2021-07-31 00:00:00 +00:00
|
|
|
Ty: &'a Type,
|
2018-07-10 10:28:39 +00:00
|
|
|
Pointer: &'a Value,
|
|
|
|
Indices: *const &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
NumIndices: c_uint,
|
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildInBoundsGEP2<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2021-08-01 00:00:00 +00:00
|
|
|
Ty: &'a Type,
|
2018-07-10 10:28:39 +00:00
|
|
|
Pointer: &'a Value,
|
|
|
|
Indices: *const &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
NumIndices: c_uint,
|
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Casts
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildTrunc<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildZExt<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSExt<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFPToUI<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFPToSI<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildUIToFP<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildSIToFP<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFPTrunc<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFPExt<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildPtrToInt<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildIntToPtr<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildBitCast<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildPointerCast<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildIntCast2<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
DestTy: &'a Type,
|
2023-04-08 09:15:26 +00:00
|
|
|
IsSigned: Bool,
|
2023-04-03 13:30:34 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Comparisons
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildICmp<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Op: c_uint,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFCmp<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Op: c_uint,
|
2018-07-10 10:28:39 +00:00
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &'a Value;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Miscellaneous instructions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildPhi<'a>(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char)
|
|
|
|
-> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildSelect<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
If: &'a Value,
|
|
|
|
Then: &'a Value,
|
|
|
|
Else: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildVAArg<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
list: &'a Value,
|
2018-07-03 12:49:43 +00:00
|
|
|
Ty: &'a Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildExtractElement<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
VecVal: &'a Value,
|
|
|
|
Index: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildInsertElement<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
VecVal: &'a Value,
|
|
|
|
EltVal: &'a Value,
|
|
|
|
Index: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildShuffleVector<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
V1: &'a Value,
|
|
|
|
V2: &'a Value,
|
|
|
|
Mask: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildExtractValue<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
AggVal: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Index: c_uint,
|
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildInsertValue<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
AggVal: &'a Value,
|
|
|
|
EltVal: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Index: c_uint,
|
2018-06-27 14:57:25 +00:00
|
|
|
Name: *const c_char,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2023-11-21 18:43:11 +00:00
|
|
|
// Atomic Operations
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAtomicCmpXchg<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
CMP: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Order: AtomicOrdering,
|
|
|
|
FailureOrder: AtomicOrdering,
|
|
|
|
SingleThreaded: Bool,
|
|
|
|
) -> &'a Value;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetWeak(CmpXchgInst: &Value, IsWeak: Bool);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildAtomicRMW<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Op: AtomicRmwBinOp,
|
|
|
|
LHS: &'a Value,
|
|
|
|
RHS: &'a Value,
|
|
|
|
Order: AtomicOrdering,
|
|
|
|
SingleThreaded: Bool,
|
|
|
|
) -> &'a Value;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMBuildFence<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Order: AtomicOrdering,
|
|
|
|
SingleThreaded: Bool,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
|
|
|
|
|
|
|
/// Writes a module to the specified path. Returns 0 on success.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMWriteBitcodeToFile(M: &Module, Path: *const c_char) -> c_int;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
/// Creates a legacy pass manager -- only used for final codegen.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMCreatePassManager<'a>() -> &'a mut PassManager<'a>;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMAddAnalysisPasses<'a>(T: &'a TargetMachine, PM: &PassManager<'a>);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetHostCPUFeatures() -> *mut c_char;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMDisposeMessage(message: *mut c_char);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsMultithreaded() -> Bool;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMStructCreateNamed(C: &Context, Name: *const c_char) -> &Type;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMStructSetBody<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
StructTy: &'a Type,
|
|
|
|
ElementTypes: *const &'a Type,
|
|
|
|
ElementCount: c_uint,
|
|
|
|
Packed: Bool,
|
|
|
|
);
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMMetadataAsValue<'a>(C: &'a Context, MD: &'a Metadata) -> &'a Value;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMSetUnnamedAddress(Global: &Value, UnnamedAddr: UnnamedAddr);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMIsAConstantInt(value_ref: &Value) -> Option<&ConstantInt>;
|
2024-10-18 07:31:28 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMGetOrInsertComdat(M: &Module, Name: *const c_char) -> &Comdat;
|
|
|
|
pub(crate) fn LLVMSetComdat(V: &Value, C: &Comdat);
|
2024-10-28 06:25:40 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMCreateOperandBundle(
|
|
|
|
Tag: *const c_char,
|
|
|
|
TagLen: size_t,
|
|
|
|
Args: *const &'_ Value,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
) -> *mut OperandBundle<'_>;
|
|
|
|
pub(crate) fn LLVMDisposeOperandBundle(Bundle: ptr::NonNull<OperandBundle<'_>>);
|
|
|
|
|
|
|
|
pub(crate) fn LLVMBuildCallWithOperandBundles<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
Fn: &'a Value,
|
|
|
|
Args: *const &'a Value,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Bundles: *const &OperandBundle<'a>,
|
|
|
|
NumBundles: c_uint,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildInvokeWithOperandBundles<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
Fn: &'a Value,
|
|
|
|
Args: *const &'a Value,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Then: &'a BasicBlock,
|
|
|
|
Catch: &'a BasicBlock,
|
|
|
|
Bundles: *const &OperandBundle<'a>,
|
|
|
|
NumBundles: c_uint,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMBuildCallBr<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
Ty: &'a Type,
|
|
|
|
Fn: &'a Value,
|
|
|
|
DefaultDest: &'a BasicBlock,
|
|
|
|
IndirectDests: *const &'a BasicBlock,
|
|
|
|
NumIndirectDests: c_uint,
|
|
|
|
Args: *const &'a Value,
|
|
|
|
NumArgs: c_uint,
|
|
|
|
Bundles: *const &OperandBundle<'a>,
|
|
|
|
NumBundles: c_uint,
|
|
|
|
Name: *const c_char,
|
|
|
|
) -> &'a Value;
|
2023-11-21 18:43:11 +00:00
|
|
|
}
|
|
|
|
|
2025-01-31 05:29:09 +00:00
|
|
|
// FFI bindings for `DIBuilder` functions in the LLVM-C API.
|
|
|
|
// Try to keep these in the same order as in `llvm/include/llvm-c/DebugInfo.h`.
|
2024-12-07 13:10:39 +00:00
|
|
|
//
|
|
|
|
// FIXME(#134001): Audit all `Option` parameters, especially in lists, to check
|
|
|
|
// that they really are nullable on the C/C++ side. LLVM doesn't appear to
|
|
|
|
// actually document which ones are nullable.
|
2025-01-31 05:29:09 +00:00
|
|
|
unsafe extern "C" {
|
|
|
|
pub(crate) fn LLVMCreateDIBuilder<'ll>(M: &'ll Module) -> *mut DIBuilder<'ll>;
|
|
|
|
pub(crate) fn LLVMDisposeDIBuilder<'ll>(Builder: ptr::NonNull<DIBuilder<'ll>>);
|
2025-02-01 02:38:12 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMDIBuilderFinalize<'ll>(Builder: &DIBuilder<'ll>);
|
2025-02-01 02:43:30 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMDIBuilderCreateNameSpace<'ll>(
|
|
|
|
Builder: &DIBuilder<'ll>,
|
|
|
|
ParentScope: Option<&'ll Metadata>,
|
|
|
|
Name: *const c_uchar,
|
|
|
|
NameLen: size_t,
|
|
|
|
ExportSymbols: llvm::Bool,
|
|
|
|
) -> &'ll Metadata;
|
2025-02-01 02:50:01 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMDIBuilderCreateLexicalBlock<'ll>(
|
|
|
|
Builder: &DIBuilder<'ll>,
|
|
|
|
Scope: &'ll Metadata,
|
|
|
|
File: &'ll Metadata,
|
|
|
|
Line: c_uint,
|
|
|
|
Column: c_uint,
|
|
|
|
) -> &'ll Metadata;
|
2025-02-01 02:55:44 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMDIBuilderCreateLexicalBlockFile<'ll>(
|
|
|
|
Builder: &DIBuilder<'ll>,
|
|
|
|
Scope: &'ll Metadata,
|
|
|
|
File: &'ll Metadata,
|
|
|
|
Discriminator: c_uint, // (optional "DWARF path discriminator"; default is 0)
|
|
|
|
) -> &'ll Metadata;
|
2025-02-01 03:00:20 +00:00
|
|
|
|
|
|
|
pub(crate) fn LLVMDIBuilderCreateDebugLocation<'ll>(
|
|
|
|
Ctx: &'ll Context,
|
|
|
|
Line: c_uint,
|
|
|
|
Column: c_uint,
|
|
|
|
Scope: &'ll Metadata,
|
|
|
|
InlinedAt: Option<&'ll Metadata>,
|
|
|
|
) -> &'ll Metadata;
|
2025-01-31 05:29:09 +00:00
|
|
|
}
|
|
|
|
|
2023-11-21 18:43:11 +00:00
|
|
|
#[link(name = "llvm-wrapper", kind = "static")]
|
2024-08-26 23:40:43 +00:00
|
|
|
unsafe extern "C" {
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustInstallErrorHandlers();
|
|
|
|
pub(crate) fn LLVMRustDisableSystemDialogsOnCrash();
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Create and destroy contexts.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustContextCreate(shouldDiscardNames: bool) -> &'static mut Context;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
/// See llvm::LLVMTypeKind::getTypeID.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetTypeKind(Ty: &Type) -> TypeKind;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Operations on all values
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGlobalAddMetadata<'a>(
|
|
|
|
Val: &'a Value,
|
|
|
|
KindID: c_uint,
|
|
|
|
Metadata: &'a Metadata,
|
|
|
|
);
|
|
|
|
pub(crate) fn LLVMRustIsNonGVFunctionPointerTy(Val: &Value) -> bool;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Operations on scalar constants
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustConstIntGetZExtValue(ConstantVal: &ConstantInt, Value: &mut u64) -> bool;
|
|
|
|
pub(crate) fn LLVMRustConstInt128Get(
|
2023-11-21 18:43:11 +00:00
|
|
|
ConstantVal: &ConstantInt,
|
|
|
|
SExt: bool,
|
|
|
|
high: &mut u64,
|
|
|
|
low: &mut u64,
|
|
|
|
) -> bool;
|
|
|
|
|
|
|
|
// Operations on global variables, functions, and aliases (globals)
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetDSOLocal(Global: &Value, is_dso_local: bool);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Operations on global variables
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetOrInsertGlobal<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
M: &'a Module,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
T: &'a Type,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustInsertPrivateGlobal<'a>(M: &'a Module, T: &'a Type) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustGetNamedValue(
|
2023-11-21 18:43:11 +00:00
|
|
|
M: &Module,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
) -> Option<&Value>;
|
|
|
|
|
|
|
|
// Operations on attributes
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustCreateAttrNoValue(C: &Context, attr: AttributeKind) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateAlignmentAttr(C: &Context, bytes: u64) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateDereferenceableAttr(C: &Context, bytes: u64) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateDereferenceableOrNullAttr(C: &Context, bytes: u64) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateByValAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateStructRetAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateElementTypeAttr<'a>(C: &'a Context, ty: &'a Type) -> &'a Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateUWTableAttr(C: &Context, async_: bool) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateAllocSizeAttr(C: &Context, size_arg: u32) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateAllocKindAttr(C: &Context, size_arg: u64) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateMemoryEffectsAttr(
|
|
|
|
C: &Context,
|
|
|
|
effects: MemoryEffects,
|
|
|
|
) -> &Attribute;
|
|
|
|
pub(crate) fn LLVMRustCreateRangeAttribute(
|
2024-07-30 09:06:26 +00:00
|
|
|
C: &Context,
|
|
|
|
num_bits: c_uint,
|
|
|
|
lower_words: *const u64,
|
|
|
|
upper_words: *const u64,
|
|
|
|
) -> &Attribute;
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Operations on functions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetOrInsertFunction<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
M: &'a Module,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
FunctionTy: &'a Type,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustAddFunctionAttributes<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
Fn: &'a Value,
|
|
|
|
index: c_uint,
|
|
|
|
Attrs: *const &'a Attribute,
|
|
|
|
AttrsLen: size_t,
|
|
|
|
);
|
|
|
|
|
|
|
|
// Operations on call sites
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustAddCallSiteAttributes<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
Instr: &'a Value,
|
|
|
|
index: c_uint,
|
|
|
|
Attrs: *const &'a Attribute,
|
|
|
|
AttrsLen: size_t,
|
|
|
|
);
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetFastMath(Instr: &Value);
|
|
|
|
pub(crate) fn LLVMRustSetAlgebraicMath(Instr: &Value);
|
|
|
|
pub(crate) fn LLVMRustSetAllowReassoc(Instr: &Value);
|
2023-11-21 18:43:11 +00:00
|
|
|
|
|
|
|
// Miscellaneous instructions
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildMemCpy<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Dst: &'a Value,
|
|
|
|
DstAlign: c_uint,
|
|
|
|
Src: &'a Value,
|
|
|
|
SrcAlign: c_uint,
|
|
|
|
Size: &'a Value,
|
|
|
|
IsVolatile: bool,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildMemMove<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Dst: &'a Value,
|
|
|
|
DstAlign: c_uint,
|
|
|
|
Src: &'a Value,
|
|
|
|
SrcAlign: c_uint,
|
|
|
|
Size: &'a Value,
|
|
|
|
IsVolatile: bool,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildMemSet<'a>(
|
2023-11-21 18:43:11 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Dst: &'a Value,
|
|
|
|
DstAlign: c_uint,
|
|
|
|
Val: &'a Value,
|
|
|
|
Size: &'a Value,
|
|
|
|
IsVolatile: bool,
|
|
|
|
) -> &'a Value;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceFAdd<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Acc: &'a Value,
|
|
|
|
Src: &'a Value,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceFMul<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Acc: &'a Value,
|
|
|
|
Src: &'a Value,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceAdd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceMul<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceAnd<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceOr<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceXor<'a>(B: &Builder<'a>, Src: &'a Value) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceMin<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Src: &'a Value,
|
2018-03-13 15:46:55 +00:00
|
|
|
IsSigned: bool,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceMax<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Src: &'a Value,
|
2018-03-13 15:46:55 +00:00
|
|
|
IsSigned: bool,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceFMin<'a>(
|
2021-12-14 18:49:49 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Src: &'a Value,
|
|
|
|
IsNaN: bool,
|
|
|
|
) -> &'a Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildVectorReduceFMax<'a>(
|
2021-12-14 18:49:49 +00:00
|
|
|
B: &Builder<'a>,
|
|
|
|
Src: &'a Value,
|
|
|
|
IsNaN: bool,
|
|
|
|
) -> &'a Value;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildMinNum<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
LHS: &'a Value,
|
|
|
|
) -> &'a Value;
|
|
|
|
pub(crate) fn LLVMRustBuildMaxNum<'a>(
|
|
|
|
B: &Builder<'a>,
|
|
|
|
LHS: &'a Value,
|
|
|
|
LHS: &'a Value,
|
|
|
|
) -> &'a Value;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2016-10-22 13:07:35 +00:00
|
|
|
// Atomic Operations
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildAtomicLoad<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2021-07-04 15:49:51 +00:00
|
|
|
ElementType: &'a Type,
|
2018-07-10 10:28:39 +00:00
|
|
|
PointerVal: &'a Value,
|
2018-06-27 14:57:25 +00:00
|
|
|
Name: *const c_char,
|
2016-08-02 20:10:10 +00:00
|
|
|
Order: AtomicOrdering,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustBuildAtomicStore<'a>(
|
2018-07-17 15:33:09 +00:00
|
|
|
B: &Builder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
|
|
|
Ptr: &'a Value,
|
2016-08-02 20:10:10 +00:00
|
|
|
Order: AtomicOrdering,
|
2018-12-09 10:20:20 +00:00
|
|
|
) -> &'a Value;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustTimeTraceProfilerInitialize();
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustTimeTraceProfilerFinishThread();
|
2022-09-18 22:49:49 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustTimeTraceProfilerFinish(FileName: *const c_char);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
|
|
|
/// Returns a string describing the last error caused by an LLVMRust* call.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetLastError() -> *const c_char;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2024-11-03 04:15:46 +00:00
|
|
|
/// Prints the timing information collected by `-Ztime-llvm-passes`.
|
|
|
|
pub(crate) fn LLVMRustPrintPassTimings(OutStr: &RustString);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2024-11-03 04:15:46 +00:00
|
|
|
/// Prints the statistics collected by `-Zprint-codegen-stats`.
|
|
|
|
pub(crate) fn LLVMRustPrintStatistics(OutStr: &RustString);
|
2022-11-05 08:08:57 +00:00
|
|
|
|
2016-08-02 20:10:10 +00:00
|
|
|
/// Prepares inline assembly.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustInlineAsm(
|
2018-07-02 14:52:53 +00:00
|
|
|
Ty: &Type,
|
2016-08-02 20:10:10 +00:00
|
|
|
AsmString: *const c_char,
|
2020-03-10 00:00:00 +00:00
|
|
|
AsmStringLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
Constraints: *const c_char,
|
2020-03-10 00:00:00 +00:00
|
|
|
ConstraintsLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
SideEffects: Bool,
|
|
|
|
AlignStack: Bool,
|
2016-08-02 21:25:19 +00:00
|
|
|
Dialect: AsmDialect,
|
2021-08-28 17:02:00 +00:00
|
|
|
CanThrow: Bool,
|
2018-07-10 10:28:39 +00:00
|
|
|
) -> &Value;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustInlineAsmVerify(
|
2020-03-10 00:00:00 +00:00
|
|
|
Ty: &Type,
|
|
|
|
Constraints: *const c_char,
|
|
|
|
ConstraintsLen: size_t,
|
|
|
|
) -> bool;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageWriteFilenamesToBuffer(
|
2020-07-02 18:27:15 +00:00
|
|
|
Filenames: *const *const c_char,
|
|
|
|
FilenamesLen: size_t,
|
2023-07-24 07:27:29 +00:00
|
|
|
Lengths: *const size_t,
|
|
|
|
LengthsLen: size_t,
|
2020-07-02 18:27:15 +00:00
|
|
|
BufferOut: &RustString,
|
|
|
|
);
|
|
|
|
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageWriteFunctionMappingsToBuffer(
|
2020-07-02 18:27:15 +00:00
|
|
|
VirtualFileMappingIDs: *const c_uint,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumVirtualFileMappingIDs: size_t,
|
2023-07-22 08:23:39 +00:00
|
|
|
Expressions: *const crate::coverageinfo::ffi::CounterExpression,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumExpressions: size_t,
|
2024-10-19 11:22:43 +00:00
|
|
|
CodeRegions: *const crate::coverageinfo::ffi::CodeRegion,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumCodeRegions: size_t,
|
2024-10-19 11:22:43 +00:00
|
|
|
BranchRegions: *const crate::coverageinfo::ffi::BranchRegion,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumBranchRegions: size_t,
|
2024-10-19 11:22:43 +00:00
|
|
|
MCDCBranchRegions: *const crate::coverageinfo::ffi::MCDCBranchRegion,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumMCDCBranchRegions: size_t,
|
2024-10-19 11:22:43 +00:00
|
|
|
MCDCDecisionRegions: *const crate::coverageinfo::ffi::MCDCDecisionRegion,
|
2024-11-01 10:29:09 +00:00
|
|
|
NumMCDCDecisionRegions: size_t,
|
2020-07-02 18:27:15 +00:00
|
|
|
BufferOut: &RustString,
|
|
|
|
);
|
|
|
|
|
2024-10-19 10:47:42 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageCreatePGOFuncNameVar(
|
2023-07-24 07:47:47 +00:00
|
|
|
F: &Value,
|
|
|
|
FuncName: *const c_char,
|
|
|
|
FuncNameLen: size_t,
|
|
|
|
) -> &Value;
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageHashBytes(Bytes: *const c_char, NumBytes: size_t) -> u64;
|
2020-07-02 18:27:15 +00:00
|
|
|
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageWriteCovmapSectionNameToString(M: &Module, OutStr: &RustString);
|
2020-11-23 20:56:07 +00:00
|
|
|
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageWriteCovfunSectionNameToString(M: &Module, OutStr: &RustString);
|
2020-07-02 18:27:15 +00:00
|
|
|
|
2024-11-01 10:29:09 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageWriteCovmapVarNameToString(OutStr: &RustString);
|
2020-07-02 18:27:15 +00:00
|
|
|
|
2024-10-19 10:47:42 +00:00
|
|
|
pub(crate) fn LLVMRustCoverageMappingVersion() -> u32;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDebugMetadataVersion() -> u32;
|
|
|
|
pub(crate) fn LLVMRustVersionMajor() -> u32;
|
|
|
|
pub(crate) fn LLVMRustVersionMinor() -> u32;
|
|
|
|
pub(crate) fn LLVMRustVersionPatch() -> u32;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2022-01-19 14:51:59 +00:00
|
|
|
/// Add LLVM module flags.
|
|
|
|
///
|
|
|
|
/// In order for Rust-C LTO to work, module flags must be compatible with Clang. What
|
|
|
|
/// "compatible" means depends on the merge behaviors involved.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustAddModuleFlagU32(
|
2022-01-19 14:51:59 +00:00
|
|
|
M: &Module,
|
2024-10-29 02:38:17 +00:00
|
|
|
MergeBehavior: ModuleFlagMergeBehavior,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
Value: u32,
|
2022-01-19 14:51:59 +00:00
|
|
|
);
|
2024-01-28 10:38:41 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustAddModuleFlagString(
|
2024-01-28 10:38:41 +00:00
|
|
|
M: &Module,
|
2024-10-29 02:38:17 +00:00
|
|
|
MergeBehavior: ModuleFlagMergeBehavior,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
Value: *const c_char,
|
|
|
|
ValueLen: size_t,
|
2024-01-28 10:38:41 +00:00
|
|
|
);
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateCompileUnit<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Lang: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
Producer: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
ProducerLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
isOptimized: bool,
|
|
|
|
Flags: *const c_char,
|
|
|
|
RuntimeVer: c_uint,
|
2019-01-22 21:01:14 +00:00
|
|
|
SplitName: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
SplitNameLen: size_t,
|
2019-01-22 21:01:14 +00:00
|
|
|
kind: DebugEmissionKind,
|
2020-09-23 15:25:20 +00:00
|
|
|
DWOId: u64,
|
|
|
|
SplitDebugInlining: bool,
|
2023-11-16 04:07:37 +00:00
|
|
|
DebugNameTableKind: DebugNameTableKind,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIDescriptor;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateFile<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Filename: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
FilenameLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
Directory: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
DirectoryLen: size_t,
|
2020-03-31 05:17:15 +00:00
|
|
|
CSKind: ChecksumKind,
|
|
|
|
Checksum: *const c_char,
|
|
|
|
ChecksumLen: size_t,
|
2024-04-27 21:14:36 +00:00
|
|
|
Source: *const c_char,
|
|
|
|
SourceLen: size_t,
|
2018-07-17 15:45:33 +00:00
|
|
|
) -> &'a DIFile;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateSubroutineType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
ParameterTypes: &'a DIArray,
|
|
|
|
) -> &'a DICompositeType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateFunction<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: &'a DIDescriptor,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
LinkageName: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
LinkageNameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNo: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
2016-08-02 20:10:10 +00:00
|
|
|
ScopeLine: c_uint,
|
2016-11-18 22:15:14 +00:00
|
|
|
Flags: DIFlags,
|
2019-01-16 17:59:03 +00:00
|
|
|
SPFlags: DISPFlags,
|
2020-02-10 20:30:51 +00:00
|
|
|
MaybeFn: Option<&'a Value>,
|
2018-07-04 13:36:49 +00:00
|
|
|
TParam: &'a DIArray,
|
|
|
|
Decl: Option<&'a DIDescriptor>,
|
|
|
|
) -> &'a DISubprogram;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateMethod<'a>(
|
2023-05-03 22:52:31 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Scope: &'a DIDescriptor,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
LinkageName: *const c_char,
|
|
|
|
LinkageNameLen: size_t,
|
|
|
|
File: &'a DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Ty: &'a DIType,
|
|
|
|
Flags: DIFlags,
|
|
|
|
SPFlags: DISPFlags,
|
|
|
|
TParam: &'a DIArray,
|
|
|
|
) -> &'a DISubprogram;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateBasicType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
SizeInBits: u64,
|
|
|
|
Encoding: c_uint,
|
2018-07-17 15:45:33 +00:00
|
|
|
) -> &'a DIBasicType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateTypedef<'a>(
|
2020-06-25 06:28:00 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Type: &'a DIBasicType,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
File: &'a DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Scope: Option<&'a DIScope>,
|
|
|
|
) -> &'a DIDerivedType;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreatePointerType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
PointeeTy: &'a DIType,
|
2016-10-22 13:07:35 +00:00
|
|
|
SizeInBits: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2020-03-06 00:00:00 +00:00
|
|
|
AddressSpace: c_uint,
|
2016-10-22 13:07:35 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIDerivedType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateStructType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: Option<&'a DIDescriptor>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2016-11-18 22:15:14 +00:00
|
|
|
Flags: DIFlags,
|
2018-07-04 13:36:49 +00:00
|
|
|
DerivedFrom: Option<&'a DIType>,
|
|
|
|
Elements: &'a DIArray,
|
2016-08-02 20:10:10 +00:00
|
|
|
RunTimeLang: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
VTableHolder: Option<&'a DIType>,
|
2016-08-02 20:10:10 +00:00
|
|
|
UniqueId: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
UniqueIdLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DICompositeType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateMemberType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: &'a DIDescriptor,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNo: c_uint,
|
|
|
|
SizeInBits: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2016-08-02 20:10:10 +00:00
|
|
|
OffsetInBits: u64,
|
2016-11-18 22:15:14 +00:00
|
|
|
Flags: DIFlags,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
|
|
|
) -> &'a DIDerivedType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateVariantMemberType<'a>(
|
2017-11-29 21:42:25 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Scope: &'a DIScope,
|
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2017-11-29 21:42:25 +00:00
|
|
|
File: &'a DIFile,
|
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: u64,
|
|
|
|
AlignInBits: u32,
|
|
|
|
OffsetInBits: u64,
|
|
|
|
Discriminant: Option<&'a Value>,
|
|
|
|
Flags: DIFlags,
|
|
|
|
Ty: &'a DIType,
|
|
|
|
) -> &'a DIType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateStaticMemberType<'a>(
|
2022-06-20 15:50:27 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Scope: &'a DIDescriptor,
|
|
|
|
Name: *const c_char,
|
|
|
|
NameLen: size_t,
|
|
|
|
File: &'a DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
Ty: &'a DIType,
|
|
|
|
Flags: DIFlags,
|
|
|
|
val: Option<&'a Value>,
|
|
|
|
AlignInBits: u32,
|
|
|
|
) -> &'a DIDerivedType;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateQualifiedType<'a>(
|
2024-12-06 16:11:11 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Tag: c_uint,
|
|
|
|
Type: &'a DIType,
|
|
|
|
) -> &'a DIDerivedType;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateStaticVariable<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Context: Option<&'a DIScope>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2016-08-02 20:10:10 +00:00
|
|
|
LinkageName: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
LinkageNameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNo: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
2016-08-02 20:10:10 +00:00
|
|
|
isLocalToUnit: bool,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-04 13:36:49 +00:00
|
|
|
Decl: Option<&'a DIDescriptor>,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2018-09-14 16:06:45 +00:00
|
|
|
) -> &'a DIGlobalVariableExpression;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateVariable<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Tag: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: &'a DIDescriptor,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNo: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
2016-08-02 20:10:10 +00:00
|
|
|
AlwaysPreserve: bool,
|
2016-11-18 22:15:14 +00:00
|
|
|
Flags: DIFlags,
|
2016-11-18 16:11:18 +00:00
|
|
|
ArgNo: c_uint,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIVariable;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateArrayType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Size: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
|
|
|
Subscripts: &'a DIArray,
|
|
|
|
) -> &'a DIType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderGetOrCreateSubrange<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Lo: i64,
|
|
|
|
Count: i64,
|
2018-07-17 15:45:33 +00:00
|
|
|
) -> &'a DISubrange;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderGetOrCreateArray<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ptr: *const Option<&'a DIDescriptor>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Count: c_uint,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIArray;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderInsertDeclareAtEnd<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-10 10:28:39 +00:00
|
|
|
Val: &'a Value,
|
2018-07-04 13:36:49 +00:00
|
|
|
VarInfo: &'a DIVariable,
|
2022-01-03 10:25:33 +00:00
|
|
|
AddrOps: *const u64,
|
2016-08-02 20:10:10 +00:00
|
|
|
AddrOpsCount: c_uint,
|
2020-02-10 20:52:20 +00:00
|
|
|
DL: &'a DILocation,
|
2018-07-10 11:34:34 +00:00
|
|
|
InsertAtEnd: &'a BasicBlock,
|
2024-07-12 12:52:26 +00:00
|
|
|
);
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateEnumerator<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-05 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2022-10-01 21:12:03 +00:00
|
|
|
Value: *const u64,
|
|
|
|
SizeInBits: c_uint,
|
2020-03-05 00:00:00 +00:00
|
|
|
IsUnsigned: bool,
|
2018-07-17 15:45:33 +00:00
|
|
|
) -> &'a DIEnumerator;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateEnumerationType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: &'a DIScope,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2018-07-04 13:36:49 +00:00
|
|
|
Elements: &'a DIArray,
|
2017-11-29 21:42:25 +00:00
|
|
|
ClassType: &'a DIType,
|
2019-01-16 17:59:03 +00:00
|
|
|
IsScoped: bool,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateUnionType<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2021-04-26 18:39:57 +00:00
|
|
|
Scope: Option<&'a DIScope>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
File: &'a DIFile,
|
2016-08-02 20:10:10 +00:00
|
|
|
LineNumber: c_uint,
|
|
|
|
SizeInBits: u64,
|
2017-02-04 10:51:10 +00:00
|
|
|
AlignInBits: u32,
|
2016-11-18 22:15:14 +00:00
|
|
|
Flags: DIFlags,
|
2018-07-04 13:36:49 +00:00
|
|
|
Elements: Option<&'a DIArray>,
|
2016-08-02 20:10:10 +00:00
|
|
|
RunTimeLang: c_uint,
|
|
|
|
UniqueId: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
UniqueIdLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
) -> &'a DIType;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateVariantPart<'a>(
|
2017-11-29 21:42:25 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
Scope: &'a DIScope,
|
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2017-11-29 21:42:25 +00:00
|
|
|
File: &'a DIFile,
|
|
|
|
LineNo: c_uint,
|
|
|
|
SizeInBits: u64,
|
|
|
|
AlignInBits: u32,
|
|
|
|
Flags: DIFlags,
|
|
|
|
Discriminator: Option<&'a DIDerivedType>,
|
|
|
|
Elements: &'a DIArray,
|
|
|
|
UniqueId: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
UniqueIdLen: size_t,
|
2017-11-29 21:42:25 +00:00
|
|
|
) -> &'a DIDerivedType;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDIBuilderCreateTemplateTypeParameter<'a>(
|
2018-07-17 15:45:33 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
2018-07-04 13:36:49 +00:00
|
|
|
Scope: Option<&'a DIScope>,
|
2016-08-02 20:10:10 +00:00
|
|
|
Name: *const c_char,
|
2020-03-06 00:00:00 +00:00
|
|
|
NameLen: size_t,
|
2018-07-04 13:36:49 +00:00
|
|
|
Ty: &'a DIType,
|
|
|
|
) -> &'a DITemplateTypeParameter;
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDICompositeTypeReplaceArrays<'a>(
|
2018-10-12 13:34:14 +00:00
|
|
|
Builder: &DIBuilder<'a>,
|
|
|
|
CompositeType: &'a DIType,
|
|
|
|
Elements: Option<&'a DIArray>,
|
|
|
|
Params: Option<&'a DIArray>,
|
|
|
|
);
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDILocationCloneWithBaseDiscriminator<'a>(
|
2024-11-04 19:38:14 +00:00
|
|
|
Location: &'a DILocation,
|
|
|
|
BD: c_uint,
|
|
|
|
) -> Option<&'a DILocation>;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustWriteTypeToString(Type: &Type, s: &RustString);
|
|
|
|
pub(crate) fn LLVMRustWriteValueToString(value_ref: &Value, s: &RustString);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustHasFeature(T: &TargetMachine, s: *const c_char) -> bool;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2024-11-02 01:40:28 +00:00
|
|
|
pub(crate) fn LLVMRustPrintTargetCPUs(TM: &TargetMachine, OutStr: &RustString);
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetTargetFeaturesCount(T: &TargetMachine) -> size_t;
|
|
|
|
pub(crate) fn LLVMRustGetTargetFeature(
|
2021-04-08 05:00:47 +00:00
|
|
|
T: &TargetMachine,
|
|
|
|
Index: size_t,
|
|
|
|
Feature: &mut *const c_char,
|
|
|
|
Desc: &mut *const c_char,
|
|
|
|
);
|
2016-08-06 05:50:48 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetHostCPUName(LenOut: &mut size_t) -> *const u8;
|
2023-09-17 12:40:22 +00:00
|
|
|
|
2024-09-18 03:34:49 +00:00
|
|
|
// This function makes copies of pointed to data, so the data's lifetime may end after this
|
|
|
|
// function returns.
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustCreateTargetMachine(
|
2016-08-02 20:10:10 +00:00
|
|
|
Triple: *const c_char,
|
|
|
|
CPU: *const c_char,
|
|
|
|
Features: *const c_char,
|
2019-10-30 04:12:05 +00:00
|
|
|
Abi: *const c_char,
|
2016-08-02 20:10:10 +00:00
|
|
|
Model: CodeModel,
|
2020-04-23 17:49:00 +00:00
|
|
|
Reloc: RelocModel,
|
2016-08-02 20:10:10 +00:00
|
|
|
Level: CodeGenOptLevel,
|
2024-12-30 17:10:59 +00:00
|
|
|
FloatABIType: FloatAbi,
|
2016-08-02 20:10:10 +00:00
|
|
|
FunctionSections: bool,
|
2017-11-11 15:08:00 +00:00
|
|
|
DataSections: bool,
|
2021-10-11 19:09:32 +00:00
|
|
|
UniqueSectionNames: bool,
|
2017-10-23 03:01:00 +00:00
|
|
|
TrapUnreachable: bool,
|
2018-08-12 17:59:18 +00:00
|
|
|
Singlethread: bool,
|
2024-06-21 19:08:49 +00:00
|
|
|
VerboseAsm: bool,
|
2019-12-02 12:22:45 +00:00
|
|
|
EmitStackSizeSection: bool,
|
|
|
|
RelaxELFRelocations: bool,
|
2020-04-17 02:40:11 +00:00
|
|
|
UseInitArray: bool,
|
2020-09-23 15:25:20 +00:00
|
|
|
SplitDwarfFile: *const c_char,
|
2023-09-09 12:00:24 +00:00
|
|
|
OutputObjFile: *const c_char,
|
2023-07-12 21:07:34 +00:00
|
|
|
DebugInfoCompression: *const c_char,
|
2023-11-13 12:48:23 +00:00
|
|
|
UseEmulatedTls: bool,
|
2023-07-03 11:11:27 +00:00
|
|
|
ArgsCstrBuff: *const c_char,
|
|
|
|
ArgsCstrBuffLen: usize,
|
2023-09-17 12:40:22 +00:00
|
|
|
) -> *mut TargetMachine;
|
2024-01-12 10:23:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustDisposeTargetMachine(T: *mut TargetMachine);
|
|
|
|
pub(crate) fn LLVMRustAddLibraryInfo<'a>(
|
2024-01-12 10:23:04 +00:00
|
|
|
PM: &PassManager<'a>,
|
|
|
|
M: &'a Module,
|
|
|
|
DisableSimplifyLibCalls: bool,
|
|
|
|
);
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustWriteOutputFile<'a>(
|
2018-07-12 15:34:59 +00:00
|
|
|
T: &'a TargetMachine,
|
2025-01-14 12:25:16 +00:00
|
|
|
PM: *mut PassManager<'a>,
|
2018-07-12 15:34:59 +00:00
|
|
|
M: &'a Module,
|
2016-08-02 20:10:10 +00:00
|
|
|
Output: *const c_char,
|
2020-09-23 15:25:20 +00:00
|
|
|
DwoOutput: *const c_char,
|
2016-08-02 20:10:10 +00:00
|
|
|
FileType: FileType,
|
2024-11-26 14:25:46 +00:00
|
|
|
VerifyIR: bool,
|
2016-08-02 20:10:10 +00:00
|
|
|
) -> LLVMRustResult;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustOptimize<'a>(
|
2020-01-05 18:16:58 +00:00
|
|
|
M: &'a Module,
|
|
|
|
TM: &'a TargetMachine,
|
|
|
|
OptLevel: PassBuilderOptLevel,
|
|
|
|
OptStage: OptStage,
|
2023-07-11 23:19:42 +00:00
|
|
|
IsLinkerPluginLTO: bool,
|
2020-01-05 18:16:58 +00:00
|
|
|
NoPrepopulatePasses: bool,
|
|
|
|
VerifyIR: bool,
|
2024-08-29 10:12:31 +00:00
|
|
|
LintIR: bool,
|
2020-01-05 18:16:58 +00:00
|
|
|
UseThinLTOBuffers: bool,
|
|
|
|
MergeFunctions: bool,
|
|
|
|
UnrollLoops: bool,
|
|
|
|
SLPVectorize: bool,
|
|
|
|
LoopVectorize: bool,
|
2024-01-12 10:23:04 +00:00
|
|
|
DisableSimplifyLibCalls: bool,
|
2020-05-13 00:00:00 +00:00
|
|
|
EmitLifetimeMarkers: bool,
|
2025-02-08 03:27:46 +00:00
|
|
|
RunEnzyme: bool,
|
2020-01-05 18:16:58 +00:00
|
|
|
SanitizerOptions: Option<&SanitizerOptions>,
|
|
|
|
PGOGenPath: *const c_char,
|
|
|
|
PGOUsePath: *const c_char,
|
2021-04-05 08:45:04 +00:00
|
|
|
InstrumentCoverage: bool,
|
2022-08-10 16:16:20 +00:00
|
|
|
InstrProfileOutput: *const c_char,
|
2021-05-07 07:41:37 +00:00
|
|
|
PGOSampleUsePath: *const c_char,
|
|
|
|
DebugInfoForProfiling: bool,
|
2020-02-11 21:37:16 +00:00
|
|
|
llvm_selfprofiler: *mut c_void,
|
|
|
|
begin_callback: SelfProfileBeforePassCallback,
|
|
|
|
end_callback: SelfProfileAfterPassCallback,
|
2021-04-05 13:37:11 +00:00
|
|
|
ExtraPasses: *const c_char,
|
|
|
|
ExtraPassesLen: size_t,
|
2021-11-24 10:43:40 +00:00
|
|
|
LLVMPlugins: *const c_char,
|
|
|
|
LLVMPluginsLen: size_t,
|
2021-04-05 13:37:11 +00:00
|
|
|
) -> LLVMRustResult;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustPrintModule(
|
2021-12-14 18:49:49 +00:00
|
|
|
M: &Module,
|
2017-06-29 14:52:43 +00:00
|
|
|
Output: *const c_char,
|
|
|
|
Demangle: extern "C" fn(*const c_char, size_t, *mut c_char, size_t) -> size_t,
|
2019-04-06 00:48:23 +00:00
|
|
|
) -> LLVMRustResult;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetLLVMOptions(Argc: c_int, Argv: *const *const c_char);
|
|
|
|
pub(crate) fn LLVMRustPrintPasses();
|
|
|
|
pub(crate) fn LLVMRustSetNormalizedTarget(M: &Module, triple: *const c_char);
|
|
|
|
pub(crate) fn LLVMRustRunRestrictionPass(M: &Module, syms: *const *const c_char, len: size_t);
|
|
|
|
|
|
|
|
pub(crate) fn LLVMRustOpenArchive(path: *const c_char) -> Option<&'static mut Archive>;
|
|
|
|
pub(crate) fn LLVMRustArchiveIteratorNew(AR: &Archive) -> &mut ArchiveIterator<'_>;
|
|
|
|
pub(crate) fn LLVMRustArchiveIteratorNext<'a>(
|
2018-07-17 15:26:58 +00:00
|
|
|
AIR: &ArchiveIterator<'a>,
|
|
|
|
) -> Option<&'a mut ArchiveChild<'a>>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustArchiveChildName(
|
|
|
|
ACR: &ArchiveChild<'_>,
|
|
|
|
size: &mut size_t,
|
|
|
|
) -> *const c_char;
|
|
|
|
pub(crate) fn LLVMRustArchiveChildFree<'a>(ACR: &'a mut ArchiveChild<'a>);
|
|
|
|
pub(crate) fn LLVMRustArchiveIteratorFree<'a>(AIR: &'a mut ArchiveIterator<'a>);
|
|
|
|
pub(crate) fn LLVMRustDestroyArchive(AR: &'static mut Archive);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustWriteTwineToString(T: &Twine, s: &RustString);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustUnpackOptimizationDiagnostic<'a>(
|
2018-07-13 10:59:41 +00:00
|
|
|
DI: &'a DiagnosticInfo,
|
2018-07-13 11:43:12 +00:00
|
|
|
pass_name_out: &RustString,
|
|
|
|
function_out: &mut Option<&'a Value>,
|
|
|
|
loc_line_out: &mut c_uint,
|
|
|
|
loc_column_out: &mut c_uint,
|
|
|
|
loc_filename_out: &RustString,
|
|
|
|
message_out: &RustString,
|
|
|
|
);
|
2019-12-22 22:42:04 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustUnpackInlineAsmDiagnostic<'a>(
|
2018-07-13 10:59:41 +00:00
|
|
|
DI: &'a DiagnosticInfo,
|
2020-06-09 13:37:59 +00:00
|
|
|
level_out: &mut DiagnosticLevel,
|
2024-02-21 09:18:59 +00:00
|
|
|
cookie_out: &mut u64,
|
2018-07-13 12:27:55 +00:00
|
|
|
message_out: &mut Option<&'a Twine>,
|
|
|
|
);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustWriteDiagnosticInfoToString(DI: &DiagnosticInfo, s: &RustString);
|
|
|
|
pub(crate) fn LLVMRustGetDiagInfoKind(DI: &DiagnosticInfo) -> DiagnosticKind;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetSMDiagnostic<'a>(
|
2021-07-28 19:31:47 +00:00
|
|
|
DI: &'a DiagnosticInfo,
|
2024-08-17 04:32:09 +00:00
|
|
|
cookie_out: &mut u64,
|
2021-07-28 19:31:47 +00:00
|
|
|
) -> &'a SMDiagnostic;
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustUnpackSMDiagnostic(
|
2020-05-26 19:07:59 +00:00
|
|
|
d: &SMDiagnostic,
|
|
|
|
message_out: &RustString,
|
|
|
|
buffer_out: &RustString,
|
2020-06-09 13:37:59 +00:00
|
|
|
level_out: &mut DiagnosticLevel,
|
2020-05-26 19:07:59 +00:00
|
|
|
loc_out: &mut c_uint,
|
|
|
|
ranges_out: *mut c_uint,
|
|
|
|
num_ranges: &mut usize,
|
|
|
|
) -> bool;
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustWriteArchive(
|
2016-08-02 20:10:10 +00:00
|
|
|
Dst: *const c_char,
|
|
|
|
NumMembers: size_t,
|
2019-02-25 07:40:18 +00:00
|
|
|
Members: *const &RustArchiveMember<'_>,
|
2016-08-02 20:10:10 +00:00
|
|
|
WriteSymbtab: bool,
|
2016-10-22 13:07:35 +00:00
|
|
|
Kind: ArchiveKind,
|
2024-03-27 17:49:21 +00:00
|
|
|
isEC: bool,
|
2016-10-22 13:07:35 +00:00
|
|
|
) -> LLVMRustResult;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustArchiveMemberNew<'a>(
|
2016-08-02 20:10:10 +00:00
|
|
|
Filename: *const c_char,
|
|
|
|
Name: *const c_char,
|
2018-08-10 10:31:10 +00:00
|
|
|
Child: Option<&ArchiveChild<'a>>,
|
2018-07-17 13:00:10 +00:00
|
|
|
) -> &'a mut RustArchiveMember<'a>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustArchiveMemberFree<'a>(Member: &'a mut RustArchiveMember<'a>);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
|
2016-08-02 20:10:10 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetModulePICLevel(M: &Module);
|
|
|
|
pub(crate) fn LLVMRustSetModulePIELevel(M: &Module);
|
|
|
|
pub(crate) fn LLVMRustSetModuleCodeModel(M: &Module, Model: CodeModel);
|
|
|
|
pub(crate) fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
|
|
|
|
pub(crate) fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
|
|
|
|
pub(crate) fn LLVMRustModuleBufferLen(p: &ModuleBuffer) -> usize;
|
|
|
|
pub(crate) fn LLVMRustModuleBufferFree(p: &'static mut ModuleBuffer);
|
|
|
|
pub(crate) fn LLVMRustModuleCost(M: &Module) -> u64;
|
|
|
|
pub(crate) fn LLVMRustModuleInstructionStats(M: &Module, Str: &RustString);
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustThinLTOBufferCreate(
|
2024-05-23 19:10:04 +00:00
|
|
|
M: &Module,
|
|
|
|
is_thin: bool,
|
|
|
|
emit_summary: bool,
|
|
|
|
) -> &'static mut ThinLTOBuffer;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustThinLTOBufferFree(M: &'static mut ThinLTOBuffer);
|
|
|
|
pub(crate) fn LLVMRustThinLTOBufferPtr(M: &ThinLTOBuffer) -> *const c_char;
|
|
|
|
pub(crate) fn LLVMRustThinLTOBufferLen(M: &ThinLTOBuffer) -> size_t;
|
|
|
|
pub(crate) fn LLVMRustThinLTOBufferThinLinkDataPtr(M: &ThinLTOBuffer) -> *const c_char;
|
|
|
|
pub(crate) fn LLVMRustThinLTOBufferThinLinkDataLen(M: &ThinLTOBuffer) -> size_t;
|
|
|
|
pub(crate) fn LLVMRustCreateThinLTOData(
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
Modules: *const ThinLTOModule,
|
2024-10-27 06:30:46 +00:00
|
|
|
NumModules: size_t,
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
PreservedSymbols: *const *const c_char,
|
2024-10-27 06:30:46 +00:00
|
|
|
PreservedSymbolsLen: size_t,
|
2018-07-17 13:43:49 +00:00
|
|
|
) -> Option<&'static mut ThinLTOData>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustPrepareThinLTORename(
|
2020-06-26 01:52:41 +00:00
|
|
|
Data: &ThinLTOData,
|
|
|
|
Module: &Module,
|
|
|
|
Target: &TargetMachine,
|
2025-01-07 00:53:42 +00:00
|
|
|
);
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustPrepareThinLTOResolveWeak(Data: &ThinLTOData, Module: &Module) -> bool;
|
|
|
|
pub(crate) fn LLVMRustPrepareThinLTOInternalize(Data: &ThinLTOData, Module: &Module) -> bool;
|
|
|
|
pub(crate) fn LLVMRustPrepareThinLTOImport(
|
2020-06-26 01:52:41 +00:00
|
|
|
Data: &ThinLTOData,
|
|
|
|
Module: &Module,
|
|
|
|
Target: &TargetMachine,
|
|
|
|
) -> bool;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustFreeThinLTOData(Data: &'static mut ThinLTOData);
|
|
|
|
pub(crate) fn LLVMRustParseBitcodeForLTO(
|
2018-06-27 14:57:25 +00:00
|
|
|
Context: &Context,
|
rustc: Implement ThinLTO
This commit is an implementation of LLVM's ThinLTO for consumption in rustc
itself. Currently today LTO works by merging all relevant LLVM modules into one
and then running optimization passes. "Thin" LTO operates differently by having
more sharded work and allowing parallelism opportunities between optimizing
codegen units. Further down the road Thin LTO also allows *incremental* LTO
which should enable even faster release builds without compromising on the
performance we have today.
This commit uses a `-Z thinlto` flag to gate whether ThinLTO is enabled. It then
also implements two forms of ThinLTO:
* In one mode we'll *only* perform ThinLTO over the codegen units produced in a
single compilation. That is, we won't load upstream rlibs, but we'll instead
just perform ThinLTO amongst all codegen units produced by the compiler for
the local crate. This is intended to emulate a desired end point where we have
codegen units turned on by default for all crates and ThinLTO allows us to do
this without performance loss.
* In anther mode, like full LTO today, we'll optimize all upstream dependencies
in "thin" mode. Unlike today, however, this LTO step is fully parallelized so
should finish much more quickly.
There's a good bit of comments about what the implementation is doing and where
it came from, but the tl;dr; is that currently most of the support here is
copied from upstream LLVM. This code duplication is done for a number of
reasons:
* Controlling parallelism means we can use the existing jobserver support to
avoid overloading machines.
* We will likely want a slightly different form of incremental caching which
integrates with our own incremental strategy, but this is yet to be
determined.
* This buys us some flexibility about when/where we run ThinLTO, as well as
having it tailored to fit our needs for the time being.
* Finally this allows us to reuse some artifacts such as our `TargetMachine`
creation, where all our options we used today aren't necessarily supported by
upstream LLVM yet.
My hope is that we can get some experience with this copy/paste in tree and then
eventually upstream some work to LLVM itself to avoid the duplication while
still ensuring our needs are met. Otherwise I fear that maintaining these
bindings may be quite costly over the years with LLVM updates!
2017-07-23 15:14:38 +00:00
|
|
|
Data: *const u8,
|
|
|
|
len: usize,
|
|
|
|
Identifier: *const c_char,
|
2018-06-27 14:57:25 +00:00
|
|
|
) -> Option<&Module>;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetSliceFromObjectDataByName(
|
2023-09-07 13:48:50 +00:00
|
|
|
data: *const u8,
|
|
|
|
len: usize,
|
|
|
|
name: *const u8,
|
2024-10-29 23:02:46 +00:00
|
|
|
name_len: usize,
|
2023-09-07 13:48:50 +00:00
|
|
|
out_len: &mut usize,
|
|
|
|
) -> *const u8;
|
2018-02-12 16:38:46 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>;
|
|
|
|
pub(crate) fn LLVMRustLinkerAdd(
|
2019-02-25 07:40:18 +00:00
|
|
|
linker: &Linker<'_>,
|
2018-02-12 16:38:46 +00:00
|
|
|
bytecode: *const c_char,
|
|
|
|
bytecode_len: usize,
|
|
|
|
) -> bool;
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>);
|
|
|
|
pub(crate) fn LLVMRustComputeLTOCacheKey(
|
Use llvm::computeLTOCacheKey to determine post-ThinLTO CGU reuse
During incremental ThinLTO compilation, we attempt to re-use the
optimized (post-ThinLTO) bitcode file for a module if it is 'safe' to do
so.
Up until now, 'safe' has meant that the set of modules that our current
modules imports from/exports to is unchanged from the previous
compilation session. See PR #67020 and PR #71131 for more details.
However, this turns out be insufficient to guarantee that it's safe
to reuse the post-LTO module (i.e. that optimizing the pre-LTO module
would produce the same result). When LLVM optimizes a module during
ThinLTO, it may look at other information from the 'module index', such
as whether a (non-imported!) global variable is used. If this
information changes between compilation runs, we may end up re-using an
optimized module that (for example) had dead-code elimination run on a
function that is now used by another module.
Fortunately, LLVM implements its own ThinLTO module cache, which is used
when ThinLTO is performed by a linker plugin (e.g. when clang is used to
compile a C proect). Using this cache directly would require extensive
refactoring of our code - but fortunately for us, LLVM provides a
function that does exactly what we need.
The function `llvm::computeLTOCacheKey` is used to compute a SHA-1 hash
from all data that might influence the result of ThinLTO on a module.
In addition to the module imports/exports that we manually track, it
also hashes information about global variables (e.g. their liveness)
which might be used during optimization. By using this function, we
shouldn't have to worry about new LLVM passes breaking our module re-use
behavior.
In LLVM, the output of this function forms part of the filename used to
store the post-ThinLTO module. To keep our current filename structure
intact, this PR just writes out the mapping 'CGU name -> Hash' to a
file. To determine if a post-LTO module should be reused, we compare
hashes from the previous session.
This should unblock PR #75199 - by sheer chance, it seems to have hit
this issue due to the particular CGU partitioning and optimization
decisions that end up getting made.
2020-09-17 21:36:13 +00:00
|
|
|
key_out: &RustString,
|
|
|
|
mod_id: *const c_char,
|
|
|
|
data: &ThinLTOData,
|
|
|
|
);
|
2021-11-12 00:00:00 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustContextGetDiagnosticHandler(
|
|
|
|
Context: &Context,
|
|
|
|
) -> Option<&DiagnosticHandler>;
|
|
|
|
pub(crate) fn LLVMRustContextSetDiagnosticHandler(
|
2021-11-12 00:00:00 +00:00
|
|
|
context: &Context,
|
|
|
|
diagnostic_handler: Option<&DiagnosticHandler>,
|
|
|
|
);
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustContextConfigureDiagnosticHandler(
|
2021-11-12 00:00:00 +00:00
|
|
|
context: &Context,
|
|
|
|
diagnostic_handler_callback: DiagnosticHandlerTy,
|
|
|
|
diagnostic_handler_context: *mut c_void,
|
|
|
|
remark_all_passes: bool,
|
|
|
|
remark_passes: *const *const c_char,
|
|
|
|
remark_passes_len: usize,
|
2023-06-25 21:39:02 +00:00
|
|
|
remark_file: *const c_char,
|
2023-08-07 15:56:57 +00:00
|
|
|
pgo_available: bool,
|
2021-11-12 00:00:00 +00:00
|
|
|
);
|
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetMangledName(V: &Value, out: &RustString);
|
2022-07-19 13:03:39 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetElementTypeArgIndex(CallSite: &Value) -> i32;
|
2022-05-28 10:43:51 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustLLVMHasZlibCompressionForDebugSymbols() -> bool;
|
2023-07-12 21:07:34 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustLLVMHasZstdCompressionForDebugSymbols() -> bool;
|
2023-07-12 21:07:34 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustGetSymbols(
|
2022-05-28 10:43:51 +00:00
|
|
|
buf_ptr: *const u8,
|
|
|
|
buf_len: usize,
|
|
|
|
state: *mut c_void,
|
|
|
|
callback: GetSymbolsCallback,
|
|
|
|
error_callback: GetSymbolsErrorCallback,
|
|
|
|
) -> *mut c_void;
|
2024-04-16 18:31:43 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustIs64BitSymbolicFile(buf_ptr: *const u8, buf_len: usize) -> bool;
|
2024-04-16 18:31:43 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustIsECObject(buf_ptr: *const u8, buf_len: usize) -> bool;
|
2024-07-08 13:49:50 +00:00
|
|
|
|
2025-02-11 18:33:45 +00:00
|
|
|
pub(crate) fn LLVMRustSetNoSanitizeAddress(Global: &Value);
|
|
|
|
pub(crate) fn LLVMRustSetNoSanitizeHWAddress(Global: &Value);
|
2016-08-02 20:10:10 +00:00
|
|
|
}
|