Skip to main content

rustc_target/callconv/
m68k.rs

1use rustc_abi::{CanonAbi, TyAbiInterface};
2
3use crate::callconv::{ArgAbi, ComputeCallConv};
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) struct M64KCallConv;
33
34impl<'a, Ty, C> ComputeCallConv<'a, Ty, C> for M64KCallConv
35where
36    Ty: TyAbiInterface<'a, C> + Copy,
37{
38    fn new(_cx: &C, _conv: CanonAbi, _c_variadic: bool) -> Self {
39        Self
40    }
41
42    fn compute_ret_abi(&mut self, _cx: &C, ret: &mut ArgAbi<'a, Ty>) {
43        classify_ret(ret);
44    }
45
46    fn compute_arg_abi(&mut self, cx: &C, arg: &mut ArgAbi<'a, Ty>, _is_vararg: bool) {
47        classify_arg(cx, arg);
48    }
49}