Auto merge of #132736 - matthiaskrgr:rollup-66naqwb, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #132638 (Remove fixme comment about clobber_abi on PowerPC) - #132726 (Remove unused intercrate dependencies) - #132729 (Make fn_abi_sanity_check a bit stricter) - #132734 ( remove 'platform-intrinsic' ABI leftovers) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
57a8a7efdb
12
Cargo.lock
12
Cargo.lock
@ -3274,7 +3274,6 @@ name = "rustc_ast_lowering"
|
|||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_ast",
|
"rustc_ast",
|
||||||
"rustc_ast_pretty",
|
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_errors",
|
"rustc_errors",
|
||||||
"rustc_fluent_macro",
|
"rustc_fluent_macro",
|
||||||
@ -3469,7 +3468,6 @@ dependencies = [
|
|||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_metadata",
|
"rustc_metadata",
|
||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_monomorphize",
|
|
||||||
"rustc_query_system",
|
"rustc_query_system",
|
||||||
"rustc_serialize",
|
"rustc_serialize",
|
||||||
"rustc_session",
|
"rustc_session",
|
||||||
@ -3745,7 +3743,6 @@ dependencies = [
|
|||||||
"rustc_feature",
|
"rustc_feature",
|
||||||
"rustc_fluent_macro",
|
"rustc_fluent_macro",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
"rustc_hir_pretty",
|
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
"rustc_infer",
|
"rustc_infer",
|
||||||
"rustc_lint_defs",
|
"rustc_lint_defs",
|
||||||
@ -3793,7 +3790,6 @@ dependencies = [
|
|||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_session",
|
"rustc_session",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
"rustc_trait_selection",
|
"rustc_trait_selection",
|
||||||
"rustc_type_ir",
|
"rustc_type_ir",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
@ -3853,9 +3849,7 @@ dependencies = [
|
|||||||
"rustc_index",
|
"rustc_index",
|
||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_next_trait_solver",
|
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_target",
|
|
||||||
"rustc_type_ir",
|
"rustc_type_ir",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thin-vec",
|
"thin-vec",
|
||||||
@ -3934,7 +3928,6 @@ dependencies = [
|
|||||||
"rustc_feature",
|
"rustc_feature",
|
||||||
"rustc_fluent_macro",
|
"rustc_fluent_macro",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
"rustc_hir_pretty",
|
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
"rustc_infer",
|
"rustc_infer",
|
||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
@ -4162,7 +4155,6 @@ dependencies = [
|
|||||||
name = "rustc_next_trait_solver"
|
name = "rustc_next_trait_solver"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.6.0",
|
|
||||||
"derive-where",
|
"derive-where",
|
||||||
"rustc_ast_ir",
|
"rustc_ast_ir",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
@ -4458,9 +4450,7 @@ dependencies = [
|
|||||||
"object 0.36.4",
|
"object 0.36.4",
|
||||||
"rustc_abi",
|
"rustc_abi",
|
||||||
"rustc_data_structures",
|
"rustc_data_structures",
|
||||||
"rustc_feature",
|
|
||||||
"rustc_fs_util",
|
"rustc_fs_util",
|
||||||
"rustc_index",
|
|
||||||
"rustc_macros",
|
"rustc_macros",
|
||||||
"rustc_serialize",
|
"rustc_serialize",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
@ -4492,8 +4482,6 @@ dependencies = [
|
|||||||
"rustc_middle",
|
"rustc_middle",
|
||||||
"rustc_next_trait_solver",
|
"rustc_next_trait_solver",
|
||||||
"rustc_parse_format",
|
"rustc_parse_format",
|
||||||
"rustc_query_system",
|
|
||||||
"rustc_serialize",
|
|
||||||
"rustc_session",
|
"rustc_session",
|
||||||
"rustc_span",
|
"rustc_span",
|
||||||
"rustc_transmute",
|
"rustc_transmute",
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`.
|
// We need this feature as it changes `dylib` linking behavior and allows us to link to `rustc_driver`.
|
||||||
#![feature(rustc_private)]
|
#![feature(rustc_private)]
|
||||||
|
// Several crates are depended upon but unused so that they are present in the sysroot
|
||||||
|
#![expect(unused_crate_dependencies)]
|
||||||
|
|
||||||
// A note about jemalloc: rustc uses jemalloc when built for CI and
|
// A note about jemalloc: rustc uses jemalloc when built for CI and
|
||||||
// distribution. The obvious way to do this is with the `#[global_allocator]`
|
// distribution. The obvious way to do this is with the `#[global_allocator]`
|
||||||
|
@ -9,7 +9,6 @@ doctest = false
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
rustc_ast = { path = "../rustc_ast" }
|
rustc_ast = { path = "../rustc_ast" }
|
||||||
rustc_ast_pretty = { path = "../rustc_ast_pretty" }
|
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_errors = { path = "../rustc_errors" }
|
rustc_errors = { path = "../rustc_errors" }
|
||||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`, `extern "platform-intrinsic"`
|
//! Codegen of intrinsics. This includes `extern "rust-intrinsic"`,
|
||||||
//! and LLVM intrinsics that have symbol names starting with `llvm.`.
|
//! and LLVM intrinsics that have symbol names starting with `llvm.`.
|
||||||
|
|
||||||
macro_rules! intrinsic_args {
|
macro_rules! intrinsic_args {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
//! Codegen `extern "platform-intrinsic"` intrinsics.
|
//! Codegen SIMD intrinsics.
|
||||||
|
|
||||||
use cranelift_codegen::ir::immediates::Offset32;
|
use cranelift_codegen::ir::immediates::Offset32;
|
||||||
use rustc_target::abi::Endian;
|
use rustc_target::abi::Endian;
|
||||||
|
@ -28,7 +28,6 @@ rustc_index = { path = "../rustc_index" }
|
|||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
rustc_metadata = { path = "../rustc_metadata" }
|
rustc_metadata = { path = "../rustc_metadata" }
|
||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
rustc_monomorphize = { path = "../rustc_monomorphize" }
|
|
||||||
rustc_query_system = { path = "../rustc_query_system" }
|
rustc_query_system = { path = "../rustc_query_system" }
|
||||||
rustc_serialize = { path = "../rustc_serialize" }
|
rustc_serialize = { path = "../rustc_serialize" }
|
||||||
rustc_session = { path = "../rustc_session" }
|
rustc_session = { path = "../rustc_session" }
|
||||||
|
@ -19,7 +19,6 @@ rustc_errors = { path = "../rustc_errors" }
|
|||||||
rustc_feature = { path = "../rustc_feature" }
|
rustc_feature = { path = "../rustc_feature" }
|
||||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||||
rustc_hir = { path = "../rustc_hir" }
|
rustc_hir = { path = "../rustc_hir" }
|
||||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
|
||||||
rustc_index = { path = "../rustc_index" }
|
rustc_index = { path = "../rustc_index" }
|
||||||
rustc_infer = { path = "../rustc_infer" }
|
rustc_infer = { path = "../rustc_infer" }
|
||||||
rustc_lint_defs = { path = "../rustc_lint_defs" }
|
rustc_lint_defs = { path = "../rustc_lint_defs" }
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
//! Type-checking for the rust-intrinsic and platform-intrinsic
|
//! Type-checking for the rust-intrinsic intrinsics that the compiler exposes.
|
||||||
//! intrinsics that the compiler exposes.
|
|
||||||
|
|
||||||
use rustc_abi::ExternAbi;
|
use rustc_abi::ExternAbi;
|
||||||
use rustc_errors::codes::*;
|
use rustc_errors::codes::*;
|
||||||
|
@ -23,7 +23,6 @@ rustc_macros = { path = "../rustc_macros" }
|
|||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
rustc_session = { path = "../rustc_session" }
|
rustc_session = { path = "../rustc_session" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_target = { path = "../rustc_target" }
|
|
||||||
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
rustc_trait_selection = { path = "../rustc_trait_selection" }
|
||||||
rustc_type_ir = { path = "../rustc_type_ir" }
|
rustc_type_ir = { path = "../rustc_type_ir" }
|
||||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||||
|
@ -16,9 +16,7 @@ rustc_hir = { path = "../rustc_hir" }
|
|||||||
rustc_index = { path = "../rustc_index" }
|
rustc_index = { path = "../rustc_index" }
|
||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
rustc_next_trait_solver = { path = "../rustc_next_trait_solver" }
|
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_target = { path = "../rustc_target" }
|
|
||||||
rustc_type_ir = { path = "../rustc_type_ir" }
|
rustc_type_ir = { path = "../rustc_type_ir" }
|
||||||
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
smallvec = { version = "1.8.1", features = ["union", "may_dangle"] }
|
||||||
thin-vec = "0.2.12"
|
thin-vec = "0.2.12"
|
||||||
|
@ -14,7 +14,6 @@ rustc_errors = { path = "../rustc_errors" }
|
|||||||
rustc_feature = { path = "../rustc_feature" }
|
rustc_feature = { path = "../rustc_feature" }
|
||||||
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
rustc_fluent_macro = { path = "../rustc_fluent_macro" }
|
||||||
rustc_hir = { path = "../rustc_hir" }
|
rustc_hir = { path = "../rustc_hir" }
|
||||||
rustc_hir_pretty = { path = "../rustc_hir_pretty" }
|
|
||||||
rustc_index = { path = "../rustc_index" }
|
rustc_index = { path = "../rustc_index" }
|
||||||
rustc_infer = { path = "../rustc_infer" }
|
rustc_infer = { path = "../rustc_infer" }
|
||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
|
@ -71,7 +71,7 @@ pub enum InstanceKind<'tcx> {
|
|||||||
/// - coroutines
|
/// - coroutines
|
||||||
Item(DefId),
|
Item(DefId),
|
||||||
|
|
||||||
/// An intrinsic `fn` item (with `"rust-intrinsic"` or `"platform-intrinsic"` ABI).
|
/// An intrinsic `fn` item (with `"rust-intrinsic"` ABI).
|
||||||
///
|
///
|
||||||
/// Alongside `Virtual`, this is the only `InstanceKind` that does not have its own callable MIR.
|
/// Alongside `Virtual`, this is the only `InstanceKind` that does not have its own callable MIR.
|
||||||
/// Instead, codegen and const eval "magically" evaluate calls to intrinsics purely in the
|
/// Instead, codegen and const eval "magically" evaluate calls to intrinsics purely in the
|
||||||
|
@ -5,7 +5,6 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# tidy-alphabetical-start
|
# tidy-alphabetical-start
|
||||||
bitflags = "2.4.1"
|
|
||||||
derive-where = "1.2.7"
|
derive-where = "1.2.7"
|
||||||
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
|
rustc_ast_ir = { path = "../rustc_ast_ir", default-features = false }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
rustc_data_structures = { path = "../rustc_data_structures", optional = true }
|
||||||
|
@ -8,9 +8,7 @@ edition = "2021"
|
|||||||
bitflags = "2.4.1"
|
bitflags = "2.4.1"
|
||||||
rustc_abi = { path = "../rustc_abi" }
|
rustc_abi = { path = "../rustc_abi" }
|
||||||
rustc_data_structures = { path = "../rustc_data_structures" }
|
rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_feature = { path = "../rustc_feature" }
|
|
||||||
rustc_fs_util = { path = "../rustc_fs_util" }
|
rustc_fs_util = { path = "../rustc_fs_util" }
|
||||||
rustc_index = { path = "../rustc_index" }
|
|
||||||
rustc_macros = { path = "../rustc_macros" }
|
rustc_macros = { path = "../rustc_macros" }
|
||||||
rustc_serialize = { path = "../rustc_serialize" }
|
rustc_serialize = { path = "../rustc_serialize" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
|
@ -1128,6 +1128,21 @@ macro_rules! clobbered_regs {
|
|||||||
},
|
},
|
||||||
InlineAsmClobberAbi::PowerPC => clobbered_regs! {
|
InlineAsmClobberAbi::PowerPC => clobbered_regs! {
|
||||||
PowerPC PowerPCInlineAsmReg {
|
PowerPC PowerPCInlineAsmReg {
|
||||||
|
// Refs:
|
||||||
|
// - PPC32 SysV: "3.2. Function Calling Sequence" in Power Architecture® 32-bit Application Binary Interface Supplement 1.0 - Linux® & Embedded
|
||||||
|
// https://web.archive.org/web/20120608163804/https://www.power.org/resources/downloads/Power-Arch-32-bit-ABI-supp-1.0-Unified.pdf
|
||||||
|
// - PPC64 ELFv1: "3.2. Function Calling Sequence" in 64-bit PowerPC ELF Application Binary Interface Supplement 1.9
|
||||||
|
// https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#FUNC-CALL
|
||||||
|
// - PPC64 ELFv2: "2.2 Function Calling Sequence" in 64-Bit ELF V2 ABI Specification: Power Architecture, Revision 1.5
|
||||||
|
// https://openpowerfoundation.org/specifications/64bitelfabi/
|
||||||
|
// - AIX:
|
||||||
|
// - Register usage and conventions
|
||||||
|
// https://www.ibm.com/docs/en/aix/7.3?topic=overview-register-usage-conventions
|
||||||
|
// - Special registers in the PowerPC®
|
||||||
|
// https://www.ibm.com/docs/en/aix/7.3?topic=overview-special-registers-in-powerpc
|
||||||
|
// - AIX vector programming
|
||||||
|
// https://www.ibm.com/docs/en/aix/7.3?topic=concepts-aix-vector-programming
|
||||||
|
|
||||||
// r0, r3-r12
|
// r0, r3-r12
|
||||||
r0,
|
r0,
|
||||||
r3, r4, r5, r6, r7,
|
r3, r4, r5, r6, r7,
|
||||||
@ -1138,8 +1153,6 @@ macro_rules! clobbered_regs {
|
|||||||
f8, f9, f10, f11, f12, f13,
|
f8, f9, f10, f11, f12, f13,
|
||||||
|
|
||||||
// v0-v19
|
// v0-v19
|
||||||
// FIXME: PPC32 SysV ABI does not mention vector registers processing.
|
|
||||||
// https://refspecs.linuxfoundation.org/elf/elfspec_ppc.pdf
|
|
||||||
v0, v1, v2, v3, v4, v5, v6, v7,
|
v0, v1, v2, v3, v4, v5, v6, v7,
|
||||||
v8, v9, v10, v11, v12, v13, v14,
|
v8, v9, v10, v11, v12, v13, v14,
|
||||||
v15, v16, v17, v18, v19,
|
v15, v16, v17, v18, v19,
|
||||||
|
@ -19,8 +19,6 @@ rustc_macros = { path = "../rustc_macros" }
|
|||||||
rustc_middle = { path = "../rustc_middle" }
|
rustc_middle = { path = "../rustc_middle" }
|
||||||
rustc_next_trait_solver = { path = "../rustc_next_trait_solver" }
|
rustc_next_trait_solver = { path = "../rustc_next_trait_solver" }
|
||||||
rustc_parse_format = { path = "../rustc_parse_format" }
|
rustc_parse_format = { path = "../rustc_parse_format" }
|
||||||
rustc_query_system = { path = "../rustc_query_system" }
|
|
||||||
rustc_serialize = { path = "../rustc_serialize" }
|
|
||||||
rustc_session = { path = "../rustc_session" }
|
rustc_session = { path = "../rustc_session" }
|
||||||
rustc_span = { path = "../rustc_span" }
|
rustc_span = { path = "../rustc_span" }
|
||||||
rustc_transmute = { path = "../rustc_transmute", features = ["rustc"] }
|
rustc_transmute = { path = "../rustc_transmute", features = ["rustc"] }
|
||||||
|
@ -463,21 +463,41 @@ fn fn_arg_sanity_check<'tcx>(
|
|||||||
arg: &ArgAbi<'tcx, Ty<'tcx>>,
|
arg: &ArgAbi<'tcx, Ty<'tcx>>,
|
||||||
) {
|
) {
|
||||||
let tcx = cx.tcx();
|
let tcx = cx.tcx();
|
||||||
|
|
||||||
|
if spec_abi == ExternAbi::Rust
|
||||||
|
|| spec_abi == ExternAbi::RustCall
|
||||||
|
|| spec_abi == ExternAbi::RustCold
|
||||||
|
{
|
||||||
|
if arg.layout.is_zst() {
|
||||||
|
// Casting closures to function pointers depends on ZST closure types being
|
||||||
|
// omitted entirely in the calling convention.
|
||||||
|
assert!(arg.is_ignore());
|
||||||
|
}
|
||||||
|
if let PassMode::Indirect { on_stack, .. } = arg.mode {
|
||||||
|
assert!(!on_stack, "rust abi shouldn't use on_stack");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
match &arg.mode {
|
match &arg.mode {
|
||||||
PassMode::Ignore => {}
|
PassMode::Ignore => {
|
||||||
|
assert!(arg.layout.is_zst() || arg.layout.is_uninhabited());
|
||||||
|
}
|
||||||
PassMode::Direct(_) => {
|
PassMode::Direct(_) => {
|
||||||
// Here the Rust type is used to determine the actual ABI, so we have to be very
|
// Here the Rust type is used to determine the actual ABI, so we have to be very
|
||||||
// careful. Scalar/ScalarPair is fine, since backends will generally use
|
// careful. Scalar/Vector is fine, since backends will generally use
|
||||||
// `layout.abi` and ignore everything else. We should just reject `Aggregate`
|
// `layout.backend_repr` and ignore everything else. We should just reject
|
||||||
// entirely here, but some targets need to be fixed first.
|
//`Aggregate` entirely here, but some targets need to be fixed first.
|
||||||
if matches!(arg.layout.backend_repr, BackendRepr::Memory { .. }) {
|
match arg.layout.backend_repr {
|
||||||
|
BackendRepr::Uninhabited
|
||||||
|
| BackendRepr::Scalar(_)
|
||||||
|
| BackendRepr::Vector { .. } => {}
|
||||||
|
BackendRepr::ScalarPair(..) => {
|
||||||
|
panic!("`PassMode::Direct` used for ScalarPair type {}", arg.layout.ty)
|
||||||
|
}
|
||||||
|
BackendRepr::Memory { sized } => {
|
||||||
// For an unsized type we'd only pass the sized prefix, so there is no universe
|
// For an unsized type we'd only pass the sized prefix, so there is no universe
|
||||||
// in which we ever want to allow this.
|
// in which we ever want to allow this.
|
||||||
assert!(
|
assert!(sized, "`PassMode::Direct` for unsized type in ABI: {:#?}", fn_abi);
|
||||||
arg.layout.is_sized(),
|
|
||||||
"`PassMode::Direct` for unsized type in ABI: {:#?}",
|
|
||||||
fn_abi
|
|
||||||
);
|
|
||||||
// This really shouldn't happen even for sized aggregates, since
|
// This really shouldn't happen even for sized aggregates, since
|
||||||
// `immediate_llvm_type` will use `layout.fields` to turn this Rust type into an
|
// `immediate_llvm_type` will use `layout.fields` to turn this Rust type into an
|
||||||
// LLVM type. This means all sorts of Rust type details leak into the ABI.
|
// LLVM type. This means all sorts of Rust type details leak into the ABI.
|
||||||
@ -497,9 +517,10 @@ fn fn_arg_sanity_check<'tcx>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
PassMode::Pair(_, _) => {
|
PassMode::Pair(_, _) => {
|
||||||
// Similar to `Direct`, we need to make sure that backends use `layout.abi` and
|
// Similar to `Direct`, we need to make sure that backends use `layout.backend_repr`
|
||||||
// ignore the rest of the layout.
|
// and ignore the rest of the layout.
|
||||||
assert!(
|
assert!(
|
||||||
matches!(arg.layout.backend_repr, BackendRepr::ScalarPair(..)),
|
matches!(arg.layout.backend_repr, BackendRepr::ScalarPair(..)),
|
||||||
"PassMode::Pair for type {}",
|
"PassMode::Pair for type {}",
|
||||||
|
Loading…
Reference in New Issue
Block a user