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_sized() {
21 // Not touching this...
24 if !arg
.layout
.is_aggregate() && arg
.layout
.size
.bits() <= 64 {
25 arg
.extend_integer_width_to(64);
29 if arg
.layout
.is_single_fp_element(cx
) {
30 match arg
.layout
.size
.bytes() {
31 4 => arg
.cast_to(Reg
::f32()),
32 8 => arg
.cast_to(Reg
::f64()),
33 _
=> arg
.make_indirect(),
36 match arg
.layout
.size
.bytes() {
37 1 => arg
.cast_to(Reg
::i8()),
38 2 => arg
.cast_to(Reg
::i16()),
39 4 => arg
.cast_to(Reg
::i32()),
40 8 => arg
.cast_to(Reg
::i64()),
41 _
=> arg
.make_indirect(),
46 pub fn compute_abi_info
<'a
, Ty
, C
>(cx
: &C
, fn_abi
: &mut FnAbi
<'a
, Ty
>)
48 Ty
: TyAbiInterface
<'a
, C
> + Copy
,
51 if !fn_abi
.ret
.is_ignore() {
52 classify_ret(&mut fn_abi
.ret
);
55 for arg
in fn_abi
.args
.iter_mut() {
59 classify_arg(cx
, arg
);