Skip to main content

ptx_parser/unparser/instruction/
brx_idx.rs

1//! Original PTX specification:
2//!
3//! brx.idx{.uni} index, tlist;
4//! brx.idx{.uni} index, tlist;
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::brx_idx::section_0::*;
14
15    impl PtxUnparser for BrxIdxUni {
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, "brx");
21            push_directive(tokens, "idx");
22            if self.uni {
23                push_directive(tokens, "uni");
24            }
25            if spaced {
26                tokens.push(PtxToken::Space);
27            }
28            self.index.unparse_tokens_mode(tokens, spaced);
29            tokens.push(PtxToken::Comma);
30            if spaced {
31                tokens.push(PtxToken::Space);
32            }
33            self.tlist.unparse_tokens_mode(tokens, spaced);
34            tokens.push(PtxToken::Semicolon);
35            if spaced {
36                tokens.push(PtxToken::Newline);
37            }
38        }
39    }
40
41    impl PtxUnparser for BrxIdxUni1 {
42        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
43            self.unparse_tokens_mode(tokens, false);
44        }
45        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
46            push_opcode(tokens, "brx");
47            push_directive(tokens, "idx");
48            if self.uni {
49                push_directive(tokens, "uni");
50            }
51            if spaced {
52                tokens.push(PtxToken::Space);
53            }
54            self.index.unparse_tokens_mode(tokens, spaced);
55            tokens.push(PtxToken::Comma);
56            if spaced {
57                tokens.push(PtxToken::Space);
58            }
59            self.tlist.unparse_tokens_mode(tokens, spaced);
60            tokens.push(PtxToken::Semicolon);
61            if spaced {
62                tokens.push(PtxToken::Newline);
63            }
64        }
65    }
66}