Cranelift: use iterators instead of indexing; clean up match expressions (#5161)

This commit is contained in:
Nick Fitzgerald
2022-11-01 09:48:40 -07:00
committed by GitHub
parent d8397a56a7
commit d0673ff7da

View File

@@ -397,21 +397,15 @@ impl ABIMachineSpec for S390xMachineDeps {
// After all arguments are in their well-defined location, // After all arguments are in their well-defined location,
// allocate buffers for all StructArg or ImplicitPtrArg arguments. // allocate buffers for all StructArg or ImplicitPtrArg arguments.
for i in 0..args.args().len() { for arg in args.args_mut() {
match &mut args.args_mut()[i] { match arg {
&mut ABIArg::StructArg { ABIArg::StructArg { offset, size, .. } => {
ref mut offset,
size,
..
} => {
*offset = next_stack as i64; *offset = next_stack as i64;
next_stack += size; next_stack += *size;
} }
&mut ABIArg::ImplicitPtrArg { ABIArg::ImplicitPtrArg { offset, ty, .. } => {
ref mut offset, ty, ..
} => {
*offset = next_stack as i64; *offset = next_stack as i64;
next_stack += (ty_bits(ty) / 8) as u64; next_stack += (ty_bits(*ty) / 8) as u64;
} }
_ => {} _ => {}
} }