rustc_target/asm/
nvptx.rs

1use rustc_span::Symbol;
2
3use super::{InlineAsmArch, InlineAsmType, ModifierInfo};
4
5def_reg_class! {
6    Nvptx NvptxInlineAsmRegClass {
7        reg16,
8        reg32,
9        reg64,
10    }
11}
12
13impl NvptxInlineAsmRegClass {
14    pub fn valid_modifiers(self, _arch: InlineAsmArch) -> &'static [char] {
15        &[]
16    }
17
18    pub fn suggest_class(self, _arch: InlineAsmArch, _ty: InlineAsmType) -> Option<Self> {
19        None
20    }
21
22    pub fn suggest_modifier(
23        self,
24        _arch: InlineAsmArch,
25        _ty: InlineAsmType,
26    ) -> Option<ModifierInfo> {
27        None
28    }
29
30    pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<ModifierInfo> {
31        None
32    }
33
34    pub fn supported_types(
35        self,
36        _arch: InlineAsmArch,
37    ) -> &'static [(InlineAsmType, Option<Symbol>)] {
38        match self {
39            Self::reg16 => types! { _: I8, I16; },
40            Self::reg32 => types! { _: I8, I16, I32, F32; },
41            Self::reg64 => types! { _: I8, I16, I32, F32, I64, F64; },
42        }
43    }
44}
45
46def_regs! {
47    // Registers in PTX are declared in the assembly.
48    // There are no predefined registers that one can use.
49    Nvptx NvptxInlineAsmReg NvptxInlineAsmRegClass {}
50}