8000 Rollup of 9 pull requests by matthiaskrgr · Pull Request #100797 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 9 pull requests #100797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
7913b85
unit tests that inspect LLVM output directly. This relies on a human …
pnkfelix Jun 16, 2022
b2777ab
End-to-end regression test for 97463.
pnkfelix Jun 6, 2022
8ae5a55
fix issue 97463 using change suggested by nbdd0121.
pnkfelix Jun 6, 2022
dfdb017
experiment: trying to encode the end-to-end test as a ui test via rus…
pnkfelix Jun 30, 2022
99c0f91
fix typo, thanks wesley
pnkfelix Aug 4, 2022
9bf3d5a
Ignore test on wasm
wesleywiser Aug 5, 2022
940f078
Add pointer masking convenience functions
WaffleLapkin May 11, 2022
876ff21
use shorter `ptr_mask` impl in cg cranelift
WaffleLapkin May 11, 2022
08d488b
Implement `ptr_mask` intrinsic in cg gcc
WaffleLapkin May 11, 2022
8102e71
Fix `ptr_mask` impl in cg gcc
WaffleLapkin May 13, 2022
729334a
fill in tracking issue for `feature(ptr_mask)`
WaffleLapkin Jun 20, 2022
1dfac52
fix cg cranelift
WaffleLapkin Aug 7, 2022
de9dc86
Add codegen test for `intinsics::ptr_mask`
WaffleLapkin Aug 8, 2022
ccc558a
make `ptr_mask` codegen test more specific
WaffleLapkin Aug 9, 2022
4b16214
Ban references to `Self` in trait object substs for projection predic…
cjgillot Aug 13, 2022
9233298
Revert "Revert "Allow dynamic linking for iOS/tvOS targets.""
cutsoy Aug 16, 2022
e9e46c9
Don't treat stashed warnings as errors
CAD97 Aug 17, 2022
767239f
Reenable early feature-gates as future-compat warnings
CAD97 Aug 17, 2022
944c6b6
New ui tests for new soft feature gates
CAD97 Aug 17, 2022
be2641a
Fortify check for const generics.
cjgillot Aug 17, 2022
72acd94
Add const-generics test.
cjgillot Aug 17, 2022
5abe2dc
Do not use void pointer for `ptr_mask` intrinsic
WaffleLapkin Aug 18, 2022
ac66baa
add miri-test-libstd support to libstd
RalfJung Aug 4, 2022
27b0444
add some Miri-only tests
RalfJung Aug 4, 2022
8c8dc12
make many std tests work in Miri
RalfJung Aug 4, 2022
438e49c
silence some unused-fn warnings in miri std builds
RalfJung Aug 6, 2022
fbcdf2a
clarify lib.rs attribute structure
RalfJung Aug 18, 2022
622e425
add a ui test for `.as_ref` suggestion
WaffleLapkin Aug 19, 2022
59cc718
Update codegen tests to accommodate the potential presence/absence of…
pnkfelix Aug 19, 2022
f47b61d
elaborate how revisions work with FileCheck stuff in src/test/codegen
pnkfelix Aug 19, 2022
9735107
remove unnecessary string searchings
TaKO8Ki Aug 20, 2022
b8f6983
Rollup merge of #96946 - WaffleLapkin:ptr_mask, r=scottmcm
matthiaskrgr Aug 20, 2022
ad2e624
Rollup merge of #97800 - pnkfelix:issue-97463-fix-aarch64-call-abi-do…
matthiaskrgr Aug 20, 2022
6c2ff7c
Rollup merge of #99935 - CAD97:unstable-syntax-lints, r=petrochenkov
matthiaskrgr Aug 20, 2022
80fa648
Rollup merge of #100129 - RalfJung:miri-test-libstd, r=thomcc
matthiaskrgr Aug 20, 2022
2038658
Rollup merge of #100500 - cjgillot:verify-self-predicate, r=lcnr
matthiaskrgr Aug 20, 2022
c4d57f5
Rollup merge of #100636 - cutsoy:revert-77716, r=davidtwco
matthiaskrgr Aug 20, 2022
e5b9afc
Rollup merge of #100773 - WaffleLapkin:addasreftest, r=TaKO8Ki
matthiaskrgr Aug 20, 2022
90ca06d
Rollup merge of #100777 - pnkfelix:expand-codegen-tests-readme, r=TaK…
matthiaskrgr Aug 20, 2022
959b876
Rollup merge of #100796 - TaKO8Ki:remove-unnecessary-string-searching…
matthiaskrgr Aug 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix issue 97463 using change suggested by nbdd0121.
parameterized on target details to decide value-extension policy on calls, in order to address how Apple's aarch64 ABI differs from that on Linux and Windows.

