diff --git a/cranelift/codegen/src/isa/aarch64/abi.rs b/cranelift/codegen/src/isa/aarch64/abi.rs index 6bd8f946c0..a9b82cbcef 100644 --- a/cranelift/codegen/src/isa/aarch64/abi.rs +++ b/cranelift/codegen/src/isa/aarch64/abi.rs @@ -87,13 +87,16 @@ impl ABIMachineSpec for AArch64MachineDeps { 16 } - fn compute_arg_locs( + fn compute_arg_locs<'a, I>( call_conv: isa::CallConv, _flags: &settings::Flags, - params: &[ir::AbiParam], + params: I, args_or_rets: ArgsOrRets, add_ret_area_ptr: bool, - ) -> CodegenResult<(ABIArgVec, i64, Option)> { + ) -> CodegenResult<(ABIArgVec, i64, Option)> + where + I: IntoIterator, + { let is_apple_cc = call_conv.extends_apple_aarch64(); // See AArch64 ABI (https://github.com/ARM-software/abi-aa/blob/2021Q1/aapcs64/aapcs64.rst#64parameter-passing), sections 6.4. diff --git a/cranelift/codegen/src/isa/riscv64/abi.rs b/cranelift/codegen/src/isa/riscv64/abi.rs index 872f3656f9..9db9d586d0 100644 --- a/cranelift/codegen/src/isa/riscv64/abi.rs +++ b/cranelift/codegen/src/isa/riscv64/abi.rs @@ -56,13 +56,16 @@ impl ABIMachineSpec for Riscv64MachineDeps { 16 } - fn compute_arg_locs( + fn compute_arg_locs<'a, I>( call_conv: isa::CallConv, _flags: &settings::Flags, - params: &[ir::AbiParam], + params: I, args_or_rets: ArgsOrRets, add_ret_area_ptr: bool, - ) -> CodegenResult<(ABIArgVec, i64, Option)> { + ) -> CodegenResult<(ABIArgVec, i64, Option)> + where + I: IntoIterator, + { // All registers that can be used as parameters or rets. // both start and end are included. let (x_start, x_end, f_start, f_end) = if args_or_rets == ArgsOrRets::Args { diff --git a/cranelift/codegen/src/isa/s390x/abi.rs b/cranelift/codegen/src/isa/s390x/abi.rs index 3f7c6bf5e0..064f5976d1 100644 --- a/cranelift/codegen/src/isa/s390x/abi.rs +++ b/cranelift/codegen/src/isa/s390x/abi.rs @@ -221,13 +221,16 @@ impl ABIMachineSpec for S390xMachineDeps { 8 } - fn compute_arg_locs( + fn compute_arg_locs<'a, I>( call_conv: isa::CallConv, _flags: &settings::Flags, - params: &[ir::AbiParam], + params: I, args_or_rets: ArgsOrRets, add_ret_area_ptr: bool, - ) -> CodegenResult<(ABIArgVec, i64, Option)> { + ) -> CodegenResult<(ABIArgVec, i64, Option)> + where + I: IntoIterator, + { let mut next_gpr = 0; let mut next_fpr = 0; let mut next_vr = 0; @@ -245,7 +248,7 @@ impl ABIMachineSpec for S390xMachineDeps { next_gpr += 1; } - for (i, mut param) in params.iter().copied().enumerate() { + for (i, mut param) in params.into_iter().copied().enumerate() { let intreg = in_int_reg(param.value_type); let fltreg = in_flt_reg(param.value_type); let vecreg = in_vec_reg(param.value_type); diff --git a/cranelift/codegen/src/isa/x64/abi.rs b/cranelift/codegen/src/isa/x64/abi.rs index 5aaea546d1..befc5bf80a 100644 --- a/cranelift/codegen/src/isa/x64/abi.rs +++ b/cranelift/codegen/src/isa/x64/abi.rs @@ -81,13 +81,16 @@ impl ABIMachineSpec for X64ABIMachineSpec { 16 } - fn compute_arg_locs( + fn compute_arg_locs<'a, I>( call_conv: isa::CallConv, flags: &settings::Flags, - params: &[ir::AbiParam], + params: I, args_or_rets: ArgsOrRets, add_ret_area_ptr: bool, - ) -> CodegenResult<(ABIArgVec, i64, Option)> { + ) -> CodegenResult<(ABIArgVec, i64, Option)> + where + I: IntoIterator, + { let is_fastcall = call_conv.extends_windows_fastcall(); let mut next_gpr = 0; diff --git a/cranelift/codegen/src/machinst/abi.rs b/cranelift/codegen/src/machinst/abi.rs index f79927ceeb..d6d129cc77 100644 --- a/cranelift/codegen/src/machinst/abi.rs +++ b/cranelift/codegen/src/machinst/abi.rs @@ -345,13 +345,15 @@ pub trait ABIMachineSpec { /// Returns the list of argument locations, the stack-space used (rounded up /// to as alignment requires), and if `add_ret_area_ptr` was passed, the /// index of the extra synthetic arg that was added. - fn compute_arg_locs( + fn compute_arg_locs<'a, I>( call_conv: isa::CallConv, flags: &settings::Flags, - params: &[ir::AbiParam], + params: I, args_or_rets: ArgsOrRets, add_ret_area_ptr: bool, - ) -> CodegenResult<(ABIArgVec, i64, Option)>; + ) -> CodegenResult<(ABIArgVec, i64, Option)> + where + I: IntoIterator; /// Returns the offset from FP to the argument area, i.e., jumping over the saved FP, return /// address, and maybe other standard elements depending on ABI (e.g. Wasm TLS reg).