Skip to main content

ptx_parser/unparser/instruction/
istypep.rs

1//! Original PTX specification:
2//!
3//! istypep.type   p, a;  // result is .pred
4//! .type = { .texref, .samplerref, .surfref };
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::istypep::section_0::*;
14
15    impl PtxUnparser for IstypepType {
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, "istypep");
21            match &self.type_ {
22                Type::Samplerref => {
23                    push_directive(tokens, "samplerref");
24                }
25                Type::Surfref => {
26                    push_directive(tokens, "surfref");
27                }
28                Type::Texref => {
29                    push_directive(tokens, "texref");
30                }
31            }
32            if spaced {
33                tokens.push(PtxToken::Space);
34            }
35            self.p.unparse_tokens_mode(tokens, spaced);
36            tokens.push(PtxToken::Comma);
37            if spaced {
38                tokens.push(PtxToken::Space);
39            }
40            self.a.unparse_tokens_mode(tokens, spaced);
41            tokens.push(PtxToken::Semicolon);
42            if spaced {
43                tokens.push(PtxToken::Newline);
44            }
45        }
46    }
47}