Updated to incorporate review feedback: adjust comment on new enum specifying
param extension policy.

Updated to incorporate review feedback: shorten enum names and those of its
variants to make it less unwieldy.

placate tidy.
  • Loading branch information
pnkfelix committed Jul 6, 2022
commit 8ae5a55ba55a434995d2e2e87f8ef15237ff8124
41 changes: 34 additions & 7 deletions compiler/rustc_target/src/abi/call/aarch64.rs
< 8000 /tr>
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
use crate::abi::call::{ArgAbi, FnAbi, Reg, RegKind, Uniform};
use crate::abi::{HasDataLayout, TyAbiInterface};

/// Given integer-types M and register width N (e.g. M=u16 and N=32 bits), the
/// `ParamExtension` policy specifies how a uM value should be treated when
/// passed via register or stack-slot of width N. See also rust-lang/rust#97463.
#[derive(Copy, Clone, PartialEq)]
pub enum ParamExtension {
/// Indicates that when passing an i8/i16, either as a function argument or
/// as a return value, it must be sign-extended to 32 bits, and likewise a
/// u8/u16 must be zero-extended to 32-bits. (This variant is here to
/// accommodate Apple's deviation from the usual AArch64 ABI as defined by
/// ARM.)
///
/// See also: https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms#Pass-Arguments-to-Functions-Correctly
ExtendTo32Bits,

/// Indicates that no sign- nor zero-extension is performed: if a value of
/// type with bitwidth M is passed as function argument or return value,
/// then M bits are copied into the least significant M bits, and the
/// remaining bits of the register (or word of memory) are untouched.
NoExtension,
}

fn is_homogeneous_aggregate<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) -> Option<Uniform>
where
Ty: TyAbiInterface<'a, C> + Copy,
Expand All @@ -24,13 +45,16 @@ where
})
}

fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>)
fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, param_policy: ParamExtension)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !ret.layout.is_aggregate() {
ret.extend_integer_width_to(32);
match param_policy {
ParamExtension::ExtendTo32Bits => ret.extend_integer_width_to(32),
ParamExtension::NoExtension => {}
}
return;
}
if let Some(uniform) = is_homogeneous_aggregate(cx, ret) {
Expand All @@ -46,13 +70,16 @@ where
ret.make_indirect();
}

fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, param_policy: ParamExtension)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(32);
match param_policy {
ParamExtension::ExtendTo32Bits => arg.extend_integer_width_to(32),
ParamExtension::NoExtension => {}
}
return;
}
if let Some(uniform) = is_homogeneous_aggregate(cx, arg) {
Expand All @@ -68,19 +95,19 @@ where
arg.make_indirect();
}

pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>, param_policy: ParamExtension)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !fn_abi.ret.is_ignore() {
classify_ret(cx, &mut fn_abi.ret);
classify_ret(cx, &mut fn_abi.ret, param_policy);
}

for arg in &mut fn_abi.args {
if arg.is_ignore() {
continue;
}
classify_arg(cx, arg);
classify_arg(cx, arg, param_policy);
}
}
9 changes: 8 additions & 1 deletion compiler/rustc_target/src/abi/call/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,14 @@ impl<'a, Ty> FnAbi<'a, Ty> {
}
}
},
"aarch64" => aarch64::compute_abi_info(cx, self),
"aarch64" => {
let param_policy = if cx.target_spec().is_like_osx {
aarch64::ParamExtension::ExtendTo32Bits
} else {
aarch64::ParamExtension::NoExtension
};
aarch64::compute_abi_info(cx, self, param_policy)
}
"amdgpu" => amdgpu::compute_abi_info(cx, self),
"arm" => arm::compute_abi_info(cx, self),
"avr" => avr::compute_abi_info(self),
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_target/src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,8 @@ pub struct TargetOptions {
pub abi_return_struct_as_int: bool,
/// Whether the target toolchain is like macOS's. Only useful for compiling against iOS/macOS,
/// in particular running dsymutil and some other stuff like `-dead_strip`. Defaults to false.
/// Also indiates whether to use Apple-specific ABI changes, such as extending function
/// parameters to 32-bits.
pub is_like_osx: bool,
/// Whether the target toolchain is like Solaris's.
/// Only useful for compiling against Illumos/Solaris,
Expand Down
0