]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/abi/call/nvptx64.rs
Remove references to git.io
[rust.git] / compiler / rustc_target / src / abi / call / nvptx64.rs
1 // Reference: PTX Writer's Guide to Interoperability
2 // https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability
3
4 use crate::abi::call::{ArgAbi, FnAbi};
5
6 fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
7     if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
8         ret.make_indirect();
9     } else {
10         ret.extend_integer_width_to(64);
11     }
12 }
13
14 fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
15     if arg.layout.is_aggregate() && arg.layout.size.bits() > 64 {
16         arg.make_indirect();
17     } else {
18         arg.extend_integer_width_to(64);
19     }
20 }
21
22 pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
23     if !fn_abi.ret.is_ignore() {
24         classify_ret(&mut fn_abi.ret);
25     }
26
27     for arg in &mut fn_abi.args {
28         if arg.is_ignore() {
29             continue;
30         }
31         classify_arg(arg);
32     }
33 }