]> git.proxmox.com Git - rustc.git/blame - src/librustc_target/abi/call/nvptx64.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / librustc_target / abi / call / nvptx64.rs
CommitLineData
32a655c1
SL
1// Reference: PTX Writer's Guide to Interoperability
2// http://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability
3
60c5eb7d 4use crate::abi::call::{ArgAbi, FnAbi};
32a655c1 5
60c5eb7d 6fn classify_ret<Ty>(ret: &mut ArgAbi<'_, Ty>) {
ff7c6d11
XL
7 if ret.layout.is_aggregate() && ret.layout.size.bits() > 64 {
8 ret.make_indirect();
32a655c1
SL
9 } else {
10 ret.extend_integer_width_to(64);
11 }
12}
13
60c5eb7d 14fn classify_arg<Ty>(arg: &mut ArgAbi<'_, Ty>) {
ff7c6d11
XL
15 if arg.layout.is_aggregate() && arg.layout.size.bits() > 64 {
16 arg.make_indirect();
32a655c1
SL
17 } else {
18 arg.extend_integer_width_to(64);
19 }
20}
21
60c5eb7d
XL
22pub fn compute_abi_info<Ty>(fn_abi: &mut FnAbi<'_, Ty>) {
23 if !fn_abi.ret.is_ignore() {
24 classify_ret(&mut fn_abi.ret);
32a655c1
SL
25 }
26
60c5eb7d 27 for arg in &mut fn_abi.args {
32a655c1
SL
28 if arg.is_ignore() {
29 continue;
30 }
60c5eb7d 31 classify_arg(arg);
32a655c1
SL
32 }
33}