1 // FIXME: The assumes we're using the non-vector ABI, i.e., compiling
2 // for a pre-z13 machine or using -mno-vx.
4 use crate::abi::call::{ArgAbi, FnAbi, Reg};
5 use crate::abi::{HasDataLayout, TyAbiInterface};
7 fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
8 if !ret.layout.is_aggregate() && ret.layout.size.bits() <= 64 {
9 ret.extend_integer_width_to(64);
15 fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
17 Ty: TyAbiInterface<'a, C> + Copy,
20 if !arg.layout.is_aggregate() && arg.layout.size.bits() <= 64 {
21 arg.extend_integer_width_to(64);
25 if arg.layout.is_single_fp_element(cx) {
26 match arg.layout.size.bytes() {
27 4 => arg.cast_to(Reg::f32()),
28 8 => arg.cast_to(Reg::f64()),
29 _ => arg.make_indirect(),
32 match arg.layout.size.bytes() {
33 1 => arg.cast_to(Reg::i8()),
34 2 => arg.cast_to(Reg::i16()),
35 4 => arg.cast_to(Reg::i32()),
36 8 => arg.cast_to(Reg::i64()),
37 _ => arg.make_indirect(),
42 pub fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
44 Ty: TyAbiInterface<'a, C> + Copy,
47 if !fn_abi.ret.is_ignore() {
48 classify_ret(&mut fn_abi.ret);
51 for arg in fn_abi.args.iter_mut() {
55 classify_arg(cx, arg);