Skip to main content

ptx_parser/unparser/instruction/
setmaxnreg.rs

1//! Original PTX specification:
2//!
3//! setmaxnreg.action.sync.aligned.u32 imm-reg-count;
4//! .action = { .inc, .dec };
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::setmaxnreg::section_0::*;
14
15    impl PtxUnparser for SetmaxnregActionSyncAlignedU32 {
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, "setmaxnreg");
21            match &self.action {
22                Action::Inc => {
23                    push_directive(tokens, "inc");
24                }
25                Action::Dec => {
26                    push_directive(tokens, "dec");
27                }
28            }
29            push_directive(tokens, "sync");
30            push_directive(tokens, "aligned");
31            push_directive(tokens, "u32");
32            if spaced {
33                tokens.push(PtxToken::Space);
34            }
35            self.imm_reg_count.unparse_tokens_mode(tokens, spaced);
36            tokens.push(PtxToken::Semicolon);
37            if spaced {
38                tokens.push(PtxToken::Newline);
39            }
40        }
41    }
42}