rustc_target/callconv/
m68k.rs

1use rustc_abi::TyAbiInterface;
2
3use crate::callconv::{ArgAbi, FnAbi};
4
5fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
6    if ret.layout.is_aggregate() {
7        ret.make_indirect();
8    } else {
9        ret.extend_integer_width_to(32);
10    }
11}
12
13fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>)
14where
15    Ty: TyAbiInterface<'a, C> + Copy,
16{
17    if !arg.layout.is_sized() {
18        // Not touching this...
19        return;
20    }
21    if arg.layout.pass_indirectly_in_non_rustic_abis(cx) {
22        arg.make_indirect();
23        return;
24    }
25    if arg.layout.is_aggregate() {
26        arg.pass_by_stack_offset(None);
27    } else {
28        arg.extend_integer_width_to(32);
29    }
30}
31
32pub(crate) fn compute_abi_info<'a, Ty, C>(cx: &C, fn_abi: &mut FnAbi<'a, Ty>)
33where
34    Ty: TyAbiInterface<'a, C> + Copy,
35{
36    if !fn_abi.ret.is_ignore() {
37        classify_ret(&mut fn_abi.ret);
38    }
39
40    for arg in fn_abi.args.iter_mut() {
41        if arg.is_ignore() {
42            continue;
43        }
44        classify_arg(cx, arg);
45    }
46}