]> git.lizzy.rs Git - rust.git/blob - src/librustc_target/spec/nvptx64_nvidia_cuda.rs
Rollup merge of #61675 - fintelia:riscv-frame-pointer, r=nagisa
[rust.git] / src / librustc_target / spec / nvptx64_nvidia_cuda.rs
1 use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult, PanicStrategy, MergeFunctions};
2 use crate::spec::abi::Abi;
3
4 pub fn target() -> TargetResult {
5     Ok(Target {
6         arch: "nvptx64".to_string(),
7         data_layout: "e-i64:64-i128:128-v16:16-v32:32-n16:32:64".to_string(),
8         llvm_target: "nvptx64-nvidia-cuda".to_string(),
9
10         target_os: "cuda".to_string(),
11         target_vendor: "nvidia".to_string(),
12         target_env: String::new(),
13
14         linker_flavor: LinkerFlavor::PtxLinker,
15
16         target_endian: "little".to_string(),
17         target_pointer_width: "64".to_string(),
18         target_c_int_width: "32".to_string(),
19
20         options: TargetOptions {
21             // The linker can be installed from `crates.io`.
22             linker: Some("rust-ptx-linker".to_string()),
23
24             // With `ptx-linker` approach, it can be later overriden via link flags.
25             cpu: "sm_30".to_string(),
26
27             // FIXME: create tests for the atomics.
28             max_atomic_width: Some(64),
29
30             // Unwinding on CUDA is neither feasible nor useful.
31             panic_strategy: PanicStrategy::Abort,
32
33             // Needed to use `dylib` and `bin` crate types and the linker.
34             dynamic_linking: true,
35             executables: true,
36
37             // Avoid using dylib because it contain metadata not supported
38             // by LLVM NVPTX backend.
39             only_cdylib: true,
40
41             // Let the `ptx-linker` to handle LLVM lowering into MC / assembly.
42             obj_is_bitcode: true,
43
44             // Convinient and predicable naming scheme.
45             dll_prefix: "".to_string(),
46             dll_suffix: ".ptx".to_string(),
47             exe_suffix: ".ptx".to_string(),
48
49             // Disable MergeFunctions LLVM optimisation pass because it can
50             // produce kernel functions that call other kernel functions.
51             // This behavior is not supported by PTX ISA.
52             merge_functions: MergeFunctions::Disabled,
53
54             // FIXME: enable compilation tests for the target and
55             // create the tests for this.
56             abi_blacklist: vec![
57                 Abi::Cdecl,
58                 Abi::Stdcall,
59                 Abi::Fastcall,
60                 Abi::Vectorcall,
61                 Abi::Thiscall,
62                 Abi::Aapcs,
63                 Abi::Win64,
64                 Abi::SysV64,
65                 Abi::Msp430Interrupt,
66                 Abi::X86Interrupt,
67                 Abi::AmdGpuKernel,
68             ],
69
70             .. Default::default()
71         },
72     })
73 }