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