Skip to main content

ptx_parser/unparser/instruction/
prmt.rs

1//! Original PTX specification:
2//!
3//! prmt.b32{.mode}  d, a, b, c;
4//! .mode = { .f4e, .b4e, .rc8, .ecl, .ecr, .rc16 };
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::prmt::section_0::*;
14
15    impl PtxUnparser for PrmtB32Mode {
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, "prmt");
21            push_directive(tokens, "b32");
22            if let Some(mode_0) = self.mode.as_ref() {
23                match mode_0 {
24                    Mode::Rc16 => {
25                        push_directive(tokens, "rc16");
26                    }
27                    Mode::F4e => {
28                        push_directive(tokens, "f4e");
29                    }
30                    Mode::B4e => {
31                        push_directive(tokens, "b4e");
32                    }
33                    Mode::Rc8 => {
34                        push_directive(tokens, "rc8");
35                    }
36                    Mode::Ecl => {
37                        push_directive(tokens, "ecl");
38                    }
39                    Mode::Ecr => {
40                        push_directive(tokens, "ecr");
41                    }
42                }
43            }
44            if spaced {
45                tokens.push(PtxToken::Space);
46            }
47            self.d.unparse_tokens_mode(tokens, spaced);
48            tokens.push(PtxToken::Comma);
49            if spaced {
50                tokens.push(PtxToken::Space);
51            }
52            self.a.unparse_tokens_mode(tokens, spaced);
53            tokens.push(PtxToken::Comma);
54            if spaced {
55                tokens.push(PtxToken::Space);
56            }
57            self.b.unparse_tokens_mode(tokens, spaced);
58            tokens.push(PtxToken::Comma);
59            if spaced {
60                tokens.push(PtxToken::Space);
61            }
62            self.c.unparse_tokens_mode(tokens, spaced);
63            tokens.push(PtxToken::Semicolon);
64            if spaced {
65                tokens.push(PtxToken::Newline);
66            }
67        }
68    }
69}