]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_target/src/asm/nvptx.rs
Rollup merge of #94467 - ibraheemdev:master, r=pnkfelix
[rust.git] / compiler / rustc_target / src / asm / nvptx.rs
1 use super::{InlineAsmArch, InlineAsmType};
2 use rustc_macros::HashStable_Generic;
3 use rustc_span::Symbol;
4
5 def_reg_class! {
6     Nvptx NvptxInlineAsmRegClass {
7         reg16,
8         reg32,
9         reg64,
10     }
11 }
12
13 impl 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<(char, &'static str)> {
27         None
28     }
29
30     pub fn default_modifier(self, _arch: InlineAsmArch) -> Option<(char, &'static str)> {
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
46 def_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 }