Auto merge of #100999 - nnethercote:shrink-FnAbi, r=bjorn3

Shrink `FnAbi`

Because they can take up a lot of memory in debug and release builds.

r? `@bjorn3`
This commit is contained in:
bors 2022-08-27 14:00:53 +00:00
commit 332cc8fb75
35 changed files with 165 additions and 181 deletions

View file

@ -214,10 +214,8 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
_ => false,
}
};
// Padding must be fully equal.
let pad_compat = || caller_abi.pad == callee_abi.pad;
// When comparing the PassMode, we have to be smart about comparing the attributes.
let arg_attr_compat = |a1: ArgAttributes, a2: ArgAttributes| {
let arg_attr_compat = |a1: &ArgAttributes, a2: &ArgAttributes| {
// There's only one regular attribute that matters for the call ABI: InReg.
// Everything else is things like noalias, dereferencable, nonnull, ...
// (This also applies to pointee_size, pointee_align.)
@ -232,13 +230,13 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
return true;
};
let mode_compat = || match (caller_abi.mode, callee_abi.mode) {
let mode_compat = || match (&caller_abi.mode, &callee_abi.mode) {
(PassMode::Ignore, PassMode::Ignore) => true,
(PassMode::Direct(a1), PassMode::Direct(a2)) => arg_attr_compat(a1, a2),
(PassMode::Pair(a1, b1), PassMode::Pair(a2, b2)) => {
arg_attr_compat(a1, a2) && arg_attr_compat(b1, b2)
}
(PassMode::Cast(c1), PassMode::Cast(c2)) => c1 == c2,
(PassMode::Cast(c1, pad1), PassMode::Cast(c2, pad2)) => c1 == c2 && pad1 == pad2,
(
PassMode::Indirect { attrs: a1, extra_attrs: None, on_stack: s1 },
PassMode::Indirect { attrs: a2, extra_attrs: None, on_stack: s2 },
@ -250,7 +248,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
_ => false,
};
if layout_compat() && pad_compat() && mode_compat() {
if layout_compat() && mode_compat() {
return true;
}
trace!(