Path: blob/main/cranelift/codegen/src/isa/winch.rs
1693 views
use crate::machinst::{ABIArg, ABIArgSlot, ArgsAccumulator};12// Winch writes the first result to the highest offset, so we need to iterate through the3// args and adjust the offsets down.4pub(super) fn reverse_stack(mut args: ArgsAccumulator, next_stack: u32, uses_extension: bool) {5for arg in args.args_mut() {6if let ABIArg::Slots { slots, .. } = arg {7for slot in slots.iter_mut() {8if let ABIArgSlot::Stack { offset, ty, .. } = slot {9let size = if uses_extension {10i64::from(std::cmp::max(ty.bytes(), 8))11} else {12i64::from(ty.bytes())13};14*offset = i64::from(next_stack) - *offset - size;15}16}17} else {18unreachable!("Winch cannot handle {arg:?}");19}20}21}222324