ptx_parser/unparser/instruction/
alloca.rs

1//! Original PTX specification:
2//!
3//! alloca.type  ptr, size{, immAlign};
4//! .type = { .u32, .u64 };
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::alloca::section_0::*;
14
15    impl PtxUnparser for AllocaType {
16        fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
17            push_opcode(tokens, "alloca");
18            match &self.type_ {
19                Type::U32 => {
20                    push_directive(tokens, "u32");
21                }
22                Type::U64 => {
23                    push_directive(tokens, "u64");
24                }
25            }
26            self.ptr.unparse_tokens(tokens);
27            tokens.push(PtxToken::Comma);
28            self.size.unparse_tokens(tokens);
29            if self.immalign.is_some() {
30                tokens.push(PtxToken::Comma);
31            }
32            if let Some(opt_0) = self.immalign.as_ref() {
33                opt_0.unparse_tokens(tokens);
34            }
35            tokens.push(PtxToken::Semicolon);
36        }
37    }
38}