Skip to main content

ptx_parser/unparser/instruction/
bra.rs

1//! Original PTX specification:
2//!
3//! bra{.uni}  tgt;           // tgt is a label
4//! bra{.uni}  tgt;           // unconditional branch
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::bra::section_0::*;
14
15    impl PtxUnparser for BraUni {
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, "bra");
21            if self.uni {
22                push_directive(tokens, "uni");
23            }
24            if spaced {
25                tokens.push(PtxToken::Space);
26            }
27            self.tgt.unparse_tokens_mode(tokens, spaced);
28            tokens.push(PtxToken::Semicolon);
29            if spaced {
30                tokens.push(PtxToken::Newline);
31            }
32        }
33    }
34
35    impl PtxUnparser for BraUni1 {
36        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
37            self.unparse_tokens_mode(tokens, false);
38        }
39        fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
40            push_opcode(tokens, "bra");
41            if self.uni {
42                push_directive(tokens, "uni");
43            }
44            if spaced {
45                tokens.push(PtxToken::Space);
46            }
47            self.tgt.unparse_tokens_mode(tokens, spaced);
48            tokens.push(PtxToken::Semicolon);
49            if spaced {
50                tokens.push(PtxToken::Newline);
51            }
52        }
53    }
54}