Skip to main content

ptx_parser/unparser/instruction/
isspacep.rs

1//! Original PTX specification:
2//!
3//! isspacep.space  p, a;    // result is .pred
4//! .space = { .const, .global, .local, .shared, .shared::cta, .shared::cluster, .param, .param::entry };
5
6#![allow(unused)]
7
8use crate::lexer::PtxToken;
9use crate::unparser::{PtxUnparser, common::*};
10
11pub mod section_0 {
12    use super::*;
13    use crate::r#type::instruction::isspacep::section_0::*;
14
15    impl PtxUnparser for IsspacepSpace {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            self.unparse_tokens_mode(tokens, false);
18        }
19        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
20            push_opcode(tokens, "isspacep");
21            match &self.space {
22                Space::SharedCluster => {
23                    push_directive(tokens, "shared::cluster");
24                }
25                Space::ParamEntry => {
26                    push_directive(tokens, "param::entry");
27                }
28                Space::SharedCta => {
29                    push_directive(tokens, "shared::cta");
30                }
31                Space::Global => {
32                    push_directive(tokens, "global");
33                }
34                Space::Shared => {
35                    push_directive(tokens, "shared");
36                }
37                Space::Const => {
38                    push_directive(tokens, "const");
39                }
40                Space::Local => {
41                    push_directive(tokens, "local");
42                }
43                Space::Param => {
44                    push_directive(tokens, "param");
45                }
46            }
47            if spaced {
48                tokens.push(PtxToken::Space);
49            }
50            self.p.unparse_tokens_mode(tokens, spaced);
51            tokens.push(PtxToken::Comma);
52            if spaced {
53                tokens.push(PtxToken::Space);
54            }
55            self.a.unparse_tokens_mode(tokens, spaced);
56            tokens.push(PtxToken::Semicolon);
57            if spaced {
58                tokens.push(PtxToken::Newline);
59            }
60        }
61    }
62}