Skip to content

Commit

Permalink
Auto merge of #129046 - matthiaskrgr:rollup-9x4xgak, r=matthiaskrgr
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

Successful merges:

 - #128643 (Refactor `powerpc64` call ABI handling)
 - #128655 (std: refactor UNIX random data generation)
 - #128745 (Remove unused lifetime parameter from spawn_unchecked)
 - #128841 (bootstrap: don't use rustflags for `--rustc-args`)
 - #128983 (Slightly refactor `TargetSelection` in bootstrap)
 - #129026 (CFI: Move CFI ui tests to cfi directory)
 - #129040 (Fix blessing of rmake tests)

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Aug 13, 2024
2 parents a2e1d15 + 42f70c2 commit 80eb5a8
Show file tree
Hide file tree
Showing 54 changed files with 414 additions and 365 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_gcc/build_system/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ fn asm_tests(env: &Env, args: &TestArg) -> Result<(), String> {
&"--stage",
&"0",
&"tests/assembly/asm",
&"--rustc-args",
&"--compiletest-rustc-args",
&rustc_args,
],
Some(&rust_dir),
Expand Down Expand Up @@ -1020,7 +1020,7 @@ where
&"--stage",
&"0",
&format!("tests/{}", test_type),
&"--rustc-args",
&"--compiletest-rustc-args",
&rustc_args,
],
Some(&rust_path),
Expand Down
67 changes: 12 additions & 55 deletions compiler/rustc_target/src/abi/call/powerpc64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,64 +41,23 @@ where
})
}

fn classify_ret<'a, Ty, C>(cx: &C, ret: &mut ArgAbi<'a, Ty>, abi: ABI)
fn classify<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, abi: ABI, is_ret: bool)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !ret.layout.is_sized() {
if arg.is_ignore() || !arg.layout.is_sized() {
// Not touching this...
return;
}
if !ret.layout.is_aggregate() {
ret.extend_integer_width_to(64);
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(64);
return;
}

// The ELFv1 ABI doesn't return aggregates in registers
if abi == ELFv1 {
ret.make_indirect();
return;
}

if let Some(uniform) = is_homogeneous_aggregate(cx, ret, abi) {
ret.cast_to(uniform);
return;
}

let size = ret.layout.size;
let bits = size.bits();
if bits <= 128 {
let unit = if cx.data_layout().endian == Endian::Big {
Reg { kind: RegKind::Integer, size }
} else if bits <= 8 {
Reg::i8()
} else if bits <= 16 {
Reg::i16()
} else if bits <= 32 {
Reg::i32()
} else {
Reg::i64()
};

ret.cast_to(Uniform::new(unit, size));
return;
}

ret.make_indirect();
}

fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>, abi: ABI)
where
Ty: TyAbiInterface<'a, C> + Copy,
C: HasDataLayout,
{
if !arg.layout.is_sized() {
// Not touching this...
return;
}
if !arg.layout.is_aggregate() {
arg.extend_integer_width_to(64);
if is_ret && abi == ELFv1 {
arg.make_indirect();
return;
}

Expand All @@ -108,7 +67,10 @@ where
}

let size = arg.layout.size;
if size.bits() <= 64 {
if is_ret && size.bits() > 128 {
// Non-homogeneous aggregates larger than two doublewords are returned indirectly.
arg.make_indirect();
} else if size.bits() <= 64 {
// Aggregates smaller than a doubleword should appear in
// the least-significant bits of the parameter doubleword.
arg.cast_to(Reg { kind: RegKind::Integer, size })
Expand Down Expand Up @@ -138,14 +100,9 @@ where
}
};

if !fn_abi.ret.is_ignore() {
classify_ret(cx, &mut fn_abi.ret, abi);
}
classify(cx, &mut fn_abi.ret, abi, true);

for arg in fn_abi.args.iter_mut() {
if arg.is_ignore() {
continue;
}
classify_arg(cx, arg, abi);
classify(cx, arg, abi, false);
}
}
Loading

0 comments on commit 80eb5a8

Please sign in to comment